org-mobile.el: Add list of tags in index file

This commit is contained in:
Carsten Dominik 2009-09-28 19:18:31 +01:00
parent cdc5054835
commit 7baa702f65
2 changed files with 30 additions and 15 deletions

View File

@ -1,5 +1,8 @@
2009-09-28 Carsten Dominik <carsten.dominik@gmail.com> 2009-09-28 Carsten Dominik <carsten.dominik@gmail.com>
* org-mobile.el (org-mobile-files-alist): Add the list of tags to
the index file.
* org.el (org-ctrl-c-ctrl-c): Pass prefix arg to * org.el (org-ctrl-c-ctrl-c): Pass prefix arg to
org-table-recalculate when cursor is in TBLFM line. org-table-recalculate when cursor is in TBLFM line.

View File

@ -172,38 +172,50 @@ 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) (let ((files-alist org-mobile-files-alist)
(let ((files (org-agenda-files t)) file todo-kwds done-kwds tags drawers entry)
file todo-kwds done-kwds drawers) (org-prepare-agenda-buffers (mapcar 'car files-alist))
(org-prepare-agenda-buffers (org-agenda-files t))
(setq done-kwds (org-uniquify org-done-keywords-for-agenda)) (setq done-kwds (org-uniquify org-done-keywords-for-agenda))
(setq todo-kwds (org-delete-all (setq todo-kwds (org-delete-all
done-kwds done-kwds
(org-uniquify org-todo-keywords-for-agenda))) (org-uniquify org-todo-keywords-for-agenda)))
(setq drawers (org-uniquify org-drawers-for-agenda)) (setq drawers (org-uniquify org-drawers-for-agenda))
(setq tags (org-uniquify
(delq nil
(mapcar
(lambda (e)
(cond ((stringp e) e)
((listp e)
(if (stringp (car e)) (car e) nil))
(t nil)))
org-tag-alist-for-agenda))))
(with-temp-file (with-temp-file
(expand-file-name org-mobile-index-file org-mobile-directory) (expand-file-name org-mobile-index-file org-mobile-directory)
(insert "#+TODO: " (mapconcat 'identity todo-kwds " ") " | " (insert "#+TODO: " (mapconcat 'identity todo-kwds " ") " | "
(mapconcat 'identity done-kwds " ") "\n" (mapconcat 'identity done-kwds " ") "\n"
"#+TAGS: " (mapconcat 'identity tags " ") "\n"
"#+DRAWERS: " (mapconcat 'identity drawers " ") "\n") "#+DRAWERS: " (mapconcat 'identity drawers " ") "\n")
(insert "* [[file:agendas.org][Agenda Views]]\n") (insert "* [[file:agendas.org][Agenda Views]]\n")
(while (setq file (pop files)) (while (setq entry (pop files-alist))
(setq file (car entry)
link-name (cdr entry))
(insert (format "* [[file:%s][%s]]\n" (insert (format "* [[file:%s][%s]]\n"
(file-name-nondirectory file) link-name link-name)))
(capitalize
(file-name-sans-extension
(file-name-nondirectory file))))))
(insert (format "* [[file:%s][Captured before last sync]]\n" (insert (format "* [[file:%s][Captured before last sync]]\n"
org-mobile-capture-file))))) org-mobile-capture-file)))))
(defun org-mobile-copy-agenda-files () (defun org-mobile-copy-agenda-files ()
"Copy all agenda files to the stage or WebDAV directory." "Copy all agenda files to the stage or WebDAV directory."
(let ((files (org-agenda-files t)) file buf) (let ((files-alist org-mobile-files-alist)
(while (setq file (pop files)) file buf entry link-name target-path target-dir)
(if (file-exists-p file) (while (setq entry (pop files-alist))
(copy-file file (expand-file-name (file-name-nondirectory file) (setq file (car entry) link-name (cdr entry))
org-mobile-directory) (when (file-exists-p file)
'ok-if-exists))) (setq target-path (expand-file-name link-name org-mobile-directory)
target-dir (file-name-directory target-path))
(unless (file-directory-p target-dir)
(make-directory target-dir 'parents)
(copy-file file target-path 'ok-if-exists))))
(setq file (expand-file-name org-mobile-capture-file (setq file (expand-file-name org-mobile-capture-file
org-mobile-directory)) org-mobile-directory))
(unless (file-exists-p file) (unless (file-exists-p file)