aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/buffer.c b/src/buffer.c
index aa3fcf8c234..8728b418812 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1769,7 +1769,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1769 since anything can happen within do_yes_or_no_p. */ 1769 since anything can happen within do_yes_or_no_p. */
1770 1770
1771 /* Don't kill the minibuffer now current. */ 1771 /* Don't kill the minibuffer now current. */
1772 if (EQ (buffer, XWINDOW (minibuf_window)->buffer)) 1772 if (EQ (buffer, XWINDOW (minibuf_window)->contents))
1773 return Qnil; 1773 return Qnil;
1774 1774
1775 /* When we kill an ordinary buffer which shares it's buffer text 1775 /* When we kill an ordinary buffer which shares it's buffer text
@@ -1820,7 +1820,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1820 /* If the buffer now current is shown in the minibuffer and our buffer 1820 /* If the buffer now current is shown in the minibuffer and our buffer
1821 is the sole other buffer give up. */ 1821 is the sole other buffer give up. */
1822 XSETBUFFER (tem, current_buffer); 1822 XSETBUFFER (tem, current_buffer);
1823 if (EQ (tem, XWINDOW (minibuf_window)->buffer) 1823 if (EQ (tem, XWINDOW (minibuf_window)->contents)
1824 && EQ (buffer, Fother_buffer (buffer, Qnil, Qnil))) 1824 && EQ (buffer, Fother_buffer (buffer, Qnil, Qnil)))
1825 return Qnil; 1825 return Qnil;
1826 1826
@@ -2394,8 +2394,9 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2394 BUF_MARKERS(buf) should either be for `buf' or dead. */ 2394 BUF_MARKERS(buf) should either be for `buf' or dead. */
2395 eassert (!m->buffer); 2395 eassert (!m->buffer);
2396 } 2396 }
2397 { /* Some of the C code expects that w->buffer == w->pointm->buffer. 2397 { /* Some of the C code expects that both window markers of a
2398 So since we just swapped the markers between the two buffers, we need 2398 live window points to that window's buffer. So since we
2399 just swapped the markers between the two buffers, we need
2399 to undo the effect of this swap for window markers. */ 2400 to undo the effect of this swap for window markers. */
2400 Lisp_Object w = Fselected_window (), ws = Qnil; 2401 Lisp_Object w = Fselected_window (), ws = Qnil;
2401 Lisp_Object buf1, buf2; 2402 Lisp_Object buf1, buf2;
@@ -2405,12 +2406,19 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2405 { 2406 {
2406 ws = Fcons (w, ws); 2407 ws = Fcons (w, ws);
2407 if (MARKERP (XWINDOW (w)->pointm) 2408 if (MARKERP (XWINDOW (w)->pointm)
2408 && (EQ (XWINDOW (w)->buffer, buf1) 2409 && (EQ (XWINDOW (w)->contents, buf1)
2409 || EQ (XWINDOW (w)->buffer, buf2))) 2410 || EQ (XWINDOW (w)->contents, buf2)))
2410 Fset_marker (XWINDOW (w)->pointm, 2411 Fset_marker (XWINDOW (w)->pointm,
2411 make_number 2412 make_number
2412 (BUF_BEGV (XBUFFER (XWINDOW (w)->buffer))), 2413 (BUF_BEGV (XBUFFER (XWINDOW (w)->contents))),
2413 XWINDOW (w)->buffer); 2414 XWINDOW (w)->contents);
2415 if (MARKERP (XWINDOW (w)->start)
2416 && (EQ (XWINDOW (w)->contents, buf1)
2417 || EQ (XWINDOW (w)->contents, buf2)))
2418 Fset_marker (XWINDOW (w)->start,
2419 make_number
2420 (XBUFFER (XWINDOW (w)->contents)->last_window_start),
2421 XWINDOW (w)->contents);
2414 w = Fnext_window (w, Qt, Qt); 2422 w = Fnext_window (w, Qt, Qt);
2415 } 2423 }
2416 } 2424 }
@@ -3893,7 +3901,7 @@ modify_overlay (struct buffer *buf, ptrdiff_t start, ptrdiff_t end)
3893 if (buffer_window_count (buf) > 0) 3901 if (buffer_window_count (buf) > 0)
3894 { 3902 {
3895 /* ... it's visible in other window than selected, */ 3903 /* ... it's visible in other window than selected, */
3896 if (buf != XBUFFER (XWINDOW (selected_window)->buffer)) 3904 if (buf != XBUFFER (XWINDOW (selected_window)->contents))
3897 windows_or_buffers_changed = 1; 3905 windows_or_buffers_changed = 1;
3898 /* ... or if we modify an overlay at the end of the buffer 3906 /* ... or if we modify an overlay at the end of the buffer
3899 and so we cannot be sure that window end is still valid. */ 3907 and so we cannot be sure that window end is still valid. */