bug#81564: Possible bug when binding dynamically with an existing lexical binding

Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email protected]> Thu, 06 Aug 2026 15:38:20 -0400
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
> The code
>
>   (let ((x 2)) (defvar x) (let ((x 10)) x))
>
> returns 2, which seems extremely unintuitive to me, if not an
> outright bug.

Agreed.  I don't think the behavior is terribly problematic because
I think such code is undesirable in the first place, but the compiler
should emit a warning about it, so the user knows there's
something fishy.


=== Stefan