dajva / rg.el

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

Mac rg executable #127

Closed benkio closed 2 years ago

benkio commented 2 years ago

Hi, On mac the current implementation of rg-executable can find the executable, but, if I evaluate the following code in the scratch buffer (overriding the current implementation)

(defun rg-executable ()
  "Return the 'rg' executable.
Raises an error if it can not be found."
  (unless (executable-find "rg")
    (error "No 'rg' executable found"))
  (shell-quote-argument (executable-find "rg")))

It works fine, seems the value at https://github.com/dajva/rg.el/blob/master/rg.el#L78 is not refreshed/executed somehow. rg commands works on shell as well as async-shell-command inside emacs.

dajva commented 2 years ago

Thanks for the report. So what is the value of the variable rg-executable when the original function rg-executable is called? nil? So it seems like the ripgrep executable can't be found when loading the package but is found when it's needed by the package during a search. Could you be modifying exec-path after the package has been loaded? If you for instance rely on a package like exec-path-from-shell it should typically be loaded before this package.

benkio commented 2 years ago

 I use the exec-path-from-shell, but I realise it was added after the loading of the package, moving the exec-path-from-shell up and restarting emacs solved the issue. I close this one. Thank for your support 🙏