[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-24 r116846: * lisp/simple.el (redisplay-highlight-re
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] emacs-24 r116846: * lisp/simple.el (redisplay-highlight-region-function): Increase priority of |
Date: |
Sun, 23 Mar 2014 22:30:56 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 116846
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15899
committer: Stefan Monnier <address@hidden>
branch nick: emacs-24
timestamp: Sun 2014-03-23 18:30:47 -0400
message:
* 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.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/simple.el simple.el-20091113204419-o5vbwnq5f7feedwu-403
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/buffer.c buffer.c-20091113204419-o5vbwnq5f7feedwu-264
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2014-03-23 22:14:11 +0000
+++ b/lisp/ChangeLog 2014-03-23 22:30:47 +0000
@@ -1,3 +1,8 @@
+2014-03-23 Stefan Monnier <address@hidden>
+
+ * simple.el (redisplay-highlight-region-function): Increase priority of
+ overlay to make sure boundaries are visible (bug#15899).
+
2014-03-23 Juanma Barranquero <address@hidden>
* frameset.el (frameset-restore): Compare display strings with equal.
=== modified file 'lisp/simple.el'
--- a/lisp/simple.el 2014-03-19 19:12:50 +0000
+++ b/lisp/simple.el 2014-03-23 22:30:47 +0000
@@ -4476,6 +4476,11 @@
(funcall redisplay-unhighlight-region-function rol)
(overlay-put nrol 'window window)
(overlay-put nrol 'face 'region)
+ ;; Normal priority so that a large region doesn't hide all the
+ ;; overlays within it, but high secondary priority so that if it
+ ;; ends/starts in the middle of a small overlay, that small overlay
+ ;; won't hide the region's boundaries.
+ (overlay-put nrol 'priority '(nil . 100))
nrol)
(unless (and (eq (overlay-buffer rol) (current-buffer))
(eq (overlay-start rol) start)
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2014-03-23 15:59:15 +0000
+++ b/src/ChangeLog 2014-03-23 22:30:47 +0000
@@ -1,3 +1,9 @@
+2014-03-23 Stefan Monnier <address@hidden>
+
+ * buffer.c (struct sortvec): Add field `spriority'.
+ (compare_overlays): Use it.
+ (sort_overlays): Set it.
+
2014-03-23 Eli Zaretskii <address@hidden>
* xdisp.c (redisplay_window): If all previous attempts to find the
=== modified file 'src/buffer.c'
--- a/src/buffer.c 2014-03-15 11:16:12 +0000
+++ b/src/buffer.c 2014-03-23 22:30:47 +0000
@@ -3147,6 +3147,7 @@
Lisp_Object overlay;
ptrdiff_t beg, end;
EMACS_INT priority;
+ EMACS_INT spriority; /* Secondary priority. */
};
static int
@@ -3154,19 +3155,28 @@
{
const struct sortvec *s1 = v1;
const struct sortvec *s2 = v2;
+ /* Return 1 if s1 should take precedence, -1 if v2 should take precedence,
+ and 0 if they're equal. */
if (s1->priority != s2->priority)
return s1->priority < s2->priority ? -1 : 1;
- if (s1->beg != s2->beg)
- return s1->beg < s2->beg ? -1 : 1;
- if (s1->end != s2->end)
+ /* If the priority is equal, give precedence to the one not covered by the
+ other. If neither covers the other, obey spriority. */
+ else if (s1->beg < s2->beg)
+ return (s1->end < s2->end && s1->spriority > s2->spriority ? 1 : -1);
+ else if (s1->beg > s2->beg)
+ return (s1->end > s2->end && s1->spriority < s2->spriority ? -1 : 1);
+ else if (s1->end != s2->end)
return s2->end < s1->end ? -1 : 1;
- /* Avoid the non-determinism of qsort by choosing an arbitrary ordering
- between "equal" overlays. The result can still change between
- invocations of Emacs, but it won't change in the middle of
- `find_field' (bug#6830). */
- if (!EQ (s1->overlay, s2->overlay))
+ else if (s1->spriority != s2->spriority)
+ return (s1->spriority < s2->spriority ? -1 : 1);
+ else if (EQ (s1->overlay, s2->overlay))
+ return 0;
+ else
+ /* Avoid the non-determinism of qsort by choosing an arbitrary ordering
+ between "equal" overlays. The result can still change between
+ invocations of Emacs, but it won't change in the middle of
+ `find_field' (bug#6830). */
return XLI (s1->overlay) < XLI (s2->overlay) ? -1 : 1;
- return 0;
}
/* Sort an array of overlays by priority. The array is modified in place.
@@ -3209,10 +3219,23 @@
sortvec[j].beg = OVERLAY_POSITION (OVERLAY_START (overlay));
sortvec[j].end = OVERLAY_POSITION (OVERLAY_END (overlay));
tem = Foverlay_get (overlay, Qpriority);
- if (INTEGERP (tem))
- sortvec[j].priority = XINT (tem);
- else
- sortvec[j].priority = 0;
+ if (NILP (tem))
+ {
+ sortvec[j].priority = 0;
+ sortvec[j].spriority = 0;
+ }
+ else if (INTEGERP (tem))
+ {
+ sortvec[j].priority = XINT (tem);
+ sortvec[j].spriority = 0;
+ }
+ else if (CONSP (tem))
+ {
+ Lisp_Object car = XCAR (tem);
+ Lisp_Object cdr = XCDR (tem);
+ sortvec[j].priority = INTEGERP (car) ? XINT (car) : 0;
+ sortvec[j].spriority = INTEGERP (cdr) ? XINT (cdr) : 0;
+ }
j++;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-24 r116846: * lisp/simple.el (redisplay-highlight-region-function): Increase priority of,
Stefan Monnier <=