Variable: mode-line-format
mode-line-format is a customizable and buffer-local variable defined
in buffer.c.
Documentation
Template for displaying mode line for a window's buffer.
The value may be nil, a string, a symbol or a list.
A value of nil means don't display a mode line.
For any symbol other than t or nil, the symbol's value is processed as
a mode line construct. As a special exception, if that value is a
string, the string is processed verbatim, without handling any
%-constructs (see below). Also, unless the symbol has a non-nil
risky-local-variable property, all properties in any strings, as
well as all :eval and :propertize forms in the value, are ignored.
When the value is processed, the window's buffer is temporarily the current buffer.
A list whose car is a string or list is processed by processing each
of the list elements recursively, as separate mode line constructs,
and concatenating the results.
A list of the form (:eval FORM) is processed by evaluating FORM and
using the result as a mode line construct. Be careful--FORM should
not load any files, because that can cause an infinite recursion.
A list of the form (:propertize ELT PROPS...) is processed by
processing ELT as the mode line construct, and adding the text
properties PROPS to the result.
A list whose car is a symbol is processed by examining the symbol's
value, and, if that value is non-nil, processing the cadr of the list
recursively; and if that value is nil, processing the caddr of the
list recursively.
A list whose car is an integer is processed by processing the cadr of
the list, and padding (if the number is positive) or truncating (if
negative) to the width specified by that number.
A string is printed verbatim in the mode line except for %-constructs:
%b -- print buffer name.
%c -- print the current column number (this makes editing slower).
Columns are numbered starting from the left margin, and the
leftmost column is displayed as zero.
To make the column number update correctly in all cases,
column-number-mode(var)/column-number-mode(fun) must be non-nil.
%C -- Like %c, but the leftmost column is displayed as one.
%e -- print error message about full memory.
%f -- print visited file name.
%F -- print frame name.
%i -- print the size of the buffer.
%I -- like %i, but use k, M, G, etc., to abbreviate.
%l -- print the current line number.
%n -- print Narrow if appropriate.
%o -- print percent of window travel through buffer, or Top, Bot or All.
%p -- print percent of buffer above top of window, or Top, Bot or All.
%P -- print percent of buffer above bottom of window, perhaps plus Top,
or print Bottom or All.
%q -- print percent of buffer above both the top and the bottom of the
window, separated by -, or All.
%s -- print process status.
%z -- print mnemonics of keyboard, terminal, and buffer coding systems.
%Z -- like %z, but including the end-of-line format.
%& -- print * if the buffer is modified, otherwise hyphen.
%+ -- print *, % or hyphen (modified, read-only, neither).
%* -- print %, * or hyphen (read-only, modified, neither).
For a modified read-only buffer, %+ prints * and %* prints %.
%@ -- print @ if default-directory is on a remote machine, else hyphen.
%[ -- print one [ for each recursive editing level.
%] -- print one ] for each recursive editing level.
%- -- print enough dashes to fill the mode line.
%% -- print %.
Decimal digits after the % specify field width to which to pad.
Probably introduced at or before Emacs version 18.
Source Code
// Defined in /usr/src/emacs/src/buffer.c
DEFVAR_PER_BUFFER ("mode-line-format", &BVAR (current_buffer, mode_line_format),
Qnil,
doc: /* Template for displaying mode line for a window's buffer.
The value may be nil, a string, a symbol or a list.
A value of nil means don't display a mode line.
For any symbol other than t or nil, the symbol's value is processed as
a mode line construct. As a special exception, if that value is a
string, the string is processed verbatim, without handling any
%-constructs (see below). Also, unless the symbol has a non-nil
`risky-local-variable' property, all properties in any strings, as
well as all :eval and :propertize forms in the value, are ignored.
When the value is processed, the window's buffer is temporarily the
current buffer.
A list whose car is a string or list is processed by processing each
of the list elements recursively, as separate mode line constructs,
and concatenating the results.
A list of the form `(:eval FORM)' is processed by evaluating FORM and
using the result as a mode line construct. Be careful--FORM should
not load any files, because that can cause an infinite recursion.
A list of the form `(:propertize ELT PROPS...)' is processed by
processing ELT as the mode line construct, and adding the text
properties PROPS to the result.
A list whose car is a symbol is processed by examining the symbol's
value, and, if that value is non-nil, processing the cadr of the list
recursively; and if that value is nil, processing the caddr of the
list recursively.
A list whose car is an integer is processed by processing the cadr of
the list, and padding (if the number is positive) or truncating (if
negative) to the width specified by that number.
A string is printed verbatim in the mode line except for %-constructs:
%b -- print buffer name.
%c -- print the current column number (this makes editing slower).
Columns are numbered starting from the left margin, and the
leftmost column is displayed as zero.
To make the column number update correctly in all cases,
`column-number-mode' must be non-nil.
%C -- Like %c, but the leftmost column is displayed as one.
%e -- print error message about full memory.
%f -- print visited file name.
%F -- print frame name.
%i -- print the size of the buffer.
%I -- like %i, but use k, M, G, etc., to abbreviate.
%l -- print the current line number.
%n -- print Narrow if appropriate.
%o -- print percent of window travel through buffer, or Top, Bot or All.
%p -- print percent of buffer above top of window, or Top, Bot or All.
%P -- print percent of buffer above bottom of window, perhaps plus Top,
or print Bottom or All.
%q -- print percent of buffer above both the top and the bottom of the
window, separated by `-', or `All'.
%s -- print process status.
%z -- print mnemonics of keyboard, terminal, and buffer coding systems.
%Z -- like %z, but including the end-of-line format.
%& -- print * if the buffer is modified, otherwise hyphen.
%+ -- print *, % or hyphen (modified, read-only, neither).
%* -- print %, * or hyphen (read-only, modified, neither).
For a modified read-only buffer, %+ prints * and %* prints %.
%@ -- print @ if default-directory is on a remote machine, else hyphen.
%[ -- print one [ for each recursive editing level.
%] -- print one ] for each recursive editing level.
%- -- print enough dashes to fill the mode line.
%% -- print %.
Decimal digits after the % specify field width to which to pad. */);