org-mobile.el 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064
  1. ;;; org-mobile.el --- Code for asymmetric sync with a mobile device
  2. ;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
  3. ;;
  4. ;; Author: Carsten Dominik <carsten at orgmode dot org>
  5. ;; Keywords: outlines, hypermedia, calendar, wp
  6. ;; Homepage: http://orgmode.org
  7. ;; Version: 6.36trans
  8. ;;
  9. ;; This file is part of GNU Emacs.
  10. ;;
  11. ;; GNU Emacs is free software: you can redistribute it and/or modify
  12. ;; it under the terms of the GNU General Public License as published by
  13. ;; the Free Software Foundation, either version 3 of the License, or
  14. ;; (at your option) any later version.
  15. ;;
  16. ;; GNU Emacs is distributed in the hope that it will be useful,
  17. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. ;; GNU General Public License for more details.
  20. ;;
  21. ;; You should have received a copy of the GNU General Public License
  22. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  23. ;;
  24. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  25. ;;
  26. ;;; Commentary:
  27. ;;
  28. ;; This file contains the code to interact with Richard Moreland's iPhone
  29. ;; application MobileOrg. This code is documented in Appendix B of the
  30. ;; Org-mode manual. The code is not specific for the iPhone, however.
  31. ;; Any external viewer/flagging/editing application that uses the same
  32. ;; conventions could be used.
  33. (require 'org)
  34. (require 'org-agenda)
  35. (eval-when-compile (require 'cl))
  36. (defgroup org-mobile nil
  37. "Options concerning support for a viewer/editor on a mobile device."
  38. :tag "Org Mobile"
  39. :group 'org)
  40. (defcustom org-mobile-files '(org-agenda-files)
  41. "Files to be staged for MobileOrg.
  42. This is basically a list of files and directories. Files will be staged
  43. directly. Directories will be search for files with the extension `.org'.
  44. In addition to this, the list may also contain the following symbols:
  45. org-agenda-files
  46. This means include the complete, unrestricted list of files given in
  47. the variable `org-agenda-files'.
  48. org-agenda-text-search-extra-files
  49. Include the files given in the variable
  50. `org-agenda-text-search-extra-files'"
  51. :group 'org-mobile
  52. :type '(list :greedy t
  53. (option (const :tag "org-agenda-files" org-agenda-files))
  54. (option (const :tag "org-agenda-text-search-extra-files"
  55. org-agenda-text-search-extra-files))
  56. (repeat :inline t :tag "Additional files"
  57. (file))))
  58. (defcustom org-mobile-directory ""
  59. "The WebDAV directory where the interaction with the mobile takes place."
  60. :group 'org-mobile
  61. :type 'directory)
  62. (defcustom org-mobile-use-encryption nil
  63. "Non-nil means keep only encrypted files on the webdav server.
  64. Encryption uses AES-256, with a password given in
  65. `org-mobile-encryption-password'.
  66. When nil, plain files are kept on the server.
  67. Turning on encryption requires to set the same password in the MobileOrg
  68. application."
  69. :group 'org-mobile
  70. :type 'boolean)
  71. (defcustom org-mobile-encryption-tempfile "~/orgtmpcrypt"
  72. "File that is being used as a temporary file for encryption.
  73. This must be local file on your local machine (not on the webdav server).
  74. You might want to put this file into a directory where only you have access."
  75. :group 'org-mobile
  76. :type 'directory)
  77. (defcustom org-mobile-encryption-password ""
  78. "Password for encrypting files uploaded to the server.
  79. This is a single password which is used for AES-256 encryption. The same
  80. password must also be set in the MobileOrg application. All Org files,
  81. including mobileorg.org will be encrypted using this password.
  82. Note that, whe Org runs the encryption commands, the password could
  83. be visible on your system with the `ps' command. So this method is only
  84. intended to keep the files secure on the server, not on your own machine."
  85. :group 'org-mobile
  86. :type '(string :tag "Password"))
  87. (defcustom org-mobile-inbox-for-pull "~/org/from-mobile.org"
  88. "The file where captured notes and flags will be appended to.
  89. During the execution of `org-mobile-pull', the file
  90. `org-mobile-capture-file' will be emptied it's contents have
  91. been appended to the file given here. This file should be in
  92. `org-directory', and not in the staging area or on the web server."
  93. :group 'org-mobile
  94. :type 'file)
  95. (defconst org-mobile-capture-file "mobileorg.org"
  96. "The capture file where the mobile stores captured notes and flags.
  97. This should not be changed, because MobileOrg assumes this name.")
  98. (defcustom org-mobile-index-file "index.org"
  99. "The index file with inks to all Org files that should be loaded by MobileOrg.
  100. Relative to `org-mobile-directory'. The Address field in the MobileOrg setup
  101. should point to this file."
  102. :group 'org-mobile
  103. :type 'file)
  104. (defcustom org-mobile-agendas 'all
  105. "The agendas that should be pushed to MobileOrg.
  106. Allowed values:
  107. default the weekly agenda and the global TODO list
  108. custom all custom agendas defined by the user
  109. all the custom agendas and the default ones
  110. list a list of selection key(s) as string."
  111. :group 'org-mobile
  112. :type '(choice
  113. (const :tag "Default Agendas" default)
  114. (const :tag "Custom Agendas" custom)
  115. (const :tag "Default and Custom Agendas" all)
  116. (repeat :tag "Selected"
  117. (string :tag "Selection Keys"))))
  118. (defcustom org-mobile-force-id-on-agenda-items t
  119. "Non-nil means make all agenda items carry and ID."
  120. :group 'org-mobile
  121. :type 'boolean)
  122. (defcustom org-mobile-force-mobile-change nil
  123. "Non-nil means force the change made on the mobile device.
  124. So even if there have been changes to the computer version of the entry,
  125. force the new value set on the mobile.
  126. When nil, mark the entry from the mobile with an error message.
  127. Instead of nil or t, this variable can also be a list of symbols, indicating
  128. the editing types for which the mobile version should always dominate."
  129. :group 'org-mobile
  130. :type '(choice
  131. (const :tag "Always" t)
  132. (const :tag "Never" nil)
  133. (set :greedy t :tag "Specify"
  134. (const todo)
  135. (const tags)
  136. (const priority)
  137. (const heading)
  138. (const body))))
  139. (defcustom org-mobile-action-alist
  140. '(("edit" . (org-mobile-edit data old new)))
  141. "Alist with flags and actions for mobile sync.
  142. When flagging an entry, MobileOrg will create entries that look like
  143. * F(action:data) [[id:entry-id][entry title]]
  144. This alist defines that the ACTION in the parentheses of F() should mean,
  145. i.e. what action should be taken. The :data part in the parenthesis is
  146. optional. If present, the string after the colon will be passed to the
  147. action form as the `data' variable.
  148. The car of each elements of the alist is an actions string. The cdr is
  149. an Emacs Lisp form that will be evaluated with the cursor on the headline
  150. of that entry.
  151. For now, it is not recommended to change this variable."
  152. :group 'org-mobile
  153. :type '(repeat
  154. (cons (string :tag "Action flag")
  155. (sexp :tag "Action form"))))
  156. (defcustom org-mobile-checksum-binary (or (executable-find "shasum")
  157. (executable-find "sha1sum")
  158. (executable-find "md5sum")
  159. (executable-find "md5"))
  160. "Executable used for computing checksums of agenda files."
  161. :group 'org-mobile
  162. :type 'string)
  163. (defvar org-mobile-pre-push-hook nil
  164. "Hook run before running `org-mobile-push'.
  165. This could be used to clean up `org-mobile-directory', for example to
  166. remove files that used to be included in the agenda but no longer are.
  167. The presence of such files would not really be a problem, but after time
  168. they may accumulate.")
  169. (defvar org-mobile-post-push-hook nil
  170. "Hook run after running `org-mobile-push'.
  171. If Emacs does not have direct write access to the WebDAV directory used
  172. by the mobile device, this hook should be used to copy all files from the
  173. local staging directory `org-mobile-directory' to the WebDAV directory,
  174. for example using `rsync' or `scp'.")
  175. (defvar org-mobile-pre-pull-hook nil
  176. "Hook run before executing `org-mobile-pull'.
  177. If Emacs does not have direct write access to the WebDAV directory used
  178. by the mobile device, this hook should be used to copy the capture file
  179. `mobileorg.org' from the WebDAV location to the local staging
  180. directory `org-mobile-directory'.")
  181. (defvar org-mobile-post-pull-hook nil
  182. "Hook run after running `org-mobile-pull'.
  183. If Emacs does not have direct write access to the WebDAV directory used
  184. by the mobile device, this hook should be used to copy the emptied
  185. capture file `mobileorg.org' back to the WebDAV directory, for example
  186. using `rsync' or `scp'.")
  187. (defvar org-mobile-last-flagged-files nil
  188. "List of files containing entries flagged in the latest pull.")
  189. (defvar org-mobile-files-alist nil)
  190. (defvar org-mobile-checksum-files nil)
  191. (defun org-mobile-prepare-file-lists ()
  192. (setq org-mobile-files-alist (org-mobile-files-alist))
  193. (setq org-mobile-checksum-files nil))
  194. (defun org-mobile-files-alist ()
  195. "Expand the list in `org-mobile-files' to a list of existing files."
  196. (let* ((include-archives
  197. (and (member 'org-agenda-text-search-extra-files org-mobile-files)
  198. (member 'agenda-archives org-agenda-text-search-extra-files)
  199. t))
  200. (files
  201. (apply 'append
  202. (mapcar
  203. (lambda (f)
  204. (cond
  205. ((eq f 'org-agenda-files)
  206. (org-agenda-files t include-archives))
  207. ((eq f 'org-agenda-text-search-extra-files)
  208. (delq 'agenda-archives
  209. (copy-sequence
  210. org-agenda-text-search-extra-files)))
  211. ((and (stringp f) (file-directory-p f))
  212. (directory-files f 'full "\\.org\\'"))
  213. ((and (stringp f) (file-exists-p f))
  214. (list f))
  215. (t nil)))
  216. org-mobile-files)))
  217. (orgdir-uname (file-name-as-directory (file-truename org-directory)))
  218. (orgdir-re (concat "\\`" (regexp-quote orgdir-uname)))
  219. uname seen rtn file link-name)
  220. ;; Make the files unique, and determine the name under which they will
  221. ;; be listed.
  222. (while (setq file (pop files))
  223. (if (not (file-name-absolute-p file))
  224. (setq file (expand-file-name file org-directory)))
  225. (setq uname (file-truename file))
  226. (unless (member uname seen)
  227. (push uname seen)
  228. (if (string-match orgdir-re uname)
  229. (setq link-name (substring uname (match-end 0)))
  230. (setq link-name (file-name-nondirectory uname)))
  231. (push (cons file link-name) rtn)))
  232. (nreverse rtn)))
  233. ;;;###autoload
  234. (defun org-mobile-push ()
  235. "Push the current state of Org affairs to the WebDAV directory.
  236. This will create the index file, copy all agenda files there, and also
  237. create all custom agenda views, for upload to the mobile phone."
  238. (interactive)
  239. (let ((a-buffer (get-buffer org-agenda-buffer-name)))
  240. (let ((org-agenda-buffer-name "*SUMO*")
  241. (org-agenda-filter org-agenda-filter)
  242. (org-agenda-redo-command org-agenda-redo-command))
  243. (save-excursion
  244. (save-window-excursion
  245. (org-mobile-check-setup)
  246. (org-mobile-prepare-file-lists)
  247. (run-hooks 'org-mobile-pre-push-hook)
  248. (message "Creating agendas...")
  249. (let ((inhibit-redisplay t)) (org-mobile-create-sumo-agenda))
  250. (message "Creating agendas...done")
  251. (org-save-all-org-buffers) ; to save any IDs created by this process
  252. (message "Copying files...")
  253. (org-mobile-copy-agenda-files)
  254. (message "Writing index file...")
  255. (org-mobile-create-index-file)
  256. (message "Writing checksums...")
  257. (org-mobile-write-checksums)
  258. (run-hooks 'org-mobile-post-push-hook))))
  259. (redraw-display)
  260. (when (and a-buffer (buffer-live-p a-buffer))
  261. (if (not (get-buffer-window a-buffer))
  262. (kill-buffer a-buffer)
  263. (let ((cw (selected-window)))
  264. (select-window (get-buffer-window a-buffer))
  265. (org-agenda-redo)
  266. (select-window cw)))))
  267. (message "Files for mobile viewer staged"))
  268. (defvar org-mobile-before-process-capture-hook nil
  269. "Hook that is run after content was moved to `org-mobile-inbox-for-pull'.
  270. The inbox file is visited by the current buffer, and the buffer is
  271. narrowed to the newly captured data.")
  272. ;;;###autoload
  273. (defun org-mobile-pull ()
  274. "Pull the contents of `org-mobile-capture-file' and integrate them.
  275. Apply all flagged actions, flag entries to be flagged and then call an
  276. agenda view showing the flagged items."
  277. (interactive)
  278. (org-mobile-check-setup)
  279. (run-hooks 'org-mobile-pre-pull-hook)
  280. (let ((insertion-marker (org-mobile-move-capture)))
  281. (if (not (markerp insertion-marker))
  282. (message "No new items")
  283. (org-with-point-at insertion-marker
  284. (save-restriction
  285. (narrow-to-region (point) (point-max))
  286. (run-hooks 'org-mobile-before-process-capture-hook)))
  287. (org-with-point-at insertion-marker
  288. (org-mobile-apply (point) (point-max)))
  289. (move-marker insertion-marker nil)
  290. (run-hooks 'org-mobile-post-pull-hook)
  291. (when org-mobile-last-flagged-files
  292. ;; Make an agenda view of flagged entries, but only in the files
  293. ;; where stuff has been added.
  294. (put 'org-agenda-files 'org-restrict org-mobile-last-flagged-files)
  295. (let ((org-agenda-keep-restricted-file-list t))
  296. (org-agenda nil "?"))))))
  297. (defun org-mobile-check-setup ()
  298. "Check if org-mobile-directory has been set up."
  299. (unless (and org-directory
  300. (stringp org-directory)
  301. (string-match "\\S-" org-directory)
  302. (file-exists-p org-directory)
  303. (file-directory-p org-directory))
  304. (error
  305. "Please set `org-directory' to the directory where your org files live"))
  306. (unless (and org-mobile-directory
  307. (stringp org-mobile-directory)
  308. (string-match "\\S-" org-mobile-directory)
  309. (file-exists-p org-mobile-directory)
  310. (file-directory-p org-mobile-directory))
  311. (error
  312. "Variable `org-mobile-directory' must point to an existing directory"))
  313. (unless (and org-mobile-inbox-for-pull
  314. (stringp org-mobile-inbox-for-pull)
  315. (string-match "\\S-" org-mobile-inbox-for-pull)
  316. (file-exists-p
  317. (file-name-directory org-mobile-inbox-for-pull)))
  318. (error
  319. "Variable `org-mobile-inbox-for-pull' must point to a file in an existing directory"))
  320. (unless (and org-mobile-checksum-binary
  321. (string-match "\\S-" org-mobile-checksum-binary))
  322. (error "No executable found to compute checksums"))
  323. (when org-mobile-use-encryption
  324. (unless (string-match "\\S-" org-mobile-encryption-password)
  325. (error
  326. "To use encryption, you must set `org-mobile-encryption-password'"))
  327. (unless (file-writable-p org-mobile-encryption-tempfile)
  328. (error "Cannot write to entryption tempfile %s"
  329. org-mobile-encryption-tempfile))
  330. (unless (executable-find "openssl")
  331. (error "openssl is needed to encrypt files."))))
  332. (defun org-mobile-create-index-file ()
  333. "Write the index file in the WebDAV directory."
  334. (let ((files-alist (sort (copy-sequence org-mobile-files-alist)
  335. (lambda (a b) (string< (cdr a) (cdr b)))))
  336. (def-todo (default-value 'org-todo-keywords))
  337. (def-tags (default-value 'org-tag-alist))
  338. file link-name todo-kwds done-kwds tags drawers entry kwds dwds twds)
  339. (org-prepare-agenda-buffers (mapcar 'car files-alist))
  340. (setq done-kwds (org-uniquify org-done-keywords-for-agenda))
  341. (setq todo-kwds (org-delete-all
  342. done-kwds
  343. (org-uniquify org-todo-keywords-for-agenda)))
  344. (setq drawers (org-uniquify org-drawers-for-agenda))
  345. (setq tags (org-uniquify
  346. (delq nil
  347. (mapcar
  348. (lambda (e)
  349. (cond ((stringp e) e)
  350. ((listp e)
  351. (if (stringp (car e)) (car e) nil))
  352. (t nil)))
  353. org-tag-alist-for-agenda))))
  354. (with-temp-file
  355. (expand-file-name org-mobile-index-file org-mobile-directory)
  356. (while (setq entry (pop def-todo))
  357. (insert "#+READONLY\n")
  358. (setq kwds (mapcar (lambda (x) (if (string-match "(" x)
  359. (substring x 0 (match-beginning 0))
  360. x))
  361. (cdr entry)))
  362. (insert "#+TODO: " (mapconcat 'identity kwds " ") "\n")
  363. (setq dwds (member "|" kwds)
  364. twds (org-delete-all dwds kwds)
  365. todo-kwds (org-delete-all twds todo-kwds)
  366. done-kwds (org-delete-all dwds done-kwds)))
  367. (when (or todo-kwds done-kwds)
  368. (insert "#+TODO: " (mapconcat 'identity todo-kwds " ") " | "
  369. (mapconcat 'identity done-kwds " ") "\n"))
  370. (setq def-tags (mapcar
  371. (lambda (x)
  372. (cond ((null x) nil)
  373. ((stringp x) x)
  374. ((eq (car x) :startgroup) "{")
  375. ((eq (car x) :endgroup) "}")
  376. ((eq (car x) :newline) nil)
  377. ((listp x) (car x))
  378. (t nil)))
  379. def-tags))
  380. (setq def-tags (delq nil def-tags))
  381. (setq tags (org-delete-all def-tags tags))
  382. (setq tags (sort tags (lambda (a b) (string< (downcase a) (downcase b)))))
  383. (setq tags (append def-tags tags nil))
  384. (insert "#+TAGS: " (mapconcat 'identity tags " ") "\n")
  385. (insert "#+DRAWERS: " (mapconcat 'identity drawers " ") "\n")
  386. (insert "#+ALLPRIORITIES: A B C" "\n")
  387. (when (file-exists-p (expand-file-name
  388. org-mobile-directory "agendas.org"))
  389. (insert "* [[file:agendas.org][Agenda Views]]\n"))
  390. (while (setq entry (pop files-alist))
  391. (setq file (car entry)
  392. link-name (cdr entry))
  393. (insert (format "* [[file:%s][%s]]\n"
  394. link-name link-name)))
  395. (push (cons org-mobile-index-file (md5 (buffer-string)))
  396. org-mobile-checksum-files))))
  397. (defun org-mobile-copy-agenda-files ()
  398. "Copy all agenda files to the stage or WebDAV directory."
  399. (let ((files-alist org-mobile-files-alist)
  400. file buf entry link-name target-path target-dir check)
  401. (while (setq entry (pop files-alist))
  402. (setq file (car entry) link-name (cdr entry))
  403. (when (file-exists-p file)
  404. (setq target-path (expand-file-name link-name org-mobile-directory)
  405. target-dir (file-name-directory target-path))
  406. (unless (file-directory-p target-dir)
  407. (make-directory target-dir 'parents))
  408. (if org-mobile-use-encryption
  409. (org-mobile-encrypt-and-move file target-path)
  410. (copy-file file target-path 'ok-if-exists))
  411. (setq check (shell-command-to-string
  412. (concat org-mobile-checksum-binary " "
  413. (shell-quote-argument (expand-file-name file)))))
  414. (when (string-match "[a-fA-F0-9]\\{30,40\\}" check)
  415. (push (cons link-name (match-string 0 check))
  416. org-mobile-checksum-files))))
  417. (setq file (expand-file-name org-mobile-capture-file
  418. org-mobile-directory))
  419. (save-excursion
  420. (setq buf (find-file file))
  421. (and (= (point-min) (point-max)) (insert "\n"))
  422. (save-buffer)
  423. (push (cons org-mobile-capture-file (md5 (buffer-string)))
  424. org-mobile-checksum-files))
  425. (kill-buffer buf)))
  426. (defun org-mobile-write-checksums ()
  427. "Create checksums for all files in `org-mobile-directory'.
  428. The table of checksums is written to the file mobile-checksums."
  429. (let ((sumfile (expand-file-name "checksums.dat" org-mobile-directory))
  430. (files org-mobile-checksum-files)
  431. entry file sum)
  432. (with-temp-file sumfile
  433. (set-buffer-file-coding-system 'undecided-unix nil)
  434. (while (setq entry (pop files))
  435. (setq file (car entry) sum (cdr entry))
  436. (insert (format "%s %s\n" sum file))))))
  437. (defun org-mobile-sumo-agenda-command ()
  438. "Return an agenda custom command that comprises all custom commands."
  439. (let ((custom-list
  440. ;; normalize different versions
  441. (delq nil
  442. (mapcar
  443. (lambda (x)
  444. (cond ((stringp (cdr x)) nil)
  445. ((stringp (nth 1 x)) x)
  446. ((not (nth 1 x)) (cons (car x) (cons "" (cddr x))))
  447. (t (cons (car x) (cons "" (cdr x))))))
  448. org-agenda-custom-commands)))
  449. (default-list '(("a" "Agenda" agenda) ("t" "All TODO" alltodo)))
  450. thelist new e key desc type match settings cmds gkey gdesc gsettings cnt)
  451. (cond
  452. ((eq org-mobile-agendas 'custom)
  453. (setq thelist custom-list))
  454. ((eq org-mobile-agendas 'default)
  455. (setq thelist default-list))
  456. ((eq org-mobile-agendas 'all)
  457. (setq thelist custom-list)
  458. (unless (assoc "t" thelist) (push '("t" "ALL TODO" alltodo) thelist))
  459. (unless (assoc "a" thelist) (push '("a" "Agenda" agenda) thelist)))
  460. ((listp org-mobile-agendas)
  461. (setq thelist (append custom-list default-list))
  462. (setq thelist (delq nil (mapcar (lambda (k) (assoc k thelist))
  463. org-mobile-agendas)))))
  464. (while (setq e (pop thelist))
  465. (cond
  466. ((stringp (cdr e))
  467. ;; this is a description entry - skip it
  468. )
  469. ((eq (nth 2 e) 'search)
  470. ;; Search view is interactive, skip
  471. )
  472. ((memq (nth 2 e) '(todo-tree tags-tree occur-tree))
  473. ;; These are trees, not really agenda commands
  474. )
  475. ((and (memq (nth 2 e) '(todo tags tags-todo))
  476. (or (null (nth 3 e))
  477. (not (string-match "\\S-" (nth 3 e)))))
  478. ;; These would be interactive because the match string is empty
  479. )
  480. ((memq (nth 2 e) '(agenda alltodo todo tags tags-todo))
  481. ;; a normal command
  482. (setq key (car e) desc (nth 1 e) type (nth 2 e) match (nth 3 e)
  483. settings (nth 4 e))
  484. (setq settings
  485. (cons (list 'org-agenda-title-append
  486. (concat "<after>KEYS=" key " TITLE: "
  487. (if (and (stringp desc) (> (length desc) 0))
  488. desc (symbol-name type))
  489. " " match "</after>"))
  490. settings))
  491. (push (list type match settings) new))
  492. ((symbolp (nth 2 e))
  493. ;; A user-defined function, not sure how to handle that yet
  494. )
  495. (t
  496. ;; a block agenda
  497. (setq gkey (car e) gdesc (nth 1 e) gsettings (nth 3 e) cmds (nth 2 e))
  498. (setq cnt 0)
  499. (while (setq e (pop cmds))
  500. (setq type (car e) match (nth 1 e) settings (nth 2 e))
  501. (setq settings (append gsettings settings))
  502. (setq settings
  503. (cons (list 'org-agenda-title-append
  504. (concat "<after>KEYS=" gkey "#" (number-to-string
  505. (setq cnt (1+ cnt)))
  506. " TITLE: " gdesc " " match "</after>"))
  507. settings))
  508. (push (list type match settings) new)))))
  509. (and new (list "X" "SUMO" (reverse new)
  510. '((org-agenda-compact-blocks nil))))))
  511. (defvar org-mobile-creating-agendas nil)
  512. (defun org-mobile-write-agenda-for-mobile (file)
  513. (let ((all (buffer-string)) in-date id pl prefix line app short m sexp)
  514. (with-temp-file file
  515. (org-mode)
  516. (insert "#+READONLY\n")
  517. (insert all)
  518. (goto-char (point-min))
  519. (while (not (eobp))
  520. (cond
  521. ((looking-at "[ \t]*$")) ; keep empty lines
  522. ((looking-at "=+$")
  523. ;; remove underlining
  524. (delete-region (point) (point-at-eol)))
  525. ((get-text-property (point) 'org-agenda-structural-header)
  526. (setq in-date nil)
  527. (setq app (get-text-property (point)
  528. 'org-agenda-title-append))
  529. (setq short (get-text-property (point)
  530. 'short-heading))
  531. (when (and short (looking-at ".+"))
  532. (replace-match short)
  533. (beginning-of-line 1))
  534. (when app
  535. (end-of-line 1)
  536. (insert app)
  537. (beginning-of-line 1))
  538. (insert "* "))
  539. ((get-text-property (point) 'org-agenda-date-header)
  540. (setq in-date t)
  541. (insert "** "))
  542. ((setq m (or (get-text-property (point) 'org-hd-marker)
  543. (get-text-property (point) 'org-marker)))
  544. (setq sexp (member (get-text-property (point) 'type)
  545. '("diary" "sexp")))
  546. (if (setq pl (get-text-property (point) 'prefix-length))
  547. (progn
  548. (setq prefix (org-trim (buffer-substring
  549. (point) (+ (point) pl)))
  550. line (org-trim (buffer-substring
  551. (+ (point) pl)
  552. (point-at-eol))))
  553. (delete-region (point-at-bol) (point-at-eol))
  554. (insert line "<before>" prefix "</before>")
  555. (beginning-of-line 1))
  556. (and (looking-at "[ \t]+") (replace-match "")))
  557. (insert (if in-date "*** " "** "))
  558. (end-of-line 1)
  559. (insert "\n")
  560. (unless sexp
  561. (insert (org-agenda-get-some-entry-text
  562. m 10 " " 'planning)
  563. "\n")
  564. (when (setq id
  565. (if (org-bound-and-true-p
  566. org-mobile-force-id-on-agenda-items)
  567. (org-id-get m 'create)
  568. (org-entry-get m "ID")))
  569. (insert " :PROPERTIES:\n :ORIGINAL_ID: " id
  570. "\n :END:\n")))))
  571. (beginning-of-line 2))
  572. (push (cons (file-name-nondirectory file) (md5 (buffer-string)))
  573. org-mobile-checksum-files))
  574. (message "Agenda written to Org file %s" file)))
  575. ;;;###autoload
  576. (defun org-mobile-create-sumo-agenda ()
  577. "Create a file that contains all custom agenda views."
  578. (interactive)
  579. (let* ((file (expand-file-name "agendas.org"
  580. org-mobile-directory))
  581. (file1 (if org-mobile-use-encryption
  582. org-mobile-encryption-tempfile
  583. file))
  584. (sumo (org-mobile-sumo-agenda-command))
  585. (org-agenda-custom-commands
  586. (list (append sumo (list (list file1)))))
  587. (org-mobile-creating-agendas t))
  588. (unless (file-writable-p file1)
  589. (error "Cannot write to file %s" file1))
  590. (when sumo
  591. (org-store-agenda-views))
  592. (when org-mobile-use-encryption
  593. (org-mobile-encrypt-file file1 file)
  594. (delete-file file1))))
  595. (defun org-mobile-encrypt-and-move (infile outfile)
  596. "Encrypt INFILE locally to INFILE_enc, then move it to OUTFILE.
  597. We do this in two steps so that remote paths will work, even if the
  598. encryption program does not understand them."
  599. (let ((encfile (concat infile "_enc")))
  600. (org-mobile-encrypt-file infile encfile)
  601. (when outfile
  602. (copy-file encfile outfile 'ok-if-exists)
  603. (delete-file encfile))))
  604. (defun org-mobile-encrypt-file (infile outfile)
  605. "Encrypt INFILE to OUTFILE, using `org-mobile-encryption-password'."
  606. (shell-command
  607. (format "openssl enc -aes-256-cbc -salt -pass %s -in %s -out %s"
  608. (shell-quote-argument (concat "pass:" org-mobile-encryption-password))
  609. (shell-quote-argument (expand-file-name infile))
  610. (shell-quote-argument (expand-file-name outfile)))))
  611. (defun org-mobile-decrypt-file (infile outfile)
  612. "Decrypt INFILE to OUTFILE, using `org-mobile-encryption-password'."
  613. (shell-command
  614. (format "openssl enc -d -aes-256-cbc -salt -pass %s -in %s -out %s"
  615. (shell-quote-argument (concat "pass:" org-mobile-encryption-password))
  616. (shell-quote-argument (expand-file-name infile))
  617. (shell-quote-argument (expand-file-name outfile)))))
  618. (defun org-mobile-move-capture ()
  619. "Move the contents of the capture file to the inbox file.
  620. Return a marker to the location where the new content has been added.
  621. If nothing new has been added, return nil."
  622. (interactive)
  623. (let* ((encfile nil)
  624. (capture-file (expand-file-name org-mobile-capture-file
  625. org-mobile-directory))
  626. (inbox-buffer (find-file-noselect org-mobile-inbox-for-pull))
  627. (capture-buffer
  628. (if (not org-mobile-use-encryption)
  629. (find-file-noselect capture-file)
  630. (delete-file org-mobile-encryption-tempfile)
  631. (setq encfile (concat org-mobile-encryption-tempfile "_enc"))
  632. (copy-file capture-file encfile)
  633. (org-mobile-decrypt-file encfile org-mobile-encryption-tempfile)
  634. (find-file-noselect org-mobile-encryption-tempfile)))
  635. (insertion-point (make-marker))
  636. not-empty content)
  637. (with-current-buffer capture-buffer
  638. (setq content (buffer-string))
  639. (setq not-empty (string-match "\\S-" content))
  640. (when not-empty
  641. (set-buffer inbox-buffer)
  642. (widen)
  643. (goto-char (point-max))
  644. (or (bolp) (newline))
  645. (move-marker insertion-point
  646. (prog1 (point) (insert content)))
  647. (save-buffer)
  648. (set-buffer capture-buffer)
  649. (erase-buffer)
  650. (save-buffer)
  651. (org-mobile-update-checksum-for-capture-file (buffer-string))))
  652. (kill-buffer capture-buffer)
  653. (when org-mobile-use-encryption
  654. (org-mobile-encrypt-and-move org-mobile-encryption-tempfile
  655. capture-file))
  656. (if not-empty insertion-point)))
  657. (defun org-mobile-update-checksum-for-capture-file (buffer-string)
  658. "Find the checksum line and modify it to match BUFFER-STRING."
  659. (let* ((file (expand-file-name "checksums.dat" org-mobile-directory))
  660. (buffer (find-file-noselect file)))
  661. (when buffer
  662. (with-current-buffer buffer
  663. (when (re-search-forward (concat "\\([0-9a-fA-F]\\{30,\\}\\).*?"
  664. (regexp-quote org-mobile-capture-file)
  665. "[ \t]*$") nil t)
  666. (goto-char (match-beginning 1))
  667. (delete-region (match-beginning 1) (match-end 1))
  668. (insert (md5 buffer-string))
  669. (save-buffer)))
  670. (kill-buffer buffer))))
  671. (defun org-mobile-apply (&optional beg end)
  672. "Apply all change requests in the current buffer.
  673. If BEG and END are given, only do this in that region."
  674. (interactive)
  675. (require 'org-archive)
  676. (setq org-mobile-last-flagged-files nil)
  677. (setq beg (or beg (point-min)) end (or end (point-max)))
  678. ;; Remove all Note IDs
  679. (goto-char beg)
  680. (while (re-search-forward "^\\*\\* Note ID: [-0-9A-F]+[ \t]*\n" end t)
  681. (replace-match ""))
  682. ;; Find all the referenced entries, without making any changes yet
  683. (let ((marker (make-marker))
  684. (bos-marker (make-marker))
  685. (end (move-marker (make-marker) end))
  686. (cnt-new 0)
  687. (cnt-edit 0)
  688. (cnt-flag 0)
  689. (cnt-error 0)
  690. buf-list
  691. id-pos org-mobile-error)
  692. ;; Count the new captures
  693. (goto-char beg)
  694. (while (re-search-forward "^\\* \\(.*\\)" end t)
  695. (and (>= (- (match-end 1) (match-beginning 1)) 2)
  696. (not (equal (downcase (substring (match-string 1) 0 2)) "f("))
  697. (incf cnt-new)))
  698. (goto-char beg)
  699. (while (re-search-forward
  700. "^\\*+[ \t]+F(\\([^():\n]*\\)\\(:\\([^()\n]*\\)\\)?)[ \t]+\\[\\[\\(\\(id\\|olp\\):\\([^]\n]+\\)\\)" end t)
  701. (setq id-pos (condition-case msg
  702. (org-mobile-locate-entry (match-string 4))
  703. (error (nth 1 msg))))
  704. (when (and (markerp id-pos)
  705. (not (member (marker-buffer id-pos) buf-list)))
  706. (org-mobile-timestamp-buffer (marker-buffer id-pos))
  707. (push (marker-buffer id-pos) buf-list))
  708. (if (or (not id-pos) (stringp id-pos))
  709. (progn
  710. (goto-char (+ 2 (point-at-bol)))
  711. (insert id-pos " ")
  712. (incf cnt-error))
  713. (add-text-properties (point-at-bol) (point-at-eol)
  714. (list 'org-mobile-marker
  715. (or id-pos "Linked entry not found")))))
  716. ;; OK, now go back and start applying
  717. (goto-char beg)
  718. (while (re-search-forward "^\\*+[ \t]+F(\\([^():\n]*\\)\\(:\\([^()\n]*\\)\\)?)" end t)
  719. (catch 'next
  720. (setq id-pos (get-text-property (point-at-bol) 'org-mobile-marker))
  721. (if (not (markerp id-pos))
  722. (progn
  723. (incf cnt-error)
  724. (insert "UNKNOWN PROBLEM"))
  725. (let* ((action (match-string 1))
  726. (data (and (match-end 3) (match-string 3)))
  727. (bos (point-at-bol))
  728. (eos (save-excursion (org-end-of-subtree t t)))
  729. (cmd (if (equal action "")
  730. '(progn
  731. (incf cnt-flag)
  732. (org-toggle-tag "FLAGGED" 'on)
  733. (and note
  734. (org-entry-put nil "THEFLAGGINGNOTE" note)))
  735. (incf cnt-edit)
  736. (cdr (assoc action org-mobile-action-alist))))
  737. (note (and (equal action "")
  738. (buffer-substring (1+ (point-at-eol)) eos)))
  739. (org-inhibit-logging 'note) ;; Do not take notes interactively
  740. old new)
  741. (goto-char bos)
  742. (move-marker bos-marker (point))
  743. (if (re-search-forward "^** Old value[ \t]*$" eos t)
  744. (setq old (buffer-substring
  745. (1+ (match-end 0))
  746. (progn (outline-next-heading) (point)))))
  747. (if (re-search-forward "^** New value[ \t]*$" eos t)
  748. (setq new (buffer-substring
  749. (1+ (match-end 0))
  750. (progn (outline-next-heading)
  751. (if (eobp) (org-back-over-empty-lines))
  752. (point)))))
  753. (setq old (and old (if (string-match "\\S-" old) old nil)))
  754. (setq new (and new (if (string-match "\\S-" new) new nil)))
  755. (if (and note (> (length note) 0))
  756. ;; Make Note into a single line, to fit into a property
  757. (setq note (mapconcat 'identity
  758. (org-split-string (org-trim note) "\n")
  759. "\\n")))
  760. (unless (equal data "body")
  761. (setq new (and new (org-trim new))
  762. old (and old (org-trim old))))
  763. (goto-char (+ 2 bos-marker))
  764. (unless (markerp id-pos)
  765. (insert "BAD REFERENCE ")
  766. (incf cnt-error)
  767. (throw 'next t))
  768. (unless cmd
  769. (insert "BAD FLAG ")
  770. (incf cnt-error)
  771. (throw 'next t))
  772. ;; Remember this place so that we can return
  773. (move-marker marker (point))
  774. (setq org-mobile-error nil)
  775. (save-excursion
  776. (condition-case msg
  777. (org-with-point-at id-pos
  778. (progn
  779. (eval cmd)
  780. (if (member "FLAGGED" (org-get-tags))
  781. (add-to-list 'org-mobile-last-flagged-files
  782. (buffer-file-name (current-buffer))))))
  783. (error (setq org-mobile-error msg))))
  784. (when org-mobile-error
  785. (switch-to-buffer (marker-buffer marker))
  786. (goto-char marker)
  787. (incf cnt-error)
  788. (insert (if (stringp (nth 1 org-mobile-error))
  789. (nth 1 org-mobile-error)
  790. "EXECUTION FAILED")
  791. " ")
  792. (throw 'next t))
  793. ;; If we get here, the action has been applied successfully
  794. ;; So remove the entry
  795. (goto-char bos-marker)
  796. (delete-region (point) (org-end-of-subtree t t))))))
  797. (save-buffer)
  798. (move-marker marker nil)
  799. (move-marker end nil)
  800. (message "%d new, %d edits, %d flags, %d errors" cnt-new
  801. cnt-edit cnt-flag cnt-error)
  802. (sit-for 1)))
  803. (defun org-mobile-timestamp-buffer (buf)
  804. "Time stamp buffer BUF, just to make sure its checksum will change."
  805. (with-current-buffer buf
  806. (save-excursion
  807. (save-restriction
  808. (widen)
  809. (goto-char (point-min))
  810. (if (re-search-forward
  811. "^\\([ \t]*\\)#\\+LAST_MOBILE_CHANGE:.*\n?" nil t)
  812. (progn
  813. (goto-char (match-end 1))
  814. (delete-region (point) (match-end 0)))
  815. (if (looking-at ".*?-\\*-.*-\\*-")
  816. (forward-line 1)))
  817. (insert "#+LAST_MOBILE_CHANGE: "
  818. (format-time-string "%Y-%m-%d %T") "\n")))))
  819. (defun org-mobile-smart-read ()
  820. "Parse the entry at point for shortcuts and expand them.
  821. These shortcuts are meant for fast and easy typing on the limited
  822. keyboards of a mobile device. Below we show a list of the shortcuts
  823. currently implemented.
  824. The entry is expected to contain an inactive time stamp indicating when
  825. the entry was created. When setting dates and
  826. times (for example for deadlines), the time strings are interpreted
  827. relative to that creation date.
  828. Abbreviations are expected to take up entire lines, just because it is so
  829. easy to type RET on a mobile device. Abbreviations start with one or two
  830. letters, followed immediately by a dot and then additional information.
  831. Generally the entire shortcut line is removed after action have been taken.
  832. Time stamps will be constructed using `org-read-date'. So for example a
  833. line \"dd. 2tue\" will set a deadline on the second Tuesday after the
  834. creation date.
  835. Here are the shortcuts currently implemented:
  836. dd. string set deadline
  837. ss. string set scheduling
  838. tt. string set time tamp, here.
  839. ti. string set inactive time
  840. tg. tag1 tag2 tag3 set all these tags, change case where necessary
  841. td. kwd set this todo keyword, change case where necessary
  842. FIXME: Hmmm, not sure if we can make his work against the
  843. auto-correction feature. Needs a bit more thinking. So this function
  844. is currently a noop.")
  845. (defun org-find-olp (path)
  846. "Return a marker pointing to the entry at outline path OLP.
  847. If anything goes wrong, the return value will instead an error message,
  848. as a string."
  849. (let* ((file (pop path))
  850. (buffer (find-file-noselect file))
  851. (level 1)
  852. (lmin 1)
  853. (lmax 1)
  854. limit re end found pos heading cnt)
  855. (unless buffer (error "File not found :%s" file))
  856. (with-current-buffer buffer
  857. (save-excursion
  858. (save-restriction
  859. (widen)
  860. (setq limit (point-max))
  861. (goto-char (point-min))
  862. (while (setq heading (pop path))
  863. (setq re (format org-complex-heading-regexp-format
  864. (regexp-quote heading)))
  865. (setq cnt 0 pos (point))
  866. (while (re-search-forward re end t)
  867. (setq level (- (match-end 1) (match-beginning 1)))
  868. (if (and (>= level lmin) (<= level lmax))
  869. (setq found (match-beginning 0) cnt (1+ cnt))))
  870. (when (= cnt 0) (error "Heading not found on level %d: %s"
  871. lmax heading))
  872. (when (> cnt 1) (error "Heading not unique on level %d: %s"
  873. lmax heading))
  874. (goto-char found)
  875. (setq lmin (1+ level) lmax (+ lmin (if org-odd-levels-only 1 0)))
  876. (setq end (save-excursion (org-end-of-subtree t t))))
  877. (when (org-on-heading-p)
  878. (move-marker (make-marker) (point))))))))
  879. (defun org-mobile-locate-entry (link)
  880. (if (string-match "\\`id:\\(.*\\)$" link)
  881. (org-id-find (match-string 1 link) 'marker)
  882. (if (not (string-match "\\`olp:\\(.*?\\):\\(.*\\)$" link))
  883. nil
  884. (let ((file (match-string 1 link))
  885. (path (match-string 2 link))
  886. (table '((?: . "%3a") (?\[ . "%5b") (?\] . "%5d") (?/ . "%2f"))))
  887. (setq file (org-link-unescape file table))
  888. (setq file (expand-file-name file org-directory))
  889. (setq path (mapcar (lambda (x) (org-link-unescape x table))
  890. (org-split-string path "/")))
  891. (org-find-olp (cons file path))))))
  892. (defun org-mobile-edit (what old new)
  893. "Edit item WHAT in the current entry by replacing OLD with NEW.
  894. WHAT can be \"heading\", \"todo\", \"tags\", \"priority\", or \"body\".
  895. The edit only takes place if the current value is equal (except for
  896. white space) the OLD. If this is so, OLD will be replace by NEW
  897. and the command will return t. If something goes wrong, a string will
  898. be returned that indicates what went wrong."
  899. (let (current old1 new1)
  900. (if (stringp what) (setq what (intern what)))
  901. (cond
  902. ((memq what '(todo todostate))
  903. (setq current (org-get-todo-state))
  904. (cond
  905. ((equal new "DONEARCHIVE")
  906. (org-todo 'done)
  907. (org-archive-subtree-default))
  908. ((equal new current) t) ; nothing needs to be done
  909. ((or (equal current old)
  910. (eq org-mobile-force-mobile-change t)
  911. (memq 'todo org-mobile-force-mobile-change))
  912. (org-todo (or new 'none)) t)
  913. (t (error "State before change was expected as \"%s\", but is \"%s\""
  914. old current))))
  915. ((eq what 'tags)
  916. (setq current (org-get-tags)
  917. new1 (and new (org-split-string new ":+"))
  918. old1 (and old (org-split-string old ":+")))
  919. (cond
  920. ((org-mobile-tags-same-p current new1) t) ; no change needed
  921. ((or (org-mobile-tags-same-p current old1)
  922. (eq org-mobile-force-mobile-change t)
  923. (memq 'tags org-mobile-force-mobile-change))
  924. (org-set-tags-to new1) t)
  925. (t (error "Tags before change were expected as \"%s\", but are \"%s\""
  926. (or old "") (or current "")))))
  927. ((eq what 'priority)
  928. (when (looking-at org-complex-heading-regexp)
  929. (setq current (and (match-end 3) (substring (match-string 3) 2 3)))
  930. (cond
  931. ((equal current new) t) ; no action required
  932. ((or (equal current old)
  933. (eq org-mobile-force-mobile-change t)
  934. (memq 'tags org-mobile-force-mobile-change))
  935. (org-priority (and new (string-to-char new))))
  936. (t (error "Priority was expected to be %s, but is %s"
  937. old current)))))
  938. ((eq what 'heading)
  939. (when (looking-at org-complex-heading-regexp)
  940. (setq current (match-string 4))
  941. (cond
  942. ((equal current new) t) ; no action required
  943. ((or (equal current old)
  944. (eq org-mobile-force-mobile-change t)
  945. (memq 'heading org-mobile-force-mobile-change))
  946. (goto-char (match-beginning 4))
  947. (insert new)
  948. (delete-region (point) (+ (point) (length current)))
  949. (org-set-tags nil 'align))
  950. (t (error "Heading changed in MobileOrg and on the computer")))))
  951. ((eq what 'body)
  952. (setq current (buffer-substring (min (1+ (point-at-eol)) (point-max))
  953. (save-excursion (outline-next-heading)
  954. (point))))
  955. (if (not (string-match "\\S-" current)) (setq current nil))
  956. (cond
  957. ((org-mobile-bodies-same-p current new) t) ; no action necessary
  958. ((or (org-mobile-bodies-same-p current old)
  959. (eq org-mobile-force-mobile-change t)
  960. (memq 'body org-mobile-force-mobile-change))
  961. (save-excursion
  962. (end-of-line 1)
  963. (insert "\n" new)
  964. (or (bolp) (insert "\n"))
  965. (delete-region (point) (progn (org-back-to-heading t)
  966. (outline-next-heading)
  967. (point))))
  968. t)
  969. (t (error "Body was changed in MobileOrg and on the computer")))))))
  970. (defun org-mobile-tags-same-p (list1 list2)
  971. "Are the two tag lists the same?"
  972. (not (or (org-delete-all list1 list2)
  973. (org-delete-all list2 list1))))
  974. (defun org-mobile-bodies-same-p (a b)
  975. "Compare if A and B are visually equal strings.
  976. We first remove leading and trailing white space from the entire strings.
  977. Then we split the strings into lines and remove leading/trailing whitespace
  978. from each line. Then we compare.
  979. A and B must be strings or nil."
  980. (cond
  981. ((and (not a) (not b)) t)
  982. ((or (not a) (not b)) nil)
  983. (t (setq a (org-trim a) b (org-trim b))
  984. (setq a (mapconcat 'identity (org-split-string a "[ \t]*\n[ \t]*") "\n"))
  985. (setq b (mapconcat 'identity (org-split-string b "[ \t]*\n[ \t]*") "\n"))
  986. (equal a b))))
  987. (provide 'org-mobile)
  988. ;; arch-tag: ace0e26c-58f2-4309-8a61-05ec1535f658
  989. ;;; org-mobile.el ends here