diff options
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/src/buffer.c b/src/buffer.c index 2c7b426be84..3f278eb807b 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -3672,6 +3672,7 @@ buffer. */) | |||
| 3672 | struct buffer *b, *ob; | 3672 | struct buffer *b, *ob; |
| 3673 | Lisp_Object obuffer; | 3673 | Lisp_Object obuffer; |
| 3674 | ptrdiff_t count = SPECPDL_INDEX (); | 3674 | ptrdiff_t count = SPECPDL_INDEX (); |
| 3675 | ptrdiff_t n_beg, n_end; | ||
| 3675 | 3676 | ||
| 3676 | CHECK_OVERLAY (overlay); | 3677 | CHECK_OVERLAY (overlay); |
| 3677 | if (NILP (buffer)) | 3678 | if (NILP (buffer)) |
| @@ -3696,16 +3697,18 @@ buffer. */) | |||
| 3696 | temp = beg; beg = end; end = temp; | 3697 | temp = beg; beg = end; end = temp; |
| 3697 | } | 3698 | } |
| 3698 | 3699 | ||
| 3699 | b = XBUFFER (buffer); | 3700 | Fset_marker (OVERLAY_START (overlay), beg, buffer); |
| 3700 | if (! (BUF_BEGV (b) <= XINT (beg) && XINT (end) <= BUF_ZV (b))) | 3701 | Fset_marker (OVERLAY_END (overlay), end, buffer); |
| 3701 | args_out_of_range (beg, end); | 3702 | n_beg = marker_position (OVERLAY_START (overlay)); |
| 3703 | n_end = marker_position (OVERLAY_END (overlay)); | ||
| 3702 | 3704 | ||
| 3703 | if (XINT (beg) == XINT (end) && ! NILP (Foverlay_get (overlay, Qevaporate))) | 3705 | if (n_beg == n_end && ! NILP (Foverlay_get (overlay, Qevaporate))) |
| 3704 | return Fdelete_overlay (overlay); | 3706 | return Fdelete_overlay (overlay); |
| 3705 | 3707 | ||
| 3706 | specbind (Qinhibit_quit, Qt); | 3708 | specbind (Qinhibit_quit, Qt); |
| 3707 | 3709 | ||
| 3708 | obuffer = Fmarker_buffer (OVERLAY_START (overlay)); | 3710 | obuffer = Fmarker_buffer (OVERLAY_START (overlay)); |
| 3711 | b = XBUFFER (buffer); | ||
| 3709 | ob = BUFFERP (obuffer) ? XBUFFER (obuffer) : (struct buffer *) 0; | 3712 | ob = BUFFERP (obuffer) ? XBUFFER (obuffer) : (struct buffer *) 0; |
| 3710 | 3713 | ||
| 3711 | /* If the overlay has changed buffers, do a thorough redisplay. */ | 3714 | /* If the overlay has changed buffers, do a thorough redisplay. */ |
| @@ -3724,7 +3727,7 @@ buffer. */) | |||
| 3724 | } | 3727 | } |
| 3725 | 3728 | ||
| 3726 | /* Redisplay where the overlay is going to be. */ | 3729 | /* Redisplay where the overlay is going to be. */ |
| 3727 | modify_overlay (b, XINT (beg), XINT (end)); | 3730 | modify_overlay (b, n_beg, n_end); |
| 3728 | } | 3731 | } |
| 3729 | else | 3732 | else |
| 3730 | /* Redisplay the area the overlay has just left, or just enclosed. */ | 3733 | /* Redisplay the area the overlay has just left, or just enclosed. */ |
| @@ -3734,16 +3737,12 @@ buffer. */) | |||
| 3734 | o_beg = OVERLAY_POSITION (OVERLAY_START (overlay)); | 3737 | o_beg = OVERLAY_POSITION (OVERLAY_START (overlay)); |
| 3735 | o_end = OVERLAY_POSITION (OVERLAY_END (overlay)); | 3738 | o_end = OVERLAY_POSITION (OVERLAY_END (overlay)); |
| 3736 | 3739 | ||
| 3737 | if (o_beg == XINT (beg)) | 3740 | if (o_beg == n_beg) |
| 3738 | modify_overlay (b, o_end, XINT (end)); | 3741 | modify_overlay (b, o_end, n_end); |
| 3739 | else if (o_end == XINT (end)) | 3742 | else if (o_end == n_end) |
| 3740 | modify_overlay (b, o_beg, XINT (beg)); | 3743 | modify_overlay (b, o_beg, n_beg); |
| 3741 | else | 3744 | else |
| 3742 | { | 3745 | modify_overlay (b, min (o_beg, n_beg), max (o_end, n_end)); |
| 3743 | if (XINT (beg) < o_beg) o_beg = XINT (beg); | ||
| 3744 | if (XINT (end) > o_end) o_end = XINT (end); | ||
| 3745 | modify_overlay (b, o_beg, o_end); | ||
| 3746 | } | ||
| 3747 | } | 3746 | } |
| 3748 | 3747 | ||
| 3749 | if (!NILP (obuffer)) | 3748 | if (!NILP (obuffer)) |
| @@ -3755,12 +3754,8 @@ buffer. */) | |||
| 3755 | eassert (XOVERLAY (overlay)->next == NULL); | 3754 | eassert (XOVERLAY (overlay)->next == NULL); |
| 3756 | } | 3755 | } |
| 3757 | 3756 | ||
| 3758 | Fset_marker (OVERLAY_START (overlay), beg, buffer); | ||
| 3759 | Fset_marker (OVERLAY_END (overlay), end, buffer); | ||
| 3760 | |||
| 3761 | /* Put the overlay on the wrong list. */ | 3757 | /* Put the overlay on the wrong list. */ |
| 3762 | end = OVERLAY_END (overlay); | 3758 | if (n_end < b->overlay_center) |
| 3763 | if (OVERLAY_POSITION (end) < b->overlay_center) | ||
| 3764 | { | 3759 | { |
| 3765 | XOVERLAY (overlay)->next = b->overlays_after; | 3760 | XOVERLAY (overlay)->next = b->overlays_after; |
| 3766 | b->overlays_after = XOVERLAY (overlay); | 3761 | b->overlays_after = XOVERLAY (overlay); |