bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17234: 24.3.50; overlay priority : cons cells make an error in ediff


From: Nicolas Richard
Subject: bug#17234: 24.3.50; overlay priority : cons cells make an error in ediff
Date: Thu, 10 Apr 2014 11:36:38 +0200

Steps to reproduce from -Q :
M-x ediff-regions-wordwise RET
RET ; selects scratch buf
RET ; ditto
C-SPC C-n C-M-c ; select first line of scratch buffer
C-n C-SPC C-n C-M-c ; select second line of scratch buffer
n ; go to next difference

That makes an error
> Wrong type argument: number-or-marker-p, (nil . 100)
in function ediff-highest-priority, which comes from commit
> cdb3fff3f588caeed50cbb5b64c09bce0a0b31e3
> Author: Stefan Monnier <address@hidden>
> Date:   Sun Mar 23 18:30:47 2014 -0400

>     * lisp/simple.el (redisplay-highlight-region-function): Increase priority 
> of
>     overlay to make sure boundaries are visible.
>     * src/buffer.c (struct sortvec): Add field `spriority'.
>     (compare_overlays): Use it.
>     (sort_overlays): Set it.
where the notion of the "priority" of an overlay was changed : it can
now be a cons cell (which holds a priority and a secondary priority).
The changelog mentions bug#15899 but I saw nothing in that (very long)
thread mentionning the fix.

At (info "(elisp) Overlay Properties") however it is said that the
priority "should be a non-negative integer".

Also, and that's where the error comes from, ediff-init.el relies on the
priority being either nil or an integer, in function
ediff-highest-priority. For this I can suggest a fix (see patch below)
but I don't know what lispref should say about the change.

In GNU Emacs 24.3.50.6 (i686-pc-linux-gnu, GTK+ Version 2.24.20)
 of 2014-04-09 on LDLC-portable

        Modified   lisp/ChangeLog
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 54ac144..3ed0195 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2014-04-10  Nicolas Richard  <address@hidden>
+
+       * vc/ediff-init.el (ediff-highest-priority): Don't make an error
+       if overlay priority is a cons.
+
 2014-04-09  Dmitry Gutov  <address@hidden>
 
        * progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight more
        Modified   lisp/vc/ediff-init.el
diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el
index 000fdb9..110dc63 100644
--- a/lisp/vc/ediff-init.el
+++ b/lisp/vc/ediff-init.el
@@ -1352,7 +1352,12 @@ this variable represents.")
                               (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)
+                         (let ((priority (ediff-overlay-get ovr 'priority)))
+                            (cond ((integerp priority)
+                                   priority)
+                                  ((consp priority)
+                                   (or (car priority) (cdr priority)))
+                                  (t 0)))
                        0))
                    ovr-list))))))))
 
-- 
Nico.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]