From: Xah Lee <xahlee@gmail.com>
To: Drew Adams <drew.adams@oracle.com>
Cc: bug-gnu-emacs@gnu.org
Subject: bug#4102: 23.1.50; recentf-mode nil but toggles
Date: Wed, 12 Aug 2009 21:53:13 -0700 [thread overview]
Message-ID: <aa6b5cbe0908122153o693ddbacy4c5e01583dce8607@mail.gmail.com> (raw)
In-Reply-To: <F383C07A3CCF4CD6A513E6C1E77C1FF9@us.oracle.com>
[-- Attachment #1: Type: text/plain, Size: 2067 bytes --]
Thanks Drew and all in this thread for the info.
Xah
On Wed, Aug 12, 2009 at 9:15 PM, Drew Adams <drew.adams@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/
[-- Attachment #2: Type: text/html, Size: 2617 bytes --]
prev parent reply other threads:[~2009-08-13 4:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-10 8:06 bug#4102: 23.1.50; recentf-mode nil but toggles Xah Lee
2009-08-10 16:40 ` Stefan Monnier
2009-08-11 2:01 ` Xah Lee
2009-08-12 4:05 ` Kevin Rodgers
2009-08-13 17:36 ` Stefan Monnier
[not found] ` <mailman.4441.1250051225.2239.bug-gnu-emacs@gnu.org>
2009-08-12 19:33 ` Xah Lee
2009-08-13 4:15 ` Drew Adams
2009-08-13 4:53 ` Xah Lee [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aa6b5cbe0908122153o693ddbacy4c5e01583dce8607@mail.gmail.com \
--to=xahlee@gmail.com \
--cc=4102@emacsbugs.donarmstrong.com \
--cc=bug-gnu-emacs@gnu.org \
--cc=drew.adams@oracle.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.