emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-mobile-pull question
@ 2009-11-06 15:49 Zhichao Hong
  2009-11-06 16:03 ` Carsten Dominik
  2009-11-06 16:09 ` org-mobile-pull & ^M ( question) Giovanni Ridolfi
  0 siblings, 2 replies; 5+ messages in thread
From: Zhichao Hong @ 2009-11-06 15:49 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I am now be able to push all my agenda files successfully to my WebDav
server!  However, when I pull the changes from the server for just a
normal todo state changes.  It always return me an error about:
Heading not found on Level 1: <Some heading>^M ...  This is kind of
inconvenient as for this kind of simple change, I have to toggle the
entry manually by hand after interpreting what is in the
from-mobile.org.

I am wondering if  the exta ^M is causing this issue.  I am using it
on the windows which file encoding is unicode-dos.

Please help.
-Zhichao
Zhichao Hong, CSDP
zhichao.hong@computer.org

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

* Re: org-mobile-pull question
  2009-11-06 15:49 org-mobile-pull question Zhichao Hong
@ 2009-11-06 16:03 ` Carsten Dominik
  2009-11-06 16:09 ` org-mobile-pull & ^M ( question) Giovanni Ridolfi
  1 sibling, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2009-11-06 16:03 UTC (permalink / raw)
  To: Zhichao Hong; +Cc: emacs-orgmode


On Nov 6, 2009, at 4:49 PM, Zhichao Hong wrote:

> Hi,
>
> I am now be able to push all my agenda files successfully to my WebDav
> server!  However, when I pull the changes from the server for just a
> normal todo state changes.  It always return me an error about:
> Heading not found on Level 1: <Some heading>^M ...  This is kind of
> inconvenient as for this kind of simple change, I have to toggle the
> entry manually by hand after interpreting what is in the
> from-mobile.org.

When Emacs visits a file, the line endings should always be converted  
to just a simple \n for internal use in Emacs.  I don't know why this  
is not the case for you.

- Carsten

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

* Re: org-mobile-pull & ^M ( question)
  2009-11-06 15:49 org-mobile-pull question Zhichao Hong
  2009-11-06 16:03 ` Carsten Dominik
@ 2009-11-06 16:09 ` Giovanni Ridolfi
  2009-11-06 16:45   ` Zhichao Hong
  2009-11-06 17:47   ` Carsten Dominik
  1 sibling, 2 replies; 5+ messages in thread
From: Giovanni Ridolfi @ 2009-11-06 16:09 UTC (permalink / raw)
  To: emacs-orgmode, Zhichao Hong, Carsten Dominik

--- Ven 6/11/09, Zhichao Hong <zhichao.hong@gmail.com> 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)))))) 




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

* Re: org-mobile-pull & ^M ( question)
  2009-11-06 16:09 ` org-mobile-pull & ^M ( question) Giovanni Ridolfi
@ 2009-11-06 16:45   ` Zhichao Hong
  2009-11-06 17:47   ` Carsten Dominik
  1 sibling, 0 replies; 5+ messages in thread
From: Zhichao Hong @ 2009-11-06 16:45 UTC (permalink / raw)
  To: Giovanni Ridolfi; +Cc: emacs-orgmode, 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
<giovanni.ridolfi@yahoo.it> wrote:
> --- Ven 6/11/09, Zhichao Hong <zhichao.hong@gmail.com> 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))))))
>
>
>
>

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

* Re: org-mobile-pull & ^M ( question)
  2009-11-06 16:09 ` org-mobile-pull & ^M ( question) Giovanni Ridolfi
  2009-11-06 16:45   ` Zhichao Hong
@ 2009-11-06 17:47   ` Carsten Dominik
  1 sibling, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2009-11-06 17:47 UTC (permalink / raw)
  To: Giovanni Ridolfi; +Cc: emacs-orgmode, Zhichao Hong


On Nov 6, 2009, at 5:09 PM, Giovanni Ridolfi wrote:

> --- Ven 6/11/09, Zhichao Hong <zhichao.hong@gmail.com> 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?

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

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

end of thread, other threads:[~2009-11-06 17:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-06 15:49 org-mobile-pull question Zhichao Hong
2009-11-06 16:03 ` Carsten Dominik
2009-11-06 16:09 ` org-mobile-pull & ^M ( question) Giovanni Ridolfi
2009-11-06 16:45   ` Zhichao Hong
2009-11-06 17:47   ` Carsten Dominik

Code repositories for project(s) associated with this public 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).