diff options
| author | Luc Teirlinck | 2005-05-19 23:35:18 +0000 |
|---|---|---|
| committer | Luc Teirlinck | 2005-05-19 23:35:18 +0000 |
| commit | b4a83bb86f7b6aae03f9db2da139ce0317fed844 (patch) | |
| tree | ca931ce5735931e80e1a2d5ec9d6a75c87b2c541 | |
| parent | 6900105fc4ed503a7d97a697f82fbb0fa36cbe27 (diff) | |
| download | emacs-b4a83bb86f7b6aae03f9db2da139ce0317fed844.tar.gz emacs-b4a83bb86f7b6aae03f9db2da139ce0317fed844.zip | |
(Hooks): Delete confusing and unnecessary sentence.
(Major Mode Conventions): Refer to `Auto Major Mode' in more
appropriate place.
(Derived Modes): Small clarifications.
(Minor Mode Conventions, Keymaps and Minor Modes): Replace
references to nodes with references to anchors.
(Mode Line Data): Warn that `(:eval FORM)' should not load any files.
Clarify description of lists whose first element is an integer.
(Mode Line Variables): Add anchor.
(%-Constructs): Clarify description of integer after %.
(Emulating Mode Line): Describe nil value for FACE.
| -rw-r--r-- | lispref/modes.texi | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/lispref/modes.texi b/lispref/modes.texi index f22c16327da..1b30a23e128 100644 --- a/lispref/modes.texi +++ b/lispref/modes.texi | |||
| @@ -88,8 +88,7 @@ in Lisp Interaction mode: | |||
| 88 | @end example | 88 | @end example |
| 89 | 89 | ||
| 90 | At the appropriate time, Emacs uses the @code{run-hooks} function to | 90 | At the appropriate time, Emacs uses the @code{run-hooks} function to |
| 91 | run particular hooks. This function calls the hook functions that have | 91 | run particular hooks. |
| 92 | been added with @code{add-hook}. | ||
| 93 | 92 | ||
| 94 | @defun run-hooks &rest hookvars | 93 | @defun run-hooks &rest hookvars |
| 95 | This function takes one or more normal hook variable names as | 94 | This function takes one or more normal hook variable names as |
| @@ -470,13 +469,13 @@ and Buffer List use this feature. | |||
| 470 | @item | 469 | @item |
| 471 | If you want to make the new mode the default for files with certain | 470 | If you want to make the new mode the default for files with certain |
| 472 | recognizable names, add an element to @code{auto-mode-alist} to select | 471 | recognizable names, add an element to @code{auto-mode-alist} to select |
| 473 | the mode for those file names. If you define the mode command to | 472 | the mode for those file names (@pxref{Auto Major Mode}). If you |
| 474 | autoload, you should add this element in the same file that calls | 473 | define the mode command to autoload, you should add this element in |
| 475 | @code{autoload}. If you use an autoload cookie for the mode command, | 474 | the same file that calls @code{autoload}. If you use an autoload |
| 476 | you can also use an autoload cookie for the form that adds the element | 475 | cookie for the mode command, you can also use an autoload cookie for |
| 477 | (@pxref{autoload cookie}). If you do not autoload the mode command, | 476 | the form that adds the element (@pxref{autoload cookie}). If you do |
| 478 | it is sufficient to add the element in the file that contains the mode | 477 | not autoload the mode command, it is sufficient to add the element in |
| 479 | definition. @xref{Auto Major Mode}. | 478 | the file that contains the mode definition. |
| 480 | 479 | ||
| 481 | @item | 480 | @item |
| 482 | In the comments that document the file, you should provide a sample | 481 | In the comments that document the file, you should provide a sample |
| @@ -1011,13 +1010,13 @@ The new mode has its own abbrev table, kept in the variable | |||
| 1011 | @item | 1010 | @item |
| 1012 | The new mode has its own mode hook, @code{@var{variant}-hook}. It | 1011 | The new mode has its own mode hook, @code{@var{variant}-hook}. It |
| 1013 | runs this hook, after running the hooks of its ancestor modes, with | 1012 | runs this hook, after running the hooks of its ancestor modes, with |
| 1014 | @code{run-mode-hooks} (@pxref{Mode Hooks}). | 1013 | @code{run-mode-hooks}, as the last thing it does. @xref{Mode Hooks}. |
| 1015 | @end itemize | 1014 | @end itemize |
| 1016 | 1015 | ||
| 1017 | In addition, you can specify how to override other aspects of | 1016 | In addition, you can specify how to override other aspects of |
| 1018 | @var{parent} with @var{body}. The command @var{variant} | 1017 | @var{parent} with @var{body}. The command @var{variant} |
| 1019 | evaluates the forms in @var{body} after setting up all its usual | 1018 | evaluates the forms in @var{body} after setting up all its usual |
| 1020 | overrides, just before running @code{@var{variant}-hook}. | 1019 | overrides, just before running the mode hooks. |
| 1021 | 1020 | ||
| 1022 | You can also specify @code{nil} for @var{parent}. This gives the new | 1021 | You can also specify @code{nil} for @var{parent}. This gives the new |
| 1023 | mode no parent. Then @code{define-derived-mode} behaves as described | 1022 | mode no parent. Then @code{define-derived-mode} behaves as described |
| @@ -1262,8 +1261,9 @@ enable or disable the minor mode based on the raw prefix argument value. | |||
| 1262 | 1261 | ||
| 1263 | @item | 1262 | @item |
| 1264 | Add an element to @code{minor-mode-alist} for each minor mode | 1263 | Add an element to @code{minor-mode-alist} for each minor mode |
| 1265 | (@pxref{Mode Line Variables}), if you want to indicate the minor mode in | 1264 | (@pxref{Definition of minor-mode-alist}), if you want to indicate the |
| 1266 | the mode line. This element should be a list of the following form: | 1265 | minor mode in the mode line. This element should be a list of the |
| 1266 | following form: | ||
| 1267 | 1267 | ||
| 1268 | @smallexample | 1268 | @smallexample |
| 1269 | (@var{mode-variable} @var{string}) | 1269 | (@var{mode-variable} @var{string}) |
| @@ -1305,7 +1305,7 @@ should also specify a @code{:set} method which enables the mode by | |||
| 1305 | invoking the mode command. Note in the variable's documentation string that | 1305 | invoking the mode command. Note in the variable's documentation string that |
| 1306 | setting the variable other than via Custom may not take effect. | 1306 | setting the variable other than via Custom may not take effect. |
| 1307 | 1307 | ||
| 1308 | Also mark the definition with an autoload cookie (@pxref{Autoload}), | 1308 | Also mark the definition with an autoload cookie (@pxref{autoload cookie}), |
| 1309 | and specify a @code{:require} so that customizing the variable will load | 1309 | and specify a @code{:require} so that customizing the variable will load |
| 1310 | the library that defines the mode. This will copy suitable definitions | 1310 | the library that defines the mode. This will copy suitable definitions |
| 1311 | into @file{loaddefs.el} so that users can use @code{customize-option} to | 1311 | into @file{loaddefs.el} so that users can use @code{customize-option} to |
| @@ -1334,7 +1334,7 @@ use either \\[customize] or the function `msb-mode'." | |||
| 1334 | 1334 | ||
| 1335 | Each minor mode can have its own keymap, which is active when the mode | 1335 | Each minor mode can have its own keymap, which is active when the mode |
| 1336 | is enabled. To set up a keymap for a minor mode, add an element to the | 1336 | is enabled. To set up a keymap for a minor mode, add an element to the |
| 1337 | alist @code{minor-mode-map-alist}. @xref{Active Keymaps}. | 1337 | alist @code{minor-mode-map-alist}. @xref{Definition of minor-mode-map-alist}. |
| 1338 | 1338 | ||
| 1339 | @cindex @code{self-insert-command}, minor modes | 1339 | @cindex @code{self-insert-command}, minor modes |
| 1340 | One use of minor mode keymaps is to modify the behavior of certain | 1340 | One use of minor mode keymaps is to modify the behavior of certain |
| @@ -1628,7 +1628,9 @@ common form of mode-line construct. | |||
| 1628 | 1628 | ||
| 1629 | @item (:eval @var{form}) | 1629 | @item (:eval @var{form}) |
| 1630 | A list whose first element is the symbol @code{:eval} says to evaluate | 1630 | A list whose first element is the symbol @code{:eval} says to evaluate |
| 1631 | @var{form}, and use the result as a string to display. | 1631 | @var{form}, and use the result as a string to display. Make sure this |
| 1632 | evaluation cannot load any files, as doing so could cause infinite | ||
| 1633 | recursion. | ||
| 1632 | 1634 | ||
| 1633 | @item (:propertize @var{elt} @var{props}@dots{}) | 1635 | @item (:propertize @var{elt} @var{props}@dots{}) |
| 1634 | A list whose first element is the symbol @code{:propertize} says to | 1636 | A list whose first element is the symbol @code{:propertize} says to |
| @@ -1650,9 +1652,10 @@ the value of @var{symbol} is @code{nil}. | |||
| 1650 | A list whose first element is an integer specifies truncation or | 1652 | A list whose first element is an integer specifies truncation or |
| 1651 | padding of the results of @var{rest}. The remaining elements | 1653 | padding of the results of @var{rest}. The remaining elements |
| 1652 | @var{rest} are processed recursively as mode-line constructs and | 1654 | @var{rest} are processed recursively as mode-line constructs and |
| 1653 | concatenated together. Then the result is space filled (if | 1655 | concatenated together. When @var{width} is positive, the result is |
| 1654 | @var{width} is positive) or truncated (to @minus{}@var{width} columns, | 1656 | space filled on the right if its width is less than @var{width}. When |
| 1655 | if @var{width} is negative) on the right. | 1657 | @var{width} is negative, the result is truncated on the right to |
| 1658 | @minus{}@var{width} columns if its width exceeds @minus{}@var{width}. | ||
| 1656 | 1659 | ||
| 1657 | For example, the usual way to show what percentage of a buffer is above | 1660 | For example, the usual way to show what percentage of a buffer is above |
| 1658 | the top of the window is to use a list like this: @code{(-3 "%p")}. | 1661 | the top of the window is to use a list like this: @code{(-3 "%p")}. |
| @@ -1818,6 +1821,7 @@ is @code{nil}. | |||
| 1818 | @end defvar | 1821 | @end defvar |
| 1819 | 1822 | ||
| 1820 | @defvar minor-mode-alist | 1823 | @defvar minor-mode-alist |
| 1824 | @anchor{Definition of minor-mode-alist} | ||
| 1821 | This variable holds an association list whose elements specify how the | 1825 | This variable holds an association list whose elements specify how the |
| 1822 | mode line should indicate that a minor mode is active. Each element of | 1826 | mode line should indicate that a minor mode is active. Each element of |
| 1823 | the @code{minor-mode-alist} should be a two-element list: | 1827 | the @code{minor-mode-alist} should be a two-element list: |
| @@ -1889,7 +1893,8 @@ specifies addition of text properties. | |||
| 1889 | 1893 | ||
| 1890 | The following table lists the recognized @code{%}-constructs and what | 1894 | The following table lists the recognized @code{%}-constructs and what |
| 1891 | they mean. In any construct except @samp{%%}, you can add a decimal | 1895 | they mean. In any construct except @samp{%%}, you can add a decimal |
| 1892 | integer after the @samp{%} to specify how many characters to display. | 1896 | integer after the @samp{%} to specify a minimum field width. If the |
| 1897 | width is less, the field is padded with spaces to the right. | ||
| 1893 | 1898 | ||
| 1894 | @table @code | 1899 | @table @code |
| 1895 | @item %b | 1900 | @item %b |
| @@ -1994,7 +1999,7 @@ The value of @code{global-mode-string}. Currently, only | |||
| 1994 | 1999 | ||
| 1995 | Certain text properties are meaningful in the | 2000 | Certain text properties are meaningful in the |
| 1996 | mode line. The @code{face} property affects the appearance of text; the | 2001 | mode line. The @code{face} property affects the appearance of text; the |
| 1997 | @code{help-echo} property associate help strings with the text, and | 2002 | @code{help-echo} property associates help strings with the text, and |
| 1998 | @code{local-map} can make the text mouse-sensitive. | 2003 | @code{local-map} can make the text mouse-sensitive. |
| 1999 | 2004 | ||
| 2000 | There are four ways to specify text properties for text in the mode | 2005 | There are four ways to specify text properties for text in the mode |
| @@ -2062,7 +2067,7 @@ It is normally @code{nil}, so that ordinary buffers have no header line. | |||
| 2062 | 2067 | ||
| 2063 | You can use the function @code{format-mode-line} to compute | 2068 | You can use the function @code{format-mode-line} to compute |
| 2064 | the text that would appear in a mode line or header line | 2069 | the text that would appear in a mode line or header line |
| 2065 | based on certain mode-line specification. | 2070 | based on a certain mode-line specification. |
| 2066 | 2071 | ||
| 2067 | @defun format-mode-line format &optional face window buffer | 2072 | @defun format-mode-line format &optional face window buffer |
| 2068 | This function formats a line of text according to @var{format} as if | 2073 | This function formats a line of text according to @var{format} as if |
| @@ -2078,7 +2083,8 @@ faces, keymaps, etc., that the mode line would have. And any character | |||
| 2078 | for which no @code{face} property is specified gets a default | 2083 | for which no @code{face} property is specified gets a default |
| 2079 | value which is usually @var{face}. (If @var{face} is @code{t}, | 2084 | value which is usually @var{face}. (If @var{face} is @code{t}, |
| 2080 | that stands for either @code{mode-line} if @var{window} is selected, | 2085 | that stands for either @code{mode-line} if @var{window} is selected, |
| 2081 | otherwise @code{mode-line-inactive}.) | 2086 | otherwise @code{mode-line-inactive}. If @var{face} is @code{nil} or |
| 2087 | omitted, that stands for no face property.) | ||
| 2082 | 2088 | ||
| 2083 | However, if @var{face} is an integer, the value has no text properties. | 2089 | However, if @var{face} is an integer, the value has no text properties. |
| 2084 | 2090 | ||