doom--cycle-real-buffers: if n=0, switch to fallback buffer
This commit is contained in:
parent
fa72e8d09b
commit
00cc57a2bd
1 changed files with 22 additions and 20 deletions
|
@ -126,10 +126,12 @@ If DERIVED-P, test with `derived-mode-p', otherwise use `eq'."
|
||||||
when (string-match-p pattern (buffer-name buf))
|
when (string-match-p pattern (buffer-name buf))
|
||||||
collect buf))
|
collect buf))
|
||||||
|
|
||||||
(defun doom--cycle-real-buffers (&optional n)
|
(defun doom--cycle-real-buffers (n)
|
||||||
"Switch to the next buffer N times (previous, if N < 0), skipping over unreal
|
"Switch to the next buffer N times (previous, if N < 0), skipping over unreal
|
||||||
buffers. If there's nothing left, switch to `doom-fallback-buffer'. See
|
buffers. If there's nothing left, switch to `doom-fallback-buffer'. See
|
||||||
`doom-real-buffer-p' for what 'real' means."
|
`doom-real-buffer-p' for what 'real' means."
|
||||||
|
(if (null n)
|
||||||
|
(switch-to-buffer (doom-fallback-buffer) nil t)
|
||||||
(let ((buffers (delq (current-buffer) (doom-real-buffer-list))))
|
(let ((buffers (delq (current-buffer) (doom-real-buffer-list))))
|
||||||
(cond ((or (not buffers)
|
(cond ((or (not buffers)
|
||||||
(zerop (% n (1+ (length buffers)))))
|
(zerop (% n (1+ (length buffers)))))
|
||||||
|
@ -146,9 +148,9 @@ buffers. If there's nothing left, switch to `doom-fallback-buffer'. See
|
||||||
while (not (memq (current-buffer) buffers))
|
while (not (memq (current-buffer) buffers))
|
||||||
do
|
do
|
||||||
(dotimes (_i (abs n))
|
(dotimes (_i (abs n))
|
||||||
(funcall move-func)))))
|
(funcall move-func)))))))
|
||||||
(force-mode-line-update)
|
(force-mode-line-update)
|
||||||
(current-buffer)))
|
(current-buffer))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-set-buffer-real (buffer flag)
|
(defun doom-set-buffer-real (buffer flag)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue