grep and ack search options return error for 'more complex' search-term (GNU/linux)
On GNU/linux (Fedora 32, ack version 3.3.1), when trying to replace the string xpath=//ul[@id="input-internetpinnen_prefix_subscriptions"]//div[contains(text(), "KLM")][last()] using projectile-replace, the grep and ack options in the projectile-files-with-string function return the following errors.
(The 'ag' option works fine)
Expected behavior
Succesful replacement of text (like when using the ag option in the projectile-files-with-string function)
Actual behavior
The grep function returns the following error:
("/home/dalanicolai/.emacs.d/elpa/26.3/develop/grep: Invalid range end")
The ack function returns the error:
("/home/dalanicolai/.emacs.d/elpa/26.3/develop/ack: Options '--heading' and '-l' can't be used together.")
Steps to reproduce the problem
- make sure "the silver searcher" is not installed (i.e. there is no executable "ag" in your path)
- evaluate
(projectile-files-with-string "xpath=//ul[@id=\"input-internetpinnen_prefix_subscriptions\"]//div[contains(text(), \"KLM\")][last()]" directory), replacing directory with some valid directory path on your system OR runprojectile-replacetrying to replacexpath=//ul[@id=\"input-internetpinnen_prefix_subscriptions\"]//div[contains(text(), \"KLM\")][last()]
Environment & Version information
ack version 3.3.1
Projectile version information
Projectile 20200616.1659
Emacs version
26.3
Operating system
GNU/linux (Fedora 32)
Ack version 2.2.1 seems to work fine at the moment (current version of ack on Ubuntu 18.04). For ack version 3.3.1 removing the --noheading flag fixes the issue as the -l flag automatically adds/implies the --noheading flag. Because a new LTS release of Ubuntu (20.04) is already available and ships ack version 3.3.1, I guess the --noheading flag can be removed immediately or otherwise very soon
make sure "the silver searcher" is not installed (i.e. there is no executable "ag" in your path)
I've been using only ag for years now. :-)
I'll have to check what's up with grep - last time I checked this was working fine, but I was on macOS back then. Now I'm also on Ubuntu 20.04.
guess the --noheading flag can be removed immediately or otherwise very soon
I was under the impression I removed support for ack a while back. Perhaps you're using some extension for this?
I am using ag's "competitor" ripgrep. But that option was not yet implemented, so that I found this issue. Although grep is still the basic linux search utility for many, ag or ripgrep can be quickly installed so that this issue does not appear to be very urgent.
The ack support is right here on line 3595
Oh, sorry. I had misread the description. I'll remove the --noheading option for ack.