emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Org-capture from Firefox: ^M or not ^M?


From: Otto Pichlhöfer
Subject: Re: [O] Org-capture from Firefox: ^M or not ^M?
Date: Wed, 20 Jul 2011 13:18:08 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Sebastien Vauban <address@hidden> writes:

> 
> Hello,
> 
> In the exact same conditions (I mean, Emacs settings, etc.), when I capture
> some regions from Web pages, they sometimes:
> 
> - are mixed "all one one line"
>   Example: 
> http://lists.gnu.org/archive/html/help-gnu-emacs/2007-03/msg00670.html
> 
> - are copied as on the screen, but with ending ^M at every line
>   Example: http://www.emacswiki.org/emacs/DiaryMode
> 
> I'm not sure anymore whether or when it is correct:
> - region on multiple lines (as on the screen), and
> - no ending ^M...
> 
> Questions:
> 
> - Do you see the same behavior as mine?  I'm on Windows XP with Firefox
>   3.6.18.
> 
> - Is there some work around so that you would not have to fiddle with the
>   copied text?
> 
> Best regards,
>   Seb
> 


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)

Regards,
Otto




reply via email to

[Prev in Thread] Current Thread [Next in Thread]