From: Luc Teirlinck <teirllm@dms.auburn.edu>
Cc: emacs-devel@gnu.org
Subject: Re: cua: quiet warning messages
Date: Mon, 16 Jun 2003 13:47:58 -0500 (CDT) [thread overview]
Message-ID: <200306161847.h5GIlwn08741@eel.dms.auburn.edu> (raw)
In-Reply-To: <20030616170421.37652.qmail@web80512.mail.yahoo.com> (message from Michael Mauger on Mon, 16 Jun 2003 10:04:21 -0700 (PDT))
Michael Mauger wrote:
I've noticed that when CUA starts up under 21.3.50 that it issues warning
messages when delete-selection-mode and pc-selection-mode are disabled.
Actually the error is issued by the modes themselves. The warnings are:
Toggling delete-selection-mode off; better pass an explicit argument.
Toggling pc-selection-mode off; better pass an explicit argument.
These warnings are issued by define-minor-mode. As a consequence,
modes defined by define-minor-mode behave differently from modes
defined by other means. The behavior of these minor modes is
inconsistent with the behavior as explained in the Emacs manual:
With no argument, the function turns the mode on if it was
off and off if it was on. This is known as "toggling". A positive
argument always turns the mode on, and an explicit zero argument or a
negative argument always turns it off.
Elisp manual:
The command should accept one optional argument. If the argument
is `nil', it should toggle the mode (turn it on if it is off, and
off if it is on). Otherwise, it should turn the mode on if the
argument is a positive integer, a symbol other than `nil' or `-',
or a list whose CAR is such an integer or symbol; it should turn
the mode off otherwise.
Note that _any_ symbol other than `nil' or `-' should turn the mode
_on_. 'toggle is a symbol, it is not `nil' and not `-'.
>From the Elisp documentation of define-minor-mode:
This macro defines a new minor mode whose name is MODE (a
symbol). It defines a command named MODE to toggle the minor
mode, with DOC as its documentation string.
>From the documentation string of define-minor-mode:
Define a new minor mode MODE.
This function defines the associated control variable MODE, keymap
MODE-map, toggle command MODE, and hook MODE-hook.
Nowhere anywhere any mention whatsoever about the argument 'toggle
which according to define-minor-mode's _code_ seems to be the only
stylistically acceptable way to toggle a minor mode non-interactively.
You have to read the code of define-minor-mode to find that out.
If an author fails to carefully read the code and follows the
stylistic conventions documented in all relevant manuals, as well as
the documentation string of define-minor-mode itself, and fails to
follow this completely undocumented stylistic "convention" instead,
define-minor-mode expresses its distaste for the _programmer's_ style,
not through a compiler warning, but by printing an error message to
the _user_ complaining about the author's style. This seems highly
unusual.
I believe that the bug is in define-minor-mode and should be corrected
there.
Sincerely,
Luc.
next prev parent reply other threads:[~2003-06-16 18:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-16 17:04 cua: quiet warning messages Michael Mauger
2003-06-16 18:47 ` Luc Teirlinck [this message]
2003-06-16 19:12 ` Stefan Monnier
2003-06-16 19:41 ` Luc Teirlinck
2003-06-22 3:01 ` Richard Stallman
2003-06-23 17:00 ` Stefan Monnier
2003-07-01 15:17 ` Richard Stallman
2003-07-04 0:47 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200306161847.h5GIlwn08741@eel.dms.auburn.edu \
--to=teirllm@dms.auburn.edu \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).