# HG changeset patch # User Richard M. Stallman # Date 937104565 0 # Node ID 385bf7dbf253e000f5e0a289aafeb7f01a12408d # Parent 5567112176817dcafa7f0c28bc55867155a39852 (run_window_scroll_functions): If hook functions switch buffers, switch back after. diff -r 556711217681 -r 385bf7dbf253 src/xdisp.c --- 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;