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

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

bug#65209: 30.0.50; Unexpected behaviour of setq-local


From: Michael Heerdegen
Subject: bug#65209: 30.0.50; Unexpected behaviour of setq-local
Date: Wed, 23 Aug 2023 05:47:18 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

> IOW, it is impossible for me to judge whether some text is good enough
> for the manual without seeing the proposed text.  IME, some very
> complicated issues are better left unsaid, especially if they
> sufficiently rare and obscure, to avoid making the more common
> scenarios potentially less clear.

True, I know what you mean.  OTOH, a good understanding of the underlying
language (Elisp) makes the number of things that seem confusing or
obscure smaller.

Ok - I'm not good at writing documentation.  As a start, do you think
that it's possible to create a good addition to the manual out of this
stub?


| The following example demonstrates which binding is "seen" when
| let-binding and buffer-local variables are combined:
|
| (defvar var :default)
|
| (with-temp-buffer
|   (let ((var :let-bound))
|     var                            ; --> :let-bound
|     (setq-local var :buffer-local)
|     var                            ; --> :buffer-local
|     (with-temp-buffer var))        ; --> :let-bound
|   var                              ; --> :buffer-local
|   (with-temp-buffer var))          ; --> :default
|
|
| A lexical variable always refers to its lexical binding even when
| a buffer-local variable of the same name exists:
|
| (let ((lvar :lexical))
|   (setq-local lvar :local)
|   lvar                           ; --> :lexical
|   (symbol-value 'lvar))          ; --> :local


I would not suggest such an addition if I would not have missed that
kind of information in the manual.  In some situations the above stuff
gets important, and let-binding variables that are made buffer-local is
daily business.  Maybe this stuff is clear to people with a different
background - I don't know.


Michael.





reply via email to

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