bug#46476: Feature request: Right-aligning part of the modeline

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#46476: Feature request: Right-aligning part of the modeline

Paweł Kraśnicki
Many people who use Emacs with significant customization have their modeline
split into left and right aligned parts. I've also seen the Lisp code for this
in several packages. I think it would be useful to have this feature as a
%-construct so that the users who want it wouldn't have to install a package or
write custom Lisp that uses the `display' text property.

Everything after this construct would be aligned to the right. For example,
assuming the construct was %=, the mode-line-format

"l%=r"

would cause the modeline in a 20 character wide window to look like

l                  r

It could also be useful to generalize this to centering, though I've seen this
used less often. Then, the mode-line-format

"lllll%=c%=r"

would cause the modeline to look like

lllll     c        r



Reply | Threaded
Open this post in threaded view
|

bug#46476: Feature request: Right-aligning part of the modeline

Eli Zaretskii
> From: Paweł Kraśnicki
>  <[hidden email]>
> Date: Fri, 12 Feb 2021 23:59:26 +0100
>
> Many people who use Emacs with significant customization have their modeline
> split into left and right aligned parts. I've also seen the Lisp code for this
> in several packages.

Can you describe how is this done in Lisp?

> I think it would be useful to have this feature as a
> %-construct so that the users who want it wouldn't have to install a package or
> write custom Lisp that uses the `display' text property.
>
> Everything after this construct would be aligned to the right. For example,
> assuming the construct was %=, the mode-line-format
>
> "l%=r"
>
> would cause the modeline in a 20 character wide window to look like
>
> l                  r
>
> It could also be useful to generalize this to centering, though I've seen this
> used less often. Then, the mode-line-format
>
> "lllll%=c%=r"
>
> would cause the modeline to look like
>
> lllll     c        r

The immediate question about this I have is what to do when the
mode-line string is too long for the window's width?  Right now, we
simply chop the stuff on the right that doesn't fit, but if the
mode-line string has 2 or 3 different part, that should be revised,
right?