GNU Emacs Lisp Reference Manual
%-Constructs in the Mode Line
The following table lists the recognized %-constructs and what
they mean. In any construct except %%, you can add a decimal
integer after the % to specify how many characters to display.
%b
buffer-name function.
See Buffer Names.
%f
buffer-file-name
function. See Buffer File Name.
%F
%c
%l
%*
% 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.
%s
process-status. See Process Information.
%t
%p
Top, Bottom or All.
%P
Top if the top of the buffer is
visible on screen; or Bottom or All.
%n
Narrow when narrowing is in effect; nothing otherwise (see
narrow-to-region in Narrowing).
%[
[ for each editing level.
See Recursive Editing.
%]
] for each recursive editing level (not counting minibuffer
levels).
%%
%---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
mode-name and global-mode-string.
%m
mode-name.
%M
global-mode-string. Currently, only
display-time modifies the value of global-mode-string.