Remove doom--cycle-real-buffers; refactor kill-this-buffer advice

cycle-real-buffers was a tidbit of complexity that was never necessary
in the first place. This functionality was already available in the form
of the frame buffer-predicate parameter, which controls where functions
like next-buffer and other-buffer can land you.

The only thing I have to do myself, is check for the condition where
there are no more real buffers left to switch to, and in that case send
you to the fallback-buffer.
This commit is contained in:
Henrik Lissner 2018-02-02 04:23:54 -05:00
parent ec7f20589a
commit d1953e00c4
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 10 additions and 53 deletions

View file

@ -109,27 +109,6 @@
(should (buffer-live-p fallback))
(should (equal (buffer-name fallback) doom-fallback-buffer-name))))
;; `doom--cycle-real-buffers'
(def-test! kill-buffer-then-show-real-buffer
(with-temp-buffers!! (a b c d)
(let-advice!! ((kill-this-buffer :around doom*switch-to-fallback-buffer-maybe))
(dolist (buf (list a b d))
(with-current-buffer buf
(setq-local buffer-file-name "x")))
(should (cl-every #'buffer-live-p (buffer-list)))
(switch-to-buffer a)
(should (eq (current-buffer) a))
(should (eq (selected-window) (get-buffer-window a)))
(kill-this-buffer)
(should-not (eq (current-buffer) a))
(should-not (buffer-live-p a))
;; eventually end up in the fallback buffer
(let ((fallback (doom-fallback-buffer)))
(while (not (eq (current-buffer) fallback))
(should (doom-real-buffer-p))
(kill-this-buffer))
(should (eq (current-buffer) fallback))))))
;; `doom-kill-buffer-and-windows'
(def-test! kill-buffer-and-windows
(with-temp-buffers!! (a b)