emacs-devel
[Top][All Lists]
Advanced

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

Re: questions about define-minor-mode


From: Stefan Monnier
Subject: Re: questions about define-minor-mode
Date: Thu, 08 Apr 2010 22:16:40 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> 1. `define-minor-mode' defines a defcustom if the mode is declared
> global, but it does not otherwise.

> Why not? I'm sure there is a good reason, but it's not clear to me.
> Why shouldn't a user be able to customize the (default) value for
> a non-global minor mode?

The reason is that such a "global default" can not always be changed
easily and correctly in a way that doesn't risk confusing users.
I.e. it would only make sense if/when we can provide a meaningful
interface such as "always activate it in this/that situation".
Until then, the programmer will have to provide its own defcustom for
those cases where it makes sense.

> 3. The explanation of "initial value must (!) be `nil'" is not clear
> to me at all.  I don't understand either the "exceptional" conditions
> under which non-nil is permitted (!) or the reasoning behind
> this rule.

The initial value should *describe* (i.e. not control) the normal state
in the case where the minor mode function is not called.

For minor modes where the function does not do anything (i.e. all the
minor mode's state is kept in the boolean variable), the different
between controlling and describing is irrelevant.  But in the general
case it's important since otherwise loading the file would require Emacs
to run the minor-mode function to make sure the state is consistent
with the minor mode variable.


        Stefan




reply via email to

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