bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Eli Zaretskii
Subject: bug#62606: [PATCH] function to align mode-line elements to right
Date: Fri, 09 Jun 2023 16:13:06 +0300

> Date: Fri, 09 Jun 2023 13:47:55 +0100
> From: hugo@heagren.com
> Cc: 62606@debbugs.gnu.org
> 
> On 2023-06-06 12:24, Eli Zaretskii wrote:
> >> 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.
> 
> I'm not sure what you mean? If you're talking about what the function
> /does/, isn't this just a matter of preference? You might not like using
> it, but I /do/ like it. I wanted a function which does exactly what that
> function does, but for the modeline. I find the way it displays
> information perfectly natural. Clearly enough other people also do that
> the tab-bar equivalent was worth building and using. If you're talking
> about the internals, could you explain a bit more?

Put mildly, the implementation is IMO very complicated, and hard to
follow and maintain/develop.

> > 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.
> 
> Right, I see. But that's only true of the text as a whole isn't it?
> Consider a modeline with two constructs, FOO and BAR: '(FOO " " BAR).
> Both are left aligned. Say FOO prints "foo" and BAR prints "bar", so we
> have:
> 
> foo bar
> 
> If FOO now prints something longer (e.g. "foooooooo", the beginning of 
> the
> BAR part will move, thus:
> 
> foo bar
>      ----->
> foooooooo bar
> 
> So with left aligned text, sometimes the beginning (of some piece of
> information) moves as well). This happens for real if FOO is something
> like the buffer name -- BAR will move whenever we switch to a buffer
> with a name of a different length. I think if people who want
> left-aligned text can put up with this, then people who want
> right-aligned text will probably put up with the equivalent problem.

Yes, but with the current mode-line structure, we take care to prevent
that by leaving enough padding for the extra text to have space,
before it starts shifting what's after it.  With right-alignment,
that's harder to accomplish.

> In fact, it was precisely /because/ of this kind of situation, that I
> originally wanted to right-align some of my information, so that it
> /wouldn't/ move when elements to the left of it changed length. By
> right-aligning, I can completely control the space between them.

You can accomplish that by padding, even without right-alignment, I
think.

> Overall, I can see that this isn't a feature you like, and probably not
> one you would use either, but it's similar enough (in function and in
> problems) to other stuff already in Emacs

Sadly.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]