From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id aI9aO77LNWB6EwAA0tVLHw (envelope-from ) for ; Wed, 24 Feb 2021 03:45:02 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id uBGvNr7LNWCGGwAAB5/wlQ (envelope-from ) for ; Wed, 24 Feb 2021 03:45:02 +0000 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 C4FC21D343 for ; Wed, 24 Feb 2021 04:45:01 +0100 (CET) Received: from localhost ([::1]:59222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lEl6i-0000Ah-0L for larch@yhetil.org; Tue, 23 Feb 2021 22:45:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42096) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lEl6M-0000AZ-R6 for emacs-orgmode@gnu.org; Tue, 23 Feb 2021 22:44:38 -0500 Received: from out1.migadu.com ([2001:41d0:2:863f::]:34435) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lEl6J-0006pL-6E for emacs-orgmode@gnu.org; Tue, 23 Feb 2021 22:44:38 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1614138271; h=from:from: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; bh=qk9CKGIGdY49u3vGLmUNw/R01vuIu5vfp5claFOW1lo=; b=F0bPWL3FBntqC/2I0/FaBzgVO0VUkscyKq0OzKlVZopekfIUYhCKBZw0wRGzUFOAvDuZaW JTfb56VpQaHhynNneKsJN9fsVPk3vYRXwJrA7p7fDdqTaIRRxOfrScYNlgu6ejtsRHJu0N zxvZsCIl5HwTF4ryObbys+f5QrPi68kxS5SGCC2UJlXhFfXEjcN/C3ezkd2vO3jIaIGc1u lpw5ug+88OLkGFoNBp31dqLlxiwnin+a6HYwgzRn9pXgVrQ7Ggvka8FPRrSN9pyxJb58bc a/YT0jjIhDUoTfH+k3XIsb7Hi3r1SoY4l9ykc6qI7D6H/GDTkGpTKbdTeNB+1g== From: Kyle Meyer To: Stefan Monnier Subject: Re: Using lexical-binding In-Reply-To: <87k0qywbtb.fsf@kyleam.com> References: <87k0qywbtb.fsf@kyleam.com> Date: Tue, 23 Feb 2021 22:44:24 -0500 Message-ID: <87ft1mw2nb.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Auth-User: kyle@kyleam.com Received-SPF: pass client-ip=2001:41d0:2:863f::; envelope-from=kyle@kyleam.com; helo=out1.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -1.07 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=kyleam.com header.s=key1 header.b=F0bPWL3F; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: C4FC21D343 X-Spam-Score: -1.07 X-Migadu-Scanner: scn0.migadu.com X-TUID: +YqoXAL8Gids Kyle Meyer writes: > Stefan Monnier writes: [...] > ;; (org-agenda-list) ; fails: void-variable date > > There are also some `make test' failures: > > 7 unexpected results: > FAILED test-org-agenda/diary-inclusion > FAILED test-org-agenda/empty > FAILED test-org-agenda/one-line > FAILED test-org-agenda/scheduled-non-todo > FAILED test-org-agenda/set-priority > FAILED test-org-agenda/sticky-agenda-name > FAILED test-org-agenda/sticky-agenda-name-after-reload > >> or "pretends everything is fine but doesn't do the right thing any >> more", or (even better) actual feedback about the code itself and the >> approach(es) I chose to use. > > While I'm not sure I can provide any useful feedback about approaches, > I'll see if I can tweak your patch to resolve the org-agenda-list > failure or any of the above test failures. With the changes below on top of your patch, the simple org-agenda-list call from above works and the test failures are gone. diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 16ec70c77..81409d6ac 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -5448,27 +5448,29 @@ (defun org-agenda-get-day-entries (file date &rest args) (setf args (cons :deadline* (delq :deadline* args))))) ;; Collect list of headlines. Return them flattened. (let ((case-fold-search nil) results deadlines) - (dolist (arg args (apply #'nconc (nreverse results))) - (pcase arg - ((and :todo (guard (org-agenda-today-p date))) - (push (org-agenda-get-todos) results)) - (:timestamp - (push (org-agenda-get-blocks) results) - (push (org-agenda-get-timestamps deadlines) results)) - (:sexp - (push (org-agenda-get-sexps) results)) - (:scheduled - (push (org-agenda-get-scheduled deadlines) results)) - (:scheduled* - (push (org-agenda-get-scheduled deadlines t) results)) - (:closed - (push (org-agenda-get-progress) results)) - (:deadline - (setf deadlines (org-agenda-get-deadlines)) - (push deadlines results)) - (:deadline* - (setf deadlines (org-agenda-get-deadlines t)) - (push deadlines results))))))))))) + (org-dlet + ((date date)) + (dolist (arg args (apply #'nconc (nreverse results))) + (pcase arg + ((and :todo (guard (org-agenda-today-p date))) + (push (org-agenda-get-todos) results)) + (:timestamp + (push (org-agenda-get-blocks) results) + (push (org-agenda-get-timestamps deadlines) results)) + (:sexp + (push (org-agenda-get-sexps) results)) + (:scheduled + (push (org-agenda-get-scheduled deadlines) results)) + (:scheduled* + (push (org-agenda-get-scheduled deadlines t) results)) + (:closed + (push (org-agenda-get-progress) results)) + (:deadline + (setf deadlines (org-agenda-get-deadlines)) + (push deadlines results)) + (:deadline* + (setf deadlines (org-agenda-get-deadlines t)) + (push deadlines results)))))))))))) (defsubst org-em (x y list) "Is X or Y a member of LIST?" @@ -6710,6 +6712,7 @@ (defun org-agenda-format-item (extra txt &optional level category tags dotime (get-text-property 1 'effort txt))) (tag (if tags (nth (1- (length tags)) tags) "")) (time-grid-trailing-characters (nth 2 org-agenda-time-grid)) + (extra (or (and (not habitp) extra) "")) time (ts (when dotime (concat (if (stringp dotime) dotime "") @@ -6793,7 +6796,6 @@ (defun org-agenda-format-item (extra txt &optional level category tags dotime (concat time-grid-trailing-characters " ") time-grid-trailing-characters))) (t "")) - extra (or (and (not habitp) extra) "") category (if (symbolp category) (symbol-name category) category) level (or level "")) (if (string-match org-link-bracket-re category)