emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] OrgMobile problem: only three files in checksums.dat


From: Jonathan Leech-Pepin
Subject: Re: [O] OrgMobile problem: only three files in checksums.dat
Date: Mon, 19 Mar 2012 00:35:44 -0400

I haven't had this issue with Org-Mobile specifically because I'm not using it, however I found the same error when using el-get.

In my case at least the issue popped up because I was using zsh/bash via cygwin for ="" where =shell-quote-argument= expected it to be cmdproxy.exe on Windows.  I'm guessing you've got something similar since it's using forward-slashes for sha1sum.  It also fits because the only way the final regexp gets applied is when the system is not ms-dos or windows-nt along with a known Windows shell, which means cmd.exe, command.com, cmdproxy and a couple others, cygwin shells are not on that list.

The simplest solution would actually be to wrap your Org-mobile call in


(let ((shell-file-name (or (and (eq system-type 'windows-nt)
                          (executable-find "cmdproxy.exe"))
                      shell-file-name)))
     {{{insert call here}}} )

Hope this helps,
Jonathan


On 18 March 2012 18:23, Alexander Vorobiev <address@hidden> wrote:
I figured out what is wrong. I am on Windows 7 (with cygwin) where shell-quote-argument (defined in emacs' subr.el) seems to be broken, specifically it insists on escaping colons (as one of non-POSIX filename characters), so, for instance path to one of my files c:/Users/alex/org/gtd.org becomes c\\:/Users/alex/org/gtd.org
The result of that is org-mobile-copy-agenda-files which calls shell-quote-argument while generating command line to produce checksums, ends up with something like

c:/cygwin/bin/sha1sum c\\:/Users/alex/org/gtd.org

which inevitably fails. I am surprised nobody else with Windows machines noticed that, could there be anything I am doing wrong?

The quick fix would be to redefine the shell-quote-argument to account for colons (added colon in the regex on the last line, see below). After that all my org files get added to checksum.dat and become visible on my Android phone.

I temporarily put this definition to my cygwin-specific initialization file but I feel that there should be more elegant solutions:

(defun shell-quote-argument (argument)
  "Quote ARGUMENT for passing as argument to an inferior shell."
  (if (or (eq system-type 'ms-dos)
          (and (eq system-type 'windows-nt) (w32-shell-dos-semantics)))
      ;; Quote using double quotes, but escape any existing quotes in
      ;; the argument with backslashes.
      (let ((result "")
   (start 0)
   end)
(if (or (null (string-match "[^\"]" argument))
(< (match-end 0) (length argument)))
   (while (string-match "[\"]" argument start)
     (setq end (match-beginning 0)
   result (concat result (substring argument start end)
  "\\" (substring argument end (1+ end)))
   start (1+ end))))
(concat "\"" result (substring argument start) "\""))
    (if (equal argument "")
        "''"
      ;; Quote everything except POSIX filename characters.
      ;; This should be safe enough even for really weird shells.
      (replace-regexp-in-string "\n" "'\n'"
       (replace-regexp-in-string "[^-0-9a-zA-Z_./\n:]" "\\\\\\&" argument)))))

Regards,
Alex

On Sat, Mar 17, 2012 at 10:50 PM, Alexander Vorobiev <address@hidden> wrote:
Hi,

I have many files in the org-mobile-files list. On org-mobile-push all of them are copied to my MobileOrg directory, syncronized via Dropbox to my phone, etc. But the file checksums.dat always has only three lines - for files index.org, mobileorg.org, and agendas.org. The org-mobile-checksum-files variable also has the checksums for those files only. Consequently, MobileOrg for Android only shows one line "Agenda Views" and does not show any of my org files despite having all of them in the same Dropbox directory.

Thanks
Alex



reply via email to

[Prev in Thread] Current Thread [Next in Thread]