aboutsummaryrefslogtreecommitdiffstats
path: root/doc/lispref
diff options
context:
space:
mode:
authorMartin Rudalics2019-01-17 10:21:07 +0100
committerMartin Rudalics2019-01-17 10:21:07 +0100
commit0aece3e1181e66f2a1a067ae876e55bdaa45edd5 (patch)
tree240c9dca3ff8a81460e5150d6b24993766bd707e /doc/lispref
parent978cf88bda9c9b41f1cc20cf8e53a9e6caeb91be (diff)
downloademacs-0aece3e1181e66f2a1a067ae876e55bdaa45edd5.tar.gz
emacs-0aece3e1181e66f2a1a067ae876e55bdaa45edd5.zip
Expand spectrum of window change functions
* src/window.c (run_window_change_functions): Run window change functions for Qwindow_state_change_functions. (resize_frame_windows): Set frame's window_change slot when single-window frames change size. (Qwindow_state_change_functions): New symbol. (Vwindow_state_change_functions): New Lisp variable. * doc/lispref/windows.texi (Selecting Windows): Mention 'window-selection/state-change-functions' and add reference to Window Hooks. (Window Hooks): Document 'window-state-change-functions'. * etc/NEWS: Mention new hook 'window-state-change-functions'.
Diffstat (limited to 'doc/lispref')
-rw-r--r--doc/lispref/windows.texi46
1 files changed, 40 insertions, 6 deletions
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 6b5aa66a955..afb81e6874f 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -1758,7 +1758,7 @@ raise the frame or make sure input focus is directed to that frame.
1758@xref{Input Focus}. 1758@xref{Input Focus}.
1759@end defun 1759@end defun
1760 1760
1761@cindex select window hook 1761@cindex select window hooks
1762@cindex running a hook when a window gets selected 1762@cindex running a hook when a window gets selected
1763For historical reasons, Emacs does not run a separate hook whenever a 1763For historical reasons, Emacs does not run a separate hook whenever a
1764window gets selected. Applications and internal routines often 1764window gets selected. Applications and internal routines often
@@ -1774,8 +1774,8 @@ useful.
1774 However, when its @var{norecord} argument is @code{nil}, 1774 However, when its @var{norecord} argument is @code{nil},
1775@code{select-window} updates the buffer list and thus indirectly runs 1775@code{select-window} updates the buffer list and thus indirectly runs
1776the normal hook @code{buffer-list-update-hook} (@pxref{Buffer List}). 1776the normal hook @code{buffer-list-update-hook} (@pxref{Buffer List}).
1777Consequently, that hook provides a reasonable way to run a function 1777Consequently, that hook provides one way to run a function whenever a
1778whenever a window gets selected more ``permanently''. 1778window gets selected more ``permanently''.
1779 1779
1780 Since @code{buffer-list-update-hook} is also run by functions that are 1780 Since @code{buffer-list-update-hook} is also run by functions that are
1781not related to window management, it will usually make sense to save the 1781not related to window management, it will usually make sense to save the
@@ -1787,6 +1787,13 @@ temporarily passes a non-@code{nil} @var{norecord} argument. If
1787possible, the macro @code{with-selected-window} (see below) should be 1787possible, the macro @code{with-selected-window} (see below) should be
1788used in such cases. 1788used in such cases.
1789 1789
1790 Emacs also runs the hook @code{window-selection-change-functions}
1791whenever the redisplay routine detects that another window has been
1792selected since last redisplay. @xref{Window Hooks}, for a detailed
1793explanation. @code{window-state-change-functions} (described in the
1794same section) is another abnormal hook run after a different window
1795has been selected but is triggered by other window changes as well.
1796
1790@cindex most recently selected windows 1797@cindex most recently selected windows
1791 The sequence of calls to @code{select-window} with a non-@code{nil} 1798 The sequence of calls to @code{select-window} with a non-@code{nil}
1792@var{norecord} argument determines an ordering of windows by their 1799@var{norecord} argument determines an ordering of windows by their
@@ -6039,7 +6046,7 @@ buffer are (re)fontified because a window was scrolled or its size
6039changed. @xref{Other Font Lock Variables}. 6046changed. @xref{Other Font Lock Variables}.
6040 6047
6041@cindex window change functions 6048@cindex window change functions
6042 The remainder of this section covers four hooks that are called at 6049 The remainder of this section covers five hooks that are called at
6043the end of redisplay provided a significant, non-scrolling change of a 6050the end of redisplay provided a significant, non-scrolling change of a
6044window has been detected. For simplicity, these hooks and the 6051window has been detected. For simplicity, these hooks and the
6045functions they call will be collectively referred to as @dfn{window 6052functions they call will be collectively referred to as @dfn{window
@@ -6108,10 +6115,37 @@ window has changed since the last time window change functions were
6108run. In this case the frame is passed as argument. 6115run. In this case the frame is passed as argument.
6109@end defvar 6116@end defvar
6110 6117
6118@cindex window state change
6119The fourth of these hooks is run after a @dfn{window state change} has
6120been detected, which means that at least one of the three preceding
6121window changes has occurred.
6122
6123@defvar window-state-change-functions
6124This variable specifies functions called at the end of redisplay when
6125a window buffer or size change occurred or the selected window or a
6126frame's selected window has changed. The value should be a list of
6127functions that take one argument.
6128
6129Functions specified buffer-locally are called for any window showing
6130the corresponding buffer if that window has been added or assigned
6131another buffer, total or body size or has been selected or deselected
6132(among all windows or among all windows on its frame) since the last
6133time window change functions were run. In this case the window is
6134passed as argument.
6135
6136Functions specified by the default value are called for a frame if at
6137least one window on that frame has been added, deleted or assigned
6138another buffer, total or body size or that frame has been selected or
6139deselected or the frame's selected window has changed since the last
6140time window change functions were run. In this case the frame is
6141passed as argument.
6142@end defvar
6143
6111@cindex window configuration change 6144@cindex window configuration change
6112The fourth of these hooks is run when a @dfn{window configuration 6145The fifth of these hooks is run when a @dfn{window configuration
6113change} has been detected which means that either the buffer or the 6146change} has been detected which means that either the buffer or the
6114size of a window changed. 6147size of a window changed. It differs from the four preceding hooks in
6148the way it is run.
6115 6149
6116@defvar window-configuration-change-hook 6150@defvar window-configuration-change-hook
6117This variable specifies functions called at the end of redisplay when 6151This variable specifies functions called at the end of redisplay when