This question does not seem to be about Projectile or Helm, but more generally about using grep/find with Emacs on Windows. Have you tried any of the built-in Emacs commands like rgrep
, find-grep-dired
, etc?
A couple things to try:
I've generally found I want to update both exec-path
and PATH
on Windows. Here's a bit of code I'm currently using to make sure my unix shell tools are ahead of any Windows executables:
;; Windows path
(when (eq system-type 'windows-nt)
;; Make sure Unix tools are in front of `exec-path'
(let ((bash (executable-find "bash")))
(when bash
(push (file-name-directory bash) exec-path)))
;; Update PATH from exec-path
(let ((path (mapcar 'file-truename
(append exec-path
(split-string (getenv "PATH") path-separator t)))))
(setenv "PATH" (mapconcat 'identity (delete-dups path) path-separator))))
This finds my unix bin dir (by looking for bash
) and makes sure it is at the front of exec-path
. Then I change the PATH variable to match the exec-path
.
Update: Details about projectile use of find
A few details about projectile, if this is really specific to projectile:
On Windows, projectile defaults to setting projectile-indexing-method
to native
, which does not use external tools like find
. If it is calling find then you may have changed the configuration to use alien
indexing, which looks for external tools.
If you use alien
indexing, projectile will first check if the project uses a version control tool that provides fast searching, e.g. git. Otherwise it will fall back to using projectile-generic-command
.
The default value for projectile-generic-command
is "find . -type f -print0"
. Note that this is a string passed to shell-command-to-string
, and so it expects that the shell will have find
on the PATH. Changing e.g. find-program
and exec-path
are not relevant here, since those do not affect a shell process created by Emacs.
So if projectile is failing to use the right find command, you probably want to make sure that your shell (as determined by shell-file-name
) is running with the right PATH. As I noted above, you can setenv PATH within Emacs, and this will affect the environment of shell processes that Emacs creates.
(setq grep-program "c:/progra~1/GnuWin32/bin/grep.exe")