From a20c0f42dbbecb356b286875b684f01fd25c6ebb Mon Sep 17 00:00:00 2001
Date: Wed, 4 May 2016 17:06:44 -0400
Subject: [PATCH] Shell escape arguments for find cmd used by xref
* lisp/progmodes/xref.el (xref-collect-matches): When the dir has
characters like spaces (e.g. /tmp/some dir/), those need to be escaped
before passing it as an argument to the shell command like `find'.
The escaping is done using `shell-quote-argument' (bug#23453).
lisp/progmodes/xref.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 62cef23..ff87bc3 100644
@@ -890,7 +890,7 @@ xref-collect-matches
(command (xref--rgrep-command (xref--regexp-to-extended regexp)
- (expand-file-name dir)
+ (shell-quote-argument (expand-file-name dir))
(buf (get-buffer-create " *xref-grep*"))
(grep-re (caar grep-regexp-alist))
Oh, as it turns out, the bug is there but not related to not finding find/grep.
It IS actually finding the find.exe and grep.exe correctly using the exec-path and/or (setenv "PATH" ..) hacks.
The problem was that the file was in a path with spaces in it:
C:\Users\kmodi\Desktop\_keep this folder empty\NEWS.txt
When I try using `A' in dired with above file marked and search for "Emacs", I get "No matches for: Emacs". Note the spaces in the directory name: "_keep this folder empty"
But when I copied NEWS.txt to C:\Users\kmodi\Desktop\NEWS.txt and then did the same "Emacs" search using `A' in dired, it worked!
I can recreate this bug in RHEL too!
(1) mkdir -p /tmp/some\ dir
(3) In emacs -Q, use C-x d to open dired in /tmp/some\ dir/
(4) Mark NEWS.txt using `m' key
(5) Then I do `A' and search for "Emacs" (or probably anything else too)
(6) You should get "No matches for: Emacs"
Can you please rename the bug title to "25.0.93; dired-do-find-regexp does not work when path contains spaces"?