aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2005-12-30 03:43:06 +0000
committerRichard M. Stallman2005-12-30 03:43:06 +0000
commit94a867a62c87d09bed70756fc18d97587c73510f (patch)
treea8b0ddab282f9cdcd7068fced8492b73fbd53c01
parent70c6db6c462fe42a70073c5e5f093b23f2bb374b (diff)
downloademacs-94a867a62c87d09bed70756fc18d97587c73510f.tar.gz
emacs-94a867a62c87d09bed70756fc18d97587c73510f.zip
(Mode Line Top): New node.
(Mode Line Data): Some text moved to new node. Explain the data structure more concretely. (Mode Line Basics): Clarifications. (Mode Line Variables): Clarify intro paragraph. (%-Constructs): Clarify intro paragraph. (Mode Line Format): Update menu.
-rw-r--r--lispref/ChangeLog10
-rw-r--r--lispref/modes.texi146
2 files changed, 89 insertions, 67 deletions
diff --git a/lispref/ChangeLog b/lispref/ChangeLog
index e812c834c01..434ff9f1ba4 100644
--- a/lispref/ChangeLog
+++ b/lispref/ChangeLog
@@ -1,3 +1,13 @@
12005-12-29 Richard M. Stallman <rms@gnu.org>
2
3 * modes.texi (Mode Line Top): New node.
4 (Mode Line Data): Some text moved to new node.
5 Explain the data structure more concretely.
6 (Mode Line Basics): Clarifications.
7 (Mode Line Variables): Clarify intro paragraph.
8 (%-Constructs): Clarify intro paragraph.
9 (Mode Line Format): Update menu.
10
12005-12-28 Luc Teirlinck <teirllm@auburn.edu> 112005-12-28 Luc Teirlinck <teirllm@auburn.edu>
2 12
3 * minibuf.texi (Basic Completion): Update lazy-completion-table 13 * minibuf.texi (Basic Completion): Update lazy-completion-table
diff --git a/lispref/modes.texi b/lispref/modes.texi
index 6fd23114044..a5e5699b57c 100644
--- a/lispref/modes.texi
+++ b/lispref/modes.texi
@@ -1520,8 +1520,9 @@ information displayed in the mode line relates to the enabled major and
1520minor modes. 1520minor modes.
1521 1521
1522@menu 1522@menu
1523* Mode Line Basics:: 1523* Base: Mode Line Basics. Basic ideas of mode line control.
1524* Mode Line Data:: The data structure that controls the mode line. 1524* Data: Mode Line Data. The data structure that controls the mode line.
1525* Top: Mode LIne Top. The top level variable, mode-line-format.
1525* Mode Line Variables:: Variables used in that data structure. 1526* Mode Line Variables:: Variables used in that data structure.
1526* %-Constructs:: Putting information into a mode line. 1527* %-Constructs:: Putting information into a mode line.
1527* Properties in Mode:: Using text properties in the mode line. 1528* Properties in Mode:: Using text properties in the mode line.
@@ -1533,12 +1534,13 @@ minor modes.
1533@subsection Mode Line Basics 1534@subsection Mode Line Basics
1534 1535
1535 @code{mode-line-format} is a buffer-local variable that holds a 1536 @code{mode-line-format} is a buffer-local variable that holds a
1536template used to display the mode line of the current buffer. All 1537@dfn{mode line construct}, a kind of template, which controls the
1537windows for the same buffer use the same @code{mode-line-format}, so 1538display the mode line of the current buffer. All windows for the same
1538their mode lines appear the same---except for scrolling percentages, and 1539buffer use the same @code{mode-line-format}, so their mode lines
1539line and column numbers, since those depend on point and on how the 1540appear the same---except for scrolling percentages, and line and
1540window is scrolled. @code{header-line-format} is used likewise for 1541column numbers, since those depend on point and on how the window is
1541header lines. 1542scrolled. The value of @code{header-line-format} specifies the
1543buffer's header line in the same way, with a mode line construct.
1542 1544
1543 For efficiency, Emacs does not recompute the mode line and header 1545 For efficiency, Emacs does not recompute the mode line and header
1544line of a window in every redisplay. It does so when circumstances 1546line of a window in every redisplay. It does so when circumstances
@@ -1567,61 +1569,36 @@ and the frame title.
1567color using the face @code{mode-line}. Other windows' mode lines 1569color using the face @code{mode-line}. Other windows' mode lines
1568appear in the face @code{mode-line-inactive} instead. @xref{Faces}. 1570appear in the face @code{mode-line-inactive} instead. @xref{Faces}.
1569 1571
1570 A window that is just one line tall does not display either a mode
1571line or a header line, even if the variables call for one. A window
1572that is two lines tall cannot display both a mode line and a header
1573line at once; if the variables call for both, only the mode line
1574actually appears.
1575
1576@node Mode Line Data 1572@node Mode Line Data
1577@subsection The Data Structure of the Mode Line 1573@subsection The Data Structure of the Mode Line
1578@cindex mode-line construct 1574@cindex mode-line construct
1579 1575
1580 The mode-line contents are controlled by a data structure of lists, 1576 The mode-line contents are controlled by a data structure called a
1581strings, symbols, and numbers kept in buffer-local variables. The data 1577@dfn{mode-line construct}, made up of lists, strings, symbols, and
1582structure is called a @dfn{mode-line construct}, and it is built in 1578numbers kept in buffer-local variables. Each data type has a specific
1583recursive fashion out of simpler mode-line constructs. The same data 1579meaning for the mode-line appearance, as described below. The same
1584structure is used for constructing frame titles (@pxref{Frame Titles}) 1580data structure is used for constructing frame titles (@pxref{Frame
1585and header lines (@pxref{Header Lines}). 1581Titles}) and header lines (@pxref{Header Lines}).
1586
1587@defvar mode-line-format
1588The value of this variable is a mode-line construct with overall
1589responsibility for the mode-line format. The value of this variable
1590controls which other variables are used to form the mode-line text, and
1591where they appear.
1592
1593If you set this variable to @code{nil} in a buffer, that buffer does not
1594have a mode line.
1595@end defvar
1596
1597 A mode-line construct may be as simple as a fixed string of text, but
1598it usually specifies how to use other variables to construct the text.
1599Many of these variables are themselves defined to have mode-line
1600constructs as their values.
1601 1582
1602 The default value of @code{mode-line-format} incorporates the values 1583 A mode-line construct may be as simple as a fixed string of text,
1603of variables such as @code{mode-line-position} and 1584but it usually specifies how to combine fixed strings with variables'
1604@code{mode-line-modes} (which in turn incorporates the values of the 1585values to construct the text. Many of these variables are themselves
1605variables @code{mode-name} and @code{minor-mode-alist}). Because of 1586defined to have mode-line constructs as their values.
1606this, very few modes need to alter @code{mode-line-format} itself. For
1607most purposes, it is sufficient to alter some of the variables that
1608@code{mode-line-format} either directly or indirectly refers to.
1609 1587
1610 A mode-line construct may be a list, a symbol, or a string. If the 1588 Here are the meanings of various data types as mode-line constructs:
1611value is a list, each element may be a list, a symbol, or a string.
1612
1613 The mode line can display various faces, if the strings that control
1614it have the @code{face} property. @xref{Properties in Mode}. In
1615addition, the face @code{mode-line} is used as a default for the whole
1616mode line (@pxref{Standard Faces,,, emacs, The GNU Emacs Manual}).
1617 1589
1618@table @code 1590@table @code
1619@cindex percent symbol in mode line 1591@cindex percent symbol in mode line
1620@item @var{string} 1592@item @var{string}
1621A string as a mode-line construct is displayed verbatim in the mode line 1593A string as a mode-line construct appears verbatim in the mode line
1622except for @dfn{@code{%}-constructs}. Decimal digits after the @samp{%} 1594except for @dfn{@code{%}-constructs} in it. These stand for
1623specify the field width for space filling on the right (i.e., the data 1595substitution of other data; see @ref{%-Constructs}.
1624is left justified). @xref{%-Constructs}. 1596
1597If the string has @code{face} properties, they are copied into the
1598mode line contents too (@pxref{Properties in Mode}). Any characters
1599in the mode line which have no @code{face} properties are displayed,
1600by default, in the face @code{mode-line} or @code{mode-line-inactive}
1601(@pxref{Standard Faces,,, emacs, The GNU Emacs Manual}).
1625 1602
1626@item @var{symbol} 1603@item @var{symbol}
1627A symbol as a mode-line construct stands for its value. The value of 1604A symbol as a mode-line construct stands for its value. The value of
@@ -1633,11 +1610,13 @@ There is one exception: if the value of @var{symbol} is a string, it is
1633displayed verbatim: the @code{%}-constructs are not recognized. 1610displayed verbatim: the @code{%}-constructs are not recognized.
1634 1611
1635Unless @var{symbol} is marked as ``risky'' (i.e., it has a 1612Unless @var{symbol} is marked as ``risky'' (i.e., it has a
1636non-@code{nil} @code{risky-local-variable} property), all properties in 1613non-@code{nil} @code{risky-local-variable} property), all text
1637any strings, as well as all @code{:eval} and @code{:propertize} forms in 1614properties specified in @var{symbol}'s value are ignored. This
1638the value of that symbol will be ignored. 1615includes the text properties of strings in @var{symbol}'s value, as
1616well as all @code{:eval} and @code{:propertize} forms in it.
1639 1617
1640@item (@var{string} @var{rest}@dots{}) @r{or} (@var{list} @var{rest}@dots{}) 1618@item (@var{string} @var{rest}@dots{})
1619@itemx (@var{list} @var{rest}@dots{})
1641A list whose first element is a string or list means to process all the 1620A list whose first element is a string or list means to process all the
1642elements recursively and concatenate the results. This is the most 1621elements recursively and concatenate the results. This is the most
1643common form of mode-line construct. 1622common form of mode-line construct.
@@ -1650,7 +1629,7 @@ recursion.
1650 1629
1651@item (:propertize @var{elt} @var{props}@dots{}) 1630@item (:propertize @var{elt} @var{props}@dots{})
1652A list whose first element is the symbol @code{:propertize} says to 1631A list whose first element is the symbol @code{:propertize} says to
1653process the mode-line construct @var{elt} recursively and add the text 1632process the mode-line construct @var{elt} recursively, then add the text
1654properties specified by @var{props} to the result. The argument 1633properties specified by @var{props} to the result. The argument
1655@var{props} should consist of zero or more pairs @var{text-property} 1634@var{props} should consist of zero or more pairs @var{text-property}
1656@var{value}. (This feature is new as of Emacs 22.1.) 1635@var{value}. (This feature is new as of Emacs 22.1.)
@@ -1677,6 +1656,29 @@ For example, the usual way to show what percentage of a buffer is above
1677the top of the window is to use a list like this: @code{(-3 "%p")}. 1656the top of the window is to use a list like this: @code{(-3 "%p")}.
1678@end table 1657@end table
1679 1658
1659@node Mode Line Top
1660@subsection The Top Level of Mode Line Control
1661
1662 The variable in overall control of the mode line is
1663@code{mode-line-format}.
1664
1665@defvar mode-line-format
1666The value of this variable is a mode-line construct that controls the
1667contents of the mode-line. It is always buffer-local in all buffers.
1668
1669If you set this variable to @code{nil} in a buffer, that buffer does
1670not have a mode line. (A window that is just one line tall never
1671displays a mode line.)
1672@end defvar
1673
1674 The default value of @code{mode-line-format} is designed to use the
1675values of other variables such as @code{mode-line-position} and
1676@code{mode-line-modes} (which in turn incorporates the values of the
1677variables @code{mode-name} and @code{minor-mode-alist}). Very few
1678modes need to alter @code{mode-line-format} itself. For most
1679purposes, it is sufficient to alter some of the variables that
1680@code{mode-line-format} either directly or indirectly refers to.
1681
1680 If you do alter @code{mode-line-format} itself, the new value should 1682 If you do alter @code{mode-line-format} itself, the new value should
1681use the same variables that appear in the default value (@pxref{Mode 1683use the same variables that appear in the default value (@pxref{Mode
1682Line Variables}), rather than duplicating their contents or displaying 1684Line Variables}), rather than duplicating their contents or displaying
@@ -1730,11 +1732,14 @@ these variable names are also the minor mode command names.)
1730@node Mode Line Variables 1732@node Mode Line Variables
1731@subsection Variables Used in the Mode Line 1733@subsection Variables Used in the Mode Line
1732 1734
1733 This section describes variables incorporated by the 1735 This section describes variables incorporated by the standard value
1734standard value of @code{mode-line-format} into the text of the mode 1736of @code{mode-line-format} into the text of the mode line. There is
1735line. There is nothing inherently special about these variables; any 1737nothing inherently special about these variables; any other variables
1736other variables could have the same effects on the mode line if 1738could have the same effects on the mode line if
1737@code{mode-line-format} were changed to use them. 1739@code{mode-line-format}'s value were changed to use them. However,
1740various parts of Emacs set these variables on the understanding that
1741they will control parts of the mode line; therefore, practically
1742speaking, it is essential for the mode line to use them.
1738 1743
1739@defvar mode-line-mule-info 1744@defvar mode-line-mule-info
1740This variable holds the value of the mode-line construct that displays 1745This variable holds the value of the mode-line construct that displays
@@ -1907,10 +1912,12 @@ specifies addition of text properties.
1907@node %-Constructs 1912@node %-Constructs
1908@subsection @code{%}-Constructs in the Mode Line 1913@subsection @code{%}-Constructs in the Mode Line
1909 1914
1910 The following table lists the recognized @code{%}-constructs and what 1915 Strings used as mode-line constructs can use certain
1911they mean. In any construct except @samp{%%}, you can add a decimal 1916@code{%}-constructs to substitute various kinds of data. Here is a
1912integer after the @samp{%} to specify a minimum field width. If the 1917list of the defined @code{%}-constructs, and what they mean. In any
1913width is less, the field is padded with spaces to the right. 1918construct except @samp{%%}, you can add a decimal integer after the
1919@samp{%} to specify a minimum field width. If the width is less, the
1920field is padded with spaces to the right.
1914 1921
1915@table @code 1922@table @code
1916@item %b 1923@item %b
@@ -2078,6 +2085,11 @@ that do not override it. This is the same as @code{(default-value
2078It is normally @code{nil}, so that ordinary buffers have no header line. 2085It is normally @code{nil}, so that ordinary buffers have no header line.
2079@end defvar 2086@end defvar
2080 2087
2088 A window that is just one line tall never displays a header line. A
2089window that is two lines tall cannot display both a mode line and a
2090header line at once; if it has a mode line, then it does not display a
2091header line.
2092
2081@node Emulating Mode Line 2093@node Emulating Mode Line
2082@subsection Emulating Mode-Line Formatting 2094@subsection Emulating Mode-Line Formatting
2083 2095