]> git.eshelyaron.com Git - emacs.git/commitdiff
Use diff faces for compare-windows
authorJuri Linkov <juri@linkov.net>
Sun, 28 Dec 2014 00:48:05 +0000 (02:48 +0200)
committerJuri Linkov <juri@linkov.net>
Sun, 28 Dec 2014 00:48:05 +0000 (02:48 +0200)
* lisp/vc/compare-w.el: Require diff-mode for diff faces.
(compare-windows-removed, compare-windows-added): New faces
inheriting from diff faces.
(compare-windows): Define obsolete face alias.
(compare-windows-highlight): Replace face `compare-windows' with
new faces `compare-windows-added' and `compare-windows-removed'.
(compare-windows-get-recent-window): Signal an error when
no other window is found.

Fixes: debbugs:19451
etc/NEWS
lisp/ChangeLog
lisp/vc/compare-w.el

index 14933aa8b0cffd56486f7809fc0e804cdb096004..4d6327838124e26a8fc436c436d506684445424a 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -401,10 +401,13 @@ and comments.
 the color range from `vc-annotate-color-map' is applied to the
 background or to the foreground.
 
-*** compare-windows now compares text with the most recently used window
+*** `compare-windows' now compares text with the most recently used window
 instead of the next window.  The new option `compare-windows-get-window-function'
 allows to customize this.
 
+*** Two new faces `compare-windows-removed' and `compare-windows-added'
+replace the obsolete face `compare-windows'.
+
 ** Calculator: decimal display mode uses "," groups, so it's more
 fitting for use in money calculations; factorial works with
 non-integer inputs.
index 57103be22a01d69e35fd77acbc7ec3aacf97dee7..bfe2dfb6f2e5f741eba7d3c739d13021288febe8 100644 (file)
@@ -1,3 +1,15 @@
+2014-12-28  Juri Linkov  <juri@linkov.net>
+
+       * vc/compare-w.el: Require diff-mode for diff faces.
+       (compare-windows-removed, compare-windows-added): New faces
+       inheriting from diff faces.
+       (compare-windows): Define obsolete face alias.
+       (compare-windows-highlight): Replace face `compare-windows' with
+       new faces `compare-windows-added' and `compare-windows-removed'
+       (bug#19451).
+       (compare-windows-get-recent-window): Signal an error when
+       no other window is found (bug#19170).
+
 2014-12-27  Dmitry Gutov  <dgutov@yandex.ru>
 
        * progmodes/elisp-mode.el (elisp--xref-identifier-file):
index 3b8293cda249ca7c5c9d2b9388f8232eb4f4b8ef..454139e90251a3494f5d6be02df78d6ad1be8c2f 100644 (file)
@@ -30,6 +30,8 @@
 
 ;;; Code:
 
+(require 'diff-mode)                    ; For diff faces.
+
 (defgroup compare-windows nil
   "Compare text between windows."
   :prefix "compare-"
@@ -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)
@@ -158,7 +168,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 +404,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))