emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org-capture from Firefox: ^M or not ^M?
@ 2011-07-19 12:19 Sebastien Vauban
  2011-07-20 13:18 ` Otto Pichlhöfer
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastien Vauban @ 2011-07-19 12:19 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

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

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Org-capture from Firefox: ^M or not ^M?
  2011-07-19 12:19 Org-capture from Firefox: ^M or not ^M? Sebastien Vauban
@ 2011-07-20 13:18 ` Otto Pichlhöfer
  2011-07-20 19:23   ` Sebastien Vauban
  2011-07-20 21:59   ` Sebastien Vauban
  0 siblings, 2 replies; 4+ messages in thread
From: Otto Pichlhöfer @ 2011-07-20 13:18 UTC (permalink / raw)
  To: emacs-orgmode

Sebastien Vauban <wxhgmqzgwmuf@...> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Org-capture from Firefox: ^M or not ^M?
  2011-07-20 13:18 ` Otto Pichlhöfer
@ 2011-07-20 19:23   ` Sebastien Vauban
  2011-07-20 21:59   ` Sebastien Vauban
  1 sibling, 0 replies; 4+ messages in thread
From: Sebastien Vauban @ 2011-07-20 19:23 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Otto ,

Otto Pichlhöfer  wrote:
> Sebastien Vauban <wxhgmqzgwmuf@...> writes:
>> 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?
>
> 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 captured
--, in the first link above? If yes, do you have a solution for that one?

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Org-capture from Firefox: ^M or not ^M?
  2011-07-20 13:18 ` Otto Pichlhöfer
  2011-07-20 19:23   ` Sebastien Vauban
@ 2011-07-20 21:59   ` Sebastien Vauban
  1 sibling, 0 replies; 4+ messages in thread
From: Sebastien Vauban @ 2011-07-20 21:59 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Otto ,

Otto Pichlhöfer  wrote:
>> 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

Just to be complete, what's weird in this case is that lines are well "apart"
(or "unfilled", in Emacs terminology) in the HTML source.

Of course, we can imagine putting a "filling" command in the capture hook, but
this will often break things -- you don't want code to be automatically (and
irresponsibly) filled, do you?

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-07-20 21:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-19 12:19 Org-capture from Firefox: ^M or not ^M? Sebastien Vauban
2011-07-20 13:18 ` Otto Pichlhöfer
2011-07-20 19:23   ` Sebastien Vauban
2011-07-20 21:59   ` Sebastien Vauban

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).