Re: Propertize C string for percent position in mode-line?
Frank Steiner <[email protected]> Tue, 7 Jul 2026 16:28:03 +0200
| Newsgroups | gmane.emacs.help |
|---|---|
| Message-ID | <[email protected]> |
First of all: you pushed me into the right direction and so my
result is now
'(:propertize ("L%l C%c " (-3 "%o")) face modeline-blue-face display (min-width (15.0)))
which does exactly what I want. Thank you very much for that!
Eli Zaretskii wrote:
> No, "%o" is not a C string, since it is defined (by your Lisp code) in
> Lisp.
I got that from https://lists.gnu.org/r/emacs-devel/2021-11/msg01763.html
and thought you said there that we could not propertize
mode-line-percent-position for that C-string reason, but I got that wrong.
It turned out that the whole problem was that I sometimes still don't
understand when to use ' and when not. My modeline construct is
(setq-default mode-line-format
'(
(:eval (list
; all kinds of strings and functions
And these two work identically inside this construct:
(propertize "L%l C%c %o" 'face 'modeline-red-face)
'(:propertize "L%l C%c %o" face modeline-red-face)
But only the latter construct allows lists like
'(:propertize ("L%l C%c %o") face modeline-red-face)
'(:propertize ("L%l C%c " (-3 "%o")) face modeline-red-face)
While I'm still trying to understand that in detail, I'm
totally lost when looking at
'(:propertize (list -3 "%o") face modeline-red-face)
'(:propertize (-3 "%o") face modeline-red-face)
The first line shows "Bottom" in the mode-line while the second one
shows "Bot". But shouldn't (list -3 "%o") return exactly (-3 "%o")?
No matter how much I read about it, sometimes this "what is evaluated
when" is still a mystery :-)
--
Dipl.-Inform. Frank Steiner Web: http://www.bio.ifi.lmu.de/~steiner/
Lehrstuhl f. Bioinformatik Mail: http://www.bio.ifi.lmu.de/~steiner/m/
LMU, Amalienstr. 17 Phone: +49 89 2180-4049
80333 Muenchen, Germany Fax: +49 89 2180-99-4049
* Rekursion kann man erst verstehen, wenn man Rekursion verstanden hat. *