GNU bug report logs -
#44733
Nested let bindings for non-local DEFVAR_PER_BUFFER variables unwind wrong
Previous Next
Reported by: Spencer Baugh <sbaugh <at> catern.com>
Date: Thu, 19 Nov 2020 03:12:02 UTC
Severity: normal
Fixed in version 28.1
Done: Stefan Kangas <stefan <at> marxist.se>
Bug is archived. No further changes may be made.
Full log
Message #20 received at 44733 <at> debbugs.gnu.org (full text, mbox):
>> 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.
That's the way all other variables behave:
(defvar-local sm-foo 1)
(let ((sm-foo 23))
(setq sm-foo 45)
(list sm-foo
(with-temp-buffer sm-foo)))
and I think it's asking for trouble if
(let ((sm-foo 23))
...)
behaves differently from
(let (sm-foo)
(setq sm-foo 23)
...)
> 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.)
Indeed the current behavior is clearly buggy. Historically, the
behavior of PER_BUFFER variables has been even more unlike that of
`make-variable-buffer-local` but over the years, I've made efforts to
make them behave the same. Clearly, I missed this spot.
Stefan
This bug report was last modified 3 years and 272 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.