cleaning up the mode-line

Emacs' version on a status-bar is called the mode-line, and contains all
kind of information – the current buffer name, the cursor position and a
lot of other things, depending on what major and minor modes are active.




Customizing the mode-line is, unfortunately, rather hard. One day, I'll
write something about that… but for now at least we may be able to improve
things a little bit, by reducing mode line pollution. Mode line pollution?
Well, many parts of emacs like to announce their presence and state in the
mode line. With the limited space available there, this can become a bit of
an issue, the (Lisp Interaction company Yas abbrev) takes quite some
space:








But there are some ways to limit the space taken by modes and
minor-modes. Note, these snippets should go in your .emacs, and you need to restart emacs to make them active.



First, the minor modes (note, you can see the currently activated
ones with C-h m); install the handy diminish.el (or get it using the emacs-goodies-el package when using Debian/Ubuntu) and add something like the following:


(when (require 'diminish nil 'noerror)
(eval-after-load "company"
'(diminish 'company-mode "Cmp"))
(eval-after-load "abbrev"
'(diminish 'abbrev-mode "Ab"))
(eval-after-load "yasnippet"
'(diminish 'yas/minor-mode "Y")))



And the major-modes, for example for Emacs Lisp mode:


(add-hook 'emacs-lisp-mode-hook 
(lambda()
(setq mode-name "el"))) 

This looks a bit shorter:






You can of course set these names to whatever is obvious to you.

No comments:

Post a Comment

Followers

Popular Posts