Remove doom|protect-visible-buffer

This behavior is now isolated to kill-this-buffer.
This commit is contained in:
Henrik Lissner 2019-03-16 23:55:56 -04:00
parent 7fd1497e88
commit 259590d54e
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 4 additions and 10 deletions

View file

@ -227,9 +227,10 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
(doom-visible-buffers))) (doom-visible-buffers)))
;; if we end up back where we start (or previous-buffer ;; if we end up back where we start (or previous-buffer
;; returns nil), we have nowhere left to go ;; returns nil), we have nowhere left to go
(memq (previous-buffer) (list buf 'nil))) (memq (switch-to-prev-buffer nil t) (list buf 'nil)))
(switch-to-buffer (doom-fallback-buffer)))) (switch-to-buffer (doom-fallback-buffer)))
(kill-buffer buf))) (unless (delq (selected-window) (get-buffer-window-list buf nil t))
(kill-buffer buf)))))
((funcall orig-fn))))) ((funcall orig-fn)))))

View file

@ -121,12 +121,6 @@ behavior). Do not set this directly, this is let-bound in `doom|init-theme'.")
(setq doom-theme theme) (setq doom-theme theme)
(run-hooks 'doom-load-theme-hook))) (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 () (defun doom|protect-fallback-buffer ()
"Don't kill the scratch buffer. Meant for `kill-buffer-query-functions'." "Don't kill the scratch buffer. Meant for `kill-buffer-query-functions'."
(not (eq (current-buffer) (doom-fallback-buffer)))) (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) (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-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) (add-hook 'after-change-major-mode-hook #'doom|highlight-non-default-indentation)
;; Reload theme if the display device has changed ;; Reload theme if the display device has changed