From: Spencer Baugh <sbaugh@catern.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 44733@debbugs.gnu.org
Subject: bug#44733: Nested let bindings for non-local DEFVAR_PER_BUFFER variables unwind wrong
Date: Thu, 19 Nov 2020 15:56:54 -0500 [thread overview]
Message-ID: <87tutljca1.fsf@catern.com> (raw)
In-Reply-To: <jwvh7pl5cff.fsf-monnier+emacs@gnu.org>
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> 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)))
Aha, okay, I certainly can't argue with that. DEFVAR_PER_BUFFER
variables should match that behavior. I'll update my patch series to
match.
> and I think it's asking for trouble if
>
> (let ((sm-foo 23))
> ...)
>
> behaves differently from
>
> (let (sm-foo)
> (setq sm-foo 23)
> ...)
Ah, this example is persuasive to me.
I see also that there is at least some documentation of this behavior,
in the make-variable-buffer-local documentation in variables.texi, which
I missed:
A peculiar wrinkle of this feature is that binding the variable (with
@code{let} or other binding constructs) does not create a buffer-local
binding for it. Only setting the variable (with @code{set} or
@code{setq}), while the variable does not have a @code{let}-style
binding that was made in the current buffer, does so.
next prev parent reply other threads:[~2020-11-19 20:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-19 3:11 bug#44733: Nested let bindings for non-local DEFVAR_PER_BUFFER variables unwind wrong Spencer Baugh
2020-11-19 14:10 ` Eli Zaretskii
2020-11-19 14:22 ` Spencer Baugh
2020-11-19 18:17 ` Stefan Monnier
2020-11-19 19:21 ` Spencer Baugh
2020-11-19 20:23 ` Stefan Monnier
2020-11-19 20:56 ` Spencer Baugh [this message]
2020-11-19 22:14 ` Stefan Monnier
2021-10-23 10:19 ` Stefan Kangas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tutljca1.fsf@catern.com \
--to=sbaugh@catern.com \
--cc=44733@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.