aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2020-08-21 15:58:32 +0200
committerLars Ingebrigtsen2020-08-21 15:58:32 +0200
commit4a8d3d81cfc3e26dfb5eafd4af1c6a5a73fca8aa (patch)
tree97c9322c62b107b4ca3ea6c6e96c566950a22d72
parent9d0385d7c7adc810dfd06321b783593b7afb3d58 (diff)
downloademacs-4a8d3d81cfc3e26dfb5eafd4af1c6a5a73fca8aa.tar.gz
emacs-4a8d3d81cfc3e26dfb5eafd4af1c6a5a73fca8aa.zip
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).
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/vc/diff-mode.el7
2 files changed, 11 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 717439a6ddb..0a6a7dec5cd 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -821,6 +821,10 @@ window after starting). This variable defaults to nil.
821** Miscellaneous 821** Miscellaneous
822 822
823--- 823---
824*** New 'diff-mode' font locking face 'diff-error'.
825This face is used for error messages from diff.
826
827---
824*** 'hs-minor-mode' now heeds 'hs-special-modes-alist' for derived modes. 828*** 'hs-minor-mode' now heeds 'hs-special-modes-alist' for derived modes.
825The settings in 'hs-special-modes-alist' now also affect modes derived 829The settings in 'hs-special-modes-alist' now also affect modes derived
826from those mentioned in that alist. 830from those mentioned in that alist.
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."
392 '((t :inherit diff-file-header)) 392 '((t :inherit diff-file-header))
393 "`diff-mode' face used to highlight nonexistent files in recursive diffs.") 393 "`diff-mode' face used to highlight nonexistent files in recursive diffs.")
394 394
395(defface diff-error
396 '((((class color))
397 :foreground "red" :background "black" :weight bold)
398 (t :weight bold))
399 "`diff-mode' face for error messages from diff.")
400
395(defconst diff-yank-handler '(diff-yank-function)) 401(defconst diff-yank-handler '(diff-yank-function))
396(defun diff-yank-function (text) 402(defun diff-yank-function (text)
397 ;; FIXME: the yank-handler is now called separately on each piece of text 403 ;; 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.")
472 ("^\\(#\\)\\(.*\\)" 478 ("^\\(#\\)\\(.*\\)"
473 (1 font-lock-comment-delimiter-face) 479 (1 font-lock-comment-delimiter-face)
474 (2 font-lock-comment-face)) 480 (2 font-lock-comment-face))
481 ("^diff: .*" (0 'diff-error))
475 ("^[^-=+*!<>#].*\n" (0 'diff-context)) 482 ("^[^-=+*!<>#].*\n" (0 'diff-context))
476 (,#'diff--font-lock-syntax) 483 (,#'diff--font-lock-syntax)
477 (,#'diff--font-lock-prettify) 484 (,#'diff--font-lock-prettify)