-
-
Notifications
You must be signed in to change notification settings - Fork 389
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
helm-do-grep
dissapeared?
#1377
Comments
Vitalie Spinu notifications@github.com writes:
Yes it have been removed. I have removed the remaining references, thanks. Thierry |
Ok. So what's the alternative then? Would be convenient if you could obsolete a function with a warning with new alternative, so that people won't get surprised. |
I see that there is no alternative. You can call grep from helm files commands only. Why did you make this decision? I am not using helm-files ecosistem. I find it ineficient, but I use everything else. I also don't like |
Vitalie Spinu notifications@github.com writes:
Start with helm-find-files. Thierry |
Vitalie Spinu notifications@github.com writes:
You were using helm files stuff anyway from helm-do-grep (helm-read-file-name).
So don't use it. Thierry |
Sorry, but that just doesn't make sense. Why would I start with I am baffled. Why would you remove such an essential functionality from top level? |
I have no strong opinion about that. But it's very easy to define it by yourself:
|
That solves my problem. Even more so, I am skipping the
I think this version is consistent with the |
Great. I think referring to
should do the same. (Does that so something useful with no prefix arg given?) |
Indeed!
It's clearly not as useful as ag but it has much better highlighting and allows multi matching. Till grep-ag can do that I am using do-grep for current dir and -ag for recursive stuff. A much more useful version would run a project based grep (like |
This was confusing for me as well. I used to use "C-M-g" for
@vspinu What do you mean by "multi matching"? I thought you meant that Thanks. |
I was somewhat confused back then. helm-grep indeed allows for multiple matches but those are treated as OR contrary to standard AND behavior everywhere else. So, in the current implementation, |
Vitalie Spinu notifications@github.com writes:
It doesn't.
They are not unless you type "foo|bar".
You have to understand that helm-grep is a frontend of diverse grep
So I suggest you use something else. Thierry |
Well, I still find it useful. :) It can be a little confusing sometimes, if I've forgotten that it doesn't accept multiple patterns. I wonder, would it be possible for some kind of hybrid mode that used grep for the first pattern and did "normal" helm filtering on additional ones, using the results from grep? It would be sort of like a pseudo-multi-AND-pattern grep, almost like helm-swoop across multiple files. It would be nearly as good as "the real thing." Maybe it could be called |
This is what I see on my machine. I do use grep with
I use helm, not grep in terminal. Even if it's just a front end. I expect it to have uniform UI regardless of the domain. |
@vspinu If I understand grep and Helm correctly, making helm-grep accept multiple patterns in an AND fashion would require stringing together multiple grep invocations, one for each pattern, and combining the results. I suppose that could be done, but it would be slow for large filesets, and maybe Thierry has other reasons he doesn't want to implement that. But if you wanted to do it yourself, it probably wouldn't be too difficult. You could capture the results of the first grep in a temp buffer, then pipe that buffer through another grep for each pattern, and then present the final results. You'd probably want a longer typing delay before executing the action. |
Piping grep results for each pattern is probably the way to go. This one works for me reasonably well: (defun my-helm-pipe-grep-match (fun &rest args)
(let* ((patterns (split-string helm-pattern))
(helm-grep-default-command
(cl-reduce (lambda (grep pat)
(concat grep " | grep --color=always " pat))
(cdr patterns)
:initial-value (replace-regexp-in-string "%p" (car patterns) helm-grep-default-command))))
(apply fun args)))
(advice-add 'helm-grep--prepare-cmd-line :around 'my-helm-pipe-grep-match) |
@thierryvolpiatto I still don't understand why you removed I looked through the commits in question, including 013ee11, but I can't find any explanation. So, why did you remove it? And since (defun my-helm-pipe-grep-match (fun &rest args)
(let* ((patterns (split-string helm-pattern))
(helm-grep-default-command
(cl-reduce (lambda (grep pat)
(concat grep " | grep --color=always " pat))
(cdr patterns)
:initial-value (replace-regexp-in-string "%p" (car patterns) helm-grep-default-command))))
(apply fun args)))
(advice-add 'helm-grep--prepare-cmd-line :around 'my-helm-pipe-grep-match)
(defun helm-do-grep (&optional arg)
(interactive "P")
(helm-do-grep-1 (list default-directory) arg)) |
alphapapa notifications@github.com writes:
I am now tired to explain, I have added an entry in FAQ.
No, in your case it 3 vs 2. BTW I have added a new user variable called 2 vs 2 So please stop complaining.
See FAQ
It does in your case.
No.
Perhaps. Thierry |
Vitalie Spinu notifications@github.com writes:
This proposition looks reasonable, I will write something in this sens. Thanks. Thierry |
* helm-grep.el (helm-grep--prepare-cmd-line): Pipe multiples patterns to original cmd line.
* helm-grep.el (helm-grep-ag-prepare-cmd-line): New. (helm-grep-ag-init): Use it to pipe ag result to ack.
* helm-grep.el (helm-grep-default-command): Docstring only. (helm-grep--prepare-cmd-line): extract ack cmd. (helm-grep-ag-prepare-cmd-line): Check if ack-grep is present otherwise fallback to grep -P.
* helm-grep.el (helm-grep-ag-prepare-cmd-line): Quote pattern piped.
* helm-grep.el (helm-grep--prepare-cmd-line): all on one line.
There is no more
helm-do-grep
? I am gettingWrong type argument: commandp, helm-do-grep
. I am on MELPA 20160204.926. I don't see it defined in the source anymore but plenty of references to it, including the menu definition.The text was updated successfully, but these errors were encountered: