diff options
| author | Stefan Monnier | 2008-09-07 01:22:25 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-09-07 01:22:25 +0000 |
| commit | 126f1fc1a37a64bce9f5be9bead3b49cec8825b3 (patch) | |
| tree | 639682a8947d5c41bc6a075564624fd9e0dd7e18 /src/buffer.c | |
| parent | 21e5e72e895f0e847b5ee335602bf3d881c12439 (diff) | |
| download | emacs-126f1fc1a37a64bce9f5be9bead3b49cec8825b3.tar.gz emacs-126f1fc1a37a64bce9f5be9bead3b49cec8825b3.zip | |
(Fbuffer_swap_text): Reset window->point markers.
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 20 |
1 files changed, 20 insertions, 0 deletions
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, | |||
| 2269 | if (m->buffer == current_buffer) | 2269 | if (m->buffer == current_buffer) |
| 2270 | m->buffer = other_buffer; | 2270 | m->buffer = other_buffer; |
| 2271 | } | 2271 | } |
| 2272 | { /* Some of the C code expects that w->buffer == w->pointm->buffer. | ||
| 2273 | So since we just swapped the markers between the two buffers, we need | ||
| 2274 | to undo the effect of this swap for window markers. */ | ||
| 2275 | Lisp_Object w = Fselected_window (), ws = Qnil; | ||
| 2276 | Lisp_Object buf1, buf2; | ||
| 2277 | XSETBUFFER (buf1, current_buffer); XSETBUFFER (buf2, other_buffer); | ||
| 2278 | |||
| 2279 | while (NILP (Fmemq (w, ws))) | ||
| 2280 | { | ||
| 2281 | ws = Fcons (w, ws); | ||
| 2282 | if (MARKERP (XWINDOW (w)->pointm) | ||
| 2283 | && (EQ (XWINDOW (w)->buffer, buf1) | ||
| 2284 | || EQ (XWINDOW (w)->buffer, buf2))) | ||
| 2285 | Fset_marker (XWINDOW (w)->pointm, | ||
| 2286 | make_number (BUF_BEGV (XBUFFER (XWINDOW (w)->buffer))), | ||
| 2287 | XWINDOW (w)->buffer); | ||
| 2288 | w = Fnext_window (w, Qt, Qt); | ||
| 2289 | } | ||
| 2290 | } | ||
| 2291 | |||
| 2272 | if (current_buffer->text->intervals) | 2292 | if (current_buffer->text->intervals) |
| 2273 | (eassert (EQ (current_buffer->text->intervals->up.obj, buffer)), | 2293 | (eassert (EQ (current_buffer->text->intervals->up.obj, buffer)), |
| 2274 | XSETBUFFER (current_buffer->text->intervals->up.obj, current_buffer)); | 2294 | XSETBUFFER (current_buffer->text->intervals->up.obj, current_buffer)); |