Propertize C string for percent position in mode-line?

Frank Steiner <[email protected]> Tue, 7 Jul 2026 12:02:55 +0200
Newsgroups gmane.emacs.help
Message-ID <[email protected]>
Hi,

I wonder if there is any way to show "percent position" (%p or %o) in
the mode-line with a property *and* restricting it to 3 chars, i.e.
showing "Bot" instead of "Bottom".

Currently I have

(propertize "L%l C%c %o" 'face 'modeline-blue-face 'display '(min-width (15.0)))

showing line/column/percent in blue and giving the block a min-width
so that the following buffer name is at a somewhat fixed position.

Unfortunately, "%o" and "%p" both show "Bottom" although the help-text
(at least for mode-line-format) says they would show "Bot". I'm aware of
'mode-line-percent-position but from the email archive I've learned it
cannot be propertized because (-3 "%o") is a C string and not a Lisp string.

Is there any way I can cut %o to 3 chars while still giving it a colored
face and embedding it in the min-width property together with line/column
output?

This is with emacs 30.1 (as shipped with SuSE 16.0).

Many thanks!

cu,
Frank