[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Buffer local overlay variables?

From: Stefan Monnier
Subject: Re: Buffer local overlay variables?
Date: Mon, 20 Mar 2006 02:07:06 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>>> I am trying to use buffer local overlays. I set these when the buffer
>>> is narrowed. However when the buffer is widened again they are
>>> nil. With a non-local variable everything works as I expect.
>> Can you provide a self-contained example, so we can debug it?
> Oh, no, not once again. Sorry, my fault. I forgot that changing major mode
> calls kill-all-local-variables.  I added this
>   (put 'html-inlined-overlay 'permanent-local t)
> This makes the variable survive kill-all-local-variables.

Alternatives for this kind of problem:

- add a change-major-mode-hook  which removes the overlays when the major
  mode is changed (i.e. at the same time as the local var is killed).
- remove the variable altogether and use overlays-in and
  overlays-at instead.

Not that the alternatives are always better, far from it.  Which of the
three is best depends on the situation.  If removal of the var is
realistically possible, it has the advantage that you never need to worry
about the var being "out of sync", so it's more reliable.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]