-
-
Notifications
You must be signed in to change notification settings - Fork 338
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
base: master
Are you sure you want to change the base?
Conversation
Recently a colleague asked me if it was possible to get the same behaviour as `swiper-all` with only the buffers of the current project. The solution I wrote for him involved a copy of `swiper-all-function` as the list of buffers was not variable. I think this is something that might be useful for others so here's half of that work to allow others to do the same: search through a custom list of buffers with all the niceties of `swiper-all`. I haven't done the paperwork for the copyright assignment to the FSF yet so I can't provide `swiper-projectile`. When I have the paperwork done I can make a separate PR for that if people are interested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
search through a custom list of buffers with all the niceties of
swiper-all
I've never really used this functionality, so I'm curious: where does swiper-multi
fit in here? How much overlap is there between that and swiper-all
? Are there any opportunities for sharing/merging functionality? Could/should swiper-multi
be extended instead of swiper-all
?
I haven't done the paperwork for the copyright assignment to the FSF yet so I can't provide
swiper-projectile
. When I have the paperwork done I can make a separate PR for that if people are interested.
I'd personally be more interested in an implementation that uses the built-in and extensible project.el
, which is also available from GNU ELPA and GNU-devel ELPA, rather than the third-party projectile
. TIA.
(defun swiper-all-function (str) | ||
"Search in all open buffers for STR." | ||
(defun swiper-all-buffers-function (str buffers) | ||
"Search in all given BUFFERS for STR." |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
I haven't really used it either but this question was a good prompt for me to go and learn more about swiper.
That said, there is some overlap: |
Thanks for looking into this.
But in theory it could be extended to take a list of buffers, just like this PR extends
Are you saying that
Why not merge them into a single function that can be parameterised to behave in one or the other way? |
Recently a colleague asked me if it was possible to get the same
behaviour as
swiper-all
with only the buffers of the currentproject.
The solution I wrote for him involved a copy of
swiper-all-function
as the list of buffers was not variable. I think this is something
that might be useful for others so here's half of that work to allow
others to do the same: search through a custom list of buffers with
all the niceties of
swiper-all
.I haven't done the paperwork for the copyright assignment to the FSF
yet so I can't provide
swiper-projectile
. When I have the paperworkdone I can make a separate PR for that if people are interested.