dajva / rg.el

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

Difficulty using rg with TRAMP #43

Closed danielmatz closed 6 years ago

danielmatz commented 6 years ago

If I open a buffer whose default-directory is on a remote machine, and try to run M-x rg, I see that it tries to use the path to rg on my local machine, instead of on the remote machine.

It seems I could set the rg-command variable myself to get it to work on remote machines.

But would it be possible to update this package so that it automatically finds the rg executable on a remote machine?

dajva commented 6 years ago

This is a bit tricky AFAIK. Essentially the executable-find function makes sure binaries are found in certain setups when emacs is not inheriting the shell $PATH variable (See #31). Removing that would probably make it work with tramp but other setups may suffer.

I could think of breaking out the rg executable to a new variable that does not contain any flags and then the user could choose to either use executable-find (default) or simply use "rg" and let the shell handle locating the executable. The current executable-find stuff in this package is a mess BTW, which I have been thinking to clean up for a while so I wouldn't mind such a solution at all. But maybe there are better alternatives?

dajva commented 6 years ago

I've pushed a fix where I've added an rg-executable variable that can be customized. Please try it out and see if it works for you.

danielmatz commented 6 years ago

Yes, that works for me, thanks!