aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/windows.texi106
1 files changed, 72 insertions, 34 deletions
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 6ac7aa67286..6b716323357 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -6046,8 +6046,8 @@ buffer are (re)fontified because a window was scrolled or its size
6046changed. @xref{Other Font Lock Variables}. 6046changed. @xref{Other Font Lock Variables}.
6047 6047
6048@cindex window change functions 6048@cindex window change functions
6049 The remainder of this section covers five hooks that are called at 6049 The remainder of this section covers six hooks that are called
6050the end of redisplay provided a significant, non-scrolling change of a 6050during redisplay provided a significant, non-scrolling change of a
6051window has been detected. For simplicity, these hooks and the 6051window has been detected. For simplicity, these hooks and the
6052functions they call will be collectively referred to as @dfn{window 6052functions they call will be collectively referred to as @dfn{window
6053change functions}. 6053change functions}.
@@ -6058,9 +6058,9 @@ detected, which means that a window was created, deleted or assigned
6058another buffer. 6058another buffer.
6059 6059
6060@defvar window-buffer-change-functions 6060@defvar window-buffer-change-functions
6061This variable specifies functions called at the end of redisplay when 6061This variable specifies functions called during redisplay when window
6062window buffers have changed. The value should be a list of functions 6062buffers have changed. The value should be a list of functions that
6063that take one argument. 6063take one argument.
6064 6064
6065Functions specified buffer-locally are called for any window showing 6065Functions specified buffer-locally are called for any window showing
6066the corresponding buffer if that window has been created or assigned 6066the corresponding buffer if that window has been created or assigned
@@ -6074,14 +6074,14 @@ In this case the frame is passed as argument.
6074@end defvar 6074@end defvar
6075 6075
6076@cindex window size change 6076@cindex window size change
6077The second of these hooks is run after a @dfn{window size change} has 6077The second of these hooks is run when a @dfn{window size change} has
6078been detected which means that a window was created, assigned another 6078been detected which means that a window was created, assigned another
6079buffer, or changed its total size or that of its text area. 6079buffer, or changed its total size or that of its text area.
6080 6080
6081@defvar window-size-change-functions 6081@defvar window-size-change-functions
6082This variable specifies functions called at the end of redisplay when 6082This variable specifies functions called during redisplay when a
6083a window size change occurred. The value should be a list of 6083window size change occurred. The value should be a list of functions
6084functions that take one argument. 6084that take one argument.
6085 6085
6086Functions specified buffer-locally are called for any window showing 6086Functions specified buffer-locally are called for any window showing
6087the corresponding buffer if that window has been added or assigned 6087the corresponding buffer if that window has been added or assigned
@@ -6097,13 +6097,13 @@ argument.
6097@end defvar 6097@end defvar
6098 6098
6099@cindex window selection change 6099@cindex window selection change
6100The third of these hooks is run after a @dfn{window selection change} 6100The third of these hooks is run when a @dfn{window selection change}
6101has selected another window since the last redisplay. 6101has selected another window since the last redisplay.
6102 6102
6103@defvar window-selection-change-functions 6103@defvar window-selection-change-functions
6104This variable specifies functions called at the end of redisplay when 6104This variable specifies functions called during redisplay when the
6105the selected window or a frame's selected window has changed. The 6105selected window or a frame's selected window has changed. The value
6106value should be a list of functions that take one argument. 6106should be a list of functions that take one argument.
6107 6107
6108Functions specified buffer-locally are called for any window showing 6108Functions specified buffer-locally are called for any window showing
6109the corresponding buffer if that window has been selected or 6109the corresponding buffer if that window has been selected or
@@ -6118,13 +6118,13 @@ run. In this case the frame is passed as argument.
6118@end defvar 6118@end defvar
6119 6119
6120@cindex window state change 6120@cindex window state change
6121The fourth of these hooks is run after a @dfn{window state change} has 6121The fourth of these hooks is run when a @dfn{window state change} has
6122been detected, which means that at least one of the three preceding 6122been detected, which means that at least one of the three preceding
6123window changes has occurred. 6123window changes has occurred.
6124 6124
6125@defvar window-state-change-functions 6125@defvar window-state-change-functions
6126This variable specifies functions called at the end of redisplay when 6126This variable specifies functions called during redisplay when a
6127a window buffer or size change occurred or the selected window or a 6127window buffer or size change occurred or the selected window or a
6128frame's selected window has changed. The value should be a list of 6128frame's selected window has changed. The value should be a list of
6129functions that take one argument. 6129functions that take one argument.
6130 6130
@@ -6141,6 +6141,10 @@ another buffer, changed its total or body size or that frame has been
6141selected or deselected or the frame's selected window has changed 6141selected or deselected or the frame's selected window has changed
6142since the last time window change functions were run. In this case 6142since the last time window change functions were run. In this case
6143the frame is passed as argument. 6143the frame is passed as argument.
6144
6145Functions specified by the default value are also run for a frame when
6146that frame's window state change flag (see below) has been set since
6147last redisplay.
6144@end defvar 6148@end defvar
6145 6149
6146@cindex window configuration change 6150@cindex window configuration change
@@ -6150,9 +6154,9 @@ size of a window changed. It differs from the four preceding hooks in
6150the way it is run. 6154the way it is run.
6151 6155
6152@defvar window-configuration-change-hook 6156@defvar window-configuration-change-hook
6153This variable specifies functions called at the end of redisplay when 6157This variable specifies functions called during redisplay when either
6154either the buffer or the size of a window has changed. The value 6158the buffer or the size of a window has changed. The value should be a
6155should be a list of functions that take no argument. 6159list of functions that take no argument.
6156 6160
6157Functions specified buffer-locally are called for any window showing 6161Functions specified buffer-locally are called for any window showing
6158the corresponding buffer if at least one window on that frame has been 6162the corresponding buffer if at least one window on that frame has been
@@ -6168,14 +6172,29 @@ window change functions were run. Each call is performed with the
6168frame temporarily selected and the selected window's buffer current. 6172frame temporarily selected and the selected window's buffer current.
6169@end defvar 6173@end defvar
6170 6174
6171Window change functions are called at the end of redisplay for each 6175Finally, Emacs runs a normal hook that generalizes the behavior of
6172frame as follows: First, any buffer-local window buffer change 6176@code{window-state-change-functions}.
6173function, window size change function, selected window change and 6177
6174window state change functions are called in this order. Next, the 6178@defvar window-state-change-hook
6175default values for these functions are called in the same order. Then 6179The default value of this variable specifies functions called during
6176any buffer-local window configuration change functions are called 6180redisplay when a window state change has been detected or the window
6177followed by functions specified by the default value of those 6181state change flag has been set on at least one frame. The value
6178functions. 6182should be a list of functions that take no argument.
6183
6184Applications should put a function on this hook only if they want to
6185react to changes that happened on (or have been signaled for) two or
6186more frames since last redisplay. In every other case, putting the
6187function on @code{window-state-change-functions} should be preferred.
6188@end defvar
6189
6190Window change functions are called during redisplay for each frame as
6191follows: First, any buffer-local window buffer change function, window
6192size change function, selected window change and window state change
6193functions are called in this order. Next, the default values for
6194these functions are called in the same order. Then any buffer-local
6195window configuration change functions are called followed by functions
6196specified by the default value of those functions. Finally, functions
6197on @code{window-state-change-hook} are run.
6179 6198
6180 Window change functions are run for a specific frame only if a 6199 Window change functions are run for a specific frame only if a
6181corresponding change was registered for that frame earlier. Such 6200corresponding change was registered for that frame earlier. Such
@@ -6189,6 +6208,27 @@ only if that excursion still persists at the time change functions are
6189run. If it is exited earlier, hooks will be run only if registered by 6208run. If it is exited earlier, hooks will be run only if registered by
6190a change outside the scope of that excursion. 6209a change outside the scope of that excursion.
6191 6210
6211@cindex window state change flag
6212 The @dfn{window state change flag} of a frame, if set, will cause
6213the default values of @code{window-state-change-functions} (for that
6214frame) and @code{window-state-change-hook} to be run during next
6215redisplay regardless of whether a window state change actually
6216occurred for that frame or not. After running any functions on these
6217hooks, the flag is reset for each frame. Applications can set that
6218flag and inspect its value using the following functions.
6219
6220@defun set-frame-window-state-change &optional frame arg
6221This function sets @var{frame}'s window state change flag if @var{arg}
6222is non-@code{nil} and resets it otherwise. @var{frame} must be a live
6223frame and defaults to the selected one.
6224@end defun
6225
6226@defun frame-window-state-change &optional frame
6227This functions returns @code{t} if @var{frame}'s window state change
6228flag is set and @code{nil} otherwise. @var{frame} must be a live
6229frame and defaults to the selected one.
6230@end defun
6231
6192 While window change functions are run, the functions described next 6232 While window change functions are run, the functions described next
6193can be called to get more insight into what has changed for a specific 6233can be called to get more insight into what has changed for a specific
6194window or frame since the last redisplay. All these functions take a 6234window or frame since the last redisplay. All these functions take a
@@ -6250,12 +6290,10 @@ change functions were run.
6250 6290
6251Note that window change functions provide no information about which 6291Note that window change functions provide no information about which
6252windows have been deleted since the last time they were run. If 6292windows have been deleted since the last time they were run. If
6253necessary, an application should remember any window showing a 6293necessary, applications should remember any window showing a specific
6254specific buffer in a local variable of that buffer and update it in a 6294buffer in a local variable of that buffer and update it in a function
6255function run by the default value of 6295run by the default values of any of the hooks that are run when a
6256@code{window-buffer-change-functions} or 6296window buffer change was detected.
6257@code{window-configuration-change-hook} (the only hooks triggered by
6258the deletion of windows).
6259 6297
6260 The following caveats should be considered when adding a function 6298 The following caveats should be considered when adding a function
6261to window change functions: 6299to window change functions:
@@ -6272,7 +6310,7 @@ the buffer, size or selection status of any window because there is no
6272guarantee that the information about such a change will be propagated 6310guarantee that the information about such a change will be propagated
6273to other window change functions. If at all, any such change should 6311to other window change functions. If at all, any such change should
6274be executed only by the last function listed by the default value of 6312be executed only by the last function listed by the default value of
6275@code{window-configuration-change-hook}. 6313@code{window-state-change-hook}.
6276 6314
6277@item 6315@item
6278Macros like @code{save-window-excursion}, @code{with-selected-window} 6316Macros like @code{save-window-excursion}, @code{with-selected-window}