[Top][All Lists]

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

Re: Specifying mode in file variables trouble

From: Richard M. Stallman
Subject: Re: Specifying mode in file variables trouble
Date: Thu, 25 Sep 2008 13:46:01 -0400

    > If we want all major modes to do something different, we can change
    > the functions `kill-all-local-variables' and `run-hooks'.

    Yes, that could be a way, but I think we first have to think about how,
    when and which buffer local variables should survive moving between
    chunks with different major modes.

Yes, exactly.  Before proposing mechanisms, the first step is to look
at what the cases are and see what behavior we want.

                                       I have thought about three different

    - 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.

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.

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

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

reply via email to

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