From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Elena Newsgroups: gmane.emacs.help Subject: Persistent buffer local variables? Date: Tue, 13 Jul 2010 10:57:21 -0700 (PDT) Organization: http://groups.google.com Message-ID: <555711cb-95bb-4529-85a4-f15a08782966@z8g2000yqz.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1291846796 22720 80.91.229.12 (8 Dec 2010 22:19:56 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 8 Dec 2010 22:19:56 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 08 23:19:49 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PQSMV-0003hO-Px for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 23:19:49 +0100 Original-Received: from localhost ([127.0.0.1]:43065 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQSMP-0001ND-4W for geh-help-gnu-emacs@m.gmane.org; Wed, 08 Dec 2010 17:19:41 -0500 Original-Path: usenet.stanford.edu!postnews.google.com!z8g2000yqz.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 23 Original-NNTP-Posting-Host: 94.36.118.70 Original-X-Trace: posting.google.com 1279043841 15022 127.0.0.1 (13 Jul 2010 17:57:21 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 13 Jul 2010 17:57:21 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: z8g2000yqz.googlegroups.com; posting-host=94.36.118.70; posting-account=AFCLjAoAAABJAOf_HjgEEEi3ty-lG5m2 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.19) Gecko/2010062510 Iceweasel/3.0.6 (Debian-3.0.6-3),gzip(gfe) Original-Xref: usenet.stanford.edu gnu.emacs.help:179732 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:76119 Archived-At: 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.