Subject: bug#52447: 29.0.50; New mode-line breaks calculations for last element in my mode-line

From: Eli Zaretskii <[email-masked]>
Date: Sun, 12 Dec 2021 11:03:18 +0200

> From: Pedro Andres Aranda Gutierrez <[email-masked]>
> Date: Sun, 12 Dec 2021 08:17:28 +0100
> 
> I'm using the attached code for my mode-line. It's inspired by the doom mode-line. My last element is
> right-aligned and shows GIT information when relevant. On emacs < 29, the calculation for the free space
> avoids overlapping with the fringe:
> emacs28-modeline.png
> 
> On emacs29, with fixed font using the fix from etc/NEWS, the fringe overlaps with the vc information. 
> emacs29-broken-modeline.png

Your code says:

  (defun fill-spaces (len)
    `((space :align-to (- (+ right right-fringe right-margin) ,len))))

This tells Emacs to right-align the string to the place _after_ the
margin and the fringe.  If I remove the addition of right-fringe and
right-margin from the :align-to expression, the effect is like you
want.

So it sounds like Emacs 28 and before had some bug in this area which
was fixed in Emacs 29, and your code needs to adapt by removing the
"fix" you had in previous Emacs versions.

> Not to speak variable pitch, where I only see the first 1.5 letters or so (depending on the branch I'm in)

For variable-pitch font, you need to calculate this in pixels, not in
columns.