[Top][All Lists]

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

RE: doc of defining minor modes

From: Drew Adams
Subject: RE: doc of defining minor modes
Date: Thu, 18 May 2006 17:01:17 -0700

    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

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"? How about a
scenario that shows something bad happening by loading a file with
:init-value t? I believe you that the load might occur behind the user's
back, so you need not repeat that part again.

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?

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. If, as I thought you were suggesting, 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

    > 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

* 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?

    > 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?

    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)?

That is the same for any default value. 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 problem description must be general enough to
justify imposing the restriction on all uses of `define-minor-mode' (except
for the rare corner case).

    >     Then you should perhaps read the respective discussion in the
    >     archives.  It is not like this has not been talked through
    >     already.  It is tiresome if people start finished discussions
    >     and decisions all over again without bothering to get up to
    >     scratch first.
    > I asked several times for a specific scenario. If this has already
    > been beaten to death by others, then all you need to do is point me
    > to the thread.

    It has been beaten to death even in this thread.

Please point to the thread. Argument by authority or reference only works if
an authority or reference is pointed to.

If the decision was that programmers should never use :init-value t except
in the rare corner case described, then the doc should say so explicitly and
more clearly than it does now. It should describe the corner case better and
state in so many words that one should _not_ use :init-value _except_ for
that specific corner case. That is only suggested now, in a vague and
unclear manner.

As I said, this text was added recently (in the last year). I don't see a
reason for it. If this recommendation is kept, and you want people to
understand and respect it, then it should be clarified and justified
(explain why) in the doc.

reply via email to

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