Subject: bug#33567: Syntactic fontification of diff hunks

From: Juri Linkov <[email-masked]>
Date: Thu, 27 Dec 2018 02:18:14 +0200

>> There are some underlines on this screenshot, maybe use underlines for
>> refined diffs on tty?
>
> You mean colored underlines for every line? Umm, not sure I'd like that.

Actually I meant underlines instead of inverse-video.  Underlined refinement
looks much better than in inverse-video.

Also I propose to not use this feature on tty because there is no good
solution how to combine diff foreground colors with syntax foreground colors:

diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index a4c0618c67..7ab64fa4aa 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -104,7 +104,7 @@ diff-font-lock-prettify
   :version "27.1"
   :type 'boolean)
 
-(defcustom diff-font-lock-syntax t
+(defcustom diff-font-lock-syntax (>= (display-color-cells) 88)
   "If non-nil, diff hunk font-lock includes source language syntax highlighting.
 This highlighting is the same as added by `font-lock-mode'
 when corresponding source files are visited normally.
@@ -2019,7 +2019,7 @@ diff-refine-changed
      :background "#ffff55")
     (((class color) (min-colors 88) (background dark))
      :background "#aaaa22")
-    (t :inverse-video t))
+    (t :underline t))
   "Face used for char-based changes shown by `diff-refine-hunk'.")
 
 (defface diff-refine-removed