diff options
| author | Martin Rudalics | 2019-01-17 10:21:07 +0100 |
|---|---|---|
| committer | Martin Rudalics | 2019-01-17 10:21:07 +0100 |
| commit | 0aece3e1181e66f2a1a067ae876e55bdaa45edd5 (patch) | |
| tree | 240c9dca3ff8a81460e5150d6b24993766bd707e /doc/lispref | |
| parent | 978cf88bda9c9b41f1cc20cf8e53a9e6caeb91be (diff) | |
| download | emacs-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.texi | 46 |
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 |
| 1763 | For historical reasons, Emacs does not run a separate hook whenever a | 1763 | For historical reasons, Emacs does not run a separate hook whenever a |
| 1764 | window gets selected. Applications and internal routines often | 1764 | window 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 |
| 1776 | the normal hook @code{buffer-list-update-hook} (@pxref{Buffer List}). | 1776 | the normal hook @code{buffer-list-update-hook} (@pxref{Buffer List}). |
| 1777 | Consequently, that hook provides a reasonable way to run a function | 1777 | Consequently, that hook provides one way to run a function whenever a |
| 1778 | whenever a window gets selected more ``permanently''. | 1778 | window 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 |
| 1781 | not related to window management, it will usually make sense to save the | 1781 | not 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 | |||
| 1787 | possible, the macro @code{with-selected-window} (see below) should be | 1787 | possible, the macro @code{with-selected-window} (see below) should be |
| 1788 | used in such cases. | 1788 | used in such cases. |
| 1789 | 1789 | ||
| 1790 | Emacs also runs the hook @code{window-selection-change-functions} | ||
| 1791 | whenever the redisplay routine detects that another window has been | ||
| 1792 | selected since last redisplay. @xref{Window Hooks}, for a detailed | ||
| 1793 | explanation. @code{window-state-change-functions} (described in the | ||
| 1794 | same section) is another abnormal hook run after a different window | ||
| 1795 | has 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 | |||
| 6039 | changed. @xref{Other Font Lock Variables}. | 6046 | changed. @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 |
| 6043 | the end of redisplay provided a significant, non-scrolling change of a | 6050 | the end of redisplay provided a significant, non-scrolling change of a |
| 6044 | window has been detected. For simplicity, these hooks and the | 6051 | window has been detected. For simplicity, these hooks and the |
| 6045 | functions they call will be collectively referred to as @dfn{window | 6052 | functions 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 | |||
| 6108 | run. In this case the frame is passed as argument. | 6115 | run. In this case the frame is passed as argument. |
| 6109 | @end defvar | 6116 | @end defvar |
| 6110 | 6117 | ||
| 6118 | @cindex window state change | ||
| 6119 | The fourth of these hooks is run after a @dfn{window state change} has | ||
| 6120 | been detected, which means that at least one of the three preceding | ||
| 6121 | window changes has occurred. | ||
| 6122 | |||
| 6123 | @defvar window-state-change-functions | ||
| 6124 | This variable specifies functions called at the end of redisplay when | ||
| 6125 | a window buffer or size change occurred or the selected window or a | ||
| 6126 | frame's selected window has changed. The value should be a list of | ||
| 6127 | functions that take one argument. | ||
| 6128 | |||
| 6129 | Functions specified buffer-locally are called for any window showing | ||
| 6130 | the corresponding buffer if that window has been added or assigned | ||
| 6131 | another 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 | ||
| 6133 | time window change functions were run. In this case the window is | ||
| 6134 | passed as argument. | ||
| 6135 | |||
| 6136 | Functions specified by the default value are called for a frame if at | ||
| 6137 | least one window on that frame has been added, deleted or assigned | ||
| 6138 | another buffer, total or body size or that frame has been selected or | ||
| 6139 | deselected or the frame's selected window has changed since the last | ||
| 6140 | time window change functions were run. In this case the frame is | ||
| 6141 | passed as argument. | ||
| 6142 | @end defvar | ||
| 6143 | |||
| 6111 | @cindex window configuration change | 6144 | @cindex window configuration change |
| 6112 | The fourth of these hooks is run when a @dfn{window configuration | 6145 | The fifth of these hooks is run when a @dfn{window configuration |
| 6113 | change} has been detected which means that either the buffer or the | 6146 | change} has been detected which means that either the buffer or the |
| 6114 | size of a window changed. | 6147 | size of a window changed. It differs from the four preceding hooks in |
| 6148 | the way it is run. | ||
| 6115 | 6149 | ||
| 6116 | @defvar window-configuration-change-hook | 6150 | @defvar window-configuration-change-hook |
| 6117 | This variable specifies functions called at the end of redisplay when | 6151 | This variable specifies functions called at the end of redisplay when |