From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: org-mobile-pull & ^M ( question) Date: Fri, 6 Nov 2009 18:47:36 +0100 Message-ID: <80DA5FEC-7A36-485D-99EE-5887DC4FA873@gmail.com> References: <37453.40370.qm@web28312.mail.ukl.yahoo.com> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N6Sue-0006S9-PK for emacs-orgmode@gnu.org; Fri, 06 Nov 2009 12:47:52 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N6SuX-0006GF-0V for emacs-orgmode@gnu.org; Fri, 06 Nov 2009 12:47:50 -0500 Received: from [199.232.76.173] (port=42210 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N6SuV-0006FQ-SZ for emacs-orgmode@gnu.org; Fri, 06 Nov 2009 12:47:43 -0500 Received: from paard.ic.uva.nl ([145.18.40.182]:50884) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N6SuV-0001or-1F for emacs-orgmode@gnu.org; Fri, 06 Nov 2009 12:47:43 -0500 In-Reply-To: <37453.40370.qm@web28312.mail.ukl.yahoo.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Giovanni Ridolfi Cc: emacs-orgmode@gnu.org, Zhichao Hong On Nov 6, 2009, at 5:09 PM, Giovanni Ridolfi wrote: > --- Ven 6/11/09, Zhichao Hong ha scritto: >> Heading not found on Level 1: ^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? There is now, `org-mobile-before-process-capture-hook'. - Carsten > > 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)))))) > > > - Carsten