Subject: Re: bug#79141: 31.0.50; The tab-bar-format-align-right cache doesn't take face changes and per-frame faces into account

From: Steven Allen <[email-masked]>
Date: Tue, 12 Aug 2025 12:54:13 -0700

Eli Zaretskii <[email-masked]> writes:

>> From: Steven Allen <[email-masked]>
>> Cc: [email-masked], [email-masked]
>> Date: Tue, 12 Aug 2025 11:07:08 -0700
>>
>> > Anyone who needs a (possibly unreliable) caching version, it's easy
>> > to create a copy of the existing 'tab-bar-format-align-right',
>> > add caching to it, and use in 'tab-bar-format'.
>>
>> I can describe it in this case, at least:
>>
>> 1. Any time any face attribute is updated, the "tick" would be incremented.
>
> Why do you think it makes any sense to do that?  When an attribute of
> any face is modified, Emacs discards and recomputes all the faces on
> that frame.  How would the tick help you?

We're caching the pixel-width of the right-aligned tab-bar segment.
The pixel-width of that segment depends on the faces used to display
that segment; when those faces are modified, the width of that segment
can change and there's currently no easy way to detect this situation.

Adding a `face-modification-tick' would make it possible to detect when
face attributes have changed, allowing us to invalidate the cached
width.