org--batch-store-agenda-views: Fix treatment of lambda functions

* org-agenda.el (org--batch-store-agenda-views): Fix treatment of
lambda functions used as custom agenda commands.
`org-agenda-custom-commands' entries may specify a custom function
instead of a symbol like `tags-todo'.  `org--batch-store-agenda-views'
behaved differently from `org-agenda' when that custom function was
defined as a lambda rather than a symbol, incorrectly treating the
lambda form as a list of agenda commands.  Instead, use the same test
as `org-agenda' does to determine whether the command is a series.

TINYCHANGE
This commit is contained in:
Aaron L. Zeng 2023-02-07 12:47:03 -05:00 committed by Ihor Radchenko
parent 5d548c34fa
commit 739ccf6cbf
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 7 additions and 3 deletions

View File

@ -3525,7 +3525,8 @@ This ensures the export commands can easily use it."
(let ((cmds (org-agenda-normalize-custom-commands org-agenda-custom-commands))
(pop-up-frames nil)
(dir default-directory)
cmd thiscmdkey thiscmdcmd match files opts cmd-or-set bufname)
cmd thiscmdkey thiscmdcmd match files opts cmd-or-set
seriesp bufname)
(save-window-excursion
(while cmds
(setq cmd (pop cmds)
@ -3537,9 +3538,12 @@ This ensures the export commands can easily use it."
(format "*Org Agenda(%s:%s)*" thiscmdkey match))
(format "*Org Agenda(%s)*" thiscmdkey))
org-agenda-buffer-name)
;; series: (0:key 1:desc 2:(cmd1 cmd2 ...) 3:general-settings 4:files)
;; non-series: (0:key 1:desc 2:type 3:match 4:settings 5:files)
cmd-or-set (nth 2 cmd)
opts (nth (if (listp cmd-or-set) 3 4) cmd)
files (nth (if (listp cmd-or-set) 4 5) cmd))
seriesp (not (or (symbolp cmd-or-set) (functionp cmd-or-set)))
opts (nth (if seriesp 3 4) cmd)
files (nth (if seriesp 4 5) cmd))
(if (stringp files) (setq files (list files)))
(when files
(let* ((opts (append org-agenda-exporter-settings opts))