changeset 25643:385bf7dbf253

(run_window_scroll_functions): If hook functions switch buffers, switch back after.
author Richard M. Stallman <rms@gnu.org>
date Sun, 12 Sep 1999 02:49:25 +0000
parents 556711217681
children 2ae0f7963ccc
files src/xdisp.c
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Sun Sep 12 02:17:20 1999 +0000
+++ b/src/xdisp.c	Sun Sep 12 02:49:25 1999 +0000
@@ -7808,7 +7808,9 @@
 
 
 /* Run window scroll functions, if any, for WINDOW with new window
-   start STARTP.  Sets the window start of WINDOW to that position.  */
+   start STARTP.  Sets the window start of WINDOW to that position.
+
+   We assume that the window's buffer is really current.  */
 
 static INLINE struct text_pos
 run_window_scroll_functions (window, startp)
@@ -7817,12 +7819,18 @@
 {
   struct window *w = XWINDOW (window);
   SET_MARKER_FROM_TEXT_POS (w->start, startp);
-  
+
+  if (current_buffer != XBUFFER (w->buffer))
+    abort ();
+
   if (!NILP (Vwindow_scroll_functions))
     {
       run_hook_with_args_2 (Qwindow_scroll_functions, window, 
 			    make_number (CHARPOS (startp)));
       SET_TEXT_POS_FROM_MARKER (startp, w->start);
+      /* In case the hook functions switch buffers.  */
+      if (current_buffer != XBUFFER (w->buffer))
+	set_buffer_internal_1 (XBUFFER (w->buffer));
     }
 
   return startp;