Some time ago there was an experimental change on the master
branch in Emacs, bringing “variable width” fonts to the modeline. The main problem with them is of course the fact that when a part of modeline on the left changed (even without changing the number of characters), the rest of it would “jump” because the width of the changed portion would not be constant anymore. Well, that is now fixed (pun intended): such things now have a fixed width, so changing the modeline font to a variable-width one works very well.
Well, one might ask two questions – the easy one (how to do that) and the slightly harder one (why do that). As for the “how”, well:
(set-face-attribute 'mode-line nil :inherit 'variable-pitch)
is enough. (In fact, in my init.el
I also set up the :height
attribute to make the modeline font a bit smaller.) The “why” is clear to everyone who has a lot of things in the modeline: this makes it possible to fit even more of them there. And before you say that it’s bad practice, and nobody in their right mind has that much stuff in the modeline, and that you should use diminish or something similar – well, maybe you’re right, but if you are in a Git repo on a branch with a long name, you use Projectile, you have a whole bunch of minor modes on, you split your frame into two side-by-side windows, and you use Org-mode clocking and want to see the current clock in the modeline – having a variable-width font really helps.
As usual with the bleeding-edge stuff, this will probably appear in the next version of Emacs – but if you compile Emacs yourself from the current state of the repo, you can use it even now.