You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Anyone know why need this . thing on Windows (and Mac OS)?
First of all, it seems that at the moment we have to use the . on Windows, otherwise rg.el won't display anything. It has little to do with rg.el though, I still want to discuss.
Let's do some experiments via clean Emacs interface:
Try the following three commands (no .) in Windows standard console
In the current rg.el implementation, these two directories will be combined with the current directory (i.e. .), which causes these two flags meaningless, i.e. it still searches the entire current directory.
Of course, this problem can be workaround via deleting (list ".") in the code above, but that breaks the code.
So anyone know why we have to add . on Windows (and Mac)? Is this related to Emacs or ripgrep?
Thanks.
The text was updated successfully, but these errors were encountered:
When the command-line arguments did not explicitly indicate the search path (e.g. . or ./), ripgrep would use a heuristic to guess users' intention, i.e. whether searching in the current directory or in stdin via a pipe, see hiargs.rs#L1104 and lib.rs#L170. Unfortunately, on Windows (might be also on Mac), ripgrep guesses "users want to search in stdin via a pipe", so Emacs process hangs.
A simple experiment to make the above process code work:
1. SomeTextInFiles1
2. SomeTextInFiles2
3. SomeTextInFiles3
Process rg<1> finished
However as you see that, ripgrep searched "SomeTextInFiles" in the string content, i.e. "1. SomeTextInFiles1\nxxxxxx\n2. SomeTextInFiles2\nyyyyy\n3. SomeTextInFiles3\n" instead of directory.
Some suggestions:
Make the command-line consistent on Windows, Linux and Mac OS, i.e. explicitly provide the search path instead of leaving ripgrep to guess. Remove (member system-type '(darwin windows-nt)) condition.
The search path (or "multiple directories search") should be implemented as a separate feature instead of hardcoded as . or added through rg-command-line-flags.
I saw in rg.el there are the following lines
Anyone know why need this
.
thing on Windows (and Mac OS)?First of all, it seems that at the moment we have to use the
.
on Windows, otherwise rg.el won't display anything. It has little to do with rg.el though, I still want to discuss.Let's do some experiments via clean Emacs interface:
Try the following three commands (no
.
) in Windows standard consoleAll work, i.e. they can display results in the console.
Try the same command (no
.
) in Emacs withstart-process
This doesn't work, i.e. it displayed nothing in "newbuffer123" (also for
rg.exe
only andcmd.exe /c
).The way to fix this problem is adding
.
at the end of command, i.e.Then works, but why?
Not all of the ripgrep commands can't display,
-h
can do for example:This can display help information in "newbuffer123"
I found this patch was added by @drvink from #10 but no explanation. Also, there are two related commits 842452c and 89343e9.
Nevertheless, the
.
solution works fine, until someone want to addrg-command-line-flags
to rg.el.For example, suppose I'd like to search only two specific directories under the current directory (multiple directories search):
In the current rg.el implementation, these two directories will be combined with the current directory (i.e.
.
), which causes these two flags meaningless, i.e. it still searches the entire current directory.Of course, this problem can be workaround via deleting
(list ".")
in the code above, but that breaks the code.So anyone know why we have to add
.
on Windows (and Mac)? Is this related to Emacs or ripgrep?Thanks.
The text was updated successfully, but these errors were encountered: