emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using lexical-binding


From: Samuel Wales
Subject: Re: Using lexical-binding
Date: Tue, 23 Feb 2021 21:01:55 -0700

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 via email to

[Prev in Thread] Current Thread [Next in Thread]