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

From: Eli Zaretskii <[email-masked]>
Date: Tue, 06 Jun 2023 14:24:11 +0300

> Date: Mon, 05 Jun 2023 21:45:17 +0100
> From: [email-masked]
> Cc: [email-masked]
> 
> On 2023-05-06 15:39, Eli Zaretskii wrote:
> > > > 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.
> 
> I confess I am very confused. Let's say we have a modeline like this,
> with parts L (left-aligned), M (middle - displays as empty space) and R
> (right-aligned):
> 
> |--L--|-------M-------|-R-|
> Foo bar                 X
> 
> If L gets longer then:
> - M will get shorter
> - R will stay the same
> 
> So we get:
> |--L-----|----M-------|-R-|
> Foo barrrr              X
> 
> Is this what you're worried about? If so, I don't think it's much of a
> cause for concern.

No, I was talking about the case where the R part becomes longer.

> I modelled my function on
> `tab-bar-format-align-right', which works in a very similar way.

IMNSHO, that mopdel is not the ideal one.

> It also
> strikes me that something like this happens anyway already: if we have a
> mode-line with just a left-aligned lighter, and the lighter gets longer 
> (or
> shorter), then the space between the end of the lighter and the edge of
> the screen (i.e. M+R) gets smaller (or bigger). Isn't this to be 
> expected?

Yes.  But with left alignment the beginning of the text never moves,
only the end.  With right alignment, the beginning moves.  It's
jarring, IMO.