Add drawer and keyword lists to index file for MobileOrg

MobileOrg needs to know the possible TODO keywords and DRAWERS that
can appear in Org files it receives.
This commit is contained in:
Carsten Dominik 2009-09-19 10:46:05 +01:00
parent 9491fc8d5d
commit 32b1aebb37
4 changed files with 30 additions and 3 deletions

View File

@ -1,8 +1,18 @@
2009-09-19 Carsten Dominik <carsten.dominik@gmail.com> 2009-09-19 Carsten Dominik <carsten.dominik@gmail.com>
* org-mobile.el (org-mobile-create-index-file): Add the list of
TODO keywords, and the list of drawers to the index file.
* org-agenda.el (org-prepare-agenda): Reset
`org-drawers-for-agenda'.
(org-prepare-agenda): Uniquify list of drawers.
* org.el (org-complex-heading-regexp-format): New variable. * org.el (org-complex-heading-regexp-format): New variable.
(org-set-regexps-and-options): Define (org-set-regexps-and-options): Define
`org-complex-heading-regexp-format'. `org-complex-heading-regexp-format'.
(org-drawers-for-agenda): New variable.
(org-map-entries): Bind `org-drawers-for-agenda'.
(org-prepare-agenda-buffers): Add to `org-drawers-for-agenda'.
* org-remember.el (org-go-to-remember-target) * org-remember.el (org-go-to-remember-target)
(org-remember-handler): Use `org-complex-heading-regexp-format'. (org-remember-handler): Use `org-complex-heading-regexp-format'.

View File

@ -2554,6 +2554,7 @@ bind it in the options section.")
(defun org-prepare-agenda (&optional name) (defun org-prepare-agenda (&optional name)
(setq org-todo-keywords-for-agenda nil) (setq org-todo-keywords-for-agenda nil)
(setq org-done-keywords-for-agenda nil) (setq org-done-keywords-for-agenda nil)
(setq org-drawers-for-agenda nil)
(setq org-agenda-filter nil) (setq org-agenda-filter nil)
(put 'org-agenda-filter :preset-filter org-agenda-filter-preset) (put 'org-agenda-filter :preset-filter org-agenda-filter-preset)
(if org-agenda-multi (if org-agenda-multi
@ -2575,6 +2576,7 @@ bind it in the options section.")
(org-uniquify org-todo-keywords-for-agenda)) (org-uniquify org-todo-keywords-for-agenda))
(setq org-done-keywords-for-agenda (setq org-done-keywords-for-agenda
(org-uniquify org-done-keywords-for-agenda)) (org-uniquify org-done-keywords-for-agenda))
(setq org-drawers-for-agenda (org-uniquify org-drawers-for-agenda))
(let* ((abuf (get-buffer-create org-agenda-buffer-name)) (let* ((abuf (get-buffer-create org-agenda-buffer-name))
(awin (get-buffer-window abuf))) (awin (get-buffer-window abuf)))
(cond (cond

View File

@ -173,9 +173,20 @@ agenda view showing the flagged items."
(defun org-mobile-create-index-file () (defun org-mobile-create-index-file ()
"Write the index file in the WebDAV directory." "Write the index file in the WebDAV directory."
(interactive) (interactive)
(with-temp-file (expand-file-name org-mobile-index-file org-mobile-directory) (let ((files (org-agenda-files t))
file todo-kwds done-kwds drawers)
(org-prepare-agenda-buffers (org-agenda-files t))
(setq done-kwds (org-uniquify org-done-keywords-for-agenda))
(setq todo-kwds (org-delete-all
done-kwds
(org-uniquify org-todo-keywords-for-agenda)))
(setq drawers (org-uniquify org-drawers-for-agenda))
(with-temp-file
(expand-file-name org-mobile-index-file org-mobile-directory)
(insert "#+TODO: " (mapconcat 'identity todo-kwds " ") " | "
(mapconcat 'identity done-kwds " ") "\n"
"#+DRAWERS: " (mapconcat 'identity drawers " ") "\n")
(insert "* [[file:agendas.org][Agenda Views]]\n") (insert "* [[file:agendas.org][Agenda Views]]\n")
(let ((files (org-agenda-files t)) file)
(while (setq file (pop files)) (while (setq file (pop files))
(insert (format "* [[file:%s][%s]]\n" (insert (format "* [[file:%s][%s]]\n"
(file-name-nondirectory file) (file-name-nondirectory file)

View File

@ -1705,6 +1705,7 @@ taken from the (otherwise obsolete) variable `org-todo-interpretation'."
(make-variable-buffer-local 'org-todo-keywords-1) (make-variable-buffer-local 'org-todo-keywords-1)
(defvar org-todo-keywords-for-agenda nil) (defvar org-todo-keywords-for-agenda nil)
(defvar org-done-keywords-for-agenda nil) (defvar org-done-keywords-for-agenda nil)
(defvar org-drawers-for-agenda nil)
(defvar org-todo-keyword-alist-for-agenda nil) (defvar org-todo-keyword-alist-for-agenda nil)
(defvar org-tag-alist-for-agenda nil) (defvar org-tag-alist-for-agenda nil)
(defvar org-agenda-contributing-files nil) (defvar org-agenda-contributing-files nil)
@ -11685,6 +11686,7 @@ a *different* entry, you cannot use these techniques."
org-todo-keywords-for-agenda org-todo-keywords-for-agenda
org-done-keywords-for-agenda org-done-keywords-for-agenda
org-todo-keyword-alist-for-agenda org-todo-keyword-alist-for-agenda
org-drawers-for-agenda
org-tag-alist-for-agenda) org-tag-alist-for-agenda)
(cond (cond
@ -13908,6 +13910,8 @@ When a buffer is unmodified, it is just killed. When modified, it is saved
(append org-done-keywords-for-agenda org-done-keywords)) (append org-done-keywords-for-agenda org-done-keywords))
(setq org-todo-keyword-alist-for-agenda (setq org-todo-keyword-alist-for-agenda
(append org-todo-keyword-alist-for-agenda org-todo-key-alist)) (append org-todo-keyword-alist-for-agenda org-todo-key-alist))
(setq org-drawers-for-agenda
(append org-drawers-for-agenda org-drawers))
(setq org-tag-alist-for-agenda (setq org-tag-alist-for-agenda
(append org-tag-alist-for-agenda org-tag-alist)) (append org-tag-alist-for-agenda org-tag-alist))