diff options
| author | Juri Linkov | 2014-07-08 11:49:18 +0300 |
|---|---|---|
| committer | Juri Linkov | 2014-07-08 11:49:18 +0300 |
| commit | b89e78fd90e7c405f0ef2764765c467f4b9e6ade (patch) | |
| tree | 43c906ef8d481900a123a443a2523901c1946044 | |
| parent | 43bb0be61a0788045f90d9df5d378506cbbab422 (diff) | |
| download | emacs-b89e78fd90e7c405f0ef2764765c467f4b9e6ade.tar.gz emacs-b89e78fd90e7c405f0ef2764765c467f4b9e6ade.zip | |
* 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.
Fixes: debbugs:17808
| -rw-r--r-- | etc/NEWS | 6 | ||||
| -rw-r--r-- | lisp/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/vc/vc-annotate.el | 98 |
3 files changed, 89 insertions, 26 deletions
| @@ -115,6 +115,12 @@ protocols as well as for "telnet" and "ftp" are passed to Tramp. | |||
| 115 | 115 | ||
| 116 | *** New connection method "nc", which allows to access dumb busyboxes. | 116 | *** New connection method "nc", which allows to access dumb busyboxes. |
| 117 | 117 | ||
| 118 | ** VC and related modes | ||
| 119 | |||
| 120 | *** New option `vc-annotate-background-mode' controls whether | ||
| 121 | the color range from `vc-annotate-color-map' is applied to the | ||
| 122 | background or to the foreground. | ||
| 123 | |||
| 118 | ** Calculator: decimal display mode uses "," groups, so it's more | 124 | ** Calculator: decimal display mode uses "," groups, so it's more |
| 119 | fitting for use in money calculations; factorial works with | 125 | fitting for use in money calculations; factorial works with |
| 120 | non-integer inputs. | 126 | non-integer inputs. |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 26699e0ff4d..ee5b6e2767b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,16 @@ | |||
| 1 | 2014-07-08 Juri Linkov <juri@jurta.org> | 1 | 2014-07-08 Juri Linkov <juri@jurta.org> |
| 2 | 2 | ||
| 3 | * vc/vc-annotate.el (vc-annotate-background-mode): New defcustom. | ||
| 4 | (vc-annotate-color-map): Use less saturated colors (20%) for | ||
| 5 | background-mode. | ||
| 6 | (vc-annotate-very-old-color): Add default value for background-mode. | ||
| 7 | (vc-annotate-background): Set default value to nil since now text on | ||
| 8 | the default backgrounds should be legible in light and dark modes. | ||
| 9 | (vc-annotate-lines): Use `vc-annotate-background-mode'. Doc fix. | ||
| 10 | (Bug#17808) | ||
| 11 | |||
| 12 | 2014-07-08 Juri Linkov <juri@jurta.org> | ||
| 13 | |||
| 3 | * simple.el (transpose-chars): Don't move point into read-only area. | 14 | * simple.el (transpose-chars): Don't move point into read-only area. |
| 4 | (Bug#17829) | 15 | (Bug#17829) |
| 5 | 16 | ||
diff --git a/lisp/vc/vc-annotate.el b/lisp/vc/vc-annotate.el index 424b48a4ffa..d3e10a63f56 100644 --- a/lisp/vc/vc-annotate.el +++ b/lisp/vc/vc-annotate.el | |||
| @@ -40,6 +40,23 @@ | |||
| 40 | :value "20.5")) | 40 | :value "20.5")) |
| 41 | :group 'vc) | 41 | :group 'vc) |
| 42 | 42 | ||
| 43 | (defcustom vc-annotate-background-mode | ||
| 44 | (not (or (eq (or frame-background-mode | ||
| 45 | (frame-parameter nil 'background-mode)) | ||
| 46 | 'dark) | ||
| 47 | (and (tty-display-color-p) (<= (display-color-cells) 8)))) | ||
| 48 | "Non-nil means `vc-annotate-color-map' is applied to the background. | ||
| 49 | |||
| 50 | When non-nil, the color range from `vc-annotate-color-map' is applied | ||
| 51 | to the background, while the foreground remains default. | ||
| 52 | |||
| 53 | When nil, the color range from `vc-annotate-color-map' is applied | ||
| 54 | to the foreground, and the color from the option `vc-annotate-background' | ||
| 55 | is applied to the background." | ||
| 56 | :type 'boolean | ||
| 57 | :version "24.5" | ||
| 58 | :group 'vc) | ||
| 59 | |||
| 43 | (defcustom vc-annotate-color-map | 60 | (defcustom vc-annotate-color-map |
| 44 | (if (and (tty-display-color-p) (<= (display-color-cells) 8)) | 61 | (if (and (tty-display-color-p) (<= (display-color-cells) 8)) |
| 45 | ;; A custom sorted TTY colormap | 62 | ;; A custom sorted TTY colormap |
| @@ -71,25 +88,49 @@ | |||
| 71 | (prog1 | 88 | (prog1 |
| 72 | (cons date x) | 89 | (cons date x) |
| 73 | (setq date (+ date delta)))) colors)) | 90 | (setq date (+ date delta)))) colors)) |
| 74 | ;; Normal colormap: hue stepped from 0-240deg, value=1., saturation=0.75 | 91 | (cond |
| 75 | '(( 20. . "#FF3F3F") | 92 | ;; Normal colormap for background colors with dark foreground: |
| 76 | ( 40. . "#FF6C3F") | 93 | ;; hue stepped from 0-240deg, value=1., saturation=0.20 |
| 77 | ( 60. . "#FF993F") | 94 | (vc-annotate-background-mode |
| 78 | ( 80. . "#FFC63F") | 95 | '(( 20. . "#FFCCCC") |
| 79 | (100. . "#FFF33F") | 96 | ( 40. . "#FFD8CC") |
| 80 | (120. . "#DDFF3F") | 97 | ( 60. . "#FFE4CC") |
| 81 | (140. . "#B0FF3F") | 98 | ( 80. . "#FFF0CC") |
| 82 | (160. . "#83FF3F") | 99 | (100. . "#FFFCCC") |
| 83 | (180. . "#56FF3F") | 100 | (120. . "#F6FFCC") |
| 84 | (200. . "#3FFF56") | 101 | (140. . "#EAFFCC") |
| 85 | (220. . "#3FFF83") | 102 | (160. . "#DEFFCC") |
| 86 | (240. . "#3FFFB0") | 103 | (180. . "#D2FFCC") |
| 87 | (260. . "#3FFFDD") | 104 | (200. . "#CCFFD2") |
| 88 | (280. . "#3FF3FF") | 105 | (220. . "#CCFFDE") |
| 89 | (300. . "#3FC6FF") | 106 | (240. . "#CCFFEA") |
| 90 | (320. . "#3F99FF") | 107 | (260. . "#CCFFF6") |
| 91 | (340. . "#3F6CFF") | 108 | (280. . "#CCFCFF") |
| 92 | (360. . "#3F3FFF"))) | 109 | (300. . "#CCF0FF") |
| 110 | (320. . "#CCE4FF") | ||
| 111 | (340. . "#CCD8FF") | ||
| 112 | (360. . "#CCCCFF"))) | ||
| 113 | ;; Normal colormap for foreground colors on dark background: | ||
| 114 | ;; hue stepped from 0-240deg, value=1., saturation=0.75 | ||
| 115 | (t | ||
| 116 | '(( 20. . "#FF3F3F") | ||
| 117 | ( 40. . "#FF6C3F") | ||
| 118 | ( 60. . "#FF993F") | ||
| 119 | ( 80. . "#FFC63F") | ||
| 120 | (100. . "#FFF33F") | ||
| 121 | (120. . "#DDFF3F") | ||
| 122 | (140. . "#B0FF3F") | ||
| 123 | (160. . "#83FF3F") | ||
| 124 | (180. . "#56FF3F") | ||
| 125 | (200. . "#3FFF56") | ||
| 126 | (220. . "#3FFF83") | ||
| 127 | (240. . "#3FFFB0") | ||
| 128 | (260. . "#3FFFDD") | ||
| 129 | (280. . "#3FF3FF") | ||
| 130 | (300. . "#3FC6FF") | ||
| 131 | (320. . "#3F99FF") | ||
| 132 | (340. . "#3F6CFF") | ||
| 133 | (360. . "#3F3FFF"))))) | ||
| 93 | "Association list of age versus color, for \\[vc-annotate]. | 134 | "Association list of age versus color, for \\[vc-annotate]. |
| 94 | Ages are given in units of fractional days. Default is eighteen | 135 | Ages are given in units of fractional days. Default is eighteen |
| 95 | steps using a twenty day increment, from red to blue. For TTY | 136 | steps using a twenty day increment, from red to blue. For TTY |
| @@ -98,12 +139,12 @@ all other colors between (excluding black and white)." | |||
| 98 | :type 'alist | 139 | :type 'alist |
| 99 | :group 'vc) | 140 | :group 'vc) |
| 100 | 141 | ||
| 101 | (defcustom vc-annotate-very-old-color "#3F3FFF" | 142 | (defcustom vc-annotate-very-old-color (if vc-annotate-background-mode "#CCCCFF" "#3F3FFF") |
| 102 | "Color for lines older than the current color range in \\[vc-annotate]." | 143 | "Color for lines older than the current color range in \\[vc-annotate]." |
| 103 | :type 'string | 144 | :type 'string |
| 104 | :group 'vc) | 145 | :group 'vc) |
| 105 | 146 | ||
| 106 | (defcustom vc-annotate-background "black" | 147 | (defcustom vc-annotate-background nil |
| 107 | "Background color for \\[vc-annotate]. | 148 | "Background color for \\[vc-annotate]. |
| 108 | Default color is used if nil." | 149 | Default color is used if nil." |
| 109 | :type '(choice (const :tag "Default background" nil) (color)) | 150 | :type '(choice (const :tag "Default background" nil) (color)) |
| @@ -347,7 +388,9 @@ Customization variables: | |||
| 347 | `vc-annotate-menu-elements' customizes the menu elements of the | 388 | `vc-annotate-menu-elements' customizes the menu elements of the |
| 348 | mode-specific menu. `vc-annotate-color-map' and | 389 | mode-specific menu. `vc-annotate-color-map' and |
| 349 | `vc-annotate-very-old-color' define the mapping of time to colors. | 390 | `vc-annotate-very-old-color' define the mapping of time to colors. |
| 350 | `vc-annotate-background' specifies the background color." | 391 | `vc-annotate-background' specifies the background color. |
| 392 | `vc-annotate-background-mode' specifies whether the color map | ||
| 393 | should be applied to the background or to the foreground." | ||
| 351 | (interactive | 394 | (interactive |
| 352 | (save-current-buffer | 395 | (save-current-buffer |
| 353 | (vc-ensure-vc-buffer) | 396 | (vc-ensure-vc-buffer) |
| @@ -666,10 +709,13 @@ The annotations are relative to the current time, unless overridden by OFFSET." | |||
| 666 | ;; Make the face if not done. | 709 | ;; Make the face if not done. |
| 667 | (face (or (intern-soft face-name) | 710 | (face (or (intern-soft face-name) |
| 668 | (let ((tmp-face (make-face (intern face-name)))) | 711 | (let ((tmp-face (make-face (intern face-name)))) |
| 669 | (set-face-foreground tmp-face (cdr color)) | 712 | (cond |
| 670 | (when vc-annotate-background | 713 | (vc-annotate-background-mode |
| 671 | (set-face-background tmp-face | 714 | (set-face-background tmp-face (cdr color))) |
| 672 | vc-annotate-background)) | 715 | (t |
| 716 | (set-face-foreground tmp-face (cdr color)) | ||
| 717 | (when vc-annotate-background | ||
| 718 | (set-face-background tmp-face vc-annotate-background)))) | ||
| 673 | tmp-face)))) ; Return the face | 719 | tmp-face)))) ; Return the face |
| 674 | (put-text-property start end 'face face))))) | 720 | (put-text-property start end 'face face))))) |
| 675 | ;; Pretend to font-lock there were no matches. | 721 | ;; Pretend to font-lock there were no matches. |