emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 4a8d3d8: Highlight error messages from diff in diff-mode


From: Lars Ingebrigtsen
Subject: master 4a8d3d8: Highlight error messages from diff in diff-mode
Date: Fri, 21 Aug 2020 09:58:41 -0400 (EDT)

branch: master
commit 4a8d3d81cfc3e26dfb5eafd4af1c6a5a73fca8aa
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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).
---
 etc/NEWS             | 4 ++++
 lisp/vc/diff-mode.el | 7 +++++++
 2 files changed, 11 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index 717439a..0a6a7de 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -821,6 +821,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
 from those mentioned in that alist.
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index aff20b6..9c41d50 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]