summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2013-03-28 13:25:25 +0400
committerDmitry Antipov <dmantipov@yandex.ru>2013-03-28 13:25:25 +0400
commitc7f53895b9e314345c08f000751a863bf78f7e18 (patch)
tree7adae9a11740ba9668117e451c5f93eddb82af30
parentef454cf704fdf8862f9f75e20fa989a1564e4be9 (diff)
downloademacs-c7f53895b9e314345c08f000751a863bf78f7e18.tar.gz
Fix 2013-03-28T02:41:05Z!dmantipov@yandex.ru which brokes Fbuffer_swap_text.
* buffer.c (Fbuffer_swap_text): Adjust window start markers. Fix comment.
-rw-r--r--src/ChangeLog2
-rw-r--r--src/buffer.c12
2 files changed, 12 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 1e47fa0e1b6..fcc8bb5eaa3 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -17,6 +17,8 @@
which is verified by eassert.
* editfns.c (save_excursion_save): Do not assume that
selected_window always displays the buffer.
+ * buffer.c (Fbuffer_swap_text): Adjust window start markers.
+ Fix comment.
2013-03-27 Stefan Monnier <monnier@iro.umontreal.ca>
diff --git a/src/buffer.c b/src/buffer.c
index aa3fcf8c234..d02bcf7eceb 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2394,8 +2394,9 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
BUF_MARKERS(buf) should either be for `buf' or dead. */
eassert (!m->buffer);
}
- { /* Some of the C code expects that w->buffer == w->pointm->buffer.
- So since we just swapped the markers between the two buffers, we need
+ { /* Some of the C code expects that both window markers of a
+ live window points to that window's buffer. So since we
+ just swapped the markers between the two buffers, we need
to undo the effect of this swap for window markers. */
Lisp_Object w = Fselected_window (), ws = Qnil;
Lisp_Object buf1, buf2;
@@ -2411,6 +2412,13 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
make_number
(BUF_BEGV (XBUFFER (XWINDOW (w)->buffer))),
XWINDOW (w)->buffer);
+ if (MARKERP (XWINDOW (w)->start)
+ && (EQ (XWINDOW (w)->buffer, buf1)
+ || EQ (XWINDOW (w)->buffer, buf2)))
+ Fset_marker (XWINDOW (w)->start,
+ make_number
+ (XBUFFER (XWINDOW (w)->buffer)->last_window_start),
+ XWINDOW (w)->buffer);
w = Fnext_window (w, Qt, Qt);
}
}