unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Kees Bakker <kees.bakker@altium.nl>
Cc: emacs-devel@gnu.org
Subject: Re: bug#3688: Also need (auto-fill-mode nil) to trigger this bug
Date: Mon, 29 Jun 2009 14:14:01 +0200	[thread overview]
Message-ID: <jwvtz1z2qo4.fsf-monnier+emacsbugreports@gnu.org> (raw)
In-Reply-To: <200906291118.10568.kees.bakker@altium.nl> (Kees Bakker's message of "Mon, 29 Jun 2009 11:18:10 +0200")

>> 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




  reply	other threads:[~2009-06-29 12:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200906261356.48352.kees.bakker@altium.nl>
2009-06-26 21:14 ` bug#3688: Also need (auto-fill-mode nil) to trigger this bug Alan Mackenzie
2009-06-29  8:01   ` Kees Bakker
2009-06-29  8:54     ` Stefan Monnier
2009-06-29  9:18       ` Kees Bakker
2009-06-29 12:14         ` Stefan Monnier [this message]
2009-06-29 21:37         ` Alan Mackenzie
2009-06-29 14:55       ` Alan Mackenzie

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=jwvtz1z2qo4.fsf-monnier+emacsbugreports@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=kees.bakker@altium.nl \
    /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).