Subject: Re: bug#39373: 27.0.50; [PATCH] mode-local-print-bindings broken with lexical-binding

From: Eli Zaretskii <[email-masked]>
Date: Sat, 01 Feb 2020 09:48:19 +0200

> From: Mattias Engdegård <[email-masked]>
> Date: Fri, 31 Jan 2020 21:51:48 +0100
> Cc: [email-masked]
> 
> 'add-to-list' doesn't work on lexical variables because it's a plain
> function taking the variable symbol as argument. 'push' works on
> lexical variables since it is a macro that expands to direct
> variable reference and setq.

If that's the case, then why don't we say that loud and clear in the
ELisp manual?  (The doc string of add-to-list has some vague
recommendation, not sure if it really talks about this aspect, but
that's definitely not enough for such a serious issue.)

And doesn't it mean we should audit all the gazillion uses of
add-to-list in our sources, and do that urgently?

> I should perhaps have included this in the commit message.

That would have definitely helped, thanks.

> We could sink the pushes to the leaves of the condition tree, if you prefer:

No, your original patch is fine, but please let's update the docs
ASAP.

Thanks.