summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2010-10-08 09:29:42 +0200
committerCarsten Dominik <carsten.dominik@gmail.com>2010-10-08 09:29:42 +0200
commit0c90cdc7793a21e5cf4e8ef5b4043a95d988489b (patch)
tree92f28704936590af093caf4294642d39c2a452fe
parentf1960677de1c6a1fbdf924019fcdebec6a728884 (diff)
downloadorg-mode-0c90cdc7793a21e5cf4e8ef5b4043a95d988489b.tar.gz
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.
-rw-r--r--lisp/org-mobile.el20
1 files changed, 18 insertions, 2 deletions
diff --git a/lisp/org-mobile.el b/lisp/org-mobile.el
index 5b91ed4..af3493d 100644
--- a/lisp/org-mobile.el
+++ b/lisp/org-mobile.el
@@ -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."