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: Fri, 19 May 2006 02:25:58 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

"Drew Adams" <address@hidden> writes:

>     It has been pointed out about five times to you already that a mode
>     suddenly turning itself on without the user requesting it _is_ a
>     problem.
>
> Yes, it has been claimed that there is a problem (you've done so
> again), but what the problem is has not been specified - what's the
> "harm"?

That a mode suddenly turns itself on without the user requesting it.
Emacs is not supposed to behave erratically.  It is not supposed to be
turning on all sorts of minor modes on its whim just because the user
made the mistake of, say, executing

M-x customize-browse RET

> And, as I said, it's not because _some_ library might be able to do
> something harmful with :init-value t that we should recommend that
> _no_ libraries use :init-value t (except for the rare corner
> case). What about the majority of libraries that don't do harm if
> their minor mode is turned on during load?

Turning on a minor mode is supposed to make a difference, and there
should not be a difference without the user requesting it.

> Unless, that is, you can point to a general problem (harm) that can occur
> with _any_ library...
>
>     And it is not like this is a new debate, anyway.
>
> Sorry, the question is new to me. Point me to the thread, please.
>
>     > Is it appropriate to set the mode to off initially, if the user
>     > wants it on?
>
>     If the user has not indicated that he wants it on, there is no reason
>     to assume so.
>
> Please read what I wrote. I was discussing the case where the user
> specified (setq my-mode t) in .emacs.

It is irrelevant.

> If, as I thought you were suggesting,

I didn't suggest anything of that kind.

> loading the file could somehow override user settings, then it could
> override an explicit t setting as well as an explicit nil
> setting. That was the point here.

Straw man.

>     > The point of :init-value was to specify only a _default_ value, to
>     > be used only if the user expressed no preference beforehand.
>
>     And we are talking about this.  If your insistence about wanting to
>     shoot yourself in the foot is supposed to be representative, one
>     should probably remove the :init-value option altogether.
>
> Your metaphor doesn't help - what are you referring to? Is it true
> or not that loading a file can somehow override user mode-variable
> settings in .emacs?

"Somehow"?  Most certainly.  Though one would avoid it, usually.

> * If true, then that problem should be fixed. If it cannot be fixed,
> then :init-value does not perform as advertised, and it should be
> removed.
>
> * If not true, then I don't see the problem with the library
> specifying an :init-value of either nil or t. If the user's
> preference is always respected, then where's the harm?

Is this some sort of a game with you, or what?  We are talking about
the case where the user has not specified a preference, and Emacs is
turning randomly minor modes on at its whim.

>     > Now I think I hear that Customize, menus, et al might load the
>     > library before the user can even express a choice, and that
>     > that load might somehow override a user setting in .emacs.
>
>     You are wildly speculating.
>
> Sorry; I got that speculation from your vague description of "the
> problem".  I asked for a specific scenario leading to "harm" or
> "pain", and that's all I could imagine you meant by your response
> that Customize might load the file behind the user's back. Loading
> the file should only set the mode value if the user has not already
> set it, which is not a problem (if it is, please explain). I figured
> you must be trying to say that loading by Customize somehow
> overrides a user setting. If not, what's the problem?

You are being disingenuous.  The problem is that Emacs should not be
turning minor modes on at random occasions.  It is not like this has
not been said already.

>     We are talking about the case where there
>     is no user setting in .emacs.
>
> If there is no user setting, then what is the problem? If the user
> doesn't have a preference whether loading turns the mode on or
> leaves it off, then why not let the library writer pick a default
> behavior (which is what :init-value is supposedly for)?

Because Emacs is not supposed to be turning on minor modes at random
moments.

> That is the same for any default value.

If the file for a minor mode is not loaded, there is no effect, and no
lighter set in the mode line.  So the only sensible default for a
minor mode is "off", since the default must not change by having the
file loaded: there still must be no effect, and no lighter set.  And
that means "off".

> If a user doesn't have a preference whether `debug-on-error' is t or
> nil at startup, then the default value is used. What is the specific
> problem that you see regarding the default value for a mode
> variable?

That a minor mode has an effect, and this effect should not be
activated as a side effect of a coincidental load.

>     It has been beaten to death even in this thread.
>
> Please point to the thread.

What about "this thread" did you not understand?

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

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