From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Re: cua: quiet warning messages Date: Mon, 16 Jun 2003 15:12:57 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200306161912.h5GJCwM1020131@rum.cs.yale.edu> References: <20030616170421.37652.qmail@web80512.mail.yahoo.com> <200306161847.h5GIlwn08741@eel.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1055790904 24010 80.91.224.249 (16 Jun 2003 19:15:04 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 16 Jun 2003 19:15:04 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon Jun 16 21:15:01 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 19RzQo-0006Bu-00 for ; Mon, 16 Jun 2003 21:14:18 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 19RzoL-0007k4-00 for ; Mon, 16 Jun 2003 21:38:37 +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 19RzRd-0004tq-0u for emacs-devel@quimby.gnus.org; Mon, 16 Jun 2003 15:15:09 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19RzQt-0003rN-L6 for emacs-devel@gnu.org; Mon, 16 Jun 2003 15:14:23 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19RzQf-0003if-5j for emacs-devel@gnu.org; Mon, 16 Jun 2003 15:14:10 -0400 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by monty-python.gnu.org with esmtp (Exim 4.20) id 19RzPX-0002wn-VB for emacs-devel@gnu.org; Mon, 16 Jun 2003 15:13:00 -0400 Original-Received: from rum.cs.yale.edu (localhost [127.0.0.1]) by rum.cs.yale.edu (8.12.8/8.12.8) with ESMTP id h5GJCw0i020133; Mon, 16 Jun 2003 15:12:58 -0400 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.12.8/8.12.8/Submit) id h5GJCwM1020131; Mon, 16 Jun 2003 15:12:58 -0400 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: Luc Teirlinck Original-cc: mmaug@yahoo.com 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:15134 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:15134 > 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. That's exactly how modes defined by define-minor-mode behave. > 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 `-'. That's also how define-minor-mode behaves. > 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. 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. Stefan