[Top][All Lists]

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

Re: Specifying mode in file variables trouble

From: Lennart Borgman (gmail)
Subject: Re: Specifying mode in file variables trouble
Date: Tue, 23 Sep 2008 22:26:33 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20071031 Thunderbird/ Mnenhy/

Richard M. Stallman wrote:
>     How about the solutin I sent with mumamo-save-buffer-locals and dito
>     restore? I suggested something like this
> That is a proposed _mechanism_.

Mm. Yes. It is clearly not the whole solution.

> Another mechanism which might be to put properties on the variables
> that control minor modes.  Or perhaps just on per-buffer minor modes
> (the ones that are not normally global).

There are three main scopes (maybe there are more) for minor modes:

- Global
- Per buffer
- Per major mode

Global minor modes are not a problem here.

I have suggested long ago using the existing mechanism for
distinguishing between local variables that are per buffer and those
that are per major mode. In other words: the minor modes that are per
buffer should use

   (put 'PER-BUFFER-VARIABLE 'permanent-local t)

on their buffer local variables. (I do that now in mumamo.el for some of
the most important.)

> By scanning buffer-local-variables and checking for that property,
> you could find all the minor modes that are set in a given buffer.

I believe I can see what you mean. It might however be better to do it
the other way round: mark those buffer local variables that are not used
by the type of minor modes we are talking about here.

The advantage is of course that minor mode authors most often will not
have to know about this.

I have implemented such a list in mumamo.el now. This is the variable

> The mechanism is just part of this.  We also need an interface.  There
> are lots of minor mode definitions, and we want them to be simple and
> clean.
> So please propose a change in minor mode definitions so as to do the
> job.  Then we can evaluate it and maybe propose better alternatives.

I think the suggestions above may be sufficient, but that might be just
because of lack of imagination/knowledge of Emacs ;-)

>     I have no idea what
>     delayed-mode-hooks is used for so I do not know if setting
>     delay-mode-hooks to nil may cause problems here.
> Please read the doc of the macro `delay-mode-hooks' to learn what this
> does.

Thanks. I did that after Stefan's reply. I think the doc strings for
delay-mode-hooks and the variable delayed-mode-hooks need a bit
enhancements, at least pointers to the macro.

reply via email to

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