emacs-devel
[Top][All Lists]
Advanced

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

Re: doc of defining minor modes


From: David Kastrup
Subject: Re: doc of defining minor modes
Date: Thu, 18 May 2006 19:07:13 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

"Drew Adams" <address@hidden> writes:

> Sometime in the last year, this text was added to Elisp info node Defining
> Minor Modes:
>
>    The initial value must be `nil' except in cases where (1) the mode
>    is preloaded in Emacs, or (2) it is painless for loading to enable the
>    mode even though the user did not request it.  For instance, if the
>    mode has no effect unless something else is enabled, and will always be
>    loaded by that time, enabling it by default is harmless.  But these are
>    unusual circumstances.  Normally, the initial value must be `nil'.
>
> FWIW, I do not agree. It is sometimes useful to enable a minor mode
> upon load, and there is nothing wrong with that for normal
> (i.e. respectful) minor modes. If I'm missing something here, let me
> know - what's the harm (vs "harmless")?

Customize might load a file just because a variable has been
customized from it.

> Third, I don't see why we are stating this guideline /
> recommendation / prescription. Users can always set the mode value
> to nil in their init files, which, for a mode that always toggles
> based on changes to this variable (which is the normal, recommended
> case) will inhibit mode enabling upon load.

Uh what?  Why should that happen?

> That was the spin used previously in this doc, I believe, and I
> think it is the correct recommendation. We should say something like
> this (the idea, if not the wording):
>
>   Unless the mode automatically toggles upon changes to the mode
>   variable, do not enable the mode upon load. Why? Because users
>   have no way to inhibit enabling in that case.

How do you suppose to inhibit enabling when the mode "automatically
toggles upon changes" in this case?

> That is the only case where it is important not to enable the mode
> upon load, AFAIK. The part about modes that don't respect their
> variable is missing in the current guideline - it speaks of
> "painless" and "harmless", but nowhere does it explain what the pain
> or harm is.

Files may even get autoloaded when going through a menu.

> I personally think that perhaps most normal (respectful) minor modes
> should be enabled upon load, but I wouldn't go so far as to proclaim
> that in the doc. Enabling the mode by default upon load
> (i.e. enabling unless the variable is nil) is "harmless", unless I'm
> missing something. If I am missing something, then maybe that
> something needs to be added to the doc.

Stuff connected with autoloads and customization groups triggers at
unusual moments.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

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