aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Teirlinck2005-05-19 23:35:18 +0000
committerLuc Teirlinck2005-05-19 23:35:18 +0000
commitb4a83bb86f7b6aae03f9db2da139ce0317fed844 (patch)
treeca931ce5735931e80e1a2d5ec9d6a75c87b2c541
parent6900105fc4ed503a7d97a697f82fbb0fa36cbe27 (diff)
downloademacs-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.texi52
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
91run particular hooks. This function calls the hook functions that have 91run particular hooks.
92been added with @code{add-hook}.
93 92
94@defun run-hooks &rest hookvars 93@defun run-hooks &rest hookvars
95This function takes one or more normal hook variable names as 94This function takes one or more normal hook variable names as
@@ -470,13 +469,13 @@ and Buffer List use this feature.
470@item 469@item
471If you want to make the new mode the default for files with certain 470If you want to make the new mode the default for files with certain
472recognizable names, add an element to @code{auto-mode-alist} to select 471recognizable names, add an element to @code{auto-mode-alist} to select
473the mode for those file names. If you define the mode command to 472the mode for those file names (@pxref{Auto Major Mode}). If you
474autoload, you should add this element in the same file that calls 473define the mode command to autoload, you should add this element in
475@code{autoload}. If you use an autoload cookie for the mode command, 474the same file that calls @code{autoload}. If you use an autoload
476you can also use an autoload cookie for the form that adds the element 475cookie for the mode command, you can also use an autoload cookie for
477(@pxref{autoload cookie}). If you do not autoload the mode command, 476the form that adds the element (@pxref{autoload cookie}). If you do
478it is sufficient to add the element in the file that contains the mode 477not autoload the mode command, it is sufficient to add the element in
479definition. @xref{Auto Major Mode}. 478the file that contains the mode definition.
480 479
481@item 480@item
482In the comments that document the file, you should provide a sample 481In 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
1012The new mode has its own mode hook, @code{@var{variant}-hook}. It 1011The new mode has its own mode hook, @code{@var{variant}-hook}. It
1013runs this hook, after running the hooks of its ancestor modes, with 1012runs 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
1017In addition, you can specify how to override other aspects of 1016In 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}
1019evaluates the forms in @var{body} after setting up all its usual 1018evaluates the forms in @var{body} after setting up all its usual
1020overrides, just before running @code{@var{variant}-hook}. 1019overrides, just before running the mode hooks.
1021 1020
1022You can also specify @code{nil} for @var{parent}. This gives the new 1021You can also specify @code{nil} for @var{parent}. This gives the new
1023mode no parent. Then @code{define-derived-mode} behaves as described 1022mode 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
1264Add an element to @code{minor-mode-alist} for each minor mode 1263Add 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
1266the mode line. This element should be a list of the following form: 1265minor mode in the mode line. This element should be a list of the
1266following 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
1305invoking the mode command. Note in the variable's documentation string that 1305invoking the mode command. Note in the variable's documentation string that
1306setting the variable other than via Custom may not take effect. 1306setting 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}),
1309and specify a @code{:require} so that customizing the variable will load 1309and specify a @code{:require} so that customizing the variable will load
1310the library that defines the mode. This will copy suitable definitions 1310the library that defines the mode. This will copy suitable definitions
1311into @file{loaddefs.el} so that users can use @code{customize-option} to 1311into @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
1336is enabled. To set up a keymap for a minor mode, add an element to the 1336is enabled. To set up a keymap for a minor mode, add an element to the
1337alist @code{minor-mode-map-alist}. @xref{Active Keymaps}. 1337alist @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})
1630A list whose first element is the symbol @code{:eval} says to evaluate 1630A 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
1632evaluation cannot load any files, as doing so could cause infinite
1633recursion.
1632 1634
1633@item (:propertize @var{elt} @var{props}@dots{}) 1635@item (:propertize @var{elt} @var{props}@dots{})
1634A list whose first element is the symbol @code{:propertize} says to 1636A list whose first element is the symbol @code{:propertize} says to
@@ -1650,9 +1652,10 @@ the value of @var{symbol} is @code{nil}.
1650A list whose first element is an integer specifies truncation or 1652A list whose first element is an integer specifies truncation or
1651padding of the results of @var{rest}. The remaining elements 1653padding 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
1653concatenated together. Then the result is space filled (if 1655concatenated together. When @var{width} is positive, the result is
1654@var{width} is positive) or truncated (to @minus{}@var{width} columns, 1656space filled on the right if its width is less than @var{width}. When
1655if @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
1657For example, the usual way to show what percentage of a buffer is above 1660For example, the usual way to show what percentage of a buffer is above
1658the top of the window is to use a list like this: @code{(-3 "%p")}. 1661the 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}
1821This variable holds an association list whose elements specify how the 1825This variable holds an association list whose elements specify how the
1822mode line should indicate that a minor mode is active. Each element of 1826mode line should indicate that a minor mode is active. Each element of
1823the @code{minor-mode-alist} should be a two-element list: 1827the @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
1891they mean. In any construct except @samp{%%}, you can add a decimal 1895they mean. In any construct except @samp{%%}, you can add a decimal
1892integer after the @samp{%} to specify how many characters to display. 1896integer after the @samp{%} to specify a minimum field width. If the
1897width 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
1996mode line. The @code{face} property affects the appearance of text; the 2001mode 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
2064the text that would appear in a mode line or header line 2069the text that would appear in a mode line or header line
2065based on certain mode-line specification. 2070based 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
2068This function formats a line of text according to @var{format} as if 2073This 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
2078for which no @code{face} property is specified gets a default 2083for which no @code{face} property is specified gets a default
2079value which is usually @var{face}. (If @var{face} is @code{t}, 2084value which is usually @var{face}. (If @var{face} is @code{t},
2080that stands for either @code{mode-line} if @var{window} is selected, 2085that stands for either @code{mode-line} if @var{window} is selected,
2081otherwise @code{mode-line-inactive}.) 2086otherwise @code{mode-line-inactive}. If @var{face} is @code{nil} or
2087omitted, that stands for no face property.)
2082 2088
2083However, if @var{face} is an integer, the value has no text properties. 2089However, if @var{face} is an integer, the value has no text properties.
2084 2090