From: Tassilo Horn <tsdh@gnu.org>
To: emacs-devel@gnu.org
Subject: Docstrings of minor modes are unclear
Date: Fri, 12 Oct 2012 10:45:42 +0200 [thread overview]
Message-ID: <87ehl4jcy1.fsf@thinkpad.tsdh.de> (raw)
Hi all,
the docstrings of (global) minor modes defined with `define-minor-mode'
and `define-globalized-minor-mode' are a bit unclear. Both say:
If called from Lisp, enable the mode if ARG is omitted or nil.
This is only halfway true. The minor more will be activated if ARG is
omitted or if ARG is not a negative integer or zero.
I've now seen that in the meantime the docstring generated by
`define-minor-mode' has been made a bit accurate in terms of mentioning
'toggle, but it's still not clear.
Any objections to the following patch?
--8<---------------cut here---------------start------------->8---
=== modified file 'lisp/emacs-lisp/easy-mmode.el'
--- lisp/emacs-lisp/easy-mmode.el 2012-09-22 15:24:26 +0000
+++ lisp/emacs-lisp/easy-mmode.el 2012-10-12 08:42:31 +0000
@@ -259,8 +259,11 @@
,(or doc
(format (concat "Toggle %s on or off.
With a prefix argument ARG, enable %s if ARG is
-positive, and disable it otherwise. If called from Lisp, enable
-the mode if ARG is omitted or nil, and toggle it if ARG is `toggle'.
+positive, and disable it otherwise. When called from Lisp,
+toggle the mode if the argument is `toggle', disable the mode if
+the argument is a non-positive integer, and enable the mode
+otherwise including if the argument is omitted or nil or a
+positive integer.
\\{%s}") pretty-name pretty-name keymap-sym))
;; Use `toggle' rather than (if ,mode 0 1) so that using
;; repeat-command still does the toggling correctly.
@@ -381,8 +384,10 @@
;; doc string.
,(format "Toggle %s in all buffers.
With prefix ARG, enable %s if ARG is positive;
-otherwise, disable it. If called from Lisp, enable the mode if
-ARG is omitted or nil.
+otherwise, disable it. If called from Lisp, toggle the mode if
+the argument is `toggle', disable the mode if the argument is a
+non-positive integer, and enable the mode otherwise including if
+the argument is omitted or nil or a positive integer.
%s is enabled in all buffers where
\`%s' would do it.
--8<---------------cut here---------------end--------------->8---
Bye,
Tassilo
next reply other threads:[~2012-10-12 8:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-12 8:45 Tassilo Horn [this message]
2012-10-12 14:30 ` Docstrings of minor modes are unclear 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ehl4jcy1.fsf@thinkpad.tsdh.de \
--to=tsdh@gnu.org \
--cc=emacs-devel@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 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.