Closed joachimnielandt closed 1 year ago
I am not sure what causes the abnormal exit. Either the command is not found or the command exits immediately with error code 1. consult-grep and consult-ripgrep work for you? If these don't work you should probably investigate these commands first. I am not sure if a separate consult-ugrep is really needed. Maybe it suffices to just adjust consult-grep-args globally or via let?
(defun consult-ugrep ()
(interactive)
(let ((consult-grep-args "ugrep ..."))
(call-interactively #'consult-grep)))
If a separate command (and a separate command builder function) is needed due to special ugrep features, I would appreciate if you create a separate package in the style of consult-ag. I don't want to add support for ugrep to Consult directly, since there are many flavors of grep commands, such that things would get out of hand. Thanks!
Nice to see how you could wrap consult-grep
in a separate function. In this case though, I think I'd need a different command builder as ugrep
(for my usecase anyway) would be called this way:
ugrep --bool 'a b c'
This would give all files that have a
, b
and c
somewhere in the file. Passing multiple words to the current consult-grep
builder function translates into a regex I believe.
I will attempt to create a package similar to consult-ag
, thanks for the suggestions!
@minad
Consult-ag could be easily modified into using ugrep apparently. I made an attempt to modify the underlying consult-ag functions (with call-interactively
, as you mentioned) but couldn't quite get it right... have to study some more elisp I guess. I created a fork of consult-ag instead, which seems to do the trick.
FWIW, I gave it a shot by following consult-git-grep
and consult-ripgrep
approach: https://manueluberti.eu/2023/09/16/consult-ugrep.html
@manuel-uberti That link is 404.
Yep, that's because in the meantime I reworked my website. Here it is: https://manueluberti.eu/posts/2023-09-16-consult-ugrep/
@manuel-uberti Thanks. I forked your solution to provide a ugrep --bool
experience. If anyone's interested, the code is here.
Hello all,
This is not exactly a consult issue, more of a programming-support question that could eventually lead to a contribution. So, I hope I'm at the right place :). If not, feel free to close this issue.
I'm attempting to include
ugrep
as agrep
alternative, as I'm interested in using it for its--bool --files
flags to search multiple keywords file-wide. As one of my first attempts at elisp, I was going off theconsult--grep-*
functions to see if I could make sense of this. I'm evaluating the MVE code below in a buffer, then runningconsult-ugrep
and passing some#search text
to it.In the
*consult-async*
buffer I'm getting this error:Executing this command myself in the project folder (
ugrep --null --line-buffered ...
) is functional, emacs hasugrep
on itsPATH
. Asstderr
output is empty in the error buffer I'm not sure how to proceed here.I'm running the windows client, and tested under WSL(ubuntu) with similar results.