From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= Newsgroups: gmane.emacs.help Subject: Re: buffer-local variables and state information Date: Sun, 11 Sep 2011 22:05:03 +0200 Message-ID: <8739g23kwg.fsf@gmail.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1315771823 19277 80.91.229.12 (11 Sep 2011 20:10:23 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 11 Sep 2011 20:10:23 +0000 (UTC) Cc: GNU Emacs List To: Le Wang Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Sep 11 22:10:17 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R2qM5-0004SZ-Mb for geh-help-gnu-emacs@m.gmane.org; Sun, 11 Sep 2011 22:10:17 +0200 Original-Received: from localhost ([::1]:38880 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2qM5-0000UF-7Z for geh-help-gnu-emacs@m.gmane.org; Sun, 11 Sep 2011 16:10:17 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:33072) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2qM0-0000Tt-Aj for help-gnu-emacs@gnu.org; Sun, 11 Sep 2011 16:10:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R2qLx-00011e-Ck for help-gnu-emacs@gnu.org; Sun, 11 Sep 2011 16:10:12 -0400 Original-Received: from mail-fx0-f41.google.com ([209.85.161.41]:46095) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2qLw-00011E-Ux for help-gnu-emacs@gnu.org; Sun, 11 Sep 2011 16:10:09 -0400 Original-Received: by fxh17 with SMTP id 17so1082134fxh.0 for ; Sun, 11 Sep 2011 13:10:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:content-transfer-encoding; bh=r/1dKlQdn9SV3UmJXXNx3amHJvwii780fORebg78Xmg=; b=o8OLzT0c04WY5NVC9u4NhjdRHow3lRfUa9bNZqcjGaKcEIrv4DfS1zv1MaqvoaLVo0 1FGj9u0/J+a5+QK1reLzwLqOmbri4Rg/6n7JisMZelMenyP93/im9cPQCRAH+jgGnHFV K3Yibb5dDK/YIwEiitO4CZMXw6eKm02zQGlrg= Original-Received: by 10.223.29.9 with SMTP id o9mr1751721fac.131.1315771807680; Sun, 11 Sep 2011 13:10:07 -0700 (PDT) Original-Received: from localhost (176.119.broadband10.iol.cz [90.177.119.176]) by mx.google.com with ESMTPS id f25sm5159192faf.7.2011.09.11.13.10.06 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 11 Sep 2011 13:10:06 -0700 (PDT) In-Reply-To: (Le Wang's message of "Mon, 12 Sep 2011 00:25:26 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.161.41 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:82211 Archived-At: On Sun, 11 Sep 2011 18:25:26 +0200 Le Wang wrote: > Is it considered generally acceptable to store state information, for > example, from a minor-mode in a buffer-local variable? Yes. > However, recently, I discovered that changing major-modes would > actually kill all buffer-local variables, which would leave my > minor-mode in an invalid state. So I've been doing it wrong? Not necessarily. If the variable in question should persist across major mode changes, you can set its `permanent-local' property, e.g. (put 'variable 'permanent-local t) That will make it exempt from the buffer-local variable slaughter. --=20 =C5=A0t=C4=9Bp=C3=A1n