emacs-devel
[Top][All Lists]
Advanced

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

Re: address@hidden: Info on define-minor-mode - :init-valueor :initial-v


From: Luc Teirlinck
Subject: Re: address@hidden: Info on define-minor-mode - :init-valueor :initial-value?]
Date: Sat, 30 Jul 2005 19:43:13 -0500 (CDT)

Richard Stallman wrote:

       The _default_ :initialize function is custom-initialize-reset.  That
       means that whenever a file containing a defcustom with a :set function
       is loaded, that :set function is called

   That seems like the right thing to me.  If the user set the variable,
   he probably wanted to control the mode.

In the text you quoted, I was talking about defcustoms with a :set
function that are _not_ minor modes.  The vast majority of minor modes
use custom-initialize-default, so the custom-initialize-reset problems
do not apply to them.

                                               _even_ if the user customized
       the variable outside Custom, possibly in an attempt to avoid the :set
       function.

   So what?  One can't please everybody.

I thought that we decided that use of Custom was optional, that people
should be able to customize everything in their .emacs and completely
ignore Custom, if that is what they wanted to do.
custom-initialize-reset effectively makes the Custom way of
customizing things mandatory.  If you try to customize things manually
in your .emacs you subject yourself to Custom overriding you at random
moments, without notice, when some file is loaded (for instance by Custom).

         This has repeatedly caused me
       (and other people) problems in practice.

   If you describe these problems, we could think about whether they are
   worth solving by changing this mechanism.  However, if the problems
   only occur with a few particularly troublesome variables, it would be
   easier to deal with them one by one.

Prior cases that were known to give problems have been solved already
in various ways, but people just keep writing new very intrusive :set
functions.  I have proposed a solution for one very bad example in a
different thread.  I plan to install that solution if I do not hear
any objections to it.

But custom-initialize-reset can give bad surprises to people
customizing a variable outside Custom, even for very reasonable :set
functions.  For instance, suppose that setting a variable only takes
effect if a timer is set.  People using Custom have come to expect
that just setting a variable through Custom is sufficient.  So you
have to provide a :set function that calls the timer.  Now somebody
who wants the feature sometimes enabled and sometimes not might set a
very complex value for the variable in his .emacs and then enable and
disable the feature for that complex value by repeatedly setting and
unsetting the (autoloadable) timer.  But every so often the feature
will be mysteriously silently enabled, when some file is silently
loaded, for instance by Custom.  (That is why, in defcustoms I write
that call a timer in a :set function, I usually use
custom-initialize-set, or, if the standard value does not require the
timer, custom-initialize-default.)

Sincerely,

Luc.





reply via email to

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