Fix problem in org-mobile.el when there are no custom agenda commands

This commit is contained in:
Carsten Dominik 2009-10-14 17:18:37 +02:00
parent 4fe057f4aa
commit a8a74fc9e3
1 changed files with 7 additions and 5 deletions

View File

@ -306,7 +306,8 @@ agenda view showing the flagged items."
(insert "#+TAGS: " (mapconcat 'identity tags " ") "\n") (insert "#+TAGS: " (mapconcat 'identity tags " ") "\n")
(insert "#+DRAWERS: " (mapconcat 'identity drawers " ") "\n") (insert "#+DRAWERS: " (mapconcat 'identity drawers " ") "\n")
(insert "#+ALLPRIORITIES: A B C" "\n") (insert "#+ALLPRIORITIES: A B C" "\n")
(insert "* [[file:agendas.org][Agenda Views]]\n") (when (file-exists-p "agendas.org")
(insert "* [[file:agendas.org][Agenda Views]]\n"))
(while (setq entry (pop files-alist)) (while (setq entry (pop files-alist))
(setq file (car entry) (setq file (car entry)
link-name (cdr entry)) link-name (cdr entry))
@ -409,7 +410,7 @@ The table of checksums is written to the file mobile-checksums."
" TITLE: " gdesc " " match "</after>")) " TITLE: " gdesc " " match "</after>"))
settings)) settings))
(push (list type match settings) new))))) (push (list type match settings) new)))))
(list "X" "SUMO" (reverse new) nil))) (and new (list "X" "SUMO" (reverse new) nil))))
(defvar org-mobile-creating-agendas nil) (defvar org-mobile-creating-agendas nil)
(defun org-mobile-write-agenda-for-mobile (file) (defun org-mobile-write-agenda-for-mobile (file)
@ -480,13 +481,14 @@ The table of checksums is written to the file mobile-checksums."
(interactive) (interactive)
(let* ((file (expand-file-name "agendas.org" (let* ((file (expand-file-name "agendas.org"
org-mobile-directory)) org-mobile-directory))
(sumo (org-mobile-sumo-agenda-command))
(org-agenda-custom-commands (org-agenda-custom-commands
(list (append (org-mobile-sumo-agenda-command) (list (append sumo (list (list file)))))
(list (list file)))))
(org-mobile-creating-agendas t)) (org-mobile-creating-agendas t))
(unless (file-writable-p file) (unless (file-writable-p file)
(error "Cannot write to file %s" file)) (error "Cannot write to file %s" file))
(org-store-agenda-views))) (when sumo
(org-store-agenda-views))))
(defun org-mobile-move-capture () (defun org-mobile-move-capture ()
"Move the contents of the capture file to the inbox file. "Move the contents of the capture file to the inbox file.