Subject: bug#55207: 29.0.50; tab-bar-format-align-right only works correctly with monospace characters

From: Daniel Semyonov <[email-masked]>
Date: Tue, 03 May 2022 10:40:35 +0300

>>>>> Juri Linkov writes:

    > I guess you are using global-mode-string with XBM images.

I should've added this to the last message, but this is my tab bar
configuration (just a little bit over engineered):

(init-base-customize display-time-format "%H:%M %d/%m/%y"
                     display-time-mail-function #'ignore)
(display-time-mode)

(setq global-mode-string
      '(:eval
        `(""
          ,(and (boundp 'init-gnus-unread-mail-string)
                init-gnus-unread-mail-string)
          ,(and (boundp 'init-gnus-unread-news-string)
                init-gnus-unread-news-string)
          ,(and (boundp 'init-volume-string)
                init-volume-string)
          ,(and (boundp 'emms-mode-line-string)
                emms-mode-line-string)
          ,(and (boundp 'emms-playing-time-string)
                emms-playing-time-string)
          " | " ,(string-trim-right display-time-string))))
(init-base-customize tab-bar-format
                     '( tab-bar-format-tabs tab-bar-format-align-right
                        tab-bar-format-global))
(tab-bar-mode)

('init-base-customize' is just a convenience macro which calls
'customize-set-variable' under the hood and the value of 'init-*-string' is
a string of the form "x: y " where 'x' is a letter and 'y' is a number or
percentage; 'x:' is replaced with an XBM image using the 'display'
property on GUI frames).

    > Could you then try something like this to see what number it
    > returns?

I did some further testing, first adding arbitrary text to the
'global-mode-string', then adding more images and finally adding both.
I've attached screen shots of my full Emacs frame with an example of
each test case, taken right after evaluating your provided expression
(so the number is shown in the echo area).  The buffer shown in the
images shows the exact changes I made to the 'global-mode-string' in
each test.

I've also attached the envelope and volume icons seen in the screen
shots, just in case they may be useful.

Hopefully this information proves useful, thank you for looking into
this.