This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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 |