Subject: bug#40975: 28.0.50; Variable gets buffer-local unexpectedly

From: Michael Heerdegen <[email-masked]>
Date: Thu, 30 Apr 2020 04:26:16 +0200

Hello,

here is a reproducer:

#+begin_src emacs-lisp
(defun test ()
  (make-local-variable 'my-test-var)
  (with-current-buffer (get-buffer-create "Testbuffer")
    (setq my-test-var 27)))
#+end_src

If you eval M-: (test) e.g. in emacs -Q and inspect the binding of
`my-test-var' in "Testbuffer" and the other buffers, you'll see that the
variable has become buffer local in "Testbuffer" though it has never
been made local there.  This is the bug.

Maybe there is a problem in this case because the `setq' setting is in
the same lexical scope as the `make-local-variable' call?

TIA,

Michael.

In GNU Emacs 28.0.50 (build 57, x86_64-pc-linux-gnu, GTK+ Version 3.24.18, cairo version 1.16.0)
 of 2020-04-29 built on drachen
Repository revision: fe9be663833db1bf99f38c981378255f88ff5d06
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: Debian GNU/Linux bullseye/sid