%
-Constructs in the Mode LineStrings 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
mean.
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 right.
%b
The current buffer name, obtained with the buffer-name
function.
See Buffer Names.
%c
The current column number of point, counting from zero starting at the left margin of the window.
%C
The current column number of point, counting from one starting at the left margin of the window.
%e
When Emacs is nearly out of memory for Lisp objects, a brief message saying so. Otherwise, this is empty.
%f
The visited file name, obtained with the buffer-file-name
function. See Buffer File Name.
%F
The title (only on a window system) or the name of the selected frame. See Basic Parameters.
%i
The size of the accessible part of the current buffer; basically
(- (point-max) (point-min))
.
%I
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 abbreviate.
%l
The current line number of point, counting within the accessible portion of the buffer.
%M
The value of global-mode-string
(which is part of
mode-line-misc-info
by default).
%n
‘Narrow’ when narrowing is in effect; nothing otherwise (see
narrow-to-region
in Narrowing).
%o
The degree of travel of the window through (the visible portion of) the buffer, i.e. the size of the text above the top of the window expressed as a percentage of all the text outside the window, or ‘Top’, ‘Bottom’ or ‘All’.
%p
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.
%P
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’.
%q
The percentages of text above both the top and the bottom of the window, separated by ‘-’, or ‘All’.
%s
The status of the subprocess belonging to the current buffer, obtained with
process-status
. See Process Information.
%z
The mnemonics of keyboard, terminal, and buffer coding systems.
%Z
Like ‘%z’, but including the end-of-line format.
%*
‘%’ if the buffer is read only (see buffer-read-only
);
‘*’ if the buffer is modified (see buffer-modified-p
);
‘-’ otherwise. See Buffer Modification.
%+
‘*’ if the buffer is modified (see buffer-modified-p
);
‘%’ if the buffer is read only (see buffer-read-only
);
‘-’ otherwise. This differs from ‘%*’ only for a modified
read-only buffer. See Buffer Modification.
%&
‘*’ if the buffer is modified, and ‘-’ otherwise.
%@
‘@’ if the buffer’s default-directory
(see Functions that Expand Filenames) is on a remote machine, 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 levels).
%-
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.
%
-ConstructsThe following constructs should no longer be used.
%m
Obsolete; use the mode-name
variable instead. The %m
construct is inadequate, as it produces an empty string if the value
of mode-name
is a non-string mode-line construct (as in
emacs-lisp-mode
, for example).