emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Alexander Vorobiev <alexander.vorobiev@gmail.com>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: OrgMobile problem: only three files in checksums.dat
Date: Sun, 18 Mar 2012 17:23:36 -0500	[thread overview]
Message-ID: <CAGOCFPUR+nRh1YYkq4jKBn=HPX9=2_pofKK29_QEP=Gy1DBULg@mail.gmail.com> (raw)
In-Reply-To: <CAGOCFPWxO96kaXjSb85q16Y6jn-tGDJhF5XCY73sSv1y2s30-Q@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2714 bytes --]

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 <
alexander.vorobiev@gmail.com> 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
>

[-- Attachment #2: Type: text/html, Size: 4479 bytes --]

  reply	other threads:[~2012-03-18 22:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-18  3:50 OrgMobile problem: only three files in checksums.dat Alexander Vorobiev
2012-03-18 22:23 ` Alexander Vorobiev [this message]
2012-03-19  4:35   ` Jonathan Leech-Pepin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGOCFPUR+nRh1YYkq4jKBn=HPX9=2_pofKK29_QEP=Gy1DBULg@mail.gmail.com' \
    --to=alexander.vorobiev@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).