Subject: bug#5371: Priority of different kind of local variable bindings

From: Lennart Borgman <[email-masked]>
Date: Wed, 13 Jan 2010 16:50:25 +0100

On Wed, Jan 13, 2010 at 3:41 PM, Stefan Monnier
<[email-masked]> 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