summaryrefslogtreecommitdiff
path: root/cape.el
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2025-05-09 19:20:37 +0200
committerDaniel Mendler <mail@daniel-mendler.de>2025-05-09 19:20:37 +0200
commit383fab93cbba6ef0a6a389b1a0e01f88a3d7e2d5 (patch)
tree6c7983f213661eb24e36e10a72d92623865b1c4a /cape.el
parentf0268bb03f15d378edd854ce548e073c63fec0ea (diff)
cape--buffer-list: Simplify behavior in the minibuffer
Diffstat (limited to 'cape.el')
-rw-r--r--cape.el16
1 files changed, 7 insertions, 9 deletions
diff --git a/cape.el b/cape.el
index 9720270..acb5e46 100644
--- a/cape.el
+++ b/cape.el
@@ -135,15 +135,13 @@ The buffers are scanned for completion candidates by `cape-line'."
(defun cape--buffer-list (pred)
"Return list of buffers satisfying PRED."
- (let ((cur (current-buffer)))
- (cons cur
- (if (minibufferp)
- (cl-loop for win in (window-list)
- for buf = (window-buffer win)
- unless (eq buf cur) collect buf)
- (cl-loop for buf in (buffer-list)
- if (and (not (eq buf cur)) (funcall pred buf))
- collect buf)))))
+ (let* ((cur (current-buffer))
+ (orig (and (minibufferp) (window-buffer (minibuffer-selected-window))))
+ (list (cl-loop for buf in (buffer-list)
+ if (and (not (eq buf cur)) (not (eq buf orig))
+ (funcall pred buf))
+ collect buf)))
+ `(,cur ,@(and orig (list orig)) ,@list)))
(defun cape-same-mode-buffers ()
"Return buffers with same major mode as current buffer."