GNU bug report logs -
#5371
Priority of different kind of local variable bindings
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 5371 in the body.
You can then email your comments to 5371 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#5371
; Package
emacs
.
(Wed, 13 Jan 2010 09:21:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Lennart Borgman <lennart.borgman <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 13 Jan 2010 09:21:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
I can't find a description in the manual of the priority of different
kind of local variables. Can that please be added to the manual?
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#5371
; Package
emacs
.
(Wed, 13 Jan 2010 14:42:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 5371 <at> debbugs.gnu.org (full text, mbox):
> I can't find a description in the manual of the priority of different
> kind of local variables. Can that please be added to the manual?
What do you mean by "priority of different kind of local variables"?
Stefan
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#5371
; Package
emacs
.
(Wed, 13 Jan 2010 15:51:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 5371 <at> debbugs.gnu.org (full text, mbox):
On Wed, Jan 13, 2010 at 3:41 PM, Stefan Monnier
<monnier <at> iro.umontreal.ca> wrote:
>> I can't find a description in the manual of the priority of different
>> kind of local variables. Can that please be added to the manual?
>
> What do you mean by "priority of different kind of local variables"?
I just meant which value is active at a certain point.
I saw a strange thing working with mumamo and the js.el problem, but I
have not understod yet. I have kind of solved it, but I don't know
why. Here is some code that perhaps is related. Look at the value at
"ff". Is not that a bit surprising?
(defun temp-var-display (where)
(message "%s temp-var: u=%s, b=%s d=%s" where
temp-var
(buffer-local-value 'temp-var (current-buffer))
(default-value 'temp-var)))
(defvar temp-var "global")
(set (make-local-variable 'temp-var) "buffer-1")
(temp-var-display "bb")
(with-temp-buffer
(set (make-local-variable 'temp-var) "buffer-2")
(temp-var-display "cc")
(let ((temp-var "let"))
(temp-var-display "dd")
(kill-local-variable 'temp-var)
(temp-var-display "ff"))
(temp-var-display "gg"))
(temp-var-display "hh")
(kill-local-variable 'temp-var)
(temp-var-display "ii")
bb temp-var: u=buffer-1, b=buffer-1 d=global
cc temp-var: u=buffer-2, b=buffer-2 d=global
dd temp-var: u=let, b=let d=global
ff temp-var: u=global, b=global d=global
gg temp-var: u=global, b=global d=global
hh temp-var: u=buffer-1, b=buffer-1 d=global
ii temp-var: u=global, b=global d=global
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#5371
; Package
emacs
.
(Wed, 13 Jan 2010 18:46:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 5371 <at> debbugs.gnu.org (full text, mbox):
>> What do you mean by "priority of different kind of local variables"?
> I just meant which value is active at a certain point.
It's not based on priorities.
> (with-temp-buffer
> (set (make-local-variable 'temp-var) "buffer-2")
> (temp-var-display "cc")
> (let ((temp-var "let"))
> (temp-var-display "dd")
> (kill-local-variable 'temp-var)
> (temp-var-display "ff"))
The `let' binding affects the currently "active" slot, so in this case
it affects the buffer-local slot. So after kill-local-variable, this
binding is lost.
Note that mixing let-binding and buffer-local bindings is generally
discouraged. The only known reasonably sane semantics for such a mix is
when the variable is always buffer-local. If you mix `let' with
make-local-variable and kill-local-variable you're really asking
for trouble.
Stefan
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#5371
; Package
emacs
.
(Wed, 13 Jan 2010 18:51:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 5371 <at> debbugs.gnu.org (full text, mbox):
On Wed, Jan 13, 2010 at 7:45 PM, Stefan Monnier
<monnier <at> iro.umontreal.ca> wrote:
>>> What do you mean by "priority of different kind of local variables"?
>> I just meant which value is active at a certain point.
>
> It's not based on priorities.
>
>> (with-temp-buffer
>> (set (make-local-variable 'temp-var) "buffer-2")
>> (temp-var-display "cc")
>
>> (let ((temp-var "let"))
>> (temp-var-display "dd")
>
>> (kill-local-variable 'temp-var)
>> (temp-var-display "ff"))
>
> The `let' binding affects the currently "active" slot, so in this case
> it affects the buffer-local slot. So after kill-local-variable, this
> binding is lost.
Ok, I see.
> Note that mixing let-binding and buffer-local bindings is generally
> discouraged. The only known reasonably sane semantics for such a mix is
> when the variable is always buffer-local. If you mix `let' with
> make-local-variable and kill-local-variable you're really asking
> for trouble.
I know ;-)
Is this explained somewhere (except for the code)?
bug closed, send any further explanations to Lennart Borgman <lennart.borgman <at> gmail.com>
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Fri, 15 Jan 2010 02:35:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <bug-gnu-emacs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 12 Feb 2010 12:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 15 years and 209 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.