From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 6Ck7AyWP4mMmwAAAbAwnHQ (envelope-from ) for ; Tue, 07 Feb 2023 18:49:25 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id CA0+AiWP4mPW6wAAG6o9tA (envelope-from ) for ; Tue, 07 Feb 2023 18:49:25 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B1E013D19F for ; Tue, 7 Feb 2023 18:49:24 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPS5L-0004iP-VO; Tue, 07 Feb 2023 12:48:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pPS58-0004e5-5D for emacs-orgmode@gnu.org; Tue, 07 Feb 2023 12:48:49 -0500 Received: from mail-qt1-f182.google.com ([209.85.160.182]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pPS56-0006Wz-BP for emacs-orgmode@gnu.org; Tue, 07 Feb 2023 12:48:37 -0500 Received: by mail-qt1-f182.google.com with SMTP id cr22so17616511qtb.10 for ; Tue, 07 Feb 2023 09:48:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qW9UV0cvA9vKqOIUYagoIoPF5+F2pLwi7sqS5NL2bjo=; b=lLwQ4G4Im+ZOoqRwNHoLBc8Mu1mnizpiXTaN4WB5po4VsyZb+R5cZ6yAw25xuAYsAu ++PDpdHnWczv37xiqrel2BUtO5WpQ9tTspZRYRpSk24ZQAUtbqie1xceHnmIax5HjU2y D498n8hhqY7lg+ItFja2z6CQp6y34jWqW1Z0lZJrkClqQrqBdW0OzIwY0JbcaWsdDfWu FiMmYBBSzYR0q4AZxXACa8Ye6dmhGfRwx/xvq6CU7V7psCqZhntcN0KeeqrbctJdT2UK byR49ce6twY5AcD4jyVNF23BBSaiTJf9B9m8cYsm8oMQRIlO9yTelo/nU2bIFW7sqgtd EE6A== X-Gm-Message-State: AO0yUKXNmY+JqBZERgDNSzBx5mtD86lwZQW1OQu7VrcPrwi+RhvTkn55 pcSFHZfeQuzeK4iKXpk/wbkbeuQ5w2I= X-Google-Smtp-Source: AK7set+ufs0vPW0xgmlT3tYZLnXTn1gaVKheOtR2K7XbfRjYws94gZG4jtrR99Abn5V15Jk+Lyiw/A== X-Received: by 2002:a05:622a:199b:b0:3b9:bd1f:1de6 with SMTP id u27-20020a05622a199b00b003b9bd1f1de6mr7080504qtc.40.1675792115190; Tue, 07 Feb 2023 09:48:35 -0800 (PST) Received: from mail-yw1-f170.google.com (mail-yw1-f170.google.com. [209.85.128.170]) by smtp.gmail.com with ESMTPSA id x14-20020ac84d4e000000b003b86a6449b8sm9752191qtv.85.2023.02.07.09.48.34 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Feb 2023 09:48:34 -0800 (PST) Received: by mail-yw1-f170.google.com with SMTP id 00721157ae682-526f0b3d8d9so139432967b3.3 for ; Tue, 07 Feb 2023 09:48:34 -0800 (PST) X-Received: by 2002:a81:6b8a:0:b0:524:3a4d:14b1 with SMTP id g132-20020a816b8a000000b005243a4d14b1mr408064ywc.174.1675792114502; Tue, 07 Feb 2023 09:48:34 -0800 (PST) MIME-Version: 1.0 References: <874jrxafok.fsf@localhost> <20230207174703.1960277-1-me@bcc32.com> In-Reply-To: <20230207174703.1960277-1-me@bcc32.com> From: Aaron Zeng Date: Tue, 7 Feb 2023 12:47:58 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] org--batch-store-agenda-views: Fix treatment of lambda functions To: emacs-orgmode@gnu.org, yantar92@posteo.net Content-Type: multipart/alternative; boundary="000000000000b3d61e05f41fc198" Received-SPF: pass client-ip=209.85.160.182; envelope-from=zeng.aaron.l@gmail.com; helo=mail-qt1-f182.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1675792164; a=rsa-sha256; cv=none; b=DII6dPRgwhfNL8ZHePxlhrJGCxJ/gKmlIEp868gInyXE+cjoYw+5EkvyM8NRiBv9fEXoO+ h4c3eI7LYj00LlVZlgzMv4IfD5Yqwtq2GLjZIHmNVVWWh1w+OgG5pvgoyK0ZJJOk8Y/JsC U0dkz/J3/xU/JRZSlFgDB8YmWNmau55lenl3WAqT8cpf0RXH/CwWvK9d2O6AHvO+UqwJUc u9Ej8IXR1AaaKT2bYrLRCUisRmXdl7eM0+FdSFUHyY3TBXrgnISjn9WupiFqgua8eQF6gR 4kbmP97Ue6NlWFPi+cBU48sH3Ozh/C0Dl6PVOsnodzwVii4vw3QqjG1yeaFcMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1675792164; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=qW9UV0cvA9vKqOIUYagoIoPF5+F2pLwi7sqS5NL2bjo=; b=M0KMfS2dPZ2BJHpttVinXhw1HPzthv2hRMAfzdwKKLF545we3zEV864MdjU5FXLseL5+Aw ZxmY8FO0DeFnQVdaU6IKTqN8QEx5yB9J7NSX41w0xAvwiiQFU5a42vB/tVJ5EKiyba5hCf U4kmRbuUcYf88MBXXem38jx9ZVdi7PBi97Yk4WxviAuccAQYj7JRoIm/nwAfqzLbRi70oJ hdDplmVzC80eY6D3v5IRWadeIRV6yXKAtpMoVcBM71J5Sw3YYFSS1kf7oQjKE98zg8mSQs 2GwPFDz51pPtlROVWFLLT/49N65utIK/Jz2IzN7snyXX0OcmVdt/QHPtaKfTTg== X-Migadu-Queue-Id: B1E013D19F X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=none X-Migadu-Spam-Score: -3.39 X-Spam-Score: -3.39 X-TUID: wRtJ7UuRakLy --000000000000b3d61e05f41fc198 Content-Type: text/plain; charset="UTF-8" Thanks Ihor, I sent a new patch with your comment included verbatim, and also added a ChangeLog entry. On Tue, Feb 7, 2023 at 12:47 PM Aaron L. Zeng wrote: > * 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. > --- > lisp/org-agenda.el | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el > index 1d1f2271b..49f93c338 100644 > --- a/lisp/org-agenda.el > +++ b/lisp/org-agenda.el > @@ -3525,10 +3525,13 @@ 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) > + ;; 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) > thiscmdkey (car cmd) > thiscmdcmd (cdr cmd) > match (nth 2 thiscmdcmd) > @@ -3538,8 +3541,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 > > --000000000000b3d61e05f41fc198 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks Ihor, I sent a new patch with your comment included= verbatim, and also added a ChangeLog entry.

On Tue, Feb 7, 2023 at 12:4= 7 PM Aaron L. Zeng <me@bcc32.com>= wrote:
* org-ag= enda.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'.=C2=A0 `org--batch-store-agenda-vi= ews'
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.=C2=A0 Instead, use the same test<= br> as `org-agenda' does to determine whether the command is a series.
---
=C2=A0lisp/org-agenda.el | 10 +++++++---
=C2=A01 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 1d1f2271b..49f93c338 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -3525,10 +3525,13 @@ This ensures the export commands can easily use it.= "
=C2=A0 =C2=A0(let ((cmds (org-agenda-normalize-custom-commands org-agenda-c= ustom-commands))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(pop-up-frames nil)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(dir default-directory)
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 cmd thiscmdkey thiscmdcmd match files opts cmd= -or-set bufname)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 cmd thiscmdkey thiscmdcmd match files opts cmd= -or-set
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 seriesp bufname)
=C2=A0 =C2=A0 =C2=A0(save-window-excursion
=C2=A0 =C2=A0 =C2=A0 =C2=A0(while cmds
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq cmd (pop cmds)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; series:=C2=A0 =C2=A0 = =C2=A0(0:key 1:desc 2:(cmd1 cmd2 ...) 3:general-settings 4:files)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; non-series: (0:key 1:d= esc 2:type 3:match=C2=A0 =C2=A0 4:settings=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A05:files)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 thiscmdkey (car cmd)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 thiscmdcmd (cdr cmd)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 match (nth 2 thiscmdcmd) @@ -3538,8 +3541,9 @@ This ensures the export commands can easily use it.&q= uot;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (format "*Org Agenda(%s)*" thiscm= dkey))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 org-agenda-buffer-name)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cmd-or-set (nth 2 cmd)
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0opts (nth (if (listp cmd-o= r-set) 3 4) cmd)
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0files (nth (if (listp cmd-= or-set) 4 5) cmd))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0seriesp (not (or (symbolp = cmd-or-set) (functionp cmd-or-set)))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0opts (nth (if seriesp 3 4)= cmd)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0files (nth (if seriesp 4 5= ) cmd))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (stringp files) (setq files (list files)))<= br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 (when files
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (let* ((opts (append org-agenda-exporter= -settings opts))
--
2.38.1

--000000000000b3d61e05f41fc198--