[Top][All Lists]

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

global minor modes that can be overridden locally? [was: highlight-chang

From: Drew Adams
Subject: global minor modes that can be overridden locally? [was: highlight-changes-mode]
Date: Sat, 9 Dec 2006 10:55:44 -0800

> > >    I think the real question is which way we want global
> > >    minor modes to work.  Do we want the global mode command
> > >    to affect only buffers created subsequently?  Do we want
> > >    it to affect all existing buffers? Only existing buffers
> > >    in which the user has not specified any setting for the mode?
> >
> >     I want turning on or off a global minor mode to affect all
> >     existing and all future buffers (until another explicit
> >     mode change). Anything else would be
> >     a nuisance, in addition to being confusing.
> >
> > Do you use highlight-changes-mode?  Would you say that this
> > change would be an improvement for you, in highlight-changes-mode?
> No, I haven't used it. I can't speak to that.

Some thoughts on global minor modes (for after the release). I'm no expert
on minor modes, so please correct any misunderstandings; it's quite possible
this makes no sense at all.

1. Assumption: global minor modes should, generally, let you turn on/off the
mode everywhere at once: all existing and future buffers. This should be the
most direct and easiest thing to do.

2. A minority of global minor modes might want to let you also turn on/off
the mode differently in a particular buffer. IOW, for such modes, you might
want to locally override the global setting (on or off).

3. Perhaps this could be treated analogously to setq-default and setq? For
example, toggling the mode normally would set the default value of the mode
variable everywhere. In buffers that had no different local value, this
would also set the mode. But you could set the local value of the mode
variable differently, if you wanted.

4. Perhaps an interface for #3 something like this?

- M-x foo-mode toggles the mode everywhere (including in buffers that have
local values?) - it is like using setq-default (should it also change the
local values?).

- C-u M-x foo-mode toggles the mode in the current buffer only - it is like
using setq with a local variable.

- C-9 M-x foo-mode turns the mode on globally. M-- M-x foo-mode turns it off
globally. That is, you use a numeric prefix to explicitly turn it on or off
globally (vs toggling).

- C-u C-u foo-mode turns it on locally; C-u C-u C-u turns it off locally.
That is, you use an non-numeric prefix to explicitly turn it on or off
locally (vs toggling). Perhaps someone has a better idea here?

Would this work also for minor modes that are not meant to be changed just
by setting the mode variable? Is there even a need for such a feature
(global modes that can be overridden locally)? Should global minor modes
that use this feature be declared differently - e.g. via :global-local
instead of :global, or should all global minor modes be open to such a use?

reply via email to

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