diff options
| author | Glenn Morris | 2012-02-07 00:26:54 -0800 |
|---|---|---|
| committer | Glenn Morris | 2012-02-07 00:26:54 -0800 |
| commit | 60d47423d1f05071b96857860a8281b318931bee (patch) | |
| tree | 1174c0c7270f250aea285d4acc6599d74f943d61 /doc | |
| parent | bba26374d0465e50338493a43eaa35312f8612d2 (diff) | |
| download | emacs-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.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/lispref/modes.texi | 35 |
2 files changed, 25 insertions, 15 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 @@ | |||
| 1 | 2012-02-07 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * modes.texi (Defining Minor Modes): | ||
| 4 | Expand on args of defined minor modes. | ||
| 5 | |||
| 1 | 2012-02-07 Chong Yidong <cyd@gnu.org> | 6 | 2012-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{} |
| 1381 | This macro defines a new minor mode whose name is @var{mode} (a | 1381 | This macro defines a new minor mode whose name is @var{mode} (a |
| 1382 | symbol). It defines a command named @var{mode} to toggle the minor | 1382 | symbol). It defines a command named @var{mode} to toggle the minor |
| 1383 | mode, with @var{doc} as its documentation string. By default, it also | 1383 | mode, with @var{doc} as its documentation string. |
| 1384 | defines 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 | 1385 | The toggle command takes one optional (prefix) argument. |
| 1386 | initialized to @var{init-value}. Except in unusual circumstances (see | 1386 | If called interactively with no argument it toggles the mode on or off. |
| 1387 | below), this value must be @code{nil}. | 1387 | A positive prefix argument enables the mode, any other prefix argument |
| 1388 | disables it. From Lisp, an argument of @code{toggle} toggles the mode, | ||
| 1389 | whereas an omitted or @code{nil} argument enables the mode. | ||
| 1390 | This makes it easy to enable the minor mode in a major mode hook, for example. | ||
| 1391 | If @var{doc} is nil, the macro supplies a default documentation string | ||
| 1392 | explaining the above. | ||
| 1393 | |||
| 1394 | By 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 | ||
| 1396 | is initialized to @var{init-value}. Except in unusual circumstances | ||
| 1397 | (see below), this value must be @code{nil}. | ||
| 1388 | 1398 | ||
| 1389 | The string @var{lighter} says what to display in the mode line | 1399 | The string @var{lighter} says what to display in the mode line |
| 1390 | when the mode is enabled; if it is @code{nil}, the mode is not displayed | 1400 | when 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. |
| 1481 | With no argument, this command toggles the mode. | 1491 | Interactively with no argument, this command toggles the mode. |
| 1482 | Non-null prefix argument turns on the mode. | 1492 | A positive prefix argument enables the mode, any other prefix |
| 1483 | Null prefix argument turns off the mode. | 1493 | argument disables it. From Lisp, argument omitted or nil enables |
| 1494 | the mode, `toggle' toggles the state. | ||
| 1484 | 1495 | ||
| 1485 | When Hungry mode is enabled, the control delete key | 1496 | When Hungry mode is enabled, the control delete key |
| 1486 | gobbles all preceding whitespace except the last. | 1497 | gobbles 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. |
| 1512 | With no argument, this command toggles the mode. | 1523 | ...rest of documentation as before..." |
| 1513 | Non-null prefix argument turns on the mode. | ||
| 1514 | Null prefix argument turns off the mode. | ||
| 1515 | |||
| 1516 | When Hungry mode is enabled, the control delete key | ||
| 1517 | gobbles all preceding whitespace except the last. | ||
| 1518 | See 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. |