aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorKenichi Handa2012-10-14 17:06:11 +0900
committerKenichi Handa2012-10-14 17:06:11 +0900
commit9fe32d61c5655878f877522ac4bcc251d092f732 (patch)
tree584f4c85fd2e44e8e7d597382f177359b737acb1 /src/buffer.c
parentf5772b8eaee90d0b50a60bd55d9d28805a2543cb (diff)
parent8111f5e6f05228e36496f3bdccad711f569acb9b (diff)
downloademacs-9fe32d61c5655878f877522ac4bcc251d092f732.tar.gz
emacs-9fe32d61c5655878f877522ac4bcc251d092f732.zip
merge trunk
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 425d05ca790..861a89b5a0f 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -897,6 +897,8 @@ delete_all_overlays (struct buffer *b)
897{ 897{
898 struct Lisp_Overlay *ov, *next; 898 struct Lisp_Overlay *ov, *next;
899 899
900 /* FIXME: Since each drop_overlay will scan BUF_MARKERS to unlink its
901 markers, we have an unneeded O(N^2) behavior here. */
900 for (ov = b->overlays_before; ov; ov = next) 902 for (ov = b->overlays_before; ov; ov = next)
901 { 903 {
902 drop_overlay (b, ov); 904 drop_overlay (b, ov);
@@ -1886,16 +1888,19 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1886 1888
1887 if (b->base_buffer) 1889 if (b->base_buffer)
1888 { 1890 {
1889 /* Unchain all markers that belong to this indirect buffer. 1891 { /* Unchain all markers that belong to this indirect buffer.
1890 Don't unchain the markers that belong to the base buffer 1892 Don't unchain the markers that belong to the base buffer
1891 or its other indirect buffers. */ 1893 or its other indirect buffers. */
1892 for (m = BUF_MARKERS (b); m; ) 1894 struct Lisp_Marker **mp;
1893 { 1895 for (mp = &BUF_MARKERS (b); *mp; )
1894 struct Lisp_Marker *next = m->next; 1896 {
1895 if (m->buffer == b) 1897 struct Lisp_Marker *m = *mp;
1896 unchain_marker (m); 1898 if (m->buffer == b)
1897 m = next; 1899 *mp = m->next;
1898 } 1900 else
1901 mp = &m->next;
1902 }
1903 }
1899 } 1904 }
1900 else 1905 else
1901 { 1906 {
@@ -1911,8 +1916,12 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1911 BUF_MARKERS (b) = NULL; 1916 BUF_MARKERS (b) = NULL;
1912 set_buffer_intervals (b, NULL); 1917 set_buffer_intervals (b, NULL);
1913 1918
1914 /* Perhaps we should explicitly free the interval tree here... */ 1919 /* Perhaps we should explicitly free the interval tree here... */
1915 } 1920 }
1921 /* Since we've unlinked the markers, the overlays can't be here any more
1922 either. */
1923 b->overlays_before = NULL;
1924 b->overlays_after = NULL;
1916 1925
1917 /* Reset the local variables, so that this buffer's local values 1926 /* Reset the local variables, so that this buffer's local values
1918 won't be protected from GC. They would be protected 1927 won't be protected from GC. They would be protected
@@ -2176,7 +2185,7 @@ set_buffer_temp (struct buffer *b)
2176DEFUN ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0, 2185DEFUN ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0,
2177 doc: /* Make buffer BUFFER-OR-NAME current for editing operations. 2186 doc: /* Make buffer BUFFER-OR-NAME current for editing operations.
2178BUFFER-OR-NAME may be a buffer or the name of an existing buffer. See 2187BUFFER-OR-NAME may be a buffer or the name of an existing buffer. See
2179also `save-excursion' when you want to make a buffer current 2188also `with-current-buffer' when you want to make a buffer current
2180temporarily. This function does not display the buffer, so its effect 2189temporarily. This function does not display the buffer, so its effect
2181ends when the current command terminates. Use `switch-to-buffer' or 2190ends when the current command terminates. Use `switch-to-buffer' or
2182`pop-to-buffer' to switch buffers permanently. */) 2191`pop-to-buffer' to switch buffers permanently. */)