The grep command generated by C-c p g is not working for the fish-shell, as {, } needed to be escaped as required in doc.
The very last few words ... -exec grep -i -nH -e foo {} + should be -exec grep -i -nH -e foo \{\} +
The escaped version works in sh/bash as well.
find . -type d \( -path \*/.eunit -o -path \*/.git -o -path \*/.hg -o -path \*/.fslckout -o -path \*/.bzr -o -path \*/_darcs -o -path \*/.tox -o -path \*/.svn -o -path \*/build -o -path \*/SCCS -o -path \*/RCS -o -path \*/CVS -o -path \*/MCVS -o -path \*/_MTN -o -path \*/\{arch\} \) -prune -o \! -type d \( -name TAGS -o -name .\#\* -o -name \*.o -o -name \*\~ -o -name \*.bin -o -name \*.lbin -o -name \*.so -o -name \*.a -o -name \*.ln -o -name \*.blg -o -name \*.bbl -o -name \*.elc -o -name \*.lof -o -name \*.glo -o -name \*.idx -o -name \*.lot -o -name \*.fmt -o -name \*.tfm -o -name \*.class -o -name \*.fas -o -name \*.lib -o -name \*.mem -o -name \*.x86f -o -name \*.sparcf -o -name \*.dfsl -o -name \*.pfsl -o -name \*.d64fsl -o -name \*.p64fsl -o -name \*.lx64fsl -o -name \*.lx32fsl -o -name \*.dx64fsl -o -name \*.dx32fsl -o -name \*.fx64fsl -o -name \*.fx32fsl -o -name \*.sx64fsl -o -name \*.sx32fsl -o -name \*.wx64fsl -o -name \*.wx32fsl -o -name \*.fasl -o -name \*.ufsl -o -name \*.fsl -o -name \*.dxl -o -name \*.lo -o -name \*.la -o -name \*.gmo -o -name \*.mo -o -name \*.toc -o -name \*.aux -o -name \*.cp -o -name \*.fn -o -name \*.ky -o -name \*.pg -o -name \*.tp -o -name \*.vr -o -name \*.cps -o -name \*.fns -o -name \*.kys -o -name \*.pgs -o -name \*.tps -o -name \*.vrs -o -name \*.pyc -o -name \*.pyo \) -prune -o -type f \( -iname \* -o -iname .\* \) -exec grep -i -nH -e foo {} +
Projectile uses rgrep to provide greping. I had exact same problem when using fish with rgrep alone without projectile. What I'm saying is that it's problem with rgrep and fish in general.
After few problems of this kind I thought that it's not worth it and I switched to zsh.
@kleewho Seemed to be rooted in the rgrep.el. Right now, I just use ag as my primary grep for this filtering tasks.
@bbatsov If this is a bug in rgrep.el, how could I submit an issue or bugfix?
@yangchenyun Thanks for the tip but I'm not going back to fish. It's rather grep.el
@yangchenyun M-x report-emacs-bug. Or you can post to [email protected].
I've posted and will keep the thread up to date.
This is still a bug, why is this closed?
There's nothing I can do about it, it has to be fixed upstream.
Hello, you're right, in the meantime I've found an actual work around other than changing your shell from fish. Within your init.el you can add the following:
(setq shell-file-name "/bin/sh")
of course you can replace /bin/sh with whatever shell you have. E.g. 'bash' etc. This allows you to still have fish as your default emacs shell, but to have support for rgrep.
And, if you want to have further support for your shell's path in emacs you can also use the following package in conjunction:
https://github.com/purcell/exec-path-from-shell
Hopefully this will be useful to any future readers!
Most helpful comment
Hello, you're right, in the meantime I've found an actual work around other than changing your shell from fish. Within your init.el you can add the following:
(setq shell-file-name "/bin/sh")of course you can replace /bin/sh with whatever shell you have. E.g. 'bash' etc. This allows you to still have fish as your default emacs shell, but to have support for rgrep.
And, if you want to have further support for your shell's path in emacs you can also use the following package in conjunction:
https://github.com/purcell/exec-path-from-shell
Hopefully this will be useful to any future readers!