aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2015-11-21 13:30:30 +0200
committerEli Zaretskii2015-11-21 13:30:30 +0200
commit3ca44a1ad414c5e5b07f35959ce21f01064476a8 (patch)
tree06262c25a7a9f65123d1aa43f48f32111c5ed5a9 /src
parent3858b7949fdf5af8dd94cefc5a2684ad285e2cdf (diff)
downloademacs-3ca44a1ad414c5e5b07f35959ce21f01064476a8.tar.gz
emacs-3ca44a1ad414c5e5b07f35959ce21f01064476a8.zip
Call 'window-size-change-functions' for mini-windows
* src/window.c (grow_mini_window, shrink_mini_window): Set the frame's 'window_sizes_changed' flag. * src/xdisp.c (redisplay_internal): Call the hooks on 'window-size-change-functions' if the call to 'echo_area_display' sets the frame's 'window_sizes_changed' flag. (syms_of_xdisp) <window-size-change-functions>: Update doc string to indicate the mini-window resizes trigger a call to the hooks, and don't promise that will happen "before redisplay". (Bug#19576, Bug#21333) * doc/lispref/windows.texi (Window Hooks): Update the description of 'window-size-change-functions'.
Diffstat (limited to 'src')
-rw-r--r--src/window.c2
-rw-r--r--src/xdisp.c36
2 files changed, 34 insertions, 4 deletions
diff --git a/src/window.c b/src/window.c
index 0ac76d41861..753c4ab8123 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4555,6 +4555,7 @@ grow_mini_window (struct window *w, int delta, bool pixelwise)
4555 /* Enforce full redisplay of the frame. */ 4555 /* Enforce full redisplay of the frame. */
4556 /* FIXME: Shouldn't window--resize-root-window-vertically do it? */ 4556 /* FIXME: Shouldn't window--resize-root-window-vertically do it? */
4557 fset_redisplay (f); 4557 fset_redisplay (f);
4558 FRAME_WINDOW_SIZES_CHANGED (f) = true;
4558 adjust_frame_glyphs (f); 4559 adjust_frame_glyphs (f);
4559 unblock_input (); 4560 unblock_input ();
4560 } 4561 }
@@ -4594,6 +4595,7 @@ shrink_mini_window (struct window *w, bool pixelwise)
4594 /* Enforce full redisplay of the frame. */ 4595 /* Enforce full redisplay of the frame. */
4595 /* FIXME: Shouldn't window--resize-root-window-vertically do it? */ 4596 /* FIXME: Shouldn't window--resize-root-window-vertically do it? */
4596 fset_redisplay (f); 4597 fset_redisplay (f);
4598 FRAME_WINDOW_SIZES_CHANGED (f) = true;
4597 adjust_frame_glyphs (f); 4599 adjust_frame_glyphs (f);
4598 unblock_input (); 4600 unblock_input ();
4599 } 4601 }
diff --git a/src/xdisp.c b/src/xdisp.c
index 30dfac55601..85d356e9ba5 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13536,6 +13536,32 @@ redisplay_internal (void)
13536 { 13536 {
13537 echo_area_display (false); 13537 echo_area_display (false);
13538 13538
13539 /* If echo_area_display resizes the mini-window, the redisplay and
13540 window_sizes_changed flags of the selected frame are set, but
13541 it's too late for the hooks in window-size-change-functions,
13542 which have been examined already in prepare_menu_bars. So in
13543 that case we call the hooks here only for the selected frame. */
13544 if (sf->redisplay && FRAME_WINDOW_SIZES_CHANGED (sf))
13545 {
13546 Lisp_Object functions;
13547 ptrdiff_t count1 = SPECPDL_INDEX ();
13548
13549 record_unwind_save_match_data ();
13550
13551 /* Clear flag first in case we get an error below. */
13552 FRAME_WINDOW_SIZES_CHANGED (sf) = false;
13553 functions = Vwindow_size_change_functions;
13554
13555 while (CONSP (functions))
13556 {
13557 if (!EQ (XCAR (functions), Qt))
13558 call1 (XCAR (functions), selected_frame);
13559 functions = XCDR (functions);
13560 }
13561
13562 unbind_to (count1, Qnil);
13563 }
13564
13539 if (message_cleared_p) 13565 if (message_cleared_p)
13540 update_miniwindow_p = true; 13566 update_miniwindow_p = true;
13541 13567
@@ -31132,11 +31158,13 @@ the buffer when it becomes large. */);
31132 Vmessage_log_max = make_number (1000); 31158 Vmessage_log_max = make_number (1000);
31133 31159
31134 DEFVAR_LISP ("window-size-change-functions", Vwindow_size_change_functions, 31160 DEFVAR_LISP ("window-size-change-functions", Vwindow_size_change_functions,
31135 doc: /* Functions called before redisplay, if window sizes have changed. 31161 doc: /* Functions called during redisplay, if window sizes have changed.
31136The value should be a list of functions that take one argument. 31162The value should be a list of functions that take one argument.
31137Just before redisplay, for each frame, if any of its windows have changed 31163During the first part of redisplay, for each frame, if any of its windows
31138size since the last redisplay, or have been split or deleted, 31164have changed size since the last redisplay, or have been split or deleted,
31139all the functions in the list are called, with the frame as argument. */); 31165all the functions in the list are called, with the frame as argument.
31166If redisplay decides to resize the minibuffer window, it calls these
31167functions on behalf of that as well. */);
31140 Vwindow_size_change_functions = Qnil; 31168 Vwindow_size_change_functions = Qnil;
31141 31169
31142 DEFVAR_LISP ("window-scroll-functions", Vwindow_scroll_functions, 31170 DEFVAR_LISP ("window-scroll-functions", Vwindow_scroll_functions,