diff options
| author | Richard M. Stallman | 1995-10-03 09:12:50 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-10-03 09:12:50 +0000 |
| commit | 75c43375f45ab40548b2463299b73c8150dec3eb (patch) | |
| tree | 07a2aea362f5b0227a078648c785d5e038418440 | |
| parent | 7d48558fef0502a8839510c014512e4cbd9b47f2 (diff) | |
| download | emacs-75c43375f45ab40548b2463299b73c8150dec3eb.tar.gz emacs-75c43375f45ab40548b2463299b73c8150dec3eb.zip | |
(Qwindow_scroll_functions, Vwindow_scroll_functions): New variables.
(syms_of_xdisp): Initialize them.
(redisplay_window): Call the functions when appropriate.
| -rw-r--r-- | src/xdisp.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 7000d8d6089..9fec2ee6c31 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -49,6 +49,7 @@ extern Lisp_Object Voverriding_local_map; | |||
| 49 | extern Lisp_Object Voverriding_local_map_menu_flag; | 49 | extern Lisp_Object Voverriding_local_map_menu_flag; |
| 50 | 50 | ||
| 51 | Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map; | 51 | Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map; |
| 52 | Lisp_Object Qwindow_scroll_functions, Vwindow_scroll_functions; | ||
| 52 | 53 | ||
| 53 | /* Nonzero means print newline to stdout before next minibuffer message. */ | 54 | /* Nonzero means print newline to stdout before next minibuffer message. */ |
| 54 | 55 | ||
| @@ -1498,13 +1499,21 @@ redisplay_window (window, just_this_one) | |||
| 1498 | { | 1499 | { |
| 1499 | /* Forget any recorded base line for line number display. */ | 1500 | /* Forget any recorded base line for line number display. */ |
| 1500 | w->base_line_number = Qnil; | 1501 | w->base_line_number = Qnil; |
| 1501 | /* Redisplay the mode line. Select the buffer properly for that. */ | 1502 | /* Redisplay the mode line. Select the buffer properly for that. |
| 1502 | if (!update_mode_line) | 1503 | Also, run the hook window-scroll-functions |
| 1504 | because we have scrolled. */ | ||
| 1505 | if (!update_mode_line | ||
| 1506 | || ! NILP (Vwindow_scroll_functions)) | ||
| 1503 | { | 1507 | { |
| 1508 | Lisp_Object temp[3]; | ||
| 1509 | |||
| 1504 | set_buffer_temp (old); | 1510 | set_buffer_temp (old); |
| 1505 | set_buffer_internal_1 (XBUFFER (w->buffer)); | 1511 | set_buffer_internal_1 (XBUFFER (w->buffer)); |
| 1506 | update_mode_line = 1; | 1512 | update_mode_line = 1; |
| 1507 | w->update_mode_line = Qt; | 1513 | w->update_mode_line = Qt; |
| 1514 | if (! NILP (Vwindow_scroll_functions)) | ||
| 1515 | run_hook_with_args_2 (Qwindow_scroll_functions, window, | ||
| 1516 | make_number (startp)); | ||
| 1508 | } | 1517 | } |
| 1509 | w->force_start = Qnil; | 1518 | w->force_start = Qnil; |
| 1510 | XSETFASTINT (w->last_modified, 0); | 1519 | XSETFASTINT (w->last_modified, 0); |
| @@ -1678,6 +1687,9 @@ redisplay_window (window, just_this_one) | |||
| 1678 | 1687 | ||
| 1679 | if (PT >= pos.bufpos) | 1688 | if (PT >= pos.bufpos) |
| 1680 | { | 1689 | { |
| 1690 | if (! NILP (Vwindow_scroll_functions)) | ||
| 1691 | run_hook_with_args_2 (Qwindow_scroll_functions, window, | ||
| 1692 | make_number (pos.bufpos)); | ||
| 1681 | try_window (window, pos.bufpos); | 1693 | try_window (window, pos.bufpos); |
| 1682 | if (cursor_vpos >= 0) | 1694 | if (cursor_vpos >= 0) |
| 1683 | { | 1695 | { |
| @@ -1700,6 +1712,9 @@ recenter: | |||
| 1700 | w->base_line_number = Qnil; | 1712 | w->base_line_number = Qnil; |
| 1701 | 1713 | ||
| 1702 | pos = *vmotion (PT, - (height / 2), w); | 1714 | pos = *vmotion (PT, - (height / 2), w); |
| 1715 | if (! NILP (Vwindow_scroll_functions)) | ||
| 1716 | run_hook_with_args_2 (Qwindow_scroll_functions, window, | ||
| 1717 | make_number (pos.bufpos)); | ||
| 1703 | try_window (window, pos.bufpos); | 1718 | try_window (window, pos.bufpos); |
| 1704 | 1719 | ||
| 1705 | startp = marker_position (w->start); | 1720 | startp = marker_position (w->start); |
| @@ -4185,6 +4200,9 @@ syms_of_xdisp () | |||
| 4185 | staticpro (&Qoverriding_local_map); | 4200 | staticpro (&Qoverriding_local_map); |
| 4186 | Qoverriding_local_map = intern ("overriding-local-map"); | 4201 | Qoverriding_local_map = intern ("overriding-local-map"); |
| 4187 | 4202 | ||
| 4203 | staticpro (&Qwindow_scroll_functions); | ||
| 4204 | Qwindow_scroll_functions = intern ("window-scroll-functions"); | ||
| 4205 | |||
| 4188 | staticpro (&last_arrow_position); | 4206 | staticpro (&last_arrow_position); |
| 4189 | staticpro (&last_arrow_string); | 4207 | staticpro (&last_arrow_string); |
| 4190 | last_arrow_position = Qnil; | 4208 | last_arrow_position = Qnil; |
| @@ -4270,6 +4288,12 @@ Just before redisplay, for each frame, if any of its windows have changed\n\ | |||
| 4270 | size since the last redisplay, or have been split or deleted,\n\ | 4288 | size since the last redisplay, or have been split or deleted,\n\ |
| 4271 | all the functions in the list are called, with the frame as argument."); | 4289 | all the functions in the list are called, with the frame as argument."); |
| 4272 | Vwindow_size_change_functions = Qnil; | 4290 | Vwindow_size_change_functions = Qnil; |
| 4291 | |||
| 4292 | DEFVAR_LISP ("window-scroll-functions", &Vwindow_scroll_functions, | ||
| 4293 | "Functions to call when a window is redisplayed with scrolling.\n\ | ||
| 4294 | Each function is called with two arguments, the window\n\ | ||
| 4295 | and its new display-start position."); | ||
| 4296 | Vwindow_scroll_functions = Qnil; | ||
| 4273 | } | 4297 | } |
| 4274 | 4298 | ||
| 4275 | /* initialize the window system */ | 4299 | /* initialize the window system */ |