[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#39373: 27.0.50; [PATCH] mode-local-print-bindings broken with lexica
bug#39373: 27.0.50; [PATCH] mode-local-print-bindings broken with lexical-binding
Sat, 1 Feb 2020 22:40:16 +0100
1 feb. 2020 kl. 21.15 skrev Stefan Monnier <address@hidden>:
> 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.
Thanks, pushed to emacs-27.