Emacs users have long wanted the ability to push certain mode line elements tothe right edge of the window. Think of it like having a left-aligned andright-aligned section in your mode line - buffer name on the left, maybe the timeor some status info on the right.Before Emacs 30, achieving this required various hacks involving paddingcalculations and propertized strings. It was doable, but fragile and ugly.Emacs 30 makes it trivial with mode-line-format-right-align.How it worksJust insert the symbol mode-line-format-right-align into yourmode-line-format. Everything before it is left-aligned (as usual), andeverything after it gets pushed to the right edge.(setq-default mode-line-format '("%e" mode-line-front-space mode-line-mule-info mode-line-modified " " mode-line-buffer-identification mode-line-format-right-align mode-line-modes mode-line-misc-info mode-line-end-spaces))In this example, the buffer identification stays on the left, while modes andmiscellaneous info are pushed to the right.Controlling the alignment edgeBy default, right-aligned elements are pushed to the extreme right of thewindow. You can control this with mode-line-right-align-edge:;; Align to the left edge of the right fringe (default is 'window)(setq mode-line-right-align-edge 'right-fringe)The available values are: Value Alignment point window Extreme right edge of the window (default) right-fringe Left edge of the right fringe right-margin Left edge of the right margin A practical exampleHere’s a minimal setup that puts the buffer name and modification status on theleft, and the current line/column and major mode on the right:(setq-default mode-line-format '(" %+ " mode-line-buffer-identification mode-line-format-right-align mode-line-position " " mode-line-modes))And here’s the result - the buffer name sits on the left while the positionand major mode are pushed all the way to the right:Clean, readable, and no hacks required.For years I put up with a mode line that was either cluttered on the left orpropped up with fragile padding hacks that broke the moment I resized a window.Having a proper right-aligned section built into Emacs feels almost too easy -the kind of small quality-of-life fix that makes you wonder what took so long.What do you like to keep on the right side of your mode line - the time, thebattery level, some VC info? I’d love to hear how you’ve arranged yours in thecomments!That’s all I have for you today. Keep your mode line in line!