Last Updated: February 25, 2016
· leemachin

Configuring your emacs mode-line isn't as daunting as it seems

I'd wager that even a seasoned emacs user would balk at the prospect of customising the mode-line with pure emacs-lisp. The emacs documentation is comprehensive, but a lot of the time you still have to know what to do with it.

My goal with this was to try and make the mode-line behave a little differently (eg. show buffer modified status with colours); to remove the bits I don't care about; and to do it in such a way that the code was still clean.

(Needless to say, it was made to look good in a terminal, not the GUI. Tmux customisations courtesy of Hermes by my colleagues.)

Customising the mode-line involves assigning a list of strings to a variable called 'mode-line-format'. You can evaluate conditional expressions using :eval, and play about with the formatting of a string with :propertize, and using those two building blocks you can turn it into whatever you want, while keeping it clean and modular.

Because I'm no expert there's no use trying to explain line by line, so hopefully the code does it better instead...

see the gist @ github

Say Thanks

1 Response
Add your response

Img 0245

Nice! What theme is this?

over 1 year ago ·