Wilfred / ag.el

An Emacs frontend to The Silver Searcher
http://agel.readthedocs.org/en/latest/
525 stars 61 forks source link

Searching for method invocations 'method_call(' #45

Closed letronje closed 10 years ago

letronje commented 10 years ago

When I use emacs prelude to search my project using "C-c p A" looking for method calls, like, say, "call_customer(" , the command ag.el generates is

ag --color --color-match 30\;43 --smart-case --nogroup --column -- call_customer\(

Resulting in

ERR: pcre_compile failed at position 14. Error: missing )

Quoting the search string appears to work.

ag --color --color-match 30\;43 --smart-case --nogroup --column -- "call_customer\("

Does it make sense to always quote the search string ?

Wilfred commented 10 years ago

projectile-ag calls ag-regexp, so it's expecting a regular expression. Ag.el provides the command ag, which searches for the string as written, as well as ag-regexp, which expects a PCRE pattern.

This does sometimes cause confusion. I personally use ag more than ag-regexp. Perhaps projectile needs a binding for ag too? Or perhaps projectile-ag should call ag instead?

@bbatsov do you have a preference?

bbatsov commented 10 years ago

Maybe the command should use ag by default and ag-regexp if invoked with a prefix argument?

Wilfred commented 10 years ago

Agreed, I think that's probably the most useful behaviour.

Wilfred commented 10 years ago

@bbatsov has kindly fixed this in bbatsov/projectile#274 so I'm closing. Let me know if you have any further issues.