# HG changeset patch # User Stefan Monnier # Date 1220750545 0 # Node ID b0d74e2658b73f5f898170264f9d769c2c6dac98 # Parent 43a801a18b24a478ab90045fcf92ad73105a474f (Fbuffer_swap_text): Reset window->point markers. diff -r 43a801a18b24 -r b0d74e2658b7 src/ChangeLog --- a/src/ChangeLog Sun Sep 07 01:14:58 2008 +0000 +++ b/src/ChangeLog Sun Sep 07 01:22:25 2008 +0000 @@ -1,3 +1,7 @@ +2008-09-07 Stefan Monnier + + * buffer.c (Fbuffer_swap_text): Reset window->point markers. + 2008-09-06 Roland Winkler * process.c (Fsystem_process_attributes): Doc fix. diff -r 43a801a18b24 -r b0d74e2658b7 src/buffer.c --- a/src/buffer.c Sun Sep 07 01:14:58 2008 +0000 +++ b/src/buffer.c Sun Sep 07 01:22:25 2008 +0000 @@ -2269,6 +2269,26 @@ if (m->buffer == current_buffer) m->buffer = other_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 + to undo the effect of this swap for window markers. */ + Lisp_Object w = Fselected_window (), ws = Qnil; + Lisp_Object buf1, buf2; + XSETBUFFER (buf1, current_buffer); XSETBUFFER (buf2, other_buffer); + + while (NILP (Fmemq (w, ws))) + { + ws = Fcons (w, ws); + if (MARKERP (XWINDOW (w)->pointm) + && (EQ (XWINDOW (w)->buffer, buf1) + || EQ (XWINDOW (w)->buffer, buf2))) + Fset_marker (XWINDOW (w)->pointm, + make_number (BUF_BEGV (XBUFFER (XWINDOW (w)->buffer))), + XWINDOW (w)->buffer); + w = Fnext_window (w, Qt, Qt); + } + } + if (current_buffer->text->intervals) (eassert (EQ (current_buffer->text->intervals->up.obj, buffer)), XSETBUFFER (current_buffer->text->intervals->up.obj, current_buffer));