changeset 4564:9fc21d8d9441

(Frecenter): Preserve point in the buffer we change it in.
author Richard M. Stallman <rms@gnu.org>
date Wed, 11 Aug 1993 19:29:19 +0000
parents b9118969ce28
children a97d23c71c95
files src/window.c
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/window.c	Wed Aug 11 19:22:35 1993 +0000
+++ b/src/window.c	Wed Aug 11 19:29:19 1993 +0000
@@ -1310,13 +1310,19 @@
 DEFUN ("delete-other-windows", Fdelete_other_windows, Sdelete_other_windows,
   0, 1, "",
   "Make WINDOW (or the selected window) fill its frame.\n\
-Only the frame WINDOW is on is affected.")
+Only the frame WINDOW is on is affected.\n\
+This function tries to reduce display jumps\n\
+by keeping the text previously visible in WINDOW\n\
+in the same place on the frame.  Doing this depends on\n\
+the value of (window-start WINDOW), so if calling this function\n\
+in a program gives strange scrolling, make sure the window-start\n\
+value is reasonable when this function is called.")
   (window)
      Lisp_Object window;
 {
   struct window *w;
-  int opoint = point;
   struct buffer *obuf = current_buffer;
+  int opoint;
   int top;
 
   if (NILP (window))
@@ -1330,11 +1336,12 @@
   window_loop (DELETE_OTHER_WINDOWS, window, 0, WINDOW_FRAME (w));
 
   Fset_buffer (w->buffer);
+  opoint = point;
   SET_PT (marker_position (w->start));
   Frecenter (make_number (top - FRAME_MENU_BAR_LINES (XFRAME (WINDOW_FRAME (w)))));
 
+  SET_PT (opoint);
   set_buffer_internal (obuf);
-  SET_PT (opoint);
   return Qnil;
 }