mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
doom-kill-buffer: extract protect-visible-buffers logic
Protecting buffers that were visible in other windows (burying them instead) is not the responsibility of doom-kill-buffer. This is a job for kill-buffer-query-functions, hence doom|protect-visible-buffers.
This commit is contained in:
@ -228,6 +228,12 @@ local value, whether or not it's permanent-local. Therefore, we cycle
|
||||
(add-hook! '(doom-post-init-hook minibuffer-setup-hook)
|
||||
#'doom|no-fringes-in-minibuffer)
|
||||
|
||||
(defun doom|protect-visible-buffers ()
|
||||
"Don't kill the current buffer if it is visible in another window (bury it
|
||||
instead)."
|
||||
(not (and after-init-time (get-buffer-window-list nil t))))
|
||||
(add-hook 'kill-buffer-query-functions #'doom|protect-visible-buffers)
|
||||
|
||||
|
||||
;;
|
||||
;; Plugins
|
||||
|
Reference in New Issue
Block a user