GNU bug report logs - #39373
27.0.50; [PATCH] mode-local-print-bindings broken with lexical-binding

Previous Next

Package: emacs;

Reported by: Mattias EngdegÄrd <mattiase <at> acm.org>

Date: Fri, 31 Jan 2020 17:41:03 UTC

Severity: normal

Found in version 27.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Mattias EngdegÄrd <mattiase <at> acm.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 39373 <at> debbugs.gnu.org
Subject: bug#39373: 27.0.50; [PATCH] mode-local-print-bindings broken with lexical-binding
Date: Sat, 1 Feb 2020 22:40:16 +0100
1 feb. 2020 kl. 21.15 skrev Stefan Monnier <monnier <at> iro.umontreal.ca>:

> Compiler macros work when the code passes through `macroexpand-all`, so
> it works when the code is compiled as well as when it's `load`ed (thanks
> to "eager" macroexpansion), but not when it's passed directly to `eval`.

Understood, thank you. (Obviously they aren't expanded when the function is called indirectly, but I didn't find anyone doing that with add-to-list.)

> The message is supposed not to trigger when it's applied to dynamically
> scoped var, but it's probably not 100% reliable.

It appears that the warning triggers (as a hard error, actually) when add-to-list is called directly from a function, but not if it only occurs inside a lambda. All the cases found were inside lambdas (or they would have been fixed long ago).

> BTW, this problem doesn't affect only `add-to-list`.  Other culprits
> include `add-hook`, `run-hooks`, `set`, and `symbol-value`.

Right. I see that some of them are detected by the compiler (in byte-compile-form), but add-to-list is commented out.

The set of functions is a bit open-ended; there is also add-to-ordered-list, add-to-history, etc. Not sure how much text needs to be added for all these. There is a general note about lexical variables and symbol values in the manual, in the section about lexical binding.

> LGTM,

Thanks, pushed to emacs-27.





This bug report was last modified 4 years and 282 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.