dajva / rg.el

Emacs search tool based on ripgrep
https://rgel.readthedocs.io
GNU General Public License v3.0
474 stars 39 forks source link

Have rg commands return ripgrep's exit code #173

Open hmelman opened 1 month ago

hmelman commented 1 month ago

It would be great if searches returned rg's exit code (0 for matches found, 1 for no matches found, 2 for errors).

In particular I have several searches I've created with rg-define-search and I'd like to run them just to know if there was a match or not, I don't need the results buffer to be displayed but I could handle that myself.

dajva commented 6 days ago

Don't think that is easily doable since the search is async and we don't want to block emacs during a search. We get the result from compilation-mode though so we could add a hook so the user can provide a callback function.

hmelman commented 6 days ago

That makes sense. It does feel like making the result available would be useful, but I'm not sure how convenient I'd find a callback function. I'll probably just call rg myself (synchronously).