Use frame's buffer-predicate instead of doom/{next,previous}-buffer

doom/{next,previous}-buffer was implemented so that these commands could
skip over unreal buffers, and land us on either a real one or the
dashboard. Using the frame's buffer-predicate parameter accomplishes
exactly this, natively.
This commit is contained in:
Henrik Lissner 2018-02-01 19:01:49 -05:00
parent c9e8be1f60
commit 2989296521
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
5 changed files with 27 additions and 26 deletions

View file

@ -34,6 +34,13 @@ it if it doesn't exist).")
;; Functions
;;
;;;###autoload
(defun doom-buffer-frame-predicate (buf)
"To be used as the default frame buffer-predicate parameter. Returns nil if
BUF should be skipped over by functions like `next-buffer' and `other-buffer'."
(or (doom-real-buffer-p buf)
(eq buf (doom-fallback-buffer))))
;;;###autoload
(defun doom-fallback-buffer ()
"Returns the fallback buffer, creating it if necessary. By default this is the
@ -279,17 +286,3 @@ processes killed."
(delete-process p)
(cl-incf n))))
n))
;;;###autoload
(defun doom/next-buffer ()
"Switch to the next real buffer, skipping non-real buffers. See
`doom-real-buffer-p' for what 'real' means."
(interactive)
(doom--cycle-real-buffers +1))
;;;###autoload
(defun doom/previous-buffer ()
"Switch to the previous real buffer, skipping non-real buffers. See
`doom-real-buffer-p' for what 'real' means."
(interactive)
(doom--cycle-real-buffers -1))