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?


From: Drew Adams
Subject: RE: global minor modes that can be overridden locally?
Date: Mon, 11 Dec 2006 21:00:54 -0800

> > Uh, I never heard of global-*-mode. Is that documented?
>
> global-auto-composition-mode ...

Actually, I had heard of (and used) global-font-lock-mode. I hadn't thought
about it.

> > I define a global minor mode using define-minor-mode with
> > :global, and M-x foo-mode is the global toggle for it.
> > There is no global-foo-mode defined
> > for my mode by define-minor-mode with :global.
>
> You are confusing two slightly different situations.
>
> There are "true" global modes, which _only_ have a global effect, and
> wouldn't make sense as a local mode; an example is `tool-bar-mode'.
> Such modes are called FOO-mode because it is the obvious name (and
> adding "global-" to the beginning would be pointless and annoying).

I sure agree about that last part.

> However there are global modes which are actually the effect of applying
> a local mode globally, that is, they enable or disable the corresponding
> local mode in all buffers.  Such modes are called global-FOO-mode,
> because the fundamental mode in question is the local FOO-mode, and
> global-FOO-mode is merely a convenient adjunct.

Ah, I didn't know that. Sorry if I confused things. I don't know if anything
I wrote on this earlier in this thread makes any sense for that context. I
had in mind only the other sort (the "truly" global sort) of global minor
mode. I thought that someone was asking to be able to locally override a
(truly) global mode locally, and I was proposing a way to perhaps do that.
>From what you say, there is probably no need for what I suggested. Sorry for
the noise.

In the version of Emacs 22 I was using, there was nothing about
define-global-minor-mode in the manual. I picked up a new Emacs binary today
(thanks to Lennart), however, and I see it there now.

I wonder, however, if the terminology might not be confusing. The "pseudo"
global minor modes are not the same thing as the "true" global minor modes,
but it is they that result from using the macro named
`define-global-minor-mode'. And the resulting mode names `global-*-mode'
also seem to hinder clarity in the same way. Couldn't this be made clearer
with some better choice of terminology? If the normal, "true" global minor
mode is not the one that has "global" written all over it, then aren't we
asking for trouble? And aren't we asking for trouble just by having two
different animals that are both referred to as "global" minor modes?

The local-turned-global beasts were not in my build of July, AFAICT.
Assuming that they fit a real need, shouldn't we perhaps revisit the
terminology? I don't have a good terminology suggestion (yet) - I'm still
not too clear on their raison d'etre. Maybe someone can suggest a better way
to talk about these different kinds of critters?

It sounds like the pseudo global modes are not global modes, but local modes
that are applied globally. If that's the case, then perhaps that's the best
way to speak of them: don't call them global, but speak of them being
applied globally. Perhaps rename `define-global-minor-mode' to
`make-minor-mode-global' (a la `make-variable-buffer-local'), since the
input is a minor mode and you are, in effect, making it serve globally
(IIUC). Even that characterization of being applied globally (vs being
inherently global) sounds like too fine a nuance and a possible source of
confusion, however.

One way or the other, I think there will need to be some distinction made in
the doc, to guide people toward using one or the other sort of global mode,
depending on their different needs. Miles's explanation is a start and
helped me, and that explanation is missing from the doc, AFAICT.






reply via email to

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