From 259590d54ef69728387d9a352d5d57ded28602c4 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 16 Mar 2019 23:55:56 -0400 Subject: [PATCH] Remove doom|protect-visible-buffer This behavior is now isolated to kill-this-buffer. --- core/autoload/buffers.el | 7 ++++--- core/core-ui.el | 7 ------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/core/autoload/buffers.el b/core/autoload/buffers.el index 8889e3b78..08bcc4889 100644 --- a/core/autoload/buffers.el +++ b/core/autoload/buffers.el @@ -227,9 +227,10 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original (doom-visible-buffers))) ;; if we end up back where we start (or previous-buffer ;; returns nil), we have nowhere left to go - (memq (previous-buffer) (list buf 'nil))) - (switch-to-buffer (doom-fallback-buffer)))) - (kill-buffer buf))) + (memq (switch-to-prev-buffer nil t) (list buf 'nil))) + (switch-to-buffer (doom-fallback-buffer))) + (unless (delq (selected-window) (get-buffer-window-list buf nil t)) + (kill-buffer buf))))) ((funcall orig-fn))))) diff --git a/core/core-ui.el b/core/core-ui.el index a112c6030..300bc26d9 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -121,12 +121,6 @@ behavior). Do not set this directly, this is let-bound in `doom|init-theme'.") (setq doom-theme theme) (run-hooks 'doom-load-theme-hook))) -(defun doom|protect-visible-buffer () - "Don't kill the current buffer if it is visible in another window (bury it -instead). Meant for `kill-buffer-query-functions'." - (not (and (not (member (substring (buffer-name) 0 1) '(" " "*"))) - (delq (selected-window) (get-buffer-window-list nil nil t))))) - (defun doom|protect-fallback-buffer () "Don't kill the scratch buffer. Meant for `kill-buffer-query-functions'." (not (eq (current-buffer) (doom-fallback-buffer)))) @@ -527,7 +521,6 @@ frames, however. There's always `doom/reload-theme' if you need it!" (run-hook-wrapped 'doom-init-ui-hook #'doom-try-run-hook) (add-to-list 'kill-buffer-query-functions #'doom|protect-fallback-buffer nil 'eq) - (add-to-list 'kill-buffer-query-functions #'doom|protect-visible-buffer nil 'eq) (add-hook 'after-change-major-mode-hook #'doom|highlight-non-default-indentation) ;; Reload theme if the display device has changed