🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #99432

behavior of buffer-local variables

#99432
From: Joseph Wells
Date: Fri, 07 Sep 1990 03:02
35 lines
2103 bytes
In article <9008310740.AA04666@csvax.cs.caltech.edu> daveg@CSVAX.CS.CALTECH.EDU (David Gillespie) writes:

   In make-local-variable, the function returns immediately if the variable
   has already been made "automatically buffer-local", i.e., by
   make-variable-buffer-local.  This is almost right, but there is a
   window between the call to make-local-variable and the first setq in
   which a setq-default's effect is incorrectly visible.

	   (setq foo 'one)
	   (make-variable-buffer-local 'foo)
	   (make-local-variable 'foo)
	   foo  => 'one
	   (setq-default foo 'two)
	   foo  => 'two    [this is inconsistent]
	   (setq foo 'three)
	   foo  => 'three
	   (setq-default foo 'four)
	   foo  => 'three  [correct behavior]

This is "correct" behavior.  make-variable-buffer-local and
make-local-variable leave the buffer-local value of the symbol unbound.
When the buffer-local value of a symbol is unbound, it is shadowed by the
default value of the symbol.

In any case, what is "correct" behavior for these functions is defined by
the implementation ....

Strange fact: if a symbol has any buffer-local values, even unbound
values, then that symbol's default value can not be unbound.

Fact 2: you can undo the effects of any make-variable-buffer-local and
make-local-variable calls with makunbound.

-- 
Joe Wells <jbw@bu.edu>
Technical Details
Message-ID: <JBW.90Sep6230227@bucsf.bu.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!samsung!zaphod.mps.ohio-state.edu!rpi!bu.edu!nntp-read!jbw
References: <9008310740.AA04666@csvax.cs.caltech.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,740930ec93aa18ac
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1990-09-07 13:29:18 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!samsung!zaphod.mps.ohio-state.edu!rpi!bu.edu!nntp-read!jbw
From: jbw@bucsf.bu.edu (Joseph Wells)
Newsgroups: gnu.emacs.bug
Subject: behavior of buffer-local variables
Message-ID: <JBW.90Sep6230227@bucsf.bu.edu>
Date: 7 Sep 90 03:02:27 GMT
References: <9008310740.AA04666@csvax.cs.caltech.edu>
Sender: news@bu.edu.bu.edu
Distribution: gnu
Organization: Boston University Computer Science Department
Lines: 35
Posted: Fri Sep  7 04:02:27 1990
In-reply-to: daveg@CSVAX.CS.CALTECH.EDU's message of 31 Aug 90 07:40:06 GMT