emacs-devel
[Top][All Lists]
Advanced

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

Re: Multiple major modes


From: Richard Stallman
Subject: Re: Multiple major modes
Date: Sun, 01 Jul 2007 16:40:12 -0400

Please forgive my delay in studying your message and responding.

    >Currently, the idea is that major modes can make any global variable
    >buffer-local.  Are you suggesting we divide all variables into two
    >classes, those that can be and those that can't be?  If so, what is
    >the benefit of that?

    There would be two classes.

I don't entirely follow.  Two classes of what?  Two classes of variables?

If so, could you describe each of the two classes?

                                 There would be values that are specific
    to the major mode, and variables that are local to just some buffer.
    The buffer local value would trump the mode-specific value, and any
    mode-specific value would trump the global value.

That part makes sense to me; but can't we make all kinds of bindings
possible for every variable?

    The mode-local feature I wrote (with a lot of help from David Ponce)
    works in all versions of Emacs commonly used today.  It does this work
    by modifying the buffer-local values for different major-modes.  It
    provides the concept of what a mode-local variable might be.  Ideally
    it would not operate this way, and instead have built-in support for
    real mode-local values and method tables.

That makes sense.  We could implement mode-local bindings at the low
level if that is what we want.

What should their semantics be?

      A side effect is that
    you could have minor modes that operate across both major modes in a
    single buffer, and that minor mode won't get tromped.

How would this work?

    It is obvious that if a mode-local type tool or syntax were adopted
    into Emacs, that it would be a big effort to transition everything to
    it.

I hope we can design the mechanism to avoid the need for pervasive
changes in the code of major modes.  Perhaps we would need to change
some of the current calls to make-local-variable to call some new
primitive, make-mode-variable, instead.  But even that would be a pain
if every major mode HAD to do it.

      The real advantage would come if the
    concepts were built into Emacs and the help system which could then
    show chains of values (For C-h v) or chains of function doc (for C-h f)
    based on mode.

I agree, that would be good to do.





reply via email to

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