From: Stefan Monnier Date: Sun, 7 Sep 2008 01:22:25 +0000 (+0000) Subject: (Fbuffer_swap_text): Reset window->point markers. X-Git-Tag: emacs-pretest-23.0.90~2976 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=126f1fc1a37a64bce9f5be9bead3b49cec8825b3;p=emacs.git (Fbuffer_swap_text): Reset window->point markers. --- diff --git a/src/ChangeLog b/src/ChangeLog index d5ee811e5a6..96e1062af0d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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 --git a/src/buffer.c b/src/buffer.c index 70283ffb18a..f55bcd3d415 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -2269,6 +2269,26 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, 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));