%-Constructs in the Mode Line
Strings used as mode line constructs can use certain
%-constructs to substitute various kinds of data. The
following is a list of the defined
%-constructs, and what they
In any construct except ‘%%’, you can add a decimal integer
after the ‘%’ to specify a minimum field width. If the width is
less, the field is padded to that width. Purely numeric constructs
(‘c’, ‘i’, ‘I’, and ‘l’) are padded by inserting
spaces to the left, and others are padded by inserting spaces to the
- The current buffer name, obtained with the
See Buffer Names.
- The current column number of point.
- When Emacs is nearly out of memory for Lisp objects, a brief message
saying so. Otherwise, this is empty.
- The visited file name, obtained with the
function. See Buffer File Name.
- The title (only on a window system) or the name of the selected frame.
See Basic Parameters.
- The size of the accessible part of the current buffer; basically
(- (point-max) (point-min)).
- Like ‘%i’, but the size is printed in a more readable way by using
‘k’ for 10^3, ‘M’ for 10^6, ‘G’ for 10^9, etc., to
- The current line number of point, counting within the accessible portion
of the buffer.
- ‘Narrow’ when narrowing is in effect; nothing otherwise (see
narrow-to-region in Narrowing).
- The percentage of the buffer text above the top of window, or
‘Top’, ‘Bottom’ or ‘All’. Note that the default mode
line construct truncates this to three characters.
- The percentage of the buffer text that is above the bottom of
the window (which includes the text visible in the window, as well as
the text above the top), plus ‘Top’ if the top of the buffer is
visible on screen; or ‘Bottom’ or ‘All’.
- The status of the subprocess belonging to the current buffer, obtained with
process-status. See Process Information.
- The mnemonics of keyboard, terminal, and buffer coding systems.
- Like ‘%z’, but including the end-of-line format.
- ‘%’ if the buffer is read only (see
‘*’ if the buffer is modified (see
‘-’ otherwise. See Buffer Modification.
- ‘*’ if the buffer is modified (see
‘%’ if the buffer is read only (see
‘-’ otherwise. This differs from ‘%*’ only for a modified
read-only buffer. See Buffer Modification.
- ‘*’ if the buffer is modified, and ‘-’ otherwise.
- An indication of the depth of recursive editing levels (not counting
minibuffer levels): one ‘[’ for each editing level.
See Recursive Editing.
- One ‘]’ for each recursive editing level (not counting minibuffer
- Dashes sufficient to fill the remainder of the mode line.
- The character ‘%’—this is how to include a literal ‘%’ in a
string in which
%-constructs are allowed.
The following two
%-constructs are still supported, but they are
obsolete, since you can get the same results with the variables
- The value of
- The value of