From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zhichao Hong Subject: Re: org-mobile-pull & ^M ( question) Date: Fri, 6 Nov 2009 10:45:34 -0600 Message-ID: <3fea10110911060845x53b0d337v5601d1b26b4c6e7d@mail.gmail.com> References: <3fea10110911060749y40352f5ap3972736d1ac9755@mail.gmail.com> <37453.40370.qm@web28312.mail.ukl.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N6RwT-0005Ys-Tr for emacs-orgmode@gnu.org; Fri, 06 Nov 2009 11:45:42 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N6RwP-0005Wg-2c for emacs-orgmode@gnu.org; Fri, 06 Nov 2009 11:45:41 -0500 Received: from [199.232.76.173] (port=56796 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N6RwO-0005Wb-SC for emacs-orgmode@gnu.org; Fri, 06 Nov 2009 11:45:36 -0500 Received: from mail-bw0-f215.google.com ([209.85.218.215]:50611) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N6RwO-0007g4-Ak for emacs-orgmode@gnu.org; Fri, 06 Nov 2009 11:45:36 -0500 Received: by bwz7 with SMTP id 7so1421292bwz.26 for ; Fri, 06 Nov 2009 08:45:35 -0800 (PST) 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, Carsten Dominik Yes, I know it is caused by the windows. That is why I mentioned that I am using windows :). When I changed all of agenda org files to unix encoding before pushing. Now the changes sync'ed correctly. As on the win32, emacs 23 create the file by unicode-dos as default. Is there a way to support the windows encoding for org mobile by default? This will help a lot! For now, I can manually change all the file encoding to unix for the mobileorg to work. -Zhichao On Fri, Nov 6, 2009 at 10:09 AM, Giovanni Ridolfi wrote: > --- Ven 6/11/09, Zhichao Hong ha scritto: >> Heading not found on Level 1: ^M >> >> I am wondering if=A0 the exta ^M is causing this >> issue.=A0 I am using it >> on the windows which file encoding is unicode-dos. > =A0 =A0 =A0 =A0 ^^^^^^^^^ > Windows is the culprit for the insertion of > the ^M =A0character > :-( > > google is our friend: > http://openacs.org/blog/one-entry?entry_id=3D297156 > ---------------------------------------- > To replace the annoying ^M characters you can search and replace. The fol= lowing representation holds true: > > ^M =3D 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/676113= e90825d4e7 > > I use the following function to remove the trailing ^M from such files: > > (defun xsteve-remove-control-M () > =A0"Remove ^M at end of line in the whole buffer." > =A0(interactive) > =A0(save-match-data > =A0 =A0(save-excursion > =A0 =A0 =A0(let ((remove-count 0)) > =A0 =A0 =A0 =A0(goto-char (point-min)) > =A0 =A0 =A0 =A0(while (re-search-forward " $" (point-max) t) > =A0 =A0 =A0 =A0 =A0(setq remove-count (+ remove-count 1)) > =A0 =A0 =A0 =A0 =A0(replace-match "" nil nil)) > =A0 =A0 =A0 =A0(message (format "%d ^M removed from buffer." remove-count= )))))) > > > >