aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2005-07-19 11:28:35 +0000
committerJuri Linkov2005-07-19 11:28:35 +0000
commitf3abba999d1195c28090fcbeecd58e9fe50c32c7 (patch)
tree90c4756e25cea51a04ebb1dd4a87650a3a6731b2
parentfedbc8e58cfd8d32181437674dcf5ee25dcfb6b4 (diff)
downloademacs-f3abba999d1195c28090fcbeecd58e9fe50c32c7.tar.gz
emacs-f3abba999d1195c28090fcbeecd58e9fe50c32c7.zip
(diff-file-header): Change foreground color from
yellow to green on light backgrounds. (diff-context): Inherit from `shadow' only for color/grayscale with more than 88 colors. (diff-indicator-removed, diff-indicator-added) (diff-indicator-changed): New faces. (diff-font-lock-keywords): Use new faces. Regroup rules. Add "^---$" for `normal' diff format. Fontify `#' lines with font-lock-comment-delimiter-face and font-lock-comment-face. Add `#' to ^[^...] in the rule for `diff-context-face'.
-rw-r--r--lisp/diff-mode.el58
1 files changed, 42 insertions, 16 deletions
diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el
index b6444aad2a4..38aeb01877c 100644
--- a/lisp/diff-mode.el
+++ b/lisp/diff-mode.el
@@ -197,7 +197,7 @@ when editing big diffs)."
197 (((class color) (min-colors 88) (background dark)) 197 (((class color) (min-colors 88) (background dark))
198 :background "grey60" :weight bold) 198 :background "grey60" :weight bold)
199 (((class color) (background light)) 199 (((class color) (background light))
200 :foreground "yellow" :weight bold) 200 :foreground "green" :weight bold)
201 (((class color) (background dark)) 201 (((class color) (background dark))
202 :foreground "cyan" :weight bold) 202 :foreground "cyan" :weight bold)
203 (t :weight bold)) ; :height 1.3 203 (t :weight bold)) ; :height 1.3
@@ -250,6 +250,27 @@ when editing big diffs)."
250(put 'diff-changed-face 'face-alias 'diff-changed) 250(put 'diff-changed-face 'face-alias 'diff-changed)
251(defvar diff-changed-face 'diff-changed) 251(defvar diff-changed-face 'diff-changed)
252 252
253(defface diff-indicator-removed
254 '((t :inherit diff-removed))
255 "`diff-mode' face used to highlight indicator of removed lines (-, <)."
256 :group 'diff-mode
257 :version "22.1")
258(defvar diff-indicator-removed-face 'diff-indicator-removed)
259
260(defface diff-indicator-added
261 '((t :inherit diff-added))
262 "`diff-mode' face used to highlight indicator of added lines (+, >)."
263 :group 'diff-mode
264 :version "22.1")
265(defvar diff-indicator-added-face 'diff-indicator-added)
266
267(defface diff-indicator-changed
268 '((t :inherit diff-changed))
269 "`diff-mode' face used to highlight indicator of changed lines."
270 :group 'diff-mode
271 :version "22.1")
272(defvar diff-indicator-changed-face 'diff-indicator-changed)
273
253(defface diff-function 274(defface diff-function
254 '((t :inherit diff-context)) 275 '((t :inherit diff-context))
255 "`diff-mode' face used to highlight function names produced by \"diff -p\"." 276 "`diff-mode' face used to highlight function names produced by \"diff -p\"."
@@ -259,7 +280,7 @@ when editing big diffs)."
259(defvar diff-function-face 'diff-function) 280(defvar diff-function-face 'diff-function)
260 281
261(defface diff-context 282(defface diff-context
262 '((t :inherit shadow)) 283 '((((class color grayscale) (min-colors 88)) :inherit shadow))
263 "`diff-mode' face used to highlight context and other side-information." 284 "`diff-mode' face used to highlight context and other side-information."
264 :group 'diff-mode) 285 :group 'diff-mode)
265;; backward-compatibility alias 286;; backward-compatibility alias
@@ -298,24 +319,29 @@ when editing big diffs)."
298 319
299 320
300(defvar diff-font-lock-keywords 321(defvar diff-font-lock-keywords
301 `(("^\\(@@ -[0-9,]+ \\+[0-9,]+ @@\\)\\(.*\\)$" ;unified 322 `(("^\\(@@ -[0-9,]+ \\+[0-9,]+ @@\\)\\(.*\\)$" ;unified
302 (1 diff-hunk-header-face) 323 (1 diff-hunk-header-face) (2 diff-function-face))
303 (2 diff-function-face)) 324 ("^\\(\\*\\{15\\}\\)\\(.*\\)$" ;context
304 ("^--- .+ ----$" . diff-hunk-header-face) ;context 325 (1 diff-hunk-header-face) (2 diff-function-face))
305 ("^\\(\\*\\{15\\}\\)\\(.*\\)$" ;context
306 (1 diff-hunk-header-face)
307 (2 diff-function-face))
308 ("^\\*\\*\\* .+ \\*\\*\\*\\*". diff-hunk-header-face) ;context 326 ("^\\*\\*\\* .+ \\*\\*\\*\\*". diff-hunk-header-face) ;context
327 ("^--- .+ ----$" . diff-hunk-header-face) ;context
328 ("^[0-9,]+[acd][0-9,]+$" . diff-hunk-header-face) ;normal
329 ("^---$" . diff-hunk-header-face) ;normal
309 ("^\\(---\\|\\+\\+\\+\\|\\*\\*\\*\\) \\(\\S-+\\)\\(.*[^*-]\\)?\n" 330 ("^\\(---\\|\\+\\+\\+\\|\\*\\*\\*\\) \\(\\S-+\\)\\(.*[^*-]\\)?\n"
310 (0 diff-header-face) (2 diff-file-header-face prepend)) 331 (0 diff-header-face) (2 diff-file-header-face prepend))
311 ("^[0-9,]+[acd][0-9,]+$" . diff-hunk-header-face) 332 ("^\\([-<]\\)\\(.*\n\\)"
312 ("^!.*\n" (0 diff-changed-face)) 333 (1 diff-indicator-removed-face) (2 diff-removed-face))
313 ("^[+>].*\n" (0 diff-added-face)) 334 ("^\\([+>]\\)\\(.*\n\\)"
314 ("^[-<].*\n" (0 diff-removed-face)) 335 (1 diff-indicator-added-face) (2 diff-added-face))
315 ("^Index: \\(.+\\).*\n" (0 diff-header-face) (1 diff-index-face prepend)) 336 ("^\\(!\\)\\(.*\n\\)"
337 (1 diff-indicator-changed-face) (2 diff-changed-face))
338 ("^Index: \\(.+\\).*\n"
339 (0 diff-header-face) (1 diff-index-face prepend))
316 ("^Only in .*\n" . diff-nonexistent-face) 340 ("^Only in .*\n" . diff-nonexistent-face)
317 ("^#.*" . font-lock-string-face) 341 ("^\\(#\\)\\(.*\\)"
318 ("^[^-=+*!<>].*\n" (0 diff-context-face)))) 342 (1 (eval font-lock-comment-delimiter-face))
343 (2 (eval font-lock-comment-face)))
344 ("^[^-=+*!<>#].*\n" (0 diff-context-face))))
319 345
320(defconst diff-font-lock-defaults 346(defconst diff-font-lock-defaults
321 '(diff-font-lock-keywords t nil nil nil (font-lock-multiline . nil))) 347 '(diff-font-lock-keywords t nil nil nil (font-lock-multiline . nil)))