X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/6e66744d4c4bd94bb7e34f4243de0213334a31c5..2a4362ba622a53683e9c6ea3e1b441d6f59af08f:/lisp/vc/compare-w.el diff --git a/lisp/vc/compare-w.el b/lisp/vc/compare-w.el index 3b8293cda2..cec1644698 100644 --- a/lisp/vc/compare-w.el +++ b/lisp/vc/compare-w.el @@ -1,6 +1,6 @@ ;;; compare-w.el --- compare text between windows for Emacs -;; Copyright (C) 1986, 1989, 1993, 1997, 2001-2014 Free Software +;; Copyright (C) 1986, 1989, 1993, 1997, 2001-2015 Free Software ;; Foundation, Inc. ;; Maintainer: emacs-devel@gnu.org @@ -30,6 +30,8 @@ ;;; Code: +(require 'diff-mode) ; For diff faces. + (defgroup compare-windows nil "Compare text between windows." :prefix "compare-" @@ -86,7 +88,7 @@ regexp containing some field separator or a newline, depending on the nature of the difference units separator. The variable can be made buffer-local. -If the value of this variable is `nil' (option \"No sync\"), then +If the value of this variable is nil (option \"No sync\"), then no synchronization is performed, and the function `ding' is called to beep or flash the screen when points are mismatched." :type '(choice function regexp (const :tag "No sync" nil)) @@ -128,11 +130,19 @@ out all highlighting later with the command `compare-windows-dehighlight'." :group 'compare-windows :version "22.1") -(defface compare-windows - '((t :inherit lazy-highlight)) - "Face for highlighting of compare-windows difference regions." +(defface compare-windows-removed + '((t :inherit diff-removed)) + "Face for highlighting of compare-windows removed regions." :group 'compare-windows - :version "22.1") + :version "25.1") + +(defface compare-windows-added + '((t :inherit diff-added)) + "Face for highlighting of compare-windows added regions." + :group 'compare-windows + :version "25.1") + +(define-obsolete-face-alias 'compare-windows 'compare-windows-added "25.1") (defvar compare-windows-overlay1 nil) (defvar compare-windows-overlay2 nil) @@ -140,7 +150,8 @@ out all highlighting later with the command `compare-windows-dehighlight'." (defvar compare-windows-overlays2 nil) (defvar compare-windows-sync-point nil) -(defcustom compare-windows-get-window-function 'compare-windows-get-recent-window +(defcustom compare-windows-get-window-function + 'compare-windows-get-recent-window "Function that provides the window to compare with." :type '(choice (function-item :tag "Most recently used window" @@ -149,7 +160,7 @@ out all highlighting later with the command `compare-windows-dehighlight'." compare-windows-get-next-window) (function :tag "Your function")) :group 'compare-windows - :version "25.0") + :version "25.1") (defun compare-windows-get-recent-window () "Return the most recently used window. @@ -158,7 +169,8 @@ then try to get a window on an iconified frame, and finally consider all existing frames." (or (get-mru-window 'visible t t) (get-mru-window 0 t t) - (get-mru-window t t t))) + (get-mru-window t t t) + (error "No other window"))) (defun compare-windows-get-next-window () "Return the window next in the cyclic ordering of windows. @@ -393,13 +405,13 @@ on third call it again advances points to the next difference and so on." (if compare-windows-overlay1 (move-overlay compare-windows-overlay1 beg1 end1 b1) (setq compare-windows-overlay1 (make-overlay beg1 end1 b1)) - (overlay-put compare-windows-overlay1 'face 'compare-windows) + (overlay-put compare-windows-overlay1 'face 'compare-windows-added) (overlay-put compare-windows-overlay1 'priority 1000)) (overlay-put compare-windows-overlay1 'window w1) (if compare-windows-overlay2 (move-overlay compare-windows-overlay2 beg2 end2 b2) (setq compare-windows-overlay2 (make-overlay beg2 end2 b2)) - (overlay-put compare-windows-overlay2 'face 'compare-windows) + (overlay-put compare-windows-overlay2 'face 'compare-windows-removed) (overlay-put compare-windows-overlay2 'priority 1000)) (overlay-put compare-windows-overlay2 'window w2) (if (not (eq compare-windows-highlight 'persistent))