Subject: bug#33567: Syntactic fontification of diff hunks

From: Dmitry Gutov <[email-masked]>
Date: Wed, 19 Dec 2018 03:35:39 +0200

On 19.12.2018 2:48, Dmitry Gutov wrote:
> On 19.12.2018 2:11, Juri Linkov wrote:
> 
>> Does it help to remove foreground colors from diff-added and 
>> diff-removed?
> 
> Yup. Except if I customize those and restart, I think the +'s and -'s on 
> the left will become black as well, which is somewhat of a loss.
(Maybe not on colorful enough displays, though).

Anyway, to be clear, and other considerations aside, this works:

diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index ed953deb21..8a41e365da 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -304,9 +304,7 @@ diff-removed
      (((class color) (min-colors 88) (background light))
       :background "#ffdddd")
      (((class color) (min-colors 88) (background dark))
-     :background "#553333")
-    (((class color))
-     :foreground "red"))
+     :background "#553333"))
    "`diff-mode' face used to highlight removed lines.")

  (defface diff-added
@@ -315,9 +313,7 @@ diff-added
      (((class color) (min-colors 88) (background light))
       :background "#ddffdd")
      (((class color) (min-colors 88) (background dark))
-     :background "#335533")
-    (((class color))
-     :foreground "green"))
+     :background "#335533"))
    "`diff-mode' face used to highlight added lines.")

  (defface diff-changed
@@ -328,7 +324,9 @@ diff-changed
  (defface diff-indicator-removed
    '((default :inherit diff-removed)
      (((class color) (min-colors 88))
-     :foreground "#aa2222"))
+     :foreground "#aa2222")
+    (((class color))
+     :foreground "red"))
    "`diff-mode' face used to highlight indicator of removed lines (-, <)."
    :version "22.1")
  (defvar diff-indicator-removed-face 'diff-indicator-removed)
@@ -336,7 +334,9 @@ diff-indicator-removed-face
  (defface diff-indicator-added
    '((default :inherit diff-added)
      (((class color) (min-colors 88))
-     :foreground "#22aa22"))
+     :foreground "#22aa22")
+    (((class color))
+     :foreground "green"))
    "`diff-mode' face used to highlight indicator of added lines (+, >)."
    :version "22.1")
  (defvar diff-indicator-added-face 'diff-indicator-added)