[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r108012: Do not create empty overlays
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r108012: Do not create empty overlays with the evaporate property (Bug#9642). |
Date: |
Mon, 23 Apr 2012 15:46:35 -0700 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 108012
fixes bug(s): http://debbugs.gnu.org/9642
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Mon 2012-04-23 15:46:35 -0700
message:
Do not create empty overlays with the evaporate property (Bug#9642).
* buffer.c (Fmove_overlay): Delete an evaporating overlay
if it becomes empty after its bounds are adjusted to fit within
its buffer. Without this fix, in a nonempty buffer (let ((o
(make-overlay 1 2))) (overlay-put o 'evaporate t) (move-overlay o 0 1))
yields an empty overlay that has the evaporate property, which is
not supposed to happen.
modified:
src/ChangeLog
src/buffer.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-04-23 07:34:29 +0000
+++ b/src/ChangeLog 2012-04-23 22:46:35 +0000
@@ -1,5 +1,13 @@
2012-04-23 Paul Eggert <address@hidden>
+ Do not create empty overlays with the evaporate property (Bug#9642).
+ * buffer.c (Fmove_overlay): Delete an evaporating overlay
+ if it becomes empty after its bounds are adjusted to fit within
+ its buffer. Without this fix, in a nonempty buffer (let ((o
+ (make-overlay 1 2))) (overlay-put o 'evaporate t) (move-overlay o 0 1))
+ yields an empty overlay that has the evaporate property, which is
+ not supposed to happen.
+
Fix minor GTK3 problems found by static checking.
* emacsgtkfixed.c (EMACS_TYPE_FIXED, EMACS_FIXED, EmacsFixed)
(EmacsFixedPrivate, EmacsFixedClass, struct _EmacsFixed)
=== modified file 'src/buffer.c'
--- a/src/buffer.c 2012-04-16 01:10:42 +0000
+++ b/src/buffer.c 2012-04-23 22:46:35 +0000
@@ -3682,6 +3682,7 @@
struct buffer *b, *ob;
Lisp_Object obuffer;
int count = SPECPDL_INDEX ();
+ ptrdiff_t n_beg, n_end;
CHECK_OVERLAY (overlay);
if (NILP (buffer))
@@ -3700,15 +3701,23 @@
CHECK_NUMBER_COERCE_MARKER (beg);
CHECK_NUMBER_COERCE_MARKER (end);
- if (XINT (beg) == XINT (end) && ! NILP (Foverlay_get (overlay, Qevaporate)))
+ if (XINT (beg) > XINT (end))
+ {
+ Lisp_Object temp;
+ temp = beg; beg = end; end = temp;
+ }
+
+ /* First set the overlay boundaries, which may clip them. */
+ Fset_marker (OVERLAY_START (overlay), beg, buffer);
+ Fset_marker (OVERLAY_END (overlay), end, buffer);
+ n_beg = marker_position (OVERLAY_START (overlay));
+ n_end = marker_position (OVERLAY_END (overlay));
+
+ /* Now, delete the overlay if it is empty after clipping and has the
+ evaporate property. */
+ if (n_beg == n_end && ! NILP (Foverlay_get (overlay, Qevaporate)))
return Fdelete_overlay (overlay);
- if (XINT (beg) > XINT (end))
- {
- Lisp_Object temp;
- temp = beg; beg = end; end = temp;
- }
-
specbind (Qinhibit_quit, Qt);
obuffer = Fmarker_buffer (OVERLAY_START (overlay));
@@ -3731,7 +3740,7 @@
}
/* Redisplay where the overlay is going to be. */
- modify_overlay (b, XINT (beg), XINT (end));
+ modify_overlay (b, n_beg, n_end);
}
else
/* Redisplay the area the overlay has just left, or just enclosed. */
@@ -3741,16 +3750,12 @@
o_beg = OVERLAY_POSITION (OVERLAY_START (overlay));
o_end = OVERLAY_POSITION (OVERLAY_END (overlay));
- if (o_beg == XINT (beg))
- modify_overlay (b, o_end, XINT (end));
- else if (o_end == XINT (end))
- modify_overlay (b, o_beg, XINT (beg));
+ if (o_beg == n_beg)
+ modify_overlay (b, o_end, n_end);
+ else if (o_end == n_end)
+ modify_overlay (b, o_beg, n_beg);
else
- {
- if (XINT (beg) < o_beg) o_beg = XINT (beg);
- if (XINT (end) > o_end) o_end = XINT (end);
- modify_overlay (b, o_beg, o_end);
- }
+ modify_overlay (b, min (o_beg, n_beg), max (o_end, n_end));
}
if (!NILP (obuffer))
@@ -3762,12 +3767,8 @@
eassert (XOVERLAY (overlay)->next == NULL);
}
- Fset_marker (OVERLAY_START (overlay), beg, buffer);
- Fset_marker (OVERLAY_END (overlay), end, buffer);
-
/* Put the overlay on the wrong list. */
- end = OVERLAY_END (overlay);
- if (OVERLAY_POSITION (end) < b->overlay_center)
+ if (n_end < b->overlay_center)
{
XOVERLAY (overlay)->next = b->overlays_after;
b->overlays_after = XOVERLAY (overlay);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r108012: Do not create empty overlays with the evaporate property (Bug#9642).,
Paul Eggert <=