Trigger doom-switch-buffer-hook on kill-current-buffer

Fixes the dashboard not loading when killing a file opened at
startup, i.e. `emacs FILE1` and landing in *doom*.
This commit is contained in:
Henrik Lissner 2021-05-28 16:22:26 -04:00
parent 69ea5c2020
commit 0d9b4a7da0

View file

@ -246,16 +246,16 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
(message "Can't kill the fallback buffer.")
t)
((doom-real-buffer-p buf)
(let ((visible-p (delq (selected-window) (get-buffer-window-list buf nil t)))
(doom-inhibit-switch-buffer-hooks t)
(inhibit-redisplay t)
buffer-list-update-hook)
(let ((visible-p (delq (selected-window) (get-buffer-window-list buf nil t))))
(unless visible-p
(when (and (buffer-modified-p buf)
(not (y-or-n-p
(format "Buffer %s is modified; kill anyway?"
buf))))
(user-error "Aborted")))
(let ((inhibit-redisplay t)
(doom-inhibit-switch-buffer-hooks t)
buffer-list-update-hook)
(when (or ;; if there aren't more real buffers than visible buffers,
;; then there are no real, non-visible buffers left.
(not (cl-set-difference (doom-real-buffer-list)
@ -267,8 +267,8 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
(unless visible-p
(with-current-buffer buf
(restore-buffer-modified-p nil))
(kill-buffer buf))
(run-hooks 'buffer-list-update-hook)
(kill-buffer buf)))
(run-hooks 'doom-switch-buffer-hook 'buffer-list-update-hook)
t)))))