Function: org-mobile-sumo-agenda-command
org-mobile-sumo-agenda-command is a byte-compiled function defined in
org-mobile.el.gz.
Signature
(org-mobile-sumo-agenda-command)
Documentation
Return an agenda custom command that comprises all custom commands.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-mobile.el.gz
(defun org-mobile-sumo-agenda-command ()
"Return an agenda custom command that comprises all custom commands."
(let ((custom-list
;; normalize different versions
(delq nil
(mapcar
(lambda (x)
(cond ((stringp (cdr x)) nil)
((stringp (nth 1 x)) x)
((not (nth 1 x)) (cons (car x) (cons "" (cddr x))))
(t (cons (car x) (cons "" (cdr x))))))
org-agenda-custom-commands)))
(default-list '(("a" "Agenda" agenda) ("t" "All TODO" alltodo)))
thelist atitle new e key desc type match settings cmds gkey gdesc gsettings cnt)
(cond
((eq org-mobile-agendas 'custom)
(setq thelist custom-list))
((eq org-mobile-agendas 'default)
(setq thelist default-list))
((eq org-mobile-agendas 'all)
(setq thelist custom-list)
(unless (assoc "t" thelist) (push '("t" "ALL TODO" alltodo) thelist))
(unless (assoc "a" thelist) (push '("a" "Agenda" agenda) thelist)))
((listp org-mobile-agendas)
(setq thelist (append custom-list default-list))
(setq thelist (delq nil (mapcar (lambda (k) (assoc k thelist))
org-mobile-agendas)))))
(while (setq e (pop thelist))
(cond
((stringp (cdr e))
;; this is a description entry - skip it
)
((eq (nth 2 e) 'search)
;; Search view is interactive, skip
)
((memq (nth 2 e) '(todo-tree tags-tree occur-tree))
;; These are trees, not really agenda commands
)
((and (memq (nth 2 e) '(todo tags tags-todo))
(or (null (nth 3 e))
(not (string-match "\\S-" (nth 3 e)))))
;; These would be interactive because the match string is empty
)
((memq (nth 2 e) '(agenda alltodo todo tags tags-todo))
;; a normal command
(setq key (car e) desc (nth 1 e) type (nth 2 e) match (nth 3 e)
settings (nth 4 e))
(setq settings
(cons (list 'org-agenda-title-append
(concat "<after>KEYS=" key " TITLE: "
(if (and (stringp desc) (> (length desc) 0))
desc (symbol-name type))
"</after>"))
settings))
(push (list type match settings) new))
((or (functionp (nth 2 e)) (symbolp (nth 2 e)))
;; A user-defined function, which can do anything, so simply
;; ignore it.
)
(t
;; a block agenda
(setq gkey (car e) gdesc (nth 1 e) gsettings (nth 3 e) cmds (nth 2 e))
(setq cnt 0)
(while (setq e (pop cmds))
(setq type (car e) match (nth 1 e) settings (nth 2 e))
(setq atitle (if (string= "" gdesc) match gdesc))
(setq settings (append gsettings settings))
(setq settings
(cons (list 'org-agenda-title-append
(concat "<after>KEYS=" gkey "#" (number-to-string
(setq cnt (1+ cnt)))
" TITLE: " atitle "</after>"))
settings))
(push (list type match settings) new)))))
(and new (list "X" "SUMO" (reverse new)
'((org-agenda-compact-blocks nil))))))