Skip to content

Instantly share code, notes, and snippets.

@leemeichin
leemeichin / mode-line.el
Created November 7, 2012 16:51
Customising your emacs mode-line
;; Sets the default mode-line. Remove '-default' if you want to test your changes on-the-fly with (eval-buffer)
(setq-default mode-line-format
'(
;; add a noticeable red block that says 'READ ONLY' when the file's, er, read only
(:eval
(when (eql buffer-read-only t)
;; propertize adds metadata to text, so you can add colours and formatting, amongst other things
(propertize " READ ONLY " 'face
'(:background "color-88" :foreground "white" :weight bold))))
;; show the buffer filename, with a green background when unmodified/saved and a red one when modified