From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Sebastien Vauban" Subject: Re: Org-capture from Firefox: ^M or not ^M? Date: Wed, 20 Jul 2011 21:23:00 +0200 Message-ID: <80k4bcrc2z.fsf@somewhere.org> References: <8062myo42x.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org To: emacs-orgmode-mXXj517/zsQ@public.gmane.org Hi Otto , Otto Pichlh=C3=B6fer wrote: > Sebastien Vauban writes: >> In the exact same conditions (I mean, Emacs settings, etc.), when I capt= ure >> some regions from Web pages, they sometimes: >>=20 >> - are mixed "all one one line" >> Example: http://lists.gnu.org/archive/html/help-gnu-emacs/2007-03/msg0= 0670.html >>=20 >> - are copied as on the screen, but with ending ^M at every line >> Example: http://www.emacswiki.org/emacs/DiaryMode >>=20 >> I'm not sure anymore whether or when it is correct: >> - region on multiple lines (as on the screen), and >> - no ending ^M... >>=20 >> Questions: >>=20 >> - Do you see the same behavior as mine? I'm on Windows XP with Firefox >> 3.6.18. >>=20 >> - Is there some work around so that you would not have to fiddle with the >> copied text? > > I do this: > > (defun remove-ctrl-M () > "Remove ^M at end of line in the whole buffer." > (interactive) > (save-match-data > (save-excursion > (let ((remove-count 0)) > (goto-char (point-min)) > (point-max) t) ; so passt es nur am Ende der Zeile > (while (re-search-forward (char-to-string 13) (point-max) t) > (setq remove-count (+ remove-count 1)) > (replace-match "" nil nil)) > (message (format "%d ^M removed from buffer." remove-count)))))) > > and: > > (add-hook 'org-capture-mode-hook 'remove-ctrl-M) Thanks for sharing this code which resolves... the easiest problem of the 2 described above. That's already one step. But do you get paragraphs ouput as one very long line as well -- when captu= red --, in the first link above? If yes, do you have a solution for that one? Best regards, Seb --=20 Sebastien Vauban