emacs-devel
[Top][All Lists]
Advanced

[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: Thu, 25 Sep 2008 23:34:50 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666

Richard M. Stallman wrote:
>     I have thought about three different
>     cases:
> 
>     - Buffer local variables that should never survive moving between chunks
>     with different major modes.
> 
>     - Those that always should survive (but be killed when switching major
>     modes when mumamo is not used).
> 
>     - Those that will be killed when moving to a chunk with a different
>     major mode, but will be resurrected when point again reaches a chunk
>     with the same major mode. (They are what I call "per major mode".)
> 
> I agree that these three behaviors should suffice.  (We also want
> variables that survive all changes in major mode, and that's what
> `permanent-local' does now.)
> 
> Do we need all these behaviors?
> 
> I doubt that the first behavior is needed, except for a few variables
> used specially in the implementation of mumamo.  Mumamo can easily
> implement that behavior for those few variables.

Maybe it would be meaningful for a parser that is supporting completion
in the chunk?

> Can you find any other use cases for which the first behavior is needed?
> If not, let's forget it.
> 
> I think the second and third behaviors are both useful.  So the next step
> is to design conditions under which each one should happen.
> 
> To do that, we need to see the _pattern_ of when each behavior is
> desired.  So please collect use cases for them.
> 
> Here's a proposal that came to me, suggested by what I know about
> use-case patterns.
> 
>     * If a variable is bound locally by one of the major modes used within
>     mumamo, or by the mode hooks it runs, then kill it when moving to a
>     chunk in another major mode.

Do you mean the third case aboove here? I think this is a good idea.
This is what I have implemented now in the latest sources (and that I
sent here).

>     * Any other buffer-local variable should survive through motion between
>     chunks.

I am not sure about this one, but I think it would be better to use the
third case for these variables too (and that is what I do now) if not
their 'permanent-buffer local property is non-nil.

> Can you find any use cases where this would not be right?

Let say that the user for example want to use another indentation step
for a specific chunk type. Then my comment above would perhaps apply.

But you may of course say instead that such cases should be handled by
adding this to the major mode hook.

---
I am a bit worried by this complexity for the users. One way to avoid it
would perhaps to introduce the concept of a new "persistent level"
between 'permanent-local=t and 'permanent-local=nil. A level that would
be like 'permanent-local=t but just for the current buffer. Maybe
permanent-local could take the current buffer as a value for this level?




reply via email to

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