From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: Re: cua: quiet warning messages Date: Mon, 16 Jun 2003 13:47:58 -0500 (CDT) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200306161847.h5GIlwn08741@eel.dms.auburn.edu> References: <20030616170421.37652.qmail@web80512.mail.yahoo.com> NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1055789582 17267 80.91.224.249 (16 Jun 2003 18:53:02 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 16 Jun 2003 18:53:02 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon Jun 16 20:52:59 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19Rz6B-0004U0-00 for ; Mon, 16 Jun 2003 20:52:59 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19RzTi-0007Ve-00 for ; Mon, 16 Jun 2003 21:17:18 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19Rz7G-00017v-LD for emacs-devel@quimby.gnus.org; Mon, 16 Jun 2003 14:54:06 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19Rz3G-00009I-L9 for emacs-devel@gnu.org; Mon, 16 Jun 2003 14:49:58 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19Rz3C-0008WH-El for emacs-devel@gnu.org; Mon, 16 Jun 2003 14:49:55 -0400 Original-Received: from manatee.dms.auburn.edu ([131.204.53.104]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19Rz1C-0007UA-Mu for emacs-devel@gnu.org; Mon, 16 Jun 2003 14:47:50 -0400 Original-Received: from eel.dms.auburn.edu (eel.dms.auburn.edu [131.204.53.108]) h5GIlgoc028648; Mon, 16 Jun 2003 13:47:42 -0500 (CDT) Original-Received: (from teirllm@localhost) by eel.dms.auburn.edu (8.11.6+Sun/8.11.6) id h5GIlwn08741; Mon, 16 Jun 2003 13:47:58 -0500 (CDT) X-Authentication-Warning: eel.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: mmaug@yahoo.com In-reply-to: <20030616170421.37652.qmail@web80512.mail.yahoo.com> (message from Michael Mauger on Mon, 16 Jun 2003 10:04:21 -0700 (PDT)) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:15133 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:15133 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.