- (:foreground "yellow" :weight bold :slant italic))
- (t ()))
- "`diff-mode' face used to highlight changed lines.")
-(defvar diff-changed-face 'diff-changed-face)
-
-(defface diff-function-face
- '((t (:inherit diff-context-face)))
- "`diff-mode' face used to highlight function names produced by \"diff -p\".")
-(defvar diff-function-face 'diff-function-face)
-
-(defface diff-context-face
- '((((class color) (background light))
- (:foreground "grey50"))
- (((class color) (background dark))
- (:foreground "grey70"))
- (t ))
- "`diff-mode' face used to highlight context and other side-information.")
-(defvar diff-context-face 'diff-context-face)
+ :foreground "yellow" :weight bold :slant italic))
+ "`diff-mode' face used to highlight changed lines."
+ :group 'diff-mode)
+;; backward-compatibility alias
+(put 'diff-changed-face 'face-alias 'diff-changed)
+(defvar diff-changed-face 'diff-changed)
+
+(defface diff-indicator-removed
+ '((t :inherit diff-removed))
+ "`diff-mode' face used to highlight indicator of removed lines (-, <)."
+ :group 'diff-mode
+ :version "22.1")
+(defvar diff-indicator-removed-face 'diff-indicator-removed)
+
+(defface diff-indicator-added
+ '((t :inherit diff-added))
+ "`diff-mode' face used to highlight indicator of added lines (+, >)."
+ :group 'diff-mode
+ :version "22.1")
+(defvar diff-indicator-added-face 'diff-indicator-added)
+
+(defface diff-indicator-changed
+ '((t :inherit diff-changed))
+ "`diff-mode' face used to highlight indicator of changed lines."
+ :group 'diff-mode
+ :version "22.1")
+(defvar diff-indicator-changed-face 'diff-indicator-changed)
+
+(defface diff-function
+ '((t :inherit diff-header))
+ "`diff-mode' face used to highlight function names produced by \"diff -p\"."
+ :group 'diff-mode)
+;; backward-compatibility alias
+(put 'diff-function-face 'face-alias 'diff-function)
+(defvar diff-function-face 'diff-function)
+
+(defface diff-context
+ '((((class color grayscale) (min-colors 88)) :inherit shadow))
+ "`diff-mode' face used to highlight context and other side-information."
+ :group 'diff-mode)
+;; backward-compatibility alias
+(put 'diff-context-face 'face-alias 'diff-context)
+(defvar diff-context-face 'diff-context)
+
+(defface diff-nonexistent
+ '((t :inherit diff-file-header))
+ "`diff-mode' face used to highlight nonexistent files in recursive diffs."
+ :group 'diff-mode)
+;; backward-compatibility alias
+(put 'diff-nonexistent-face 'face-alias 'diff-nonexistent)
+(defvar diff-nonexistent-face 'diff-nonexistent)
+
+(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
+ ;; with a yank-handler property, so the next-single-property-change call
+ ;; below will always return nil :-( --stef
+ (let ((mixed (next-single-property-change 0 'yank-handler text))
+ (start (point)))
+ ;; First insert the text.
+ (insert text)
+ ;; If the text does not include any diff markers and if we're not
+ ;; yanking back into a diff-mode buffer, get rid of the prefixes.
+ (unless (or mixed (derived-mode-p 'diff-mode))
+ (undo-boundary) ; Just in case the user wanted the prefixes.
+ (let ((re (save-excursion
+ (if (re-search-backward "^[><!][ \t]" start t)
+ (if (eq (char-after) ?!)
+ "^[!+- ][ \t]" "^[<>][ \t]")
+ "^[ <>!+-]"))))
+ (save-excursion
+ (while (re-search-backward re start t)
+ (replace-match "" t t)))))))