emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117489: * lisp/vc/vc-annotate.el (vc-annotate-backg


From: Juri Linkov
Subject: [Emacs-diffs] trunk r117489: * lisp/vc/vc-annotate.el (vc-annotate-background-mode): New defcustom.
Date: Tue, 08 Jul 2014 08:49:23 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117489
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/17808
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Tue 2014-07-08 11:49:18 +0300
message:
  * lisp/vc/vc-annotate.el (vc-annotate-background-mode): New defcustom.
  (vc-annotate-color-map): Use less saturated colors (20%) for
  background-mode.
  (vc-annotate-very-old-color): Add default value for background-mode.
  (vc-annotate-background): Set default value to nil since now text on
  the default backgrounds should be legible in light and dark modes.
  (vc-annotate-lines): Use `vc-annotate-background-mode'.  Doc fix.
modified:
  etc/NEWS                       news-20100311060928-aoit31wvzf25yr1z-1
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/vc/vc-annotate.el         
vcannotate.el-20091113204419-o5vbwnq5f7feedwu-8692
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2014-07-07 08:59:32 +0000
+++ b/etc/NEWS  2014-07-08 08:49:18 +0000
@@ -115,6 +115,12 @@
 
 *** New connection method "nc", which allows to access dumb busyboxes.
 
+** VC and related modes
+
+*** New option `vc-annotate-background-mode' controls whether
+the color range from `vc-annotate-color-map' is applied to the
+background or to the foreground.
+
 ** Calculator: decimal display mode uses "," groups, so it's more
 fitting for use in money calculations; factorial works with
 non-integer inputs.

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-07-08 08:27:46 +0000
+++ b/lisp/ChangeLog    2014-07-08 08:49:18 +0000
@@ -1,5 +1,16 @@
 2014-07-08  Juri Linkov  <address@hidden>
 
+       * vc/vc-annotate.el (vc-annotate-background-mode): New defcustom.
+       (vc-annotate-color-map): Use less saturated colors (20%) for
+       background-mode.
+       (vc-annotate-very-old-color): Add default value for background-mode.
+       (vc-annotate-background): Set default value to nil since now text on
+       the default backgrounds should be legible in light and dark modes.
+       (vc-annotate-lines): Use `vc-annotate-background-mode'.  Doc fix.
+       (Bug#17808)
+
+2014-07-08  Juri Linkov  <address@hidden>
+
        * simple.el (transpose-chars): Don't move point into read-only area.
        (Bug#17829)
 

=== modified file 'lisp/vc/vc-annotate.el'
--- a/lisp/vc/vc-annotate.el    2014-02-10 01:34:22 +0000
+++ b/lisp/vc/vc-annotate.el    2014-07-08 08:49:18 +0000
@@ -40,6 +40,23 @@
                         :value "20.5"))
   :group 'vc)
 
+(defcustom vc-annotate-background-mode
+  (not (or (eq (or frame-background-mode
+                  (frame-parameter nil 'background-mode))
+              'dark)
+          (and (tty-display-color-p) (<= (display-color-cells) 8))))
+  "Non-nil means `vc-annotate-color-map' is applied to the background.
+
+When non-nil, the color range from `vc-annotate-color-map' is applied
+to the background, while the foreground remains default.
+
+When nil, the color range from `vc-annotate-color-map' is applied
+to the foreground, and the color from the option `vc-annotate-background'
+is applied to the background."
+  :type 'boolean
+  :version "24.5"
+  :group 'vc)
+
 (defcustom vc-annotate-color-map
   (if (and (tty-display-color-p) (<= (display-color-cells) 8))
       ;; A custom sorted TTY colormap
@@ -71,25 +88,49 @@
                  (prog1
                      (cons date x)
                    (setq date (+ date delta)))) colors))
-    ;; Normal colormap: hue stepped from 0-240deg, value=1., saturation=0.75
-    '(( 20. . "#FF3F3F")
-      ( 40. . "#FF6C3F")
-      ( 60. . "#FF993F")
-      ( 80. . "#FFC63F")
-      (100. . "#FFF33F")
-      (120. . "#DDFF3F")
-      (140. . "#B0FF3F")
-      (160. . "#83FF3F")
-      (180. . "#56FF3F")
-      (200. . "#3FFF56")
-      (220. . "#3FFF83")
-      (240. . "#3FFFB0")
-      (260. . "#3FFFDD")
-      (280. . "#3FF3FF")
-      (300. . "#3FC6FF")
-      (320. . "#3F99FF")
-      (340. . "#3F6CFF")
-      (360. . "#3F3FFF")))
+    (cond
+     ;; Normal colormap for background colors with dark foreground:
+     ;; hue stepped from 0-240deg, value=1., saturation=0.20
+     (vc-annotate-background-mode
+      '(( 20. . "#FFCCCC")
+       ( 40. . "#FFD8CC")
+       ( 60. . "#FFE4CC")
+       ( 80. . "#FFF0CC")
+       (100. . "#FFFCCC")
+       (120. . "#F6FFCC")
+       (140. . "#EAFFCC")
+       (160. . "#DEFFCC")
+       (180. . "#D2FFCC")
+       (200. . "#CCFFD2")
+       (220. . "#CCFFDE")
+       (240. . "#CCFFEA")
+       (260. . "#CCFFF6")
+       (280. . "#CCFCFF")
+       (300. . "#CCF0FF")
+       (320. . "#CCE4FF")
+       (340. . "#CCD8FF")
+       (360. . "#CCCCFF")))
+     ;; Normal colormap for foreground colors on dark background:
+     ;; hue stepped from 0-240deg, value=1., saturation=0.75
+     (t
+      '(( 20. . "#FF3F3F")
+       ( 40. . "#FF6C3F")
+       ( 60. . "#FF993F")
+       ( 80. . "#FFC63F")
+       (100. . "#FFF33F")
+       (120. . "#DDFF3F")
+       (140. . "#B0FF3F")
+       (160. . "#83FF3F")
+       (180. . "#56FF3F")
+       (200. . "#3FFF56")
+       (220. . "#3FFF83")
+       (240. . "#3FFFB0")
+       (260. . "#3FFFDD")
+       (280. . "#3FF3FF")
+       (300. . "#3FC6FF")
+       (320. . "#3F99FF")
+       (340. . "#3F6CFF")
+       (360. . "#3F3FFF")))))
   "Association list of age versus color, for \\[vc-annotate].
 Ages are given in units of fractional days.  Default is eighteen
 steps using a twenty day increment, from red to blue.  For TTY
@@ -98,12 +139,12 @@
   :type 'alist
   :group 'vc)
 
-(defcustom vc-annotate-very-old-color "#3F3FFF"
+(defcustom vc-annotate-very-old-color (if vc-annotate-background-mode 
"#CCCCFF" "#3F3FFF")
   "Color for lines older than the current color range in \\[vc-annotate]."
   :type 'string
   :group 'vc)
 
-(defcustom vc-annotate-background "black"
+(defcustom vc-annotate-background nil
   "Background color for \\[vc-annotate].
 Default color is used if nil."
   :type '(choice (const :tag "Default background" nil) (color))
@@ -347,7 +388,9 @@
 `vc-annotate-menu-elements' customizes the menu elements of the
 mode-specific menu.  `vc-annotate-color-map' and
 `vc-annotate-very-old-color' define the mapping of time to colors.
-`vc-annotate-background' specifies the background color."
+`vc-annotate-background' specifies the background color.
+`vc-annotate-background-mode' specifies whether the color map
+should be applied to the background or to the foreground."
   (interactive
    (save-current-buffer
      (vc-ensure-vc-buffer)
@@ -666,10 +709,13 @@
                ;; Make the face if not done.
                (face (or (intern-soft face-name)
                          (let ((tmp-face (make-face (intern face-name))))
-                           (set-face-foreground tmp-face (cdr color))
-                           (when vc-annotate-background
-                            (set-face-background tmp-face
-                                                 vc-annotate-background))
+                           (cond
+                            (vc-annotate-background-mode
+                             (set-face-background tmp-face (cdr color)))
+                            (t
+                             (set-face-foreground tmp-face (cdr color))
+                             (when vc-annotate-background
+                              (set-face-background tmp-face 
vc-annotate-background))))
                            tmp-face))))        ; Return the face
           (put-text-property start end 'face face)))))
   ;; Pretend to font-lock there were no matches.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]