Subject: bug#62606: [PATCH] function to align mode-line elements to right

From: Eli Zaretskii <[email-masked]>
Date: Sat, 06 May 2023 17:39:59 +0300

> Date: Sat, 06 May 2023 15:14:24 +0100
> From: [email-masked]
> Cc: [email-masked]
> 
> > One possible issue with right alignment is that when the total size of
> > the mode-line text changes (e.g., the mode lighter changes), the
> > leftmost part of it will move horizontally, something that could be
> > unpleasant and even annoying.
> 
> This doesn't happen with my proposed setup (though I agree it would be
> annoying if it did!). The user includes the symbol
> `mode-line-format-right-align' in their mode line format. This is a
> variable which holds a mode-line construct `(:eval
> (mode-line-format-right-align))'. So whenever the mode-line is reloaded
> (and therefore, whenever the length could change), the space used to pad
> the right-aligned part to the right is recalculated.

That recalculation is what I alluded to: the space will be different
depending on the size of the mode-line text.

> > Also, what happens if the mode-line text is longer than the window
> > width.  What are user expectations in that case, and does :align-to
> > meet those expectations?
> 
> Then the text overflows to the right.

I'm not sure everyone will agree with your expectations.

> > This should use display-graphic-p, not window-system.
> 
> Fixed.
> 
> > Did you test this in a session which has both GUI and TTY frames?
> 
> Yes, it behaves correctly (i.e. right-aligns in both, even when the
> same buffer is simultaneously displayed in both).

And if then you delete all the GUI frames and only the TTY frames
remain?