Code

git-blame.el: improve color handling
authorDavid Kågedal <davidk@lysator.liu.se>
Fri, 9 Feb 2007 08:21:03 +0000 (09:21 +0100)
committerJunio C Hamano <junkio@cox.net>
Fri, 9 Feb 2007 08:52:52 +0000 (00:52 -0800)
Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
contrib/emacs/git-blame.el

index c99437e5e5bdd337b4538e695a9a3a6a94af0ffc..7ffc153bdae12f40f007c70d9cf4cde588e47eac 100644 (file)
     colors))
 
 (defvar git-blame-dark-colors
-  (color-scale '("00" "04" "08" "0c"
-                 "10" "14" "18" "1c"
-                 "20" "24" "28" "2c"
-                 "30" "34" "38" "3c")))
+  (color-scale '("0c" "04" "24" "1c" "2c" "34" "14" "3c")))
 
 (defvar git-blame-light-colors
-  (color-scale '("c0" "c4" "c8" "cc"
-                 "d0" "d4" "d8" "dc"
-                 "e0" "e4" "e8" "ec"
-                 "f0" "f4" "f8" "fc")))
+  (color-scale '("c4" "d4" "cc" "dc" "f4" "e4" "fc" "ec")))
 
 (defvar git-blame-ancient-color "dark green")
 
   (make-local-variable 'git-blame-overlays)
   (make-local-variable 'git-blame-colors)
   (make-local-variable 'git-blame-cache)
-  (let ((bgmode (cdr (assoc 'background-mode (frame-parameters)))))
-    (if (eq bgmode 'dark)
-        (setq git-blame-colors git-blame-dark-colors)
-      (setq git-blame-colors git-blame-light-colors)))
+  (git-blame-cleanup)
   (if git-blame-mode
-      (git-blame-run)
-    (git-blame-cleanup)))
+      (progn
+        (let ((bgmode (cdr (assoc 'background-mode (frame-parameters)))))
+          (if (eq bgmode 'dark)
+              (setq git-blame-colors git-blame-dark-colors)
+            (setq git-blame-colors git-blame-light-colors)))
+        (setq git-blame-cache (make-hash-table :test 'equal))
+        (git-blame-run))))
 
 (defun git-blame-run ()
   (let* ((display-buf (current-buffer))