[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: buffer-local variables and state information
From: |
Štěpán Němec |
Subject: |
Re: buffer-local variables and state information |
Date: |
Sun, 11 Sep 2011 22:05:03 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
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.
--
Štěpán