emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Samuel Wales <samologist@gmail.com>
To: Kyle Meyer <kyle@kyleam.com>
Cc: emacs-orgmode@gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: Using lexical-binding
Date: Tue, 23 Feb 2021 21:01:55 -0700	[thread overview]
Message-ID: <CAJcAo8vPaYSGUewpNNEdHKCfYSTUbY-jQ2SayGPqXbR6gv7idQ@mail.gmail.com> (raw)
In-Reply-To: <87ft1mw2nb.fsf@kyleam.com>

just a thanks to maintainers of emacs and org including those of you
fixing this and those who wrote the tests.  i had no idea org wasn't
fully lexical yet.  i look forward to whatever good that brings.


On 2/23/21, Kyle Meyer <kyle@kyleam.com> wrote:
> 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)
>
>


-- 
The Kafka Pandemic

Please learn what misopathy is.
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html


  reply	other threads:[~2021-02-24  4:02 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-23 21:11 Using lexical-binding Stefan Monnier
2021-02-24  0:26 ` Kyle Meyer
2021-02-24  3:44   ` Kyle Meyer
2021-02-24  4:01     ` Samuel Wales [this message]
2021-02-24  4:33   ` Stefan Monnier
2021-02-25  5:42     ` Kyle Meyer
2021-02-25  5:41 ` Kyle Meyer
2021-03-04  6:03   ` Kyle Meyer
2021-03-04  9:11     ` Marco Wahl
2021-03-06 16:10     ` Stefan Monnier
2021-03-06 17:08       ` Kyle Meyer
2021-03-06 22:33         ` Stefan Monnier
2021-03-09  5:35           ` Kyle Meyer
2021-03-09 14:09             ` Stefan Monnier
2021-03-10  4:16               ` Kyle Meyer
2021-03-10 16:32                 ` Stefan Monnier
2021-03-19 16:23                 ` Greg Minshall
2021-03-20  3:34                   ` Greg Minshall
2021-03-20  4:48                   ` Kyle Meyer
2021-03-20  5:33                     ` Greg Minshall
2021-03-21 16:04                       ` Kyle Meyer
2021-03-21 17:14                         ` Greg Minshall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJcAo8vPaYSGUewpNNEdHKCfYSTUbY-jQ2SayGPqXbR6gv7idQ@mail.gmail.com \
    --to=samologist@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=kyle@kyleam.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).