diff options
| author | Richard M. Stallman | 2005-12-30 03:43:06 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-12-30 03:43:06 +0000 |
| commit | 94a867a62c87d09bed70756fc18d97587c73510f (patch) | |
| tree | a8b0ddab282f9cdcd7068fced8492b73fbd53c01 | |
| parent | 70c6db6c462fe42a70073c5e5f093b23f2bb374b (diff) | |
| download | emacs-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/ChangeLog | 10 | ||||
| -rw-r--r-- | lispref/modes.texi | 146 |
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 @@ | |||
| 1 | 2005-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 | |||
| 1 | 2005-12-28 Luc Teirlinck <teirllm@auburn.edu> | 11 | 2005-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 | |||
| 1520 | minor modes. | 1520 | minor 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 |
| 1536 | template used to display the mode line of the current buffer. All | 1537 | @dfn{mode line construct}, a kind of template, which controls the |
| 1537 | windows for the same buffer use the same @code{mode-line-format}, so | 1538 | display the mode line of the current buffer. All windows for the same |
| 1538 | their mode lines appear the same---except for scrolling percentages, and | 1539 | buffer use the same @code{mode-line-format}, so their mode lines |
| 1539 | line and column numbers, since those depend on point and on how the | 1540 | appear the same---except for scrolling percentages, and line and |
| 1540 | window is scrolled. @code{header-line-format} is used likewise for | 1541 | column numbers, since those depend on point and on how the window is |
| 1541 | header lines. | 1542 | scrolled. The value of @code{header-line-format} specifies the |
| 1543 | buffer'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 |
| 1544 | line of a window in every redisplay. It does so when circumstances | 1546 | line of a window in every redisplay. It does so when circumstances |
| @@ -1567,61 +1569,36 @@ and the frame title. | |||
| 1567 | color using the face @code{mode-line}. Other windows' mode lines | 1569 | color using the face @code{mode-line}. Other windows' mode lines |
| 1568 | appear in the face @code{mode-line-inactive} instead. @xref{Faces}. | 1570 | appear 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 | ||
| 1571 | line or a header line, even if the variables call for one. A window | ||
| 1572 | that is two lines tall cannot display both a mode line and a header | ||
| 1573 | line at once; if the variables call for both, only the mode line | ||
| 1574 | actually 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 |
| 1581 | strings, symbols, and numbers kept in buffer-local variables. The data | 1577 | @dfn{mode-line construct}, made up of lists, strings, symbols, and |
| 1582 | structure is called a @dfn{mode-line construct}, and it is built in | 1578 | numbers kept in buffer-local variables. Each data type has a specific |
| 1583 | recursive fashion out of simpler mode-line constructs. The same data | 1579 | meaning for the mode-line appearance, as described below. The same |
| 1584 | structure is used for constructing frame titles (@pxref{Frame Titles}) | 1580 | data structure is used for constructing frame titles (@pxref{Frame |
| 1585 | and header lines (@pxref{Header Lines}). | 1581 | Titles}) and header lines (@pxref{Header Lines}). |
| 1586 | |||
| 1587 | @defvar mode-line-format | ||
| 1588 | The value of this variable is a mode-line construct with overall | ||
| 1589 | responsibility for the mode-line format. The value of this variable | ||
| 1590 | controls which other variables are used to form the mode-line text, and | ||
| 1591 | where they appear. | ||
| 1592 | |||
| 1593 | If you set this variable to @code{nil} in a buffer, that buffer does not | ||
| 1594 | have a mode line. | ||
| 1595 | @end defvar | ||
| 1596 | |||
| 1597 | A mode-line construct may be as simple as a fixed string of text, but | ||
| 1598 | it usually specifies how to use other variables to construct the text. | ||
| 1599 | Many of these variables are themselves defined to have mode-line | ||
| 1600 | constructs 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, |
| 1603 | of variables such as @code{mode-line-position} and | 1584 | but it usually specifies how to combine fixed strings with variables' |
| 1604 | @code{mode-line-modes} (which in turn incorporates the values of the | 1585 | values to construct the text. Many of these variables are themselves |
| 1605 | variables @code{mode-name} and @code{minor-mode-alist}). Because of | 1586 | defined to have mode-line constructs as their values. |
| 1606 | this, very few modes need to alter @code{mode-line-format} itself. For | ||
| 1607 | most 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: |
| 1611 | value 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 | ||
| 1614 | it have the @code{face} property. @xref{Properties in Mode}. In | ||
| 1615 | addition, the face @code{mode-line} is used as a default for the whole | ||
| 1616 | mode 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} |
| 1621 | A string as a mode-line construct is displayed verbatim in the mode line | 1593 | A string as a mode-line construct appears verbatim in the mode line |
| 1622 | except for @dfn{@code{%}-constructs}. Decimal digits after the @samp{%} | 1594 | except for @dfn{@code{%}-constructs} in it. These stand for |
| 1623 | specify the field width for space filling on the right (i.e., the data | 1595 | substitution of other data; see @ref{%-Constructs}. |
| 1624 | is left justified). @xref{%-Constructs}. | 1596 | |
| 1597 | If the string has @code{face} properties, they are copied into the | ||
| 1598 | mode line contents too (@pxref{Properties in Mode}). Any characters | ||
| 1599 | in the mode line which have no @code{face} properties are displayed, | ||
| 1600 | by 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} |
| 1627 | A symbol as a mode-line construct stands for its value. The value of | 1604 | A 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 | |||
| 1633 | displayed verbatim: the @code{%}-constructs are not recognized. | 1610 | displayed verbatim: the @code{%}-constructs are not recognized. |
| 1634 | 1611 | ||
| 1635 | Unless @var{symbol} is marked as ``risky'' (i.e., it has a | 1612 | Unless @var{symbol} is marked as ``risky'' (i.e., it has a |
| 1636 | non-@code{nil} @code{risky-local-variable} property), all properties in | 1613 | non-@code{nil} @code{risky-local-variable} property), all text |
| 1637 | any strings, as well as all @code{:eval} and @code{:propertize} forms in | 1614 | properties specified in @var{symbol}'s value are ignored. This |
| 1638 | the value of that symbol will be ignored. | 1615 | includes the text properties of strings in @var{symbol}'s value, as |
| 1616 | well 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{}) | ||
| 1641 | A list whose first element is a string or list means to process all the | 1620 | A list whose first element is a string or list means to process all the |
| 1642 | elements recursively and concatenate the results. This is the most | 1621 | elements recursively and concatenate the results. This is the most |
| 1643 | common form of mode-line construct. | 1622 | common 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{}) |
| 1652 | A list whose first element is the symbol @code{:propertize} says to | 1631 | A list whose first element is the symbol @code{:propertize} says to |
| 1653 | process the mode-line construct @var{elt} recursively and add the text | 1632 | process the mode-line construct @var{elt} recursively, then add the text |
| 1654 | properties specified by @var{props} to the result. The argument | 1633 | properties 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 | |||
| 1677 | the top of the window is to use a list like this: @code{(-3 "%p")}. | 1656 | the 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 | ||
| 1666 | The value of this variable is a mode-line construct that controls the | ||
| 1667 | contents of the mode-line. It is always buffer-local in all buffers. | ||
| 1668 | |||
| 1669 | If you set this variable to @code{nil} in a buffer, that buffer does | ||
| 1670 | not have a mode line. (A window that is just one line tall never | ||
| 1671 | displays a mode line.) | ||
| 1672 | @end defvar | ||
| 1673 | |||
| 1674 | The default value of @code{mode-line-format} is designed to use the | ||
| 1675 | values of other variables such as @code{mode-line-position} and | ||
| 1676 | @code{mode-line-modes} (which in turn incorporates the values of the | ||
| 1677 | variables @code{mode-name} and @code{minor-mode-alist}). Very few | ||
| 1678 | modes need to alter @code{mode-line-format} itself. For most | ||
| 1679 | purposes, 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 |
| 1681 | use the same variables that appear in the default value (@pxref{Mode | 1683 | use the same variables that appear in the default value (@pxref{Mode |
| 1682 | Line Variables}), rather than duplicating their contents or displaying | 1684 | Line 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 |
| 1734 | standard value of @code{mode-line-format} into the text of the mode | 1736 | of @code{mode-line-format} into the text of the mode line. There is |
| 1735 | line. There is nothing inherently special about these variables; any | 1737 | nothing inherently special about these variables; any other variables |
| 1736 | other variables could have the same effects on the mode line if | 1738 | could 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, |
| 1740 | various parts of Emacs set these variables on the understanding that | ||
| 1741 | they will control parts of the mode line; therefore, practically | ||
| 1742 | speaking, it is essential for the mode line to use them. | ||
| 1738 | 1743 | ||
| 1739 | @defvar mode-line-mule-info | 1744 | @defvar mode-line-mule-info |
| 1740 | This variable holds the value of the mode-line construct that displays | 1745 | This 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 |
| 1911 | they mean. In any construct except @samp{%%}, you can add a decimal | 1916 | @code{%}-constructs to substitute various kinds of data. Here is a |
| 1912 | integer after the @samp{%} to specify a minimum field width. If the | 1917 | list of the defined @code{%}-constructs, and what they mean. In any |
| 1913 | width is less, the field is padded with spaces to the right. | 1918 | construct except @samp{%%}, you can add a decimal integer after the |
| 1919 | @samp{%} to specify a minimum field width. If the width is less, the | ||
| 1920 | field 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 | |||
| 2078 | It is normally @code{nil}, so that ordinary buffers have no header line. | 2085 | It 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 | ||
| 2089 | window that is two lines tall cannot display both a mode line and a | ||
| 2090 | header line at once; if it has a mode line, then it does not display a | ||
| 2091 | header 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 | ||