-
-
Notifications
You must be signed in to change notification settings - Fork 579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
projectile-replace stomps regular expressions #576
Comments
To me, what would make the most sense would be to have two functions, |
@shosti Agree completely. The code for |
:+1 for fixing that issue, is there any consensus/interest on supporting regexps across all grep tools for projectile-replace? |
@Catalectic It's probably possible but I'm not sure it's practical. The problem is that almost all regexp tools have their own subtle differences. Possibly check out https://github.com/joddie/pcre2el. |
Any updates in this issue? Or maybe any alternatives? :) Better to have not very sufficient method for |
@d12frosted I don't think anybody has really worked on it. Seeing this again, though, it does bother me that I still can't reliably replace by regexp. I may try to throw together a PR soon. I'll keep this thread updated. |
[Fix #576] Implement `projectile-replace-regexp'
I'll start with a question, because I'm a little unclear: Is
projectile-replace
supposed to support regular expressions?This issue mostly has to do with improvements introduced in #269 by @shosti.
projectile-replace
usestags-query-replace
, which uses Emacs regular expressions. However,projectile-files-with-string
stomps entered regexp under certain conditions.I'm working on Mac OS X (
(projectile-unixy-system-p)
→t
). I haveag
,ack
,git grep
, andgrep
(henceforth "grep tools") installed. Under these conditions,ag
is selected, and then passed the--literal
flag, removing meaning from my regexp query. That's what led me to the problem, but that's not the only issue.Summary:
tags-query-replace
) interprets them [AFAIK]. Furthermore,tags-query-replace
doesn't support literal matches.It might be possible to somewhat accurately use the grep tools to speed up literal matches, providing a literal version of
tags-query-replace
could be created. However, I don't see a clear way that the file list could be narrowed for a regular expression replace without finding a tool that exactly emulates Emacs' regular expressions.Though filtering files through a faster tool is a significant benefit, it comes at the cost of accuracy. This might not seem to be a big deal, but it's very unexpected when matches you think should be replaced aren't being replaced. In this case, I think accuracy trumps speed.
I'm willing to implement a solution if there is agreement on the desired behavior. Projectile rocks and I love using it! Thanks!
The text was updated successfully, but these errors were encountered: