Add new face diff-changed-unspecified

* lisp/vc/diff-mode.el (diff-changed-unspecified): New face.
(diff-font-lock-keywords): Use it (bug#26969).
This commit is contained in:
Lars Ingebrigtsen 2021-08-13 15:35:49 +02:00
parent cebe18b63e
commit 4d51c2c472
2 changed files with 19 additions and 4 deletions

View file

@ -2339,6 +2339,10 @@ a list.
** Diff
---
*** New face 'diff-changed-unspecified'.
This is used when 'diff-use-changed-face' is non-nil.
---
*** New 'diff-mode' font locking face 'diff-error'.
This face is used for error messages from 'diff'.

View file

@ -357,6 +357,16 @@ well."
:foreground "green" :extend t))
"`diff-mode' face used to highlight added lines.")
(defface diff-changed-unspecified
'((((class color) (min-colors 88) (background light))
:background "grey90")
(((class color) (min-colors 88) (background dark))
:background "grey20")
(((class color))
:foreground "grey"))
"`diff-mode' face used to highlight changed lines."
:version "28.1")
(defface diff-changed
'((t nil))
"`diff-mode' face used to highlight changed lines."
@ -436,9 +446,10 @@ well."
(defvar diff-use-changed-face (and (face-differs-from-default-p 'diff-changed)
(not (face-equal 'diff-changed 'diff-added))
(not (face-equal 'diff-changed 'diff-removed)))
"If non-nil, use the face `diff-changed' for changed lines in context diffs.
Otherwise, use the face `diff-removed' for removed lines,
and the face `diff-added' for added lines.")
"Controls how changed lines are fontified in context diffs.
If non-nil, use the face `diff-changed-unspecified'. Otherwise,
use the face `diff-removed' for removed lines, and the face
`diff-added' for added lines.")
(defvar diff-font-lock-keywords
`((,(concat "\\(" diff-hunk-header-re-unified "\\)\\(.*\\)$")
@ -470,7 +481,7 @@ and the face `diff-added' for added lines.")
diff-indicator-added-face
diff-indicator-removed-face)))))
(2 (if diff-use-changed-face
'diff-changed
'diff-changed-unspecified
;; Otherwise, use the same method as above.
(save-match-data
(let ((limit (save-excursion (diff-beginning-of-hunk))))