Skip to content

Commit

Permalink
Trigger doom-switch-buffer-hook on kill-current-buffer
Browse files Browse the repository at this point in the history
Fixes the dashboard not loading when killing a file opened at
startup, i.e. `emacs FILE1` and landing in *doom*.
  • Loading branch information
hlissner committed May 28, 2021
1 parent 69ea5c2 commit 0d9b4a7
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions core/core-ui.el
Original file line number Diff line number Diff line change
Expand Up @@ -246,29 +246,29 @@ 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")))
(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)
(doom-visible-buffers)))
;; if we end up back where we start (or previous-buffer
;; returns nil), we have nowhere left to go
(memq (switch-to-prev-buffer nil t) (list buf 'nil)))
(switch-to-buffer (doom-fallback-buffer)))
(unless visible-p
(with-current-buffer buf
(restore-buffer-modified-p nil))
(kill-buffer buf))
(run-hooks 'buffer-list-update-hook)
(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)
(doom-visible-buffers)))
;; if we end up back where we start (or previous-buffer
;; returns nil), we have nowhere left to go
(memq (switch-to-prev-buffer nil t) (list buf 'nil)))
(switch-to-buffer (doom-fallback-buffer)))
(unless visible-p
(with-current-buffer buf
(restore-buffer-modified-p nil))
(kill-buffer buf)))
(run-hooks 'doom-switch-buffer-hook 'buffer-list-update-hook)
t)))))


Expand Down

0 comments on commit 0d9b4a7

Please sign in to comment.