From: "Drew Adams" <drew.adams@oracle.com>
To: 6335@debbugs.gnu.org
Subject: bug#6335: 24.0.50; doc for define-minor-mode: specify ARG
Date: Wed, 2 Jun 2010 15:07:28 -0700 [thread overview]
Message-ID: <C1636476D2C0470DB47E13850DE233EA@us.oracle.com> (raw)
(elisp) Minor Mode Conventions says this about a minor-mode command:
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.
`define-minor-mode' defines such a command. But the doc for
`define-minor-mode' does not let you know the identity of the parameter
(which is ARG) or anything about where its value comes from
interactively. It should, for at least these reasons:
1. A programmer can use the value. It is one thing to know that a
positive arg turns the mode on. It is another thing to know what the
arg name is, so that the command body can recuperate that value and use
it. For example, the body of the command could do something different,
depending on the value:
(cond ((integer arg) (if (> arg 0) do-foo do-fa))
((consp arg) ...)
(arg ...)
(t ...))
2. This would require Emacs developers to maintain `define-minor-mode'
so that the name ARG is respected. Yes, that's a good thing, not a bad
thing. The argument should explicitly be part of the spec defining
`define-minor-mode'. Programmers will anyway use `symbol-function' to
find out what the parameter is, and it is better that Emacs Dev
recognize this, respect the parameter name, and document it.
The doc should also state clearly that the _raw prefix argument_ is used
as ARG interactively. Programmers can then take advantage of that fact
also. Knowing this, they can easily define a minor-mode command that
lets users pass a significant value via a prefix arg.
All of this is important, missing info for programmers.
In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
of 2010-05-23 on G41R2F1
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --no-opt --cflags -Ic:/xpm/include'
next reply other threads:[~2010-06-02 22:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-02 22:07 Drew Adams [this message]
2010-06-03 1:54 ` bug#6335: 24.0.50; doc for define-minor-mode: specify ARG Stefan Monnier
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=C1636476D2C0470DB47E13850DE233EA@us.oracle.com \
--to=drew.adams@oracle.com \
--cc=6335@debbugs.gnu.org \
/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).