Safeguard the setting for `org-mobile-inbox-for-pull'

This file should be with the other org files, and not in the staging
area.  Also, when file names in mobileorg.org are interpreted, this
should be relative to org-directory.  So we also require now that the
user set this variable.
This commit is contained in:
Carsten Dominik 2009-10-18 02:53:51 +02:00
parent a45e7d88c7
commit d096fac7f7
4 changed files with 47 additions and 24 deletions

View File

@ -1,3 +1,8 @@
2009-10-18 Carsten Dominik <carsten.dominik@gmail.com>
* org.texi (Pushing to MobileOrg): Mention that `org-directory'
should be set.
2009-10-14 Carsten Dominik <carsten.dominik@gmail.com>
* org.texi (Agenda commands): Document that SPC is a filter for

View File

@ -11735,19 +11735,20 @@ from the WebDAV directory using @file{scp}.
This operation copies all files currently listed in @code{org-mobile-files}
to the directory @code{org-mobile-directory}. By default this list contains
all agenda files (as listed in @code{org-agenda-files}), but additional files
can be included by customizing @code{org-mobiles-files}. The push operation
also creates (in the same directory) a special Org file @file{agendas.org}.
This file is an Org-mode style outline, containing every custom agenda view
defined by the user. While creating the agendas, Org-mode will
force@footnote{See the variable @code{org-mobile-force-id-on-agenda-items}.}
an ID property on all entries referenced by the agendas, so that these
entries can be uniquely identified if @i{MobileOrg} flags them for further
action. Finally, Org writes the file @file{index.org}, containing links to
all other files. If @i{MobileOrg} is configured to request this file from
the WebDAV server, all agendas and Org files will be downloaded to the
device. To speed up the download, MobileOrg will only read files whose
checksums@footnote{stored automatically in the file @file{checksums.dat}}
have changed.
can be included by customizing @code{org-mobiles-files}. File names will be
staged with path relative to @code{org-directory}, so all files should be
inside this directory. The push operation also creates (in the same
directory) a special Org file @file{agendas.org}. This file is an Org-mode
style outline, containing every custom agenda view defined by the user.
While creating the agendas, Org-mode will force@footnote{See the variable
@code{org-mobile-force-id-on-agenda-items}.} an ID property on all entries
referenced by the agendas, so that these entries can be uniquely identified
if @i{MobileOrg} flags them for further action. Finally, Org writes the file
@file{index.org}, containing links to all other files. If @i{MobileOrg} is
configured to request this file from the WebDAV server, all agendas and Org
files will be downloaded to the device. To speed up the download, MobileOrg
will only read files whose checksums@footnote{stored automatically in the
file @file{checksums.dat}} have changed.
@node Pulling from MobileOrg, , Pushing to MobileOrg, MobileOrg
@section Pulling from MobileOrg

View File

@ -1,3 +1,11 @@
2009-10-18 Carsten Dominik <carsten.dominik@gmail.com>
* org-mobile.el (org-mobile-locate-entry): Interpret files
relative to org-directory.
(org-mobile-inbox-for-pull): Document the best location for this
file.
(org-mobile-check-setup): Verify `org-directory'.
2009-10-17 Carsten Dominik <carsten.dominik@gmail.com>
* org-clock.el (org-clock-resolve, org-resolve-clocks)

View File

@ -68,7 +68,8 @@ org-agenda-text-search-extra-files
"The file where captured notes and flags will be appended to.
During the execution of `org-mobile-pull', the file
`org-mobile-capture-file' will be emptied it's contents have
been appended to the file given here."
been appended to the file given here. This file should be in
`org-directory', and not in the staging area or on the web server."
:group 'org-mobile
:type 'file)
@ -236,18 +237,25 @@ agenda view showing the flagged items."
(defun org-mobile-check-setup ()
"Check if org-mobile-directory has been set up."
(when (or (not org-mobile-directory)
(not (stringp org-mobile-directory))
(not (string-match "\\S-" org-mobile-directory))
(not (file-exists-p org-mobile-directory))
(not (file-directory-p org-mobile-directory)))
(unless (and org-directory
(stringp org-directory)
(string-match "\\S-" org-directory)
(file-exists-p org-directory)
(file-directory-p org-directory))
(error
"Please set `org-directory' to the directory where your org files live"))
(unless (and org-mobile-directory
(stringp org-mobile-directory)
(string-match "\\S-" org-mobile-directory)
(file-exists-p org-mobile-directory)
(file-directory-p org-mobile-directory))
(error
"Variable `org-mobile-directory' must point to an existing directory"))
(when (or (not org-mobile-inbox-for-pull)
(not (stringp org-mobile-inbox-for-pull))
(not (string-match "\\S-" org-mobile-inbox-for-pull))
(not (file-exists-p
(file-name-directory org-mobile-inbox-for-pull))))
(unless (and org-mobile-inbox-for-pull
(stringp org-mobile-inbox-for-pull)
(string-match "\\S-" org-mobile-inbox-for-pull)
(file-exists-p
(file-name-directory org-mobile-inbox-for-pull)))
(error
"Variable `org-mobile-inbox-for-pull' must point to a file in an existing directory")))
@ -728,6 +736,7 @@ as a string."
(path (match-string 2 link))
(table '((?: . "%3a") (?\[ . "%5b") (?\] . "%5d") (?/ . "%2f"))))
(setq file (org-link-unescape file table))
(setq file (expand-file-name file org-directory))
(setq path (mapcar (lambda (x) (org-link-unescape x table))
(org-split-string path "/")))
(org-find-olp (cons file path))))))