Highlight error messages from diff in diff-mode

* lisp/vc/diff-mode.el (diff-error): New face (bug#2739).
(diff-font-lock-keywords): Use it to highlight lines like "diff: "
which are error messages from diff (for instance, when a file
doesn't exist).
This commit is contained in:
Lars Ingebrigtsen 2020-08-21 15:58:32 +02:00
parent 9d0385d7c7
commit 4a8d3d81cf
2 changed files with 11 additions and 0 deletions

View file

@ -820,6 +820,10 @@ window after starting). This variable defaults to nil.
** Miscellaneous
---
*** New 'diff-mode' font locking face 'diff-error'.
This face is used for error messages from diff.
---
*** 'hs-minor-mode' now heeds 'hs-special-modes-alist' for derived modes.
The settings in 'hs-special-modes-alist' now also affect modes derived

View file

@ -392,6 +392,12 @@ well."
'((t :inherit diff-file-header))
"`diff-mode' face used to highlight nonexistent files in recursive diffs.")
(defface diff-error
'((((class color))
:foreground "red" :background "black" :weight bold)
(t :weight bold))
"`diff-mode' face for error messages from diff.")
(defconst diff-yank-handler '(diff-yank-function))
(defun diff-yank-function (text)
;; FIXME: the yank-handler is now called separately on each piece of text
@ -472,6 +478,7 @@ and the face `diff-added' for added lines.")
("^\\(#\\)\\(.*\\)"
(1 font-lock-comment-delimiter-face)
(2 font-lock-comment-face))
("^diff: .*" (0 'diff-error))
("^[^-=+*!<>#].*\n" (0 'diff-context))
(,#'diff--font-lock-syntax)
(,#'diff--font-lock-prettify)