From e46561a27ef859132775e8025468ad5bf3cbab47 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 10 Apr 2014 15:15:01 -0400 Subject: [PATCH] Ediff's overlay priorities cause more trouble than they solve. * lisp/vc/ediff-init.el (ediff-shadow-overlay-priority): Remove variable. (ediff-highest-priority): Remove function. * lisp/vc/ediff-util.el (ediff-highlight-diff-in-one-buffer): * lisp/vc/ediff-diff.el (ediff-set-diff-overlays-in-one-buffer) (ediff-set-fine-diff-properties-in-one-buffer): Don't mess with overlay priorities. Fixes: debbugs:17234 --- lisp/ChangeLog | 10 ++++++++++ lisp/vc/ediff-diff.el | 18 +++--------------- lisp/vc/ediff-init.el | 31 ------------------------------- lisp/vc/ediff-util.el | 2 -- 4 files changed, 13 insertions(+), 48 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ad27e2fc8b4..c3721febc1a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2014-04-10 Stefan Monnier + + Ediff's overlay priorities cause more trouble than they solve. + * vc/ediff-init.el (ediff-shadow-overlay-priority): Remove variable. + (ediff-highest-priority): Remove function (bug#17234). + * vc/ediff-util.el (ediff-highlight-diff-in-one-buffer): + * vc/ediff-diff.el (ediff-set-diff-overlays-in-one-buffer) + (ediff-set-fine-diff-properties-in-one-buffer): Don't mess with + overlay priorities. + 2014-04-10 Feng Li (tiny change) * progmodes/pascal.el (pascal-font-lock-keywords): Fix incorrect format diff --git a/lisp/vc/ediff-diff.el b/lisp/vc/ediff-diff.el index 96e8acca294..f429eb35d70 100644 --- a/lisp/vc/ediff-diff.el +++ b/lisp/vc/ediff-diff.el @@ -587,7 +587,6 @@ one optional arguments, diff-number to refine.") (setq pt-saved (ediff-with-current-buffer buff (point))))) (setq overlay (ediff-make-bullet-proof-overlay begin end buff)) - (ediff-overlay-put overlay 'priority ediff-shadow-overlay-priority) (ediff-overlay-put overlay 'ediff-diff-num current-diff) (if (and (ediff-has-face-support-p) ediff-use-faces ediff-highlight-all-diffs) @@ -822,20 +821,9 @@ one optional arguments, diff-number to refine.") 'default (ediff-get-symbol-from-alist buf-type ediff-fine-diff-face-alist) - )) - (priority (if default - 0 - (1+ (or (ediff-overlay-get - (symbol-value - (ediff-get-symbol-from-alist - buf-type - ediff-current-diff-overlay-alist)) - 'priority) - 0))))) - (mapcar (lambda (overl) - (ediff-set-overlay-face overl face) - (ediff-overlay-put overl 'priority priority)) - fine-diff-vector))) + ))) + (dolist (overl fine-diff-vector) + (ediff-set-overlay-face overl face)))) ;; Set overlays over the regions that denote delimiters (defun ediff-set-fine-overlays-for-combined-merge (diff-list reg-num) diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el index 000fdb916e3..f3781c53885 100644 --- a/lisp/vc/ediff-init.el +++ b/lisp/vc/ediff-init.el @@ -707,9 +707,6 @@ shown in brighter colors." ;; List of difference overlays disturbed by working with the current diff. (defvar ediff-disturbed-overlays nil "") -;; Priority of non-selected overlays. -(defvar ediff-shadow-overlay-priority 100 "") - (defcustom ediff-version-control-package 'vc "Version control package used. Currently, Ediff supports vc.el, rcs.el, pcl-cvs.el, and generic-sc.el. The @@ -1329,34 +1326,6 @@ this variable represents.") (ediff-defvar-local ediff-current-diff-overlay-Ancestor nil "Overlay for the current difference region in the ancestor buffer.") -;; Compute priority of a current ediff overlay. -(defun ediff-highest-priority (start end buffer) - (let ((pos (max 1 (1- start))) - ovr-list) - (if (featurep 'xemacs) - (1+ ediff-shadow-overlay-priority) - (ediff-with-current-buffer buffer - (while (< pos (min (point-max) (1+ end))) - (setq ovr-list (append (overlays-at pos) ovr-list)) - (setq pos (next-overlay-change pos))) - (+ 1 ediff-shadow-overlay-priority - (apply 'max - (cons - 1 - (mapcar - (lambda (ovr) - (if (and ovr - ;; exclude ediff overlays from priority - ;; calculation, or else priority will keep - ;; increasing - (null (ediff-overlay-get ovr 'ediff)) - (null (ediff-overlay-get ovr 'ediff-diff-num))) - ;; use the overlay priority or 0 - (or (ediff-overlay-get ovr 'priority) 0) - 0)) - ovr-list)))))))) - - (defvar ediff-toggle-read-only-function 'toggle-read-only "Function to be used to toggle read-only status of the buffer. If nil, Ediff tries using the command bound to C-x C-q.") diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el index 127e6b2cfc0..649ef884059 100644 --- a/lisp/vc/ediff-util.el +++ b/lisp/vc/ediff-util.el @@ -3023,8 +3023,6 @@ Hit \\[ediff-recenter] to reset the windows afterward." (if (featurep 'xemacs) (ediff-move-overlay current-diff-overlay begin end-hilit) (ediff-move-overlay current-diff-overlay begin end-hilit buff)) - (ediff-overlay-put current-diff-overlay 'priority - (ediff-highest-priority begin end-hilit buff)) (ediff-overlay-put current-diff-overlay 'ediff-diff-num n) ;; unhighlight the background overlay for diff n so it won't -- 2.39.2