changeset 28293:14eccbd25cae

(Fvertical_motion): Always use the current buffer. Temporarily change the window's buffer, if necessary.
author Gerd Moellmann <gerd@gnu.org>
date Fri, 24 Mar 2000 13:30:08 +0000
parents 156a858432c4
children 112b5c0b06e3
files src/indent.c
diffstat 1 files changed, 12 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/indent.c	Fri Mar 24 12:21:51 2000 +0000
+++ b/src/indent.c	Fri Mar 24 13:30:08 2000 +0000
@@ -1823,34 +1823,35 @@
 {
   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);
 
-  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));
 }