aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorPaul Eggert2012-04-28 15:17:27 -0700
committerPaul Eggert2012-04-28 15:17:27 -0700
commit13c379eed08ffee0081d3c86439962a6b2f94500 (patch)
tree26cdb1d8eb9c2093b4968a8571c5d616c910460e /src/buffer.c
parent8b6c19f4c23e69f2133a8432d614abdc03bdadc6 (diff)
downloademacs-13c379eed08ffee0081d3c86439962a6b2f94500.tar.gz
emacs-13c379eed08ffee0081d3c86439962a6b2f94500.zip
Do not avoid creating empty evaporating overlays (Bug#9642).
* buffer.c (Fmove_overlay): Revert the change of 2012-04-23. That is, do not delete an evaporating overlay if it becomes empty after its bounds are adjusted to fit within its buffer. This fix caused other problems, and I'm reverting it until we get to the bottom of them.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 6c2e21c8125..9bac3ec742b 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -3682,7 +3682,6 @@ buffer. */)
3682 struct buffer *b, *ob; 3682 struct buffer *b, *ob;
3683 Lisp_Object obuffer; 3683 Lisp_Object obuffer;
3684 int count = SPECPDL_INDEX (); 3684 int count = SPECPDL_INDEX ();
3685 ptrdiff_t n_beg, n_end;
3686 3685
3687 CHECK_OVERLAY (overlay); 3686 CHECK_OVERLAY (overlay);
3688 if (NILP (buffer)) 3687 if (NILP (buffer))
@@ -3701,23 +3700,15 @@ buffer. */)
3701 CHECK_NUMBER_COERCE_MARKER (beg); 3700 CHECK_NUMBER_COERCE_MARKER (beg);
3702 CHECK_NUMBER_COERCE_MARKER (end); 3701 CHECK_NUMBER_COERCE_MARKER (end);
3703 3702
3703 if (XINT (beg) == XINT (end) && ! NILP (Foverlay_get (overlay, Qevaporate)))
3704 return Fdelete_overlay (overlay);
3705
3704 if (XINT (beg) > XINT (end)) 3706 if (XINT (beg) > XINT (end))
3705 { 3707 {
3706 Lisp_Object temp; 3708 Lisp_Object temp;
3707 temp = beg; beg = end; end = temp; 3709 temp = beg; beg = end; end = temp;
3708 } 3710 }
3709 3711
3710 /* First set the overlay boundaries, which may clip them. */
3711 Fset_marker (OVERLAY_START (overlay), beg, buffer);
3712 Fset_marker (OVERLAY_END (overlay), end, buffer);
3713 n_beg = marker_position (OVERLAY_START (overlay));
3714 n_end = marker_position (OVERLAY_END (overlay));
3715
3716 /* Now, delete the overlay if it is empty after clipping and has the
3717 evaporate property. */
3718 if (n_beg == n_end && ! NILP (Foverlay_get (overlay, Qevaporate)))
3719 return Fdelete_overlay (overlay);
3720
3721 specbind (Qinhibit_quit, Qt); 3712 specbind (Qinhibit_quit, Qt);
3722 3713
3723 obuffer = Fmarker_buffer (OVERLAY_START (overlay)); 3714 obuffer = Fmarker_buffer (OVERLAY_START (overlay));
@@ -3740,7 +3731,7 @@ buffer. */)
3740 } 3731 }
3741 3732
3742 /* Redisplay where the overlay is going to be. */ 3733 /* Redisplay where the overlay is going to be. */
3743 modify_overlay (b, n_beg, n_end); 3734 modify_overlay (b, XINT (beg), XINT (end));
3744 } 3735 }
3745 else 3736 else
3746 /* Redisplay the area the overlay has just left, or just enclosed. */ 3737 /* Redisplay the area the overlay has just left, or just enclosed. */
@@ -3750,12 +3741,16 @@ buffer. */)
3750 o_beg = OVERLAY_POSITION (OVERLAY_START (overlay)); 3741 o_beg = OVERLAY_POSITION (OVERLAY_START (overlay));
3751 o_end = OVERLAY_POSITION (OVERLAY_END (overlay)); 3742 o_end = OVERLAY_POSITION (OVERLAY_END (overlay));
3752 3743
3753 if (o_beg == n_beg) 3744 if (o_beg == XINT (beg))
3754 modify_overlay (b, o_end, n_end); 3745 modify_overlay (b, o_end, XINT (end));
3755 else if (o_end == n_end) 3746 else if (o_end == XINT (end))
3756 modify_overlay (b, o_beg, n_beg); 3747 modify_overlay (b, o_beg, XINT (beg));
3757 else 3748 else
3758 modify_overlay (b, min (o_beg, n_beg), max (o_end, n_end)); 3749 {
3750 if (XINT (beg) < o_beg) o_beg = XINT (beg);
3751 if (XINT (end) > o_end) o_end = XINT (end);
3752 modify_overlay (b, o_beg, o_end);
3753 }
3759 } 3754 }
3760 3755
3761 if (!NILP (obuffer)) 3756 if (!NILP (obuffer))
@@ -3767,8 +3762,12 @@ buffer. */)
3767 eassert (XOVERLAY (overlay)->next == NULL); 3762 eassert (XOVERLAY (overlay)->next == NULL);
3768 } 3763 }
3769 3764
3765 Fset_marker (OVERLAY_START (overlay), beg, buffer);
3766 Fset_marker (OVERLAY_END (overlay), end, buffer);
3767
3770 /* Put the overlay on the wrong list. */ 3768 /* Put the overlay on the wrong list. */
3771 if (n_end < b->overlay_center) 3769 end = OVERLAY_END (overlay);
3770 if (OVERLAY_POSITION (end) < b->overlay_center)
3772 { 3771 {
3773 XOVERLAY (overlay)->next = b->overlays_after; 3772 XOVERLAY (overlay)->next = b->overlays_after;
3774 b->overlays_after = XOVERLAY (overlay); 3773 b->overlays_after = XOVERLAY (overlay);