From: Gerd Moellmann Date: Fri, 24 Mar 2000 13:31:20 +0000 (+0000) Subject: (Fvertical_motion): Always use the current buffer. X-Git-Tag: emacs-pretest-21.0.90~4514 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=39210e90adf7be66c7ca6c9fd702bbe11e4887e7;p=emacs.git (Fvertical_motion): Always use the current buffer. Temporarily change the window's buffer, if necessary. --- diff --git a/src/ChangeLog b/src/ChangeLog index e85a8bf2e0a..f683aaa0bf8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2000-03-24 Gerd Moellmann + + * indent.c (Fvertical_motion): Always use the current buffer. + Temporarily change the window's buffer, if necessary. + 2000-03-23 Gerd Moellmann * xterm.c (fast_find_position): Make sure not to consider rows diff --git a/src/indent.c b/src/indent.c index 913b7633469..5d2dbe5ab36 100644 --- a/src/indent.c +++ b/src/indent.c @@ -1823,34 +1823,35 @@ whether or not it is currently displayed in some window.") { struct it it; struct text_pos pt; - struct buffer *old, *b; struct window *w; + Lisp_Object old_buffer; + struct gcpro gcpro1; CHECK_NUMBER (lines, 0); if (! NILP (window)) CHECK_WINDOW (window, 0); else window = selected_window; - w = XWINDOW (window); - b = XBUFFER (w->buffer); - if (b != current_buffer) + + old_buffer = Qnil; + GCPRO1 (old_buffer); + if (XBUFFER (w->buffer) != current_buffer) { - old = current_buffer; - set_buffer_internal_1 (b); + /* Set the window's buffer temporarily to the current buffer. */ + old_buffer = w->buffer; + XSETBUFFER (w->buffer, current_buffer); } - else - old = NULL; SET_TEXT_POS (pt, PT, PT_BYTE); start_display (&it, w, pt); move_it_by_lines (&it, XINT (lines), 0); SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); - if (old) - set_buffer_internal_1 (old); + if (BUFFERP (old_buffer)) + w->buffer = old_buffer; - return make_number (it.vpos); + RETURN_UNGCPRO (make_number (it.vpos)); }