From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: bug#3688: Also need (auto-fill-mode nil) to trigger this bug Date: Mon, 29 Jun 2009 14:14:01 +0200 Message-ID: References: <200906261356.48352.kees.bakker@altium.nl> <200906291001.56093.kees.bakker@altium.nl> <200906291118.10568.kees.bakker@altium.nl> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1246277666 16056 80.91.229.12 (29 Jun 2009 12:14:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 29 Jun 2009 12:14:26 +0000 (UTC) Cc: emacs-devel@gnu.org To: Kees Bakker Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 29 14:14:18 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MLFkW-0001g5-IJ for ged-emacs-devel@m.gmane.org; Mon, 29 Jun 2009 14:14:16 +0200 Original-Received: from localhost ([127.0.0.1]:42699 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MLFkV-00056v-R4 for ged-emacs-devel@m.gmane.org; Mon, 29 Jun 2009 08:14:15 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MLFkO-00056o-6F for emacs-devel@gnu.org; Mon, 29 Jun 2009 08:14:08 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MLFkJ-00056Z-M7 for emacs-devel@gnu.org; Mon, 29 Jun 2009 08:14:07 -0400 Original-Received: from [199.232.76.173] (port=53487 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MLFkJ-00056W-GG for emacs-devel@gnu.org; Mon, 29 Jun 2009 08:14:03 -0400 Original-Received: from smtp-01.vtx.ch ([212.147.0.84]:44231) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MLFkI-0006RT-VM for emacs-devel@gnu.org; Mon, 29 Jun 2009 08:14:03 -0400 Original-Received: from alfajor.home (dyn.144-85-199-203.dsl.vtx.ch [144.85.199.203]) by smtp-01.vtx.ch (VTX Services SA) with ESMTP id DB3DB27FEA; Mon, 29 Jun 2009 14:14:01 +0200 (CEST) Original-Received: by alfajor.home (Postfix, from userid 20848) id AB0E064341; Mon, 29 Jun 2009 14:14:01 +0200 (CEST) In-Reply-To: <200906291118.10568.kees.bakker@altium.nl> (Kees Bakker's message of "Mon, 29 Jun 2009 11:18:10 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.94 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:111808 Archived-At: >> All minor modes are turned on with a positive arg and turned off with >> a negative arg. A nil argument may toggle it, but that might change in >> the future. A `toggle' argument toggles most (but not all) minor modes. > OK. I didn't know that (and I'm using emacs for almost two decades now). The use of positive/negative to turn the mode on/off is described in the docstring as: With ARG, turn Auto Fill mode on if and only if arg is positive. > Still I want to express my dislike about the way a "nil" arg is handled. I agree. I'd like to change it to behave like a positive arg, but the way it works is just a result of the fact that when used interactively you want the command to toggle when it is not given any prefix argument and the easiest way to do that is to consider nil as "toggle". All minor modes defined using `define-minor-mode' now accept (and use, when called interactively) the value `toggle' to indicate that we want to toggle. They also still accept nil to mean "toggle" but this is the part that I intend to change at some point. > First, is 0 a positive arg? If you don't know, don't use it. There are plenty of obviously-positive arguments to choose from. > (auto-fill-mode -1) ;;; turn off > (auto-fill-mode 1) ;;; turn on These are the two canonical ways to turn the mode ON/OFF. > (auto-fill-mode) ;;; toggles > (auto-fill-mode nil) ;;; toggles auto-fill-mode cannot distinguish between these two cases, so obviously if one toggles, the other will too. [ Well, yes, if it used &rest, it could actually distinguish, but since it doesn't, it can't. ] > (auto-fill-mode 0) ;;; turn off > (auto-fill-mode t) ;;; turn on These two have been used fairly often, but I strongly discourage their use. I think they make about as much sense as (auto-fill-mode "Hi John!") or (auto-fill-mode (make-overlay)) > Toggling for a "nil" argument does not make sense to me. I actually agree. For various reasons (mostly, for use of the function on mode hooks), nil should turn the mode ON unconditionally; but history decided otherwise. Stefan