diff options
| author | Lars Ingebrigtsen | 2019-08-21 13:18:47 -0700 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-08-21 13:18:47 -0700 |
| commit | 2e8bbd5881d8851f19c8eb0b60def932d69b4dbc (patch) | |
| tree | 2b6bf0d376d5810715a22d2cb256f3da5add9611 | |
| parent | 6224fce0d4168fb217175a2c9e40409a0055e436 (diff) | |
| download | emacs-2e8bbd5881d8851f19c8eb0b60def932d69b4dbc.tar.gz emacs-2e8bbd5881d8851f19c8eb0b60def932d69b4dbc.zip | |
Call `quit-window-hook' in the `quit-window' command only
* lisp/window.el (quit-restore-window): Don't run quit-window-hook
here...
(quit-window): ... but here instead. Callers that call the former
programmatically can decide themselves whether to call the hook.
(quit-window-hook): Fix doc string.
| -rw-r--r-- | lisp/window.el | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lisp/window.el b/lisp/window.el index 80dbd64f18a..334b56c8e60 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -4849,7 +4849,7 @@ all window-local buffer lists." | |||
| 4849 | (unrecord-window-buffer window buffer))))) | 4849 | (unrecord-window-buffer window buffer))))) |
| 4850 | 4850 | ||
| 4851 | (defcustom quit-window-hook nil | 4851 | (defcustom quit-window-hook nil |
| 4852 | "Hook run before performing any other actions in the `quit-buffer' command." | 4852 | "Hook run before performing any other actions in the `quit-window' command." |
| 4853 | :type 'hook | 4853 | :type 'hook |
| 4854 | :version "27.1" | 4854 | :version "27.1" |
| 4855 | :group 'windows) | 4855 | :group 'windows) |
| @@ -4882,11 +4882,7 @@ nil means to not handle the buffer in a particular way. This | |||
| 4882 | most reliable remedy to not have `switch-to-prev-buffer' switch | 4882 | most reliable remedy to not have `switch-to-prev-buffer' switch |
| 4883 | to this buffer again without killing the buffer. | 4883 | to this buffer again without killing the buffer. |
| 4884 | 4884 | ||
| 4885 | `kill' means to kill WINDOW's buffer. | 4885 | `kill' means to kill WINDOW's buffer." |
| 4886 | |||
| 4887 | The functions in `quit-window-hook' will be run before doing | ||
| 4888 | anything else." | ||
| 4889 | (run-hooks 'quit-window-hook) | ||
| 4890 | (setq window (window-normalize-window window t)) | 4886 | (setq window (window-normalize-window window t)) |
| 4891 | (let* ((buffer (window-buffer window)) | 4887 | (let* ((buffer (window-buffer window)) |
| 4892 | (quit-restore (window-parameter window 'quit-restore)) | 4888 | (quit-restore (window-parameter window 'quit-restore)) |
| @@ -4986,6 +4982,7 @@ one. If non-nil, reset `quit-restore' parameter to nil. | |||
| 4986 | The functions in `quit-window-hook' will be run before doing | 4982 | The functions in `quit-window-hook' will be run before doing |
| 4987 | anything else." | 4983 | anything else." |
| 4988 | (interactive "P") | 4984 | (interactive "P") |
| 4985 | (run-hooks 'quit-window-hook) | ||
| 4989 | (quit-restore-window window (if kill 'kill 'bury))) | 4986 | (quit-restore-window window (if kill 'kill 'bury))) |
| 4990 | 4987 | ||
| 4991 | (defun quit-windows-on (&optional buffer-or-name kill frame) | 4988 | (defun quit-windows-on (&optional buffer-or-name kill frame) |