Formatting Variables Mode Line Formatting
%' element will be replaced by some string or other when the
buffer in question is generated. `
%5y' means ``insert the `
spec, and pad with spaces to get a 5-character field''.
As with normal C and Emacs Lisp formatting strings, the numerical
modifier between the `
%' and the formatting type character will
pad the output so that it is always at least that long.
%5y' will make the field always (at least) five characters wide by
padding with spaces to the left. If you say `
%-5y', it will pad to
the right instead.
You may also wish to limit the length of the field to protect against
particularly wide values. For that you can say `
means that the field will never be more than 6 characters wide and never
less than 4 characters wide.