Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalize swiper-all function for different buffer lists #2856

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions swiper.el
Original file line number Diff line number Diff line change
Expand Up @@ -1240,11 +1240,11 @@ otherwise continue prompting for buffers."
(t (buffer-file-name buffer)))))

;;* `swiper-all'
(defun swiper-all-function (str)
"Search in all open buffers for STR."
(defun swiper-all-buffers-function (str buffers)
basil-conto marked this conversation as resolved.
Show resolved Hide resolved
"Search in all given BUFFERS for STR."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Search for STR in all given BUFFERS.

(or
(ivy-more-chars)
(let* ((buffers (cl-remove-if-not #'swiper-all-buffer-p (buffer-list)))
(let* ((buffers (cl-remove-if-not #'swiper-all-buffer-p buffers))
Copy link
Collaborator

@basil-conto basil-conto May 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This let* can be a plain let, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I don't see why not

(re-full ivy-regex)
re re-tail
cands match
Expand Down Expand Up @@ -1276,6 +1276,10 @@ otherwise continue prompting for buffers."
(list "")
(setq ivy--old-cands (nreverse cands))))))

(defun swiper-all-function (str)
"Search in all buffers for STR."
(swiper-all-buffers-function str (buffer-list)))

(defun swiper--all-format-function (cands)
"Format CANDS for `swiper-all'.
See `ivy-format-functions-alist' for further information."
Expand Down