emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Kyle Meyer <kyle@kyleam.com>
Cc: Marco Wahl <marcowahlsoft@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: Using lexical-binding
Date: Tue, 09 Mar 2021 09:09:30 -0500	[thread overview]
Message-ID: <jwvv9a01l1o.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <8735x4c2k5.fsf@kyleam.com> (Kyle Meyer's message of "Tue, 09 Mar 2021 00:35:06 -0500")

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	other threads:[~2021-03-09 14:11 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
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 [this message]
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=jwvv9a01l1o.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-orgmode@gnu.org \
    --cc=kyle@kyleam.com \
    --cc=marcowahlsoft@gmail.com \
    /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).