aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2012-02-07 00:26:54 -0800
committerGlenn Morris2012-02-07 00:26:54 -0800
commit60d47423d1f05071b96857860a8281b318931bee (patch)
tree1174c0c7270f250aea285d4acc6599d74f943d61
parentbba26374d0465e50338493a43eaa35312f8612d2 (diff)
downloademacs-60d47423d1f05071b96857860a8281b318931bee.tar.gz
emacs-60d47423d1f05071b96857860a8281b318931bee.zip
Doc updates for define-minor-mode argument behavior
* doc/lispref/modes.texi (Defining Minor Modes): Expand on args of defined minor modes. * lisp/emacs-lisp/easy-mmode.el (define-minor-mode): Doc fixes for the macro and the mode it defines.
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/modes.texi35
-rw-r--r--etc/NEWS7
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/emacs-lisp/easy-mmode.el10
5 files changed, 42 insertions, 18 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 04d1234be06..a172f82d2e5 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
12012-02-07 Glenn Morris <rgm@gnu.org>
2
3 * modes.texi (Defining Minor Modes):
4 Expand on args of defined minor modes.
5
12012-02-07 Chong Yidong <cyd@gnu.org> 62012-02-07 Chong Yidong <cyd@gnu.org>
2 7
3 * variables.texi (Creating Buffer-Local): Minor clarification 8 * variables.texi (Creating Buffer-Local): Minor clarification
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index b4aa39dfbb9..052fd037167 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -1380,11 +1380,21 @@ implementing a mode in one self-contained definition.
1380@defmac define-minor-mode mode doc [init-value [lighter [keymap]]] keyword-args@dots{} body@dots{} 1380@defmac define-minor-mode mode doc [init-value [lighter [keymap]]] keyword-args@dots{} body@dots{}
1381This macro defines a new minor mode whose name is @var{mode} (a 1381This macro defines a new minor mode whose name is @var{mode} (a
1382symbol). It defines a command named @var{mode} to toggle the minor 1382symbol). It defines a command named @var{mode} to toggle the minor
1383mode, with @var{doc} as its documentation string. By default, it also 1383mode, with @var{doc} as its documentation string.
1384defines a variable named @var{mode}, which is set to @code{t} or 1384
1385@code{nil} by enabling or disabling the mode. The variable is 1385The toggle command takes one optional (prefix) argument.
1386initialized to @var{init-value}. Except in unusual circumstances (see 1386If called interactively with no argument it toggles the mode on or off.
1387below), this value must be @code{nil}. 1387A positive prefix argument enables the mode, any other prefix argument
1388disables it. From Lisp, an argument of @code{toggle} toggles the mode,
1389whereas an omitted or @code{nil} argument enables the mode.
1390This makes it easy to enable the minor mode in a major mode hook, for example.
1391If @var{doc} is nil, the macro supplies a default documentation string
1392explaining the above.
1393
1394By default, it also defines a variable named @var{mode}, which is set to
1395@code{t} or @code{nil} by enabling or disabling the mode. The variable
1396is initialized to @var{init-value}. Except in unusual circumstances
1397(see below), this value must be @code{nil}.
1388 1398
1389The string @var{lighter} says what to display in the mode line 1399The string @var{lighter} says what to display in the mode line
1390when the mode is enabled; if it is @code{nil}, the mode is not displayed 1400when the mode is enabled; if it is @code{nil}, the mode is not displayed
@@ -1478,9 +1488,10 @@ for this macro.
1478@smallexample 1488@smallexample
1479(define-minor-mode hungry-mode 1489(define-minor-mode hungry-mode
1480 "Toggle Hungry mode. 1490 "Toggle Hungry mode.
1481With no argument, this command toggles the mode. 1491Interactively with no argument, this command toggles the mode.
1482Non-null prefix argument turns on the mode. 1492A positive prefix argument enables the mode, any other prefix
1483Null prefix argument turns off the mode. 1493argument disables it. From Lisp, argument omitted or nil enables
1494the mode, `toggle' toggles the state.
1484 1495
1485When Hungry mode is enabled, the control delete key 1496When Hungry mode is enabled, the control delete key
1486gobbles all preceding whitespace except the last. 1497gobbles all preceding whitespace except the last.
@@ -1509,13 +1520,7 @@ minor modes don't need any.
1509@smallexample 1520@smallexample
1510(define-minor-mode hungry-mode 1521(define-minor-mode hungry-mode
1511 "Toggle Hungry mode. 1522 "Toggle Hungry mode.
1512With no argument, this command toggles the mode. 1523...rest of documentation as before..."
1513Non-null prefix argument turns on the mode.
1514Null prefix argument turns off the mode.
1515
1516When Hungry mode is enabled, the control delete key
1517gobbles all preceding whitespace except the last.
1518See the command \\[hungry-electric-delete]."
1519 ;; The initial value. 1524 ;; The initial value.
1520 :init-value nil 1525 :init-value nil
1521 ;; The indicator for the mode line. 1526 ;; The indicator for the mode line.
diff --git a/etc/NEWS b/etc/NEWS
index da561513745..5866a065252 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1012,8 +1012,11 @@ trouble seems to be an old-style backquote followed by a newline.
1012view-file has since Emacs 22 (ie, it won't enable View mode if the 1012view-file has since Emacs 22 (ie, it won't enable View mode if the
1013major-mode is special). 1013major-mode is special).
1014 1014
1015** Passing a nil argument to a minor mode function now turns the mode 1015** Passing a nil argument to a minor mode defined by define-minor-mode
1016ON unconditionally. 1016now turns the mode ON unconditionally. This is so that you can write, e.g.
1017 (add-hook 'text-mode-hook 'foo-minor-mode)
1018to enable foo-minor-mode in Text mode buffers, thus removing the need
1019for `turn-on-foo-minor-mode' style functions.
1017 1020
1018+++ 1021+++
1019** During startup, Emacs no longer adds entries for `menu-bar-lines' 1022** During startup, Emacs no longer adds entries for `menu-bar-lines'
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 66025e2ec91..f69b94fdb7b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12012-02-07 Glenn Morris <rgm@gnu.org> 12012-02-07 Glenn Morris <rgm@gnu.org>
2 2
3 * emacs-lisp/easy-mmode.el (define-minor-mode):
4 Doc fixes for the macro and the mode it defines.
5
3 * image.el (imagemagick-types-inhibit): Doc fix. 6 * image.el (imagemagick-types-inhibit): Doc fix.
4 7
5 * cus-start.el (imagemagick-render-type): Add it. 8 * cus-start.el (imagemagick-render-type): Add it.
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index d871f6f1212..dbacba6cd29 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -90,6 +90,14 @@ This defines the toggle command MODE and (by default) a control variable
90MODE (you can override this with the :variable keyword, see below). 90MODE (you can override this with the :variable keyword, see below).
91DOC is the documentation for the mode toggle command. 91DOC is the documentation for the mode toggle command.
92 92
93The defined mode command takes one optional (prefix) argument.
94Interactively with no prefix argument it toggles the mode.
95With a prefix argument, it enables the mode if the argument is
96positive and otherwise disables it. When called from Lisp, it
97enables the mode if the argument is omitted or nil, and toggles
98the mode if the argument is `toggle'. If DOC is nil this
99function adds a basic doc-string stating these facts.
100
93Optional INIT-VALUE is the initial value of the mode's variable. 101Optional INIT-VALUE is the initial value of the mode's variable.
94Optional LIGHTER is displayed in the modeline when the mode is on. 102Optional LIGHTER is displayed in the modeline when the mode is on.
95Optional KEYMAP is the default keymap bound to the mode keymap. 103Optional KEYMAP is the default keymap bound to the mode keymap.
@@ -242,7 +250,7 @@ or call the function `%s'."))))
242 (format (concat "Toggle %s on or off. 250 (format (concat "Toggle %s on or off.
243With a prefix argument ARG, enable %s if ARG is 251With a prefix argument ARG, enable %s if ARG is
244positive, and disable it otherwise. If called from Lisp, enable 252positive, and disable it otherwise. If called from Lisp, enable
245the mode if ARG is omitted or nil. 253the mode if ARG is omitted or nil, and toggle it if ARG is `toggle'.
246\\{%s}") pretty-name pretty-name keymap-sym)) 254\\{%s}") pretty-name pretty-name keymap-sym))
247 ;; Use `toggle' rather than (if ,mode 0 1) so that using 255 ;; Use `toggle' rather than (if ,mode 0 1) so that using
248 ;; repeat-command still does the toggling correctly. 256 ;; repeat-command still does the toggling correctly.