By default, empty buffer-file-name = unreal buffer

This commit is contained in:
Henrik Lissner 2017-06-12 14:28:59 +02:00
parent b3dafe96d3
commit d9d049549f
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 8 additions and 3 deletions

View file

@ -142,7 +142,8 @@ popup window/buffer and b) isn't a special buffer."
(or (run-hook-with-args-until-success 'doom-real-buffer-functions buf)
(not (or (doom-popup-p buf)
(minibufferp buf)
(string-match-p "^\\s-*\\*" (buffer-name buf)))))))
(string-match-p "^\\s-*\\*" (buffer-name buf))
(not (buffer-file-name buf)))))))
;;;###autoload
(defun doom/next-buffer ()

View file

@ -36,6 +36,8 @@
(ert-deftest get-real-buffers ()
(with-temp-buffers! (a b c d)
(dolist (buf (list a b))
(with-current-buffer buf (setq-local buffer-file-name "x")))
(with-current-buffer c
(rename-buffer "*C*"))
(with-current-buffer d
@ -56,7 +58,9 @@
(should-not (buffer-live-p a))))
(ert-deftest kill-buffer-then-show-real-buffer ()
(with-temp-buffers! (a b c)
(with-temp-buffers! (a b c d)
(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))
@ -64,7 +68,7 @@
(should (doom-kill-buffer a))
(should (eq (current-buffer) b))
(should (doom-kill-buffer))
(should (eq (current-buffer) c))
(should (eq (current-buffer) d))
(doom/kill-this-buffer)
(should (eq (current-buffer) (doom-fallback-buffer)))))