Wilfred / deadgrep

fast, friendly searching with ripgrep and Emacs
705 stars 46 forks source link

Support for ripgrep-all #86

Open arenzana opened 4 years ago

arenzana commented 4 years ago

I LOVE deadgrep and use it pretty much daily. One thing I just recently found was this project: https://github.com/phiresky/ripgrep-all. It allows for search inside all type of file formats (including pdf, which is the one I'm interested in particularly).

Not sure this is technically possible or worth the time, but ripgrep-all as an alternative engine would be amazing!

JohnJohnstone commented 3 years ago

I found this issue whilst attempting to use ripgrep-all to search pdf with deadgrep. I have just set the variable deadgrep-executable to rga seems to be working fine so far.

pierre-rouleau commented 1 month ago

@Wilfred, Although it's true you can set the deadgrep-executable user-option to "rga" it would be nice to be able to either be able to:

I tried the following code that almost does the job of providing a ripgrep-all even when the deadgrep-executable is set to ripgrep. Unfortunately the hook activates it for the remainder of the Emacs session and it affects all buffers:

(defun deadgrep-all-setup ()
  "Use rga in deadgrep buffer."
  (setq-local deadgrep-executable "rga"))

(defun deadgrep-all (search-term)
  "Search with rga."
  (interactive (list (deadgrep--read-search-term)))
  (let ((deadgrep-executable "rga"))
    (add-hook 'deadgrep-mode-hook 'deadgrep-all-setup)
    (deadgrep search-term)))

The advantage of being able to select ripgrep-all just sometimes, is that ripgrep is faster. Some people may want to use ripgrep-all just sometimes, and would't want to switch to ripgrep-all for all of their searches.