GNU bug report logs - #4102
23.1.50; recentf-mode nil but toggles

Previous Next

Package: emacs;

Reported by: "Xah Lee" <xah <at> xahlee.org>

Date: Mon, 10 Aug 2009 08:15:05 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Xah Lee <xahlee <at> gmail.com>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: bug-gnu-emacs <at> gnu.org
Subject: bug#4102: 23.1.50; recentf-mode nil but toggles
Date: Wed, 12 Aug 2009 21:53:13 -0700
[Message part 1 (text/plain, inline)]
Thanks Drew and all in this thread for the info.
 Xah

On Wed, Aug 12, 2009 at 9:15 PM, Drew Adams <drew.adams <at> oracle.com> wrote:

> > Is there somewhere in elisp manual that
> > explicitly explains/warns that commands that turn minor mode on/off
> > stick to 1 and 0 and consider t and nil not acceptable argument?
>
> (elisp) Minor Mode Conventions:
>
>   * Define a command whose name is the same as the mode variable.  Its
>     job is to enable and disable the mode by setting the variable.
>
>     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).  It should turn the mode on if the argument is a
>     positive integer, the symbol `t', or a list whose CAR is one of
>     those.  It should turn the mode off if the argument is a negative
>     integer or zero, the symbol `-', or a list whose CAR is a negative
>     integer or zero.  The meaning of other arguments is not specified.
>
>     Here is an example taken from the definition of
>     `transient-mark-mode'.  It shows the use of `transient-mark-mode'
>     as a variable that enables or disables the mode's behavior, and
>     also shows the proper way to toggle, enable or disable the minor
>     mode based on the raw prefix argument value.
>
>          (setq transient-mark-mode
>                (if (null arg) (not transient-mark-mode)
>                  (> (prefix-numeric-value arg) 0)))
>
> Any positive integer is the same as 1.
> Any negative integer is the same as 0.
>
>  t  is the same as 1.
> `-' is the same as 0.
>
>  (4) is the same as 1.
> (-4) is the same as 0.
>  (0) is the same as 0.
>
> (t) is the same as 1.
>
> (nil) and (-): behavior not conventionally defined
>
> nil always toggles. It lets you do just `M-x foo' to toggle (the most
> common
> change).
>
> You can do `C-u M-x foo' or `C-9 M-x foo' to turn it on and `C-- M-x foo'
> to
> turn it off.
>
> etc.
>
>


-- 
 Xah
∑ http://xahlee.org/
[Message part 2 (text/html, inline)]

This bug report was last modified 15 years and 340 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.