[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#44733: Nested let bindings for non-local DEFVAR_PER_BUFFER variables
bug#44733: Nested let bindings for non-local DEFVAR_PER_BUFFER variables unwind wrong
Thu, 19 Nov 2020 14:21:16 -0500
Stefan Monnier <firstname.lastname@example.org> writes:
>>> (let ((left-margin 1))
>>> ;; Set this variable "pseudo-locally", inside a SPECPDL_LET_DEFAULT
>>> (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
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.)
bug#44733: Nested let bindings for non-local DEFVAR_PER_BUFFER variables unwind wrong, Stefan Monnier, 2020/11/19