emacs-devel
[Top][All Lists]
Advanced

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

Re: cua: quiet warning messages


From: Luc Teirlinck
Subject: Re: cua: quiet warning messages
Date: Mon, 16 Jun 2003 14:41:51 -0500 (CDT)

Stefan Monnier wrote:

   > Note that _any_ symbol other than `nil' or `-' should turn the mode
   > _on_.  'toggle is a symbol, it is not `nil' and not `-'.

   That's also how define-minor-mode behaves.

I defined a minor mode, vis-mode using define-minor-mode.
M-: (vis-mode 'toggle) _does_ toggle.

   The 90% of the cases where a minor mode is called non-interactively with
   a nil argument is when an unsuspecting user says

           (add-hook 'foo-mode-hook 'bar-minor-mode)

   The warning is thus there so that when it ends up turning the mode
   OFF, it tells the user that it might not be doing what the
   user expected.  If the user (or author) really meant to turn the
   mode off, she should pass a -1 argument to make it clear that
   she knows what she's doing.

If foo-mode always turns bar-minor-mode on, then the above code seems
intentional and should not produce a warning.  Note that, in your
example foo-mode-hook is probably a normal hook, so you can not just
pass an explicit argument, you have to define your own function,
disable-bar-minor-mode or whatever.  The user may not know how to do
that and (add-hook 'foo-mode-hook 'bar-minor-mode) might actually be
stylistically inferior, but works.  For inclusion in Emacs' source
code I _would_ define a disable-bar-minor-mode instead, because it
seems more robust, but why be that stylistically picky for a user's
.emacs.  How does she turn the warning off if she gets tired of it?

If the current behavior would not be changed, then _at least_ it
should be _documented_ in _all_ places I mentioned.

Sincerely,

Luc.




reply via email to

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