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>
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;
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);
}
}