From: Lars Ingebrigtsen Date: Fri, 23 Aug 2019 00:07:41 +0000 (+0200) Subject: Run quit-window-hook from the correct buffer X-Git-Tag: emacs-27.0.90~1328^2~130 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4c084ba6b8953dac6f80148c0a20b92b6e7f6932;p=emacs.git Run quit-window-hook from the correct buffer * lisp/window.el (quit-window): Run the hook from the buffer specified by the WINDOW parameter. --- diff --git a/lisp/window.el b/lisp/window.el index 334b56c8e60..cf733153b89 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -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)