unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Persistent buffer local variables?
@ 2010-07-13 17:57 Elena
  2010-07-14  7:45 ` Elena
  0 siblings, 1 reply; 2+ messages in thread
From: Elena @ 2010-07-13 17:57 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

I need to attach a some values to a buffer for later use. I have tried
using buffer local variables, but it seems they are forgotten as soon
as I switch major mode. How could I work around that? Here is my test
code:


(defvar my-var nil)
(make-variable-buffer-local 'my-var)

(defun my-set-var ()
	(interactive)
	(switch-to-buffer (get-buffer-create "*test*"))
	(setq my-var "test")
	;; (text-mode) ;; If I uncomment this line, variable is forgotten.
)

(defun my-show-var ()
	(interactive)
	(message "my-var is: %s" my-var))

Thanks.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-14  7:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-13 17:57 Persistent buffer local variables? Elena
2010-07-14  7:45 ` Elena

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).