Skip to content
This repository

multi-occur is awesome. Can it be a buffer switcher #103

Closed
lewang opened this Issue · 10 comments

2 participants

Le Wang Thierry Volpiatto
Le Wang
Collaborator

Hi Thierry,

I love the new multi-occur. I'll soon integrate it into helm-cmd-t.

It would be great if it could also serve as a buffer-switcher. That is - offer a mode where matches are collapsed into buffers ike

Buffer A <12 matches>
Buffer B <3 matches>
...

And when a line is selected, we switch to the buffer, but don't move the point. It would be great if this mode can be toggled straight from helm-multi-occur results (and of course, if there was a way to go straight into it).

Thierry Volpiatto
Le Wang
Collaborator

In commit eddcd47 I added the ability for helm-multi-occur to take a list of buffers. My intention is to give it a list of buffers in current repository (or all buffers for that matter), and then narrow it down with occur search to find the buffer I want to switch to.

Thierry Volpiatto

Yes, you can also use helm-multi-occur-1 for this purpose.

I lost you when you want to give a list of buffer to *multi-occur and narrow it down with occur.
Why not narrowing this list of buffers with a simple helm source that list buffers like helm-buffers-list would do?

Le Wang
Collaborator

I'm not sure if we are on the same page yet. I want to use buffer contents to filter down to a subset of given buffers and switch to one of them. It's debatable whether this should be added to to helm-buffers-list or helm-multi-occur.

Thierry Volpiatto
Le Wang
Collaborator

Yes. I don't need to see each match, I just want to switch to a buffer without moving the point.

Thierry Volpiatto

So it is not helm-multi-occur you want, though it would work, but would be unnecessary slow for this, you need something that search your buffers for a pattern like multi-occur does, but that return immediately at first match, (i.e no need to scan all buffer) and search the next buffer and so on.
I have this (may be not exactly what you want but similar) in ioccur.el, see ioccur-find-buffer-matching.

Thierry Volpiatto thierryvolpiatto referenced this issue from a commit
Thierry Volpiatto thierryvolpiatto * helm-buffers.el (helm-c-buffer-match-major-mode): Issue #103 Match …
…inside buffers with @.

(helm-c-buffer-match-inside): new.
ce88e38
Thierry Volpiatto thierryvolpiatto referenced this issue from a commit
Thierry Volpiatto thierryvolpiatto * helm-buffers.el (helm-multi-occur-as-action): Issue #103 Use @ inpu…
…t as default input when present.

* helm-regexp.el (helm-multi-occur-1): Take one more arg INPUT.
* helm-help.el: Document new behavior of helm-buffers-list.
39c674b
Thierry Volpiatto

Try M-x helm-buffers-list
Assume you have many helm buffers files open (helm-buffers.el, helm-regexp.el etc...)
enter in pattern:
lisp ^helm @moc
the buffers containing an occurence of "moc" will be selected.
Now you can mark all these buffers, and launch helm-multi-occur with C-s, the default pattern used will be "moc".

Thierry Volpiatto

Note that if you have buffers prefixed by "@" and you want to match these buffers, you can escape the "@" e.g:
\@foo.
If you want to enter a space in pattern when using "@", use "\s-"
e.g if you want to search inside buffers "le wang", use "@le\s-wang"

Le Wang
Collaborator

This is great.

Le Wang lewang closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.