[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] org-mobile-pull & ^M ( question)
From: |
Giovanni Ridolfi |
Subject: |
Re: [Orgmode] org-mobile-pull & ^M ( question) |
Date: |
Fri, 6 Nov 2009 16:09:42 +0000 (GMT) |
--- Ven 6/11/09, Zhichao Hong <address@hidden> ha scritto:
> Heading not found on Level 1: <Some heading>^M
>
> I am wondering if the exta ^M is causing this
> issue. I am using it
> on the windows which file encoding is unicode-dos.
^^^^^^^^^
Windows is the culprit for the insertion of
the ^M character
:-(
google is our friend:
http://openacs.org/blog/one-entry?entry_id=297156
----------------------------------------
To replace the annoying ^M characters you can search and replace. The following
representation holds true:
^M = C-q C-m
Resulating in this sequence:
M-%
Query replace: C-q C-m with: C-q C-j
-------------
You can write a function [2] that
re-search-forward ^M
replace-match ""
and call this function in a pre-hook
before importing.
Carsten, is there such a pre-hook?
cheers,
Giovanni
[2] google is again our friend ;-)
http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/676113e90825d4e7
I use the following function to remove the trailing ^M from such files:
(defun xsteve-remove-control-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))
(while (re-search-forward " $" (point-max) t)
(setq remove-count (+ remove-count 1))
(replace-match "" nil nil))
(message (format "%d ^M removed from buffer." remove-count))))))