abo-abo / swiper

Ivy - a generic completion frontend for Emacs, Swiper - isearch with an overview, and more. Oh, man!
https://oremacs.com/swiper/
2.31k stars 338 forks source link

grep issues #1342

Open redguardtoo opened 6 years ago

redguardtoo commented 6 years ago

counsel-grep, counsel-git-grep, counsel-ag, and counsel-rg fail when input negative keywords ("keyword1 !keyword2", for example).

Tested on ivy v0.10.0, Emacs 25.3

Steps to reproduce:

basil-conto commented 6 years ago

counsel-grep does not work

Please elaborate on the issue with steps to reproduce, etc. as that gives nothing to go on.

basil-conto commented 6 years ago

The other commands currently hardcode the ivy--regex regexp builder; perhaps it's possible to lift this restriction, but keep in mind that there will always be discrepancies between Emacs and external regexp syntax to some extent.

abo-abo commented 6 years ago

there will always be discrepancies between Emacs and external regexp syntax to some extent

Most external tools don't support negative patterns. We could fix this by either doing the negative match filtering in Emacs, or tailoring each shell command by appending grep -v.

basil-conto commented 6 years ago

@abo-abo Indeed, that's what I meant by "perhaps it's possible to lift this restriction", i.e. allow more flexible interaction with external utilities. My comment about the regexp syntax discrepancies was more theoretical / philosophical and, thus, of little use. :)

redguardtoo commented 6 years ago

@abo-abo , we can use both solution, if grep exists use it, else use elisp.

basil-conto commented 6 years ago

@redguardtoo

if grep exists use it

Isn't that the whole point of counsel-grep vs, say, counsel-grep-or-swiper or swiper?