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 gJfQCBl142PrwQAAbAwnHQ (envelope-from ) for ; Wed, 08 Feb 2023 11:10:33 +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 ILIBBBl142NtJwAAG6o9tA (envelope-from ) for ; Wed, 08 Feb 2023 11:10:33 +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 11EC7156D7 for ; Wed, 8 Feb 2023 11:10:30 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPhOd-0001l8-2x; Wed, 08 Feb 2023 05:09:47 -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 1pPhOa-0001kk-Dk for emacs-orgmode@gnu.org; Wed, 08 Feb 2023 05:09:44 -0500 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pPhOW-0003Y7-Ao for emacs-orgmode@gnu.org; Wed, 08 Feb 2023 05:09:43 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 7B4CC24002D for ; Wed, 8 Feb 2023 11:09:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1675850974; bh=xOELXyx/FYW49dCZBI1+ZXt6004x1wBgzad7/7VyDpM=; h=From:To:Cc:Subject:Date:From; b=Cl/gLLSLs2bt/3oFdYmzm2GYQrM3avESQWYzs5IUbUNqAz9J09IXPhgZJO+MtXmmE dtDq4qxu6M1MFp6R73q8irUkC7D++nU/zbKGhQi1Sn6BLlQa0XgMJ/YEWVbZUH1ZtA dAf0ZrWEv8eo9ElMZ1lt5E2CYdqzdzf0u4dEa5JIAleMzWPPKKq7TrE7hxvl43LNr5 bC6Qec4dJ3NoNCFroSY5B88Gi8zAs+SzeiUGQX47sI8EF5Q9cVM6niLxL5KFEMJz9D 3nUypLYzQACpWA0e6dy/qHQzjvSoEBag5IbgyLaf0hr3LSCd45fG9aJRIzTxpk/64H iwhm/4oxm/brg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PBbMJ4hJRz9rxP; Wed, 8 Feb 2023 11:09:32 +0100 (CET) From: Ihor Radchenko To: "Aaron L. Zeng" Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] org--batch-store-agenda-views: Fix treatment of lambda functions In-Reply-To: <20230207174703.1960277-1-me@bcc32.com> References: <874jrxafok.fsf@localhost> <20230207174703.1960277-1-me@bcc32.com> Date: Wed, 08 Feb 2023 10:10:08 +0000 Message-ID: <87cz6keadb.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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-Flow: FLOW_IN X-Migadu-Country: US ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="Cl/gLLSL"; 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=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1675851031; a=rsa-sha256; cv=none; b=bwXGw7zZSwsqsAaTW29+nhTCAq2K7Ach13DCiBYXM5CHFOS8lDOk0my1wVX3BP5vc6/8DM W99Dh2GlAg236wM0Ivn3GGmolnkTYf5R1dCoqBwtXP3TJP6cE2+VUg5o37cHWmzDJhI6OI U8sFm8xfWH7SGjvAv4ZJIRte4+us9CvnjAEFuw3s7Nqcspk8E1/WLer2afMAxnehvteV9d g+A7eLLdRVZwmnLQPdPyPQLdQq3Ot/WKz+o00oth1ZEM674Z/7rSwI7yjxtx2RTa0+R5i7 Irch1KICNbvrCBLNoejOLSoQRsrMprdfuk5KeLRJAQqrBfO6c3UUgW8upXo8kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1675851031; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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:dkim-signature; bh=aaUgyVN9dyX7Wi/RCjcYli07DQ1Z8bAyLl4oyR6t8zI=; b=kDtpi2p0fmbCFreebjG+VJfcyEuCNdHgvuCgRqSrFks6EoBK5MEv5mZ/sJV9iEn1wHrNMq Jx3vyH5ypAJULnu+PYNndTp5P6Nl1DtG5bsJzrw0WZf9RspDDR7IsMuJF4Mry+SD5QpP12 5IQHJhWvnBhHI93Z+2SOCHV1iwzOjmPqeMdwazJLeJSZZOvF+TdUHqRQA4sjNiKgLFxHE6 SguLTb5d0jaWA7R0qaO7sSP7tNy/wYrKma3+7CYmYyvbgdT24baxoKdXTGSmUAq1EXqJ0H nBHX1YWKxCZBhK9K8UBuJCHe88qN8oYvIaJBnExvJtfiibuRoInlZcRWsqqccg== X-Migadu-Spam-Score: -6.06 X-Spam-Score: -6.06 X-Migadu-Queue-Id: 11EC7156D7 X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="Cl/gLLSL"; 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=pass (policy=none) header.from=posteo.net X-TUID: Z+V9gbkq0Dtr --=-=-= Content-Type: text/plain "Aaron L. Zeng" writes: > * 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. Thanks for the updated patch! I am attaching amended version with the comment placed closer to where the custom command list is being used. I also added TINYCHANGE cookie because you are not listed as a contributor with FSF copyright assignment. Let me know if you have any objections. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=v2-0001-org-batch-store-agenda-views-Fix-treatment-of-lam.patch >From 4f4693a5dd85e09737ecb27a68b04c7f8af014ad Mon Sep 17 00:00:00 2001 Message-Id: <4f4693a5dd85e09737ecb27a68b04c7f8af014ad.1675850882.git.yantar92@posteo.net> From: "Aaron L. Zeng" Date: Tue, 7 Feb 2023 12:47:03 -0500 Subject: [PATCH v2] 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 --- 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..127503af0 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -3525,7 +3525,8 @@ (defun org--batch-store-agenda-views (vars vals) (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 @@ (defun org--batch-store-agenda-views (vars vals) (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)) -- 2.39.1 --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--