diff options
| -rw-r--r-- | doc/lispref/windows.texi | 32 | ||||
| -rw-r--r-- | lisp/window.el | 7 |
2 files changed, 21 insertions, 18 deletions
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index e9bd0c7d83e..46f106838a5 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi | |||
| @@ -6016,26 +6016,24 @@ whether a specific window has changed size, compare the return values of | |||
| 6016 | @code{window-pixel-height} for that window (@pxref{Window Sizes}). | 6016 | @code{window-pixel-height} for that window (@pxref{Window Sizes}). |
| 6017 | 6017 | ||
| 6018 | These function are usually only called when at least one window was | 6018 | These function are usually only called when at least one window was |
| 6019 | added or has changed size since the last time this hook was run for the | 6019 | added or has changed size since the last time this hook was run for |
| 6020 | associated frame. In some rare cases this hook also runs when a window | 6020 | the associated frame. In some rare cases this hook also runs when a |
| 6021 | that was added intermittently has been deleted afterwards. In these | 6021 | window that was added intermittently has been deleted afterwards. In |
| 6022 | cases none of the windows on the frame will appear to have changed its | 6022 | these cases none of the windows on the frame will appear to have |
| 6023 | size. | 6023 | changed its size. |
| 6024 | |||
| 6025 | You may use @code{save-selected-window} in these functions | ||
| 6026 | (@pxref{Selecting Windows}). However, do not use | ||
| 6027 | @code{save-window-excursion} (@pxref{Window Configurations}); exiting | ||
| 6028 | that macro counts as a size change, which would cause these functions to | ||
| 6029 | be called again. | ||
| 6030 | @end defvar | 6024 | @end defvar |
| 6031 | 6025 | ||
| 6032 | @defvar window-configuration-change-hook | 6026 | @defvar window-configuration-change-hook |
| 6033 | A normal hook that is run every time the window configuration of a frame | 6027 | A normal hook that is run every time the window configuration of a |
| 6034 | changes. Window configuration changes include splitting and deleting | 6028 | frame changes. Window configuration changes include splitting and |
| 6035 | windows, and the display of a different buffer in a window. Resizing the | 6029 | deleting windows, and the display of a different buffer in a window. |
| 6036 | frame or individual windows do not count as configuration changes. Use | 6030 | |
| 6037 | @code{window-size-change-functions}, see above, when you want to track | 6031 | The hook can be also used for tracking changes of window sizes. It |
| 6038 | size changes that are not caused by the deletion or creation of windows. | 6032 | is, however, not run when the size of a frame changes or automatic |
| 6033 | resizing of a minibuffer window (@pxref{Minibuffer Windows}) changes | ||
| 6034 | the size of another window. As a rule, adding a function to | ||
| 6035 | @code{window-size-change-functions}, see above, is the recommended way | ||
| 6036 | for reliably tracking size changes of any window. | ||
| 6039 | 6037 | ||
| 6040 | The buffer-local value of this hook is run once for each window on the | 6038 | The buffer-local value of this hook is run once for each window on the |
| 6041 | affected frame, with the relevant window selected and its buffer | 6039 | affected frame, with the relevant window selected and its buffer |
diff --git a/lisp/window.el b/lisp/window.el index 94ac65cfc5b..f252b0e041a 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -9287,10 +9287,15 @@ displaying that processes's buffer." | |||
| 9287 | (when size | 9287 | (when size |
| 9288 | (set-process-window-size process (cdr size) (car size)))))))))) | 9288 | (set-process-window-size process (cdr size) (car size)))))))))) |
| 9289 | 9289 | ||
| 9290 | ;; Remove the following call in Emacs 27, running | ||
| 9291 | ;; 'window-size-change-functions' should suffice. | ||
| 9290 | (add-hook 'window-configuration-change-hook 'window--adjust-process-windows) | 9292 | (add-hook 'window-configuration-change-hook 'window--adjust-process-windows) |
| 9293 | |||
| 9294 | ;; Catch any size changes not handled by | ||
| 9295 | ;; 'window-configuration-change-hook' (Bug#32720, "another issue" in | ||
| 9296 | ;; Bug#33230). | ||
| 9291 | (add-hook 'window-size-change-functions (lambda (_frame) | 9297 | (add-hook 'window-size-change-functions (lambda (_frame) |
| 9292 | (window--adjust-process-windows))) | 9298 | (window--adjust-process-windows))) |
| 9293 | |||
| 9294 | 9299 | ||
| 9295 | ;; Some of these are in tutorial--default-keys, so update that if you | 9300 | ;; Some of these are in tutorial--default-keys, so update that if you |
| 9296 | ;; change these. | 9301 | ;; change these. |