Ensure switch hooks don't reference dead buffers

This commit is contained in:
Henrik Lissner
2018-08-13 18:21:07 +02:00
parent 9c4d1c3b02
commit 4c18fc81af

View File

@@ -315,8 +315,9 @@ from the default."
(let ((doom-inhibit-switch-buffer-hooks t))
(run-hooks 'doom-exit-buffer-hook)
(prog1 (apply orig-fn buffer-or-name args)
(with-current-buffer buffer-or-name
(run-hooks 'doom-enter-buffer-hook))))))
(when (buffer-live-p (get-buffer buffer-or-name))
(with-current-buffer buffer-or-name
(run-hooks 'doom-enter-buffer-hook)))))))
(defun doom|init-custom-hooks (&optional disable)
(dolist (spec '((select-window . doom*switch-window-hooks)