aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2012-07-06 08:42:30 +0400
committerDmitry Antipov2012-07-06 08:42:30 +0400
commit041a49a645d9bbe7f249083d9065076bc8ccaa45 (patch)
treeb775009c6f32c55e8504f07971a4920d87de8a45 /src
parent226c3633fdc0a259aa73aa9e6555cd42dd9f168c (diff)
downloademacs-041a49a645d9bbe7f249083d9065076bc8ccaa45.tar.gz
emacs-041a49a645d9bbe7f249083d9065076bc8ccaa45.zip
Do not use Fdelete_overlay in delete_all_overlays
to avoid redundant calls to unchain_overlay. * buffer.c (drop_overlay): New function. (delete_all_overlays, Fdelete_overlay): Use it. * minibuf.c (get_minibuffer): Fix comment.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/buffer.c45
-rw-r--r--src/minibuf.c7
3 files changed, 38 insertions, 22 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index af51c9a100a..c8a9b3f8b0c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12012-07-06 Dmitry Antipov <dmantipov@yandex.ru>
2
3 Do not use Fdelete_overlay in delete_all_overlays
4 to avoid redundant calls to unchain_overlay.
5 * buffer.c (drop_overlay): New function.
6 (delete_all_overlays, Fdelete_overlay): Use it.
7 * minibuf.c (get_minibuffer): Fix comment.
8
12012-07-06 Paul Eggert <eggert@cs.ucla.edu> 92012-07-06 Paul Eggert <eggert@cs.ucla.edu>
2 10
3 Port to OpenBSD 5.1 amd64. 11 Port to OpenBSD 5.1 amd64.
diff --git a/src/buffer.c b/src/buffer.c
index 838932db4df..f73d2d07537 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -667,27 +667,40 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
667 return buf; 667 return buf;
668} 668}
669 669
670/* Mark OV as no longer associated with B. */
671
672static void
673drop_overlay (struct buffer *b, struct Lisp_Overlay *ov)
674{
675 eassert (b == XBUFFER (Fmarker_buffer (ov->start)));
676 modify_overlay (b, marker_position (ov->start), marker_position (ov->end));
677 Fset_marker (ov->start, Qnil, Qnil);
678 Fset_marker (ov->end, Qnil, Qnil);
679
680}
681
682/* Delete all overlays of B and reset it's overlay lists. */
683
670void 684void
671delete_all_overlays (struct buffer *b) 685delete_all_overlays (struct buffer *b)
672{ 686{
673 Lisp_Object overlay; 687 struct Lisp_Overlay *ov, *next;
674 688
675 /* `reset_buffer' blindly sets the list of overlays to NULL, so we 689 for (ov = b->overlays_before; ov; ov = next)
676 have to empty the list, otherwise we end up with overlays that
677 think they belong to this buffer while the buffer doesn't know about
678 them any more. */
679 while (b->overlays_before)
680 { 690 {
681 XSETMISC (overlay, b->overlays_before); 691 drop_overlay (b, ov);
682 Fdelete_overlay (overlay); 692 next = ov->next;
693 ov->next = NULL;
683 } 694 }
684 while (b->overlays_after) 695
696 for (ov = b->overlays_after; ov; ov = next)
685 { 697 {
686 XSETMISC (overlay, b->overlays_after); 698 drop_overlay (b, ov);
687 Fdelete_overlay (overlay); 699 next = ov->next;
700 ov->next = NULL;
688 } 701 }
689 eassert (b->overlays_before == NULL); 702
690 eassert (b->overlays_after == NULL); 703 b->overlays_before = b->overlays_after = NULL;
691} 704}
692 705
693/* Reinitialize everything about a buffer except its name and contents 706/* Reinitialize everything about a buffer except its name and contents
@@ -3820,11 +3833,7 @@ DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0,
3820 = unchain_overlay (b->overlays_after, XOVERLAY (overlay)); 3833 = unchain_overlay (b->overlays_after, XOVERLAY (overlay));
3821 eassert (XOVERLAY (overlay)->next == NULL); 3834 eassert (XOVERLAY (overlay)->next == NULL);
3822 3835
3823 modify_overlay (b, 3836 drop_overlay (b, XOVERLAY (overlay));
3824 marker_position (OVERLAY_START (overlay)),
3825 marker_position (OVERLAY_END (overlay)));
3826 Fset_marker (OVERLAY_START (overlay), Qnil, Qnil);
3827 Fset_marker (OVERLAY_END (overlay), Qnil, Qnil);
3828 3837
3829 /* When deleting an overlay with before or after strings, turn off 3838 /* When deleting an overlay with before or after strings, turn off
3830 display optimizations for the affected buffer, on the basis that 3839 display optimizations for the affected buffer, on the basis that
diff --git a/src/minibuf.c b/src/minibuf.c
index 050a22a418d..89390aeb0b5 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -804,10 +804,9 @@ get_minibuffer (EMACS_INT depth)
804 else 804 else
805 { 805 {
806 ptrdiff_t count = SPECPDL_INDEX (); 806 ptrdiff_t count = SPECPDL_INDEX ();
807 /* `reset_buffer' blindly sets the list of overlays to NULL, so we 807 /* We have to empty both overlay lists. Otherwise we end
808 have to empty the list, otherwise we end up with overlays that 808 up with overlays that think they belong to this buffer
809 think they belong to this buffer while the buffer doesn't know about 809 while the buffer doesn't know about them any more. */
810 them any more. */
811 delete_all_overlays (XBUFFER (buf)); 810 delete_all_overlays (XBUFFER (buf));
812 reset_buffer (XBUFFER (buf)); 811 reset_buffer (XBUFFER (buf));
813 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); 812 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());