emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Using lexical-binding


From: Stefan Monnier
Subject: Re: Using lexical-binding
Date: Tue, 09 Mar 2021 09:09:30 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hi Kyle,

>> Subject: [PATCH] * lisp/org-agenda.el: Use lexical-binding
> [...]
>> +            (pcase type
>> +              ('agenda
>> +               (org-agenda-list current-prefix-arg))
>
> Unfortunately Org's minimum Emacs version is still Emacs 24.3.

Sorry 'bout that.  I keep forgetting about this detail of `pcase` past.
Any chance you could put this in the `Package-Requires:`?

>> +  (let* ((gprops (nth 1 series))
>> +         (gvars (mapcar #'car gprops))
>> +         (gvals (mapcar (lambda (binding) (eval (cadr binding) t)) gprops)))
>> +    (cl-progv gvars gvals (org-agenda-prepare name))
>> +    ;; We need to reset agenda markers here, because when constructing a
>> +    ;; block agenda, the individual blocks do not do that.
>> +    (org-agenda-reset-markers)
>> +    (with-suppressed-warnings ((lexical match))
>
> ... I believe with-suppressed-warnings isn't available until Emacs 27.1,
> right?

Ooh, right, and that is not just a little detail, I very much know
about that.  I don't have any excuse for this one (it's just
a careless copy&paste).

> Any objections to me squashing the below changes into your patch?

Of course not.

> +(if (fboundp 'with-suppressed-warnings)  ; Introduced in Emacs 27.1.
> +    (defalias 'org-with-suppressed-warnings 'with-suppressed-warnings)
> +  (defmacro org-with-suppressed-warnings (_warnings &rest body)
> +    (declare (debug (sexp &optional body)) (indent 1))
> +    `(progn ,@body)))

Note that all the uses I introduced of `with-suppressed-warnings` only
wrap a very small amount of code, so you could also replace them with
`with-no-warnings` (added back in Emacs-22).


        Stefan




reply via email to

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