emacs-devel
[Top][All Lists]
Advanced

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

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


From: Drew Adams
Subject: RE: global minor modes that can be overridden locally? [was:highlight-changes-mode]
Date: Sun, 10 Dec 2006 17:40:37 -0800

>     - 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.
>
> That might be good.  However, I'd rather have the simplest call
> affect only the current buffer and use C-u to make it global.

I think I disagree, if you mean that M-x foo-mode should toggle locally.
With that design:

. If there were no buffers where it was defined locally, then M-x foo-mode
would still toggle everywhere (global).

. If there were buffers where it was defined locally, then M-x foo-mode
would toggle differently, depending on where it was invoked:

  - toggle only locally, if invoked in a buffer with a local value
  - toggle globally, if invoked in a buffer with no local value

This inconsistency would be quite confusing. I think the best approach is to
let M-x foo-mode always toggle the global value and C-u M-x foo-mode always
toggle the local value. The latter could even be used to _define_ a local
override of the global value, requiring nothing extra for that.

>     - 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).
>
> That would fit the current scheme (except that these should
> operate locally).

Not sure what you mean by the last part, but if it is similar to the
previous, see above.

>     - 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?
>
> these might be ok for global turn on and off.

I guess we agree on the essential: allow for local overrides of a global
mode. But we disagree on the key bindings (UI). Please examine all cases and
then make a proposal.

My preference would be to keep the current treatment for a global minor mode
that is not overridden anywhere. This is the most common case, so it should
be the easiest to use.

I would want toggling the global (and the local) value to always use the
same key bindings (just M-x for global, with numeric arg to turn on or off
explicitly). I would not want the bindings to change, depending on whether
or not I'm in a buffer that has a local override.

If you are saying that the global toggle would sometimes (if no local value)
be via M-x and sometimes (if local values exist) be via C-u M-x, then I am
against that inconsistency.

If you are saying that the global toggle would always be C-u M-x, then I am
against that too, because the _common_ global case is (the current one)
where there are no local overrides, and it is inconvenient to use C-u each
time just to toggle the mode.

My assumption is that local overrides of global minor modes will not be too
common, and that the common cases will be a) global minor modes with no
local overrides and b) local minor modes.






reply via email to

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