From a8d359356722c525ea43c2b2908c1b77360429b6 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 22 Jan 2012 13:00:01 +0900 Subject: [PATCH] rewrite mode-line change func so that readable with both white and black background --- .emacs.el | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/.emacs.el b/.emacs.el index 0b7813e..457525d 100644 --- a/.emacs.el +++ b/.emacs.el @@ -129,15 +129,29 @@ (defun my-set-mode-line-color-read-only () "" - (let ((color (if buffer-read-only - 'blue + (let ((state (if buffer-read-only + 'readonly (if overwrite-mode - 'red - 'black)))) - (unless (eq color my-set-mode-line-color-color) - (set-face-foreground 'modeline (symbol-name color)) - (setq my-set-mode-line-color-color color)))) -(defvar my-set-mode-line-color-color nil "") + 'overwrite + 'insert))) + ) + (unless (eq state my-set-mode-line-color-state) + (set-face-foreground 'modeline + (nth 1 + (assq state + my-set-mode-line-color-color))) + (set-face-background 'modeline + (nth 2 + (assq state + my-set-mode-line-color-color))) + (setq my-set-mode-line-color-state state) + ))) +(defvar my-set-mode-line-color-color + '((readonly "blue" "white") + (overwrite "red" "white") + (insert nil nil)) + "") +(defvar my-set-mode-line-color-state nil "") (add-hook 'post-command-hook 'my-set-mode-line-color-read-only) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;