Consider dired-mode buffers real

This commit is contained in:
Henrik Lissner 2018-01-28 20:37:40 -05:00
parent 22f4404210
commit 8b19e35ef6
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 8 additions and 3 deletions

View file

@ -1,7 +1,8 @@
;;; core/autoload/buffers.el -*- lexical-binding: t; -*- ;;; core/autoload/buffers.el -*- lexical-binding: t; -*-
;;;###autoload ;;;###autoload
(defvar doom-real-buffer-functions '() (defvar doom-real-buffer-functions
'(doom-dired-buffer-p)
"A list of predicate functions run to determine if a buffer is real, unlike "A list of predicate functions run to determine if a buffer is real, unlike
`doom-unreal-buffer-functions'. They are passed one argument: the buffer to be `doom-unreal-buffer-functions'. They are passed one argument: the buffer to be
tested. tested.
@ -54,6 +55,11 @@ If no project is active, return all buffers."
collect buf) collect buf)
buffers))) buffers)))
;;;###autoload
(defun doom-dired-buffer-p (buf)
"Returns non-nil if BUF is a dired buffer."
(with-current-buffer buf (derived-mode-p 'dired-mode)))
;;;###autoload ;;;###autoload
(defun doom-special-buffer-p (buf) (defun doom-special-buffer-p (buf)
"Returns non-nil if BUF's name starts and ends with an *." "Returns non-nil if BUF's name starts and ends with an *."

View file

@ -150,8 +150,7 @@ project (which may be different across perspective)."
(defun +doom-dashboard-initial-buffer () (defun +doom-dashboard-initial-buffer ()
"Returns buffer to display on startup. Designed for `initial-buffer-choice'." "Returns buffer to display on startup. Designed for `initial-buffer-choice'."
(if (or (doom-real-buffer-p) (if (doom-real-buffer-p)
(derived-mode-p 'dired-mode))
(current-buffer) (current-buffer)
(doom-fallback-buffer))) (doom-fallback-buffer)))