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: Thu, 05 Jul 2007 16:34:37 -0400

    Sorry for being vague.  There would be "buffer-local variables", and
    "mode-local variables".

I think you really mean two classes of bindings, right?

    ;; programmatic
    (setq-mode-local 'c-mode my-var t)

    then all buffers in c-mode would get the new value of my-var.

Ok.  What happens if you do (setq my-var 69) in a buffer in C mode?
Does it change the value to 69 for all C mode buffers?

    If a multi-major-mode tool knows a particular major-mode doesn't use
    buffer-local variables, then it would not need to run the major-mode
    function (which could call `kill-all-local-variables') for every
    section switch and lots of work needed to save and restore
    buffer-local values that may or may not be mode-specific would be
    saved.

That's true, if we only consider local variables.  But major modes
set other things too: local keymap, syntax table, abbrev table.
We would need a new way to handle them too, right?

Here is another idea: `run-mode-hooks' could record all local bindings
made by a certain major mode, as mode-local bindings.  This way,
nearly all major modes would "just work" with the new mechanism; we
would not have to change their code.  Of course, `delay-mode-hooks'
would need to cooperate.




reply via email to

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