MobileOrg: Use outline path if we cannot make an ID

* lisp/org-mobile.el (org-mobile-force-id-on-agenda-items): Fix docstring.
(org-mobile-write-agenda-for-mobile): Use outline path if we do not
have an ID and are not allowed to make one.
(org-mobile-get-outline-path-link): New function.
This commit is contained in:
Carsten Dominik 2010-10-08 09:29:42 +02:00
parent f1960677de
commit 0c90cdc779
1 changed files with 18 additions and 2 deletions

View File

@ -150,7 +150,7 @@ list a list of selection key(s) as string."
(string :tag "Selection Keys"))))
(defcustom org-mobile-force-id-on-agenda-items t
"Non-nil means make all agenda items carry and ID."
"Non-nil means make all agenda items carry an ID."
:group 'org-mobile
:type 'boolean)
@ -626,7 +626,8 @@ The table of checksums is written to the file mobile-checksums."
(if (org-bound-and-true-p
org-mobile-force-id-on-agenda-items)
(org-id-get m 'create)
(org-entry-get m "ID")))
(or (org-entry-get m "ID")
(org-mobile-get-outline-path-link m))))
(insert " :PROPERTIES:\n :ORIGINAL_ID: " id
"\n :END:\n")))))
(beginning-of-line 2))
@ -634,6 +635,21 @@ The table of checksums is written to the file mobile-checksums."
org-mobile-checksum-files))
(message "Agenda written to Org file %s" file)))
(defun org-mobile-get-outline-path-link (pom)
(org-with-point-at pom
(concat "olp:"
(org-mobile-escape-olp (file-name-nondirectory buffer-file-name))
"/"
(mapconcat 'org-mobile-escape-olp
(org-get-outline-path)
"/")
"/"
(org-mobile-escape-olp (nth 4 (org-heading-components))))))
(defun org-mobile-escape-olp (s)
(let ((table '((?: . "%3a") (?\[ . "%5b") (?\] . "%5d") (?/ . "%2f"))))
(org-link-escape s table)))
;;;###autoload
(defun org-mobile-create-sumo-agenda ()
"Create a file that contains all custom agenda views."