bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#44733: Nested let bindings for non-local DEFVAR_PER_BUFFER variables


From: Spencer Baugh
Subject: bug#44733: Nested let bindings for non-local DEFVAR_PER_BUFFER variables unwind wrong
Date: Thu, 19 Nov 2020 14:21:16 -0500

Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> (let ((left-margin 1))
>>>   ;; Set this variable "pseudo-locally", inside a SPECPDL_LET_DEFAULT 
>>> binding.
>>>   (setq left-margin 123)
>>>   (assert (eq left-margin 123))
>>>   ;; Note, it's not a local variable.
>>>   (assert (not (local-variable-p 'left-margin)))
>>>   ;; The default value doesn't change.
>>>   (assert (eq (default-value 'left-margin) 1))
>
> This is a bug, indeed.  It should be 123 at this point.

That's one perspective, but it seems less consistent with the
documentation and with expected behavior.  The documentation for these
variables says:

  Automatically becomes buffer-local when set.

and here, we are setting it, with setq.  It would seem that it should
become buffer-local, then.  Indeed, that's the current behavior, that it
becomes "pseudo-buffer-local", in that the value is different in this
buffer from every other buffer.  (But local-variable-p returns nil,
which is the only indication that something weird is going on.)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]