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

Previous Next

Package: emacs;

Reported by: Steven Allen <steven <at> stebalien.com>

Date: Fri, 1 Aug 2025 20:58:02 UTC

Severity: normal

Fixed in version 31.0.50

Done: Juri Linkov <juri <at> linkov.net>

Full log


Message #8 received at 79141 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Steven Allen <steven <at> stebalien.com>
Cc: Daniel Mendler <mail <at> daniel-mendler.de>, 79141 <at> debbugs.gnu.org
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
Date: Tue, 05 Aug 2025 20:43:00 +0300
Thanks for the detailed test cases that demonstrate the problem.

> The the `tab-bar-format-align-right' width cache isn't updated when
> faces change and doesn't take into account the fact that faces can have
> different attributes on different frames.
>
> To reproduce, launch "emacs -Q" then yank the following into the scratch
> buffer:
>
>     (setq global-mode-string
>           (list "" "GNU  Emacs  is a version of Emacs...")
>           tab-bar-format
>           '(tab-bar-format-align-right tab-bar-format-global))
>     (tab-bar-mode 1)
>
> And evaluate the buffer (M-x eval-buffer RET).
>
> Finally, increase the font size with `global-text-scale-adjust': C-x C-M-0 +++++
>
> The tab-bar text will get pushed off the right side on Emacs master but
> not in the latest release. See the attached screenshots.
>
> Furthermore, different frames can have different text sizes. Personally,
> I use this to scale each of my frames' text based on the monitor's
> DPI. To reproduce, launch "emacs -Q", yank the following into the
> scratch buffer, and evaluate it:
>
>     (setq global-mode-string
>           (list "" "GNU  Emacs  is a version of Emacs...")
>           tab-bar-format
>           '(tab-bar-format-align-right tab-bar-format-global))
>     (tab-bar-mode 1)
>     (set-face-attribute 'default (selected-frame) :height (* 2 (face-attribute 'default :height)))
>     (make-frame)
>
> The tab-bar text will be correctly aligned in the new frame but not in
> the original frame.
>
> The per-frame issue can be fixed by making the cache per-frame but
> reacting to face changes is harder. Given that this is simply a cache,
> I'd recommend reverting the change and living with the slight
> performance hit.

Instead of reverting the change maybe it would be better to add
a customizable cache function that anyone could change to adapt caching
to own needs by adding more cache keys such as e.g. '(selected-frame)',
'(face-all-attributes 'default)', 'face-remapping-alist', ...




This bug report was last modified today.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.