all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] org--batch-store-agenda-views: Fix treatment of lambda functions
@ 2023-02-07  1:05 Aaron L. Zeng
  2023-02-07 11:16 ` Ihor Radchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Aaron L. Zeng @ 2023-02-07  1:05 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Aaron L. Zeng

`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.

This patch makes `org--batch-store-agenda-views' use the same test as
`org-agenda' does to determine whether the command is a series.
---
 lisp/org-agenda.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 1d1f2271b..1aab64820 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -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)
@@ -3538,8 +3539,9 @@ This ensures the export commands can easily use it."
 			      (format "*Org Agenda(%s)*" thiscmdkey))
 			org-agenda-buffer-name)
 	      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))
-- 
2.38.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-02-09 10:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-07  1:05 [PATCH] org--batch-store-agenda-views: Fix treatment of lambda functions Aaron L. Zeng
2023-02-07 11:16 ` Ihor Radchenko
2023-02-07 17:47   ` Aaron L. Zeng
2023-02-07 17:47     ` Aaron Zeng
2023-02-08 10:10     ` Ihor Radchenko
2023-02-08 15:46       ` Aaron Zeng
2023-02-09 10:01         ` Ihor Radchenko

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.