From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id EFUCL+6O4mPgygAAbAwnHQ (envelope-from ) for ; Tue, 07 Feb 2023 18:48:30 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id sJT6Lu6O4mNXmQAA9RJhRA (envelope-from ) for ; Tue, 07 Feb 2023 18:48:30 +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 75F0695E4 for ; Tue, 7 Feb 2023 18:48:30 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPS47-0003Zg-Ng; Tue, 07 Feb 2023 12:47:35 -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 1pPS3r-0003YQ-O6 for emacs-orgmode@gnu.org; Tue, 07 Feb 2023 12:47:19 -0500 Received: from mail-qv1-f53.google.com ([209.85.219.53]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pPS3q-0006NO-A1 for emacs-orgmode@gnu.org; Tue, 07 Feb 2023 12:47:19 -0500 Received: by mail-qv1-f53.google.com with SMTP id e6so7474481qvp.1 for ; Tue, 07 Feb 2023 09:47:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n6vs+oafIvw+DCpqII23ryUkjMPG6QjkORZ79ZIHUeQ=; b=Lhw1k0w6NE6hk7hUY/pciy9uezKzr5yge3D9q1xhUORks1fgKMaQhzrvMviLZKM/NG 9sj7XikggxEMfly2HN8k3iD7ufiDYEUk7mWzvGsEsgtn23mCZWjmUUm94MqBk1rjH2px FTJhObWMpCrt4rzGMV45Zi16FKF3V1FKEcMF1PUM4onyKwtQsWhRrml+KNRiodP21a4K vp1tL2NWhCniwiKUZiJfd7eiuNt+bNGVnvoOS8ROKSCHQgWQuS6LQWwhVv8N5j1j7dzS D091AJm1FZvMGSMcqtR8Nkg39Ue4iBQtIz5LwRvxBwcz3M9bpcEH10EP+aRq+4W+DjEW 1+Sg== X-Gm-Message-State: AO0yUKXkMFfPn/bBsl7+8fRN5xnx7c4fpZpS+ldK71ia5yTWmfti6utp Bzs1JLKj073ZE2txTN3HuqP5X4nKA0s= X-Google-Smtp-Source: AK7set9w9OkvkL7ql67EpC4siKD7AwJmTwFj5HLPAYPMgztB84BMheAk1StSj4316Xl+a95eHmeyvw== X-Received: by 2002:ad4:5966:0:b0:56b:f48d:fa42 with SMTP id eq6-20020ad45966000000b0056bf48dfa42mr4579368qvb.30.1675792036684; Tue, 07 Feb 2023 09:47:16 -0800 (PST) Received: from localhost.localdomain (pool-98-113-163-150.nycmny.fios.verizon.net. [98.113.163.150]) by smtp.gmail.com with ESMTPSA id bj5-20020a05620a190500b00733ab1b8045sm4098253qkb.106.2023.02.07.09.47.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Feb 2023 09:47:16 -0800 (PST) From: "Aaron L. Zeng" To: emacs-orgmode@gnu.org, yantar92@posteo.net Cc: "Aaron L. Zeng" Subject: [PATCH] org--batch-store-agenda-views: Fix treatment of lambda functions Date: Tue, 7 Feb 2023 12:47:03 -0500 Message-Id: <20230207174703.1960277-1-me@bcc32.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <874jrxafok.fsf@localhost> References: <874jrxafok.fsf@localhost> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=209.85.219.53; envelope-from=zeng.aaron.l@gmail.com; helo=mail-qv1-f53.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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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=1675792110; a=rsa-sha256; cv=none; b=PiE5EOeiEQ8/oCV1FL4R0k8eNmKwbhxuJOmxx+EHP4TqUCuW16utYgH8HXoVwkYE1imbPq /Hrxy85XB/Tld27AmK2xld934RViCU42zQWr/zDf59Z3PhIRPdH5soSsv43fvRsoXLogpx f++iPRkjKh/9pgZvoVs5RkD1vZF+ufMUHs6XgI15TYtsW8snQrfO3PrCWbyqgE5fxRUZj2 lMWGaNeOsp8o3ywQlh9ufKbivSEIWpmA6F+2T/dXq7Ec04oK8rqz6Dgi4LdoBWQo3a6CwJ xD6gVFHershMOZqBAfKbWjTk38KTrZNrLIHWhHHG/YUZes1ELRt9R2nsXLX43w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1675792110; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=n6vs+oafIvw+DCpqII23ryUkjMPG6QjkORZ79ZIHUeQ=; b=iVZywWnyFQfU3DY5UOT0Uz9rSirT+Vt29kTXKGeyRZeDiFsRYumoQbz8eHmg6KtNJB7uLe O7cVwkmz/XfkCJv/0ip5WcjKxTZAR1IaTWNGRmFu11BuZtOd3+lWGDLKlnmRHnk/iC+8KG zFeOF24UpXDSMCQXYLRGrogEK2AdmNKM13CxQKNwJQrvaNtUSS7i77ScBLGmT7dyXLR0hs fzswg11XRtPoATopb4a8XpkvgbsP5sjd/ocdKnkb8cboW9FT4MdqL/oR6LMdN9CrS2F15l 5d1882pJ9qhXOGjfbr3yKhFms8jtK5wFsXlIjBlx6ekuGdbkjlC2JMrdy53hBQ== X-Migadu-Queue-Id: 75F0695E4 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: -1.89 X-Spam-Score: -1.89 X-TUID: DMknkKgGcU9Y * 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