Closed slinkp closed 2 years ago
I wondered if it might be a difference between rg 13.0.0 and rg 12.1.1 but the output looks the same given the same input.
Thanks for the detailed report. I have no official support for Mac and no way to test so can't help much here, more than give some pointers for you to start debugging yourself. Ripgrep 13 should not be a problem in general since that is what is currently running in CI. Would be interesting if it reproduces on 12.1.1 on Mac and/or on emacs 27 on Mac for instance. That may give some leads.
I would also test if other compilation-mode
derived modes work, like grep.el
, or running the same ripgrep command via M-x compile
.
grep.el
should support ripgrep these days, not sure if that made it into emacs 28 but if so, there should be some setting for it. So that would also be interesting to try since grep.el
and rg.el
are fairly similar in the architecture.
Thanks for the troubleshooting tip!
It appears that compile
never finishes. It stays like this indefinitely:
Interestingly, M-x grep
seems to work. Given the same test directory & files, I can type M-x grep birds * <ENTER>
with these results:
I'm going to see what else I can find out.
I was able to install 27.1 on mac via homebrew, also disabling the native compilation to remove one more difference between platforms. Same behavior as reported.
ALso tried removing that and downloading the 28.1-4 binary from https://emacsformacosx.com/ Same behavior
Here's a minimal repro:
M-x compile <ENTER> rg -e hello
That hangs in the "Compiling" state, never shows any output. But only on my mac.
With any file or directory arg, it completes (either with matches or without, but it completes):
M-x compile <ENTER> rg -e hello .
Any tips on debugging why compile gets stuck?
Is it possible it's waiting for EOF on stdin?
M-x compile <ENTER> grep -e hello
similarly hangs, but that's expected because it looks at stdin if no files are specified.
man ripgrep
says this:
ripgrep will automatically detect if stdin exists and search stdin for a regex
pattern, e.g. ls | rg foo. In some environments, stdin may exist when it shouldn’t. To
turn off stdin detection explicitly specify the directory to search, e.g. rg foo ./.
Similarly, if I copy the exact command line that's run by M-x rg
, add a directory to the end, and pass that to M-x compile
then it gets results.
Ah, great debugging. There is a fix for this on windows, maybe the same is needed for os X unless there is something specific with your system that is causing this behavior.
Anyway, try changing 'windows-nt
to 'darwin
in this line and see how it works.
A bit peculiar that no one else has reported this on for Mac but I think we could try this as a general solution if it works for you and handle any potential regressions if they show up.
That works!! Thanks for the quick responses! I can ask around if I know anybody else willing to test it. So far the other mac emacs users I know are using other search packages.
I reverted my local change and pulled latest master and it's working great now! THank you!!
I can repro this only on Mac. Works fine on Ubuntu.
When I use
M-x rg
with current master (c46c5167ac03f68fd6fee07972017282c62bc942) I always getrg finished with no matches found
regardless of regexp, default directory, or file types.When I copy/paste the exact command that was run into a terminal, I do get matches.
When I use
M-x rg
to do the same search in emacs running on ubuntu, I do get matches.Steps to set up and repro :
Mac setup (not working)
MacOS 12.3.1, M1 macbook pro Emacs installed via homebrew:
Ripgrep installed via homebrew:
brew reinstall ripgrep
rg --version
saysInstall
rg.el
in emacs. I useM-x straight-use-package rg
Ubuntu 21.10 setup (working)
Install emacs and ripgrep via
apt-get
.emacs --version
saysGNU Emacs 27.1
rg --version
says:Install
rg.el
. I useM-x straight-use-package rg
To repro on both systems
Open emacs Type
M-x rg
Enterbirds
for regex Accept default file type (everything) For directory enter~/tmp
Result on Mac
If I copy/paste that exact command from emacs into a terminal on mac, I do get results:
Result on Ubuntu (expected)