summaryrefslogtreecommitdiff
path: root/src/indent.c
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2000-03-24 13:31:20 +0000
committerGerd Moellmann <gerd@gnu.org>2000-03-24 13:31:20 +0000
commit39210e90adf7be66c7ca6c9fd702bbe11e4887e7 (patch)
treef52490b22bca43fd3db87a871d436612533d6052 /src/indent.c
parent3b55acc9b020e15a7de9a2ec6ea8ed1125e6e9e7 (diff)
downloademacs-39210e90adf7be66c7ca6c9fd702bbe11e4887e7.tar.gz
(Fvertical_motion): Always use the current buffer.
Temporarily change the window's buffer, if necessary.
Diffstat (limited to 'src/indent.c')
-rw-r--r--src/indent.c23
1 files changed, 12 insertions, 11 deletions
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));
}