mikep@ism780c.UUCP (Michael A. Petonic) (01/30/88)
I've notices a peculiarity with GNU Emacs version 18.40.4 on BSD. Say that I define a variable FOO and make that variable buffer local. Say I store a value of "BAR" into FOO. Fine, it takes and acts like what a well behaved buffer-local-variable should act like. However, when I change modes, say from Emacs-lisp to Fundemental in that buffer... BOOM! It wipes out the value of FOO. It's now set to nil. Any way I can overcome this problem so that the variable stays set even across mode switches? -MikeP -------- Michael A. Petonic (213) 453-8649 x3247 INTERACTIVE Systems Corporation "My opinions in no way influences 2401 Colorado Blvd. the price of tea in China." Santa Monica, CA. 90404 {sdcrdcf|attunix|microsoft|sfmin}!ism780c!mikep
wolfgang@mgm.mit.edu (Wolfgang Rupprecht) (01/31/88)
In article <8770@ism780c.UUCP> mikep@ism780c.UUCP (Michael A. Petonic) writes: >I've notices a peculiarity with GNU Emacs version 18.40.4 on >BSD. Say that I define a variable FOO and make that variable >buffer local. Say I store a value of "BAR" into FOO. >[...] when I change modes, say from >Emacs-lisp to Fundemental in that buffer... BOOM! It wipes >out the value of FOO. It's now set to nil. Changing modes kills all local variables. See the files *-mode.el and look for functions *-mode. You will notice all of them do a call to (kill-all-local-variables). Here is its docstring. kill-all-local-variables: Eliminate all the buffer-local variable values of the current buffer. This buffer will then see the default values of all variables. If you *really* want to keep local variables across mode switches, you can try removing these calls. -- Wolfgang Rupprecht ARPA: wolfgang@mgm.mit.edu (IP 18.82.0.114) Freelance Consultant UUCP: mit-eddie!mgm.mit.edu!wolfgang Boston, Ma. VOICE: Hey_Wolfgang!_(617)_267-4365
mikep@ism780c.UUCP (Michael A. Petonic) (02/02/88)
In article <2673@bloom-beacon.MIT.EDU> wolfgang@mgm.mit.edu (Wolfgang Rupprecht) writes: >... >If you *really* want to keep local variables across mode switches, you >can try removing these calls. Well, I found a different way to do this that is probably obvious to anyone who's been hacking lisp for even a short while. I made an a-list called rserver-alist which stored the information globally. The key to the a-list was the buffer name and I could get the value I wanted from there. What a bargain! :-). -MikeP
markl@PTT.LCS.MIT.EDU (02/05/88)
From: mikep@ism780c.UUCP (Michael A. Petonic) Date: 29 Jan 88 17:25:07 GMT Reply-To: mikep@ism780c.UUCP (Michael A. Petonic) Organization: Interactive Systems Corp., Santa Monica CA I've notices a peculiarity with GNU Emacs version 18.40.4 on BSD. Say that I define a variable FOO and make that variable buffer local. Say I store a value of "BAR" into FOO. Fine, it takes and acts like what a well behaved buffer-local-variable should act like. However, when I change modes, say from Emacs-lisp to Fundemental in that buffer... BOOM! It wipes out the value of FOO. It's now set to nil. Any way I can overcome this problem so that the variable stays set even across mode switches? The problem is probably kill-all-local-variables, a LISP function that resets all buffer-local variables to their default values. I believe it is called by most mode-setup functions. -MikeP markl Internet: markl@ptt.lcs.mit.edu Mark L. Lambert MIT Laboratory for Computer Science Distributed Systems Group ----------
worley@compass.com (Dale Worley) (10/11/90)
Is there any way to distinguish (in E-lisp code) a variable that has been made local via make-local-variable from one made local via make-variable-buffer-local? Dale Worley Compass, Inc. worley@compass.com -- Trying to explain Usenet is like trying to paint a fart. -- Robert Horvitz, Whole Earth Review
gaynor@paul.rutgers.edu (Silver) (10/14/90)
I can't think of any better ways offhand than simply looking up the variable in the buffer's local variables... Regards, [Ag] _______________________________________________________________________________ (defun variable-buffer-local-p (v &optional b) "Return t if VARIABLE is buffer-local, nil otherwise. Optional BUFFER is the buffer in which to look." (and (assoc v (buffer-local-variables b)) t))