From: Lars Ingebrigtsen Date: Fri, 21 Aug 2020 13:58:32 +0000 (+0200) Subject: Highlight error messages from diff in diff-mode X-Git-Tag: emacs-28.0.90~6472 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4a8d3d81cfc3e26dfb5eafd4af1c6a5a73fca8aa;p=emacs.git 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). --- diff --git a/etc/NEWS b/etc/NEWS index 717439a6ddb..0a6a7dec5cd 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -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 diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index aff20b6e6e9..9c41d508b6b 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -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)