]> git.eshelyaron.com Git - emacs.git/commitdiff
Run quit-window-hook from the correct buffer
authorLars Ingebrigtsen <larsi@gnus.org>
Fri, 23 Aug 2019 00:07:41 +0000 (02:07 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 23 Aug 2019 00:07:41 +0000 (02:07 +0200)
* lisp/window.el (quit-window): Run the hook from the buffer
specified by the WINDOW parameter.

lisp/window.el

index 334b56c8e603d86b60630db01c6b136f4b7a5c05..cf733153b89b5003ba304f9b35b484d53ff0407b 100644 (file)
@@ -4982,7 +4982,10 @@ one.  If non-nil, reset `quit-restore' parameter to nil.
 The functions in `quit-window-hook' will be run before doing
 anything else."
   (interactive "P")
-  (run-hooks 'quit-window-hook)
+  ;; Run the hook from the buffer implied to get any buffer-local
+  ;; values.
+  (with-current-buffer (window-buffer (window-normalize-window window))
+    (run-hooks 'quit-window-hook))
   (quit-restore-window window (if kill 'kill 'bury)))
 
 (defun quit-windows-on (&optional buffer-or-name kill frame)