emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tick Reduction


From: Eli Zaretskii
Subject: Re: Tick Reduction
Date: Thu, 25 Nov 2021 16:02:04 +0200

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: dgutov@yandex.ru,  stefankangas@gmail.com,  emacs-devel@gnu.org
> Date: Thu, 25 Nov 2021 14:06:45 +0100
> 
> The one remaining problem I have now is with the mode line -- the
> display handlers aren't called in all circumstances, and I don't quite
> understand why.
> 
> With this:
> 
> (defvar mode-line-position
>   `((:propertize
>      (" " mode-line-percent-position)
>      display (min-width (6.0))
> 
> handle_display_prop is called (via next_element_from_string) as you'd
> expect, and everything works fine.  However, if you just have:
> 
> (defvar mode-line-position
>   `((:propertize
>      mode-line-percent-position
>      display (min-width (6.0))
> 
> handle_display_prop is never called.

The value of mode-line-percent-position is '(-3 "%p").  So in the
second example you propertize the thing which Emacs produces from the
%p mode-line format.  But %p produces a C string, and C strings cannot
have text properties.  That's why handle_display_prop isn't called: it
is never called for C strings we display.

Bottom line: to put text properties on stuff we display on the mode
line, you need to make sure that stuff is a Lisp string.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]