Fork me on GitHub
#emacs
<
2017-11-21
>
qqq04:11:22

Is there a emacs-projectile-sed ? I want to do search replace of one regex with another regex, but I want to do it across all files in the project.

jumar06:11:21

@qqq projectile-replace?

jumar06:11:03

in spacemacs I often use helm-project-smart-do-search (`SPC /`) with that you can enter edit with C-c C-e and do the appropriate changes in special buffer

solf12:11:10

If you don't use spacemacs, you can do the search-then-edit with helm-ag-projectile. That's what I use, but I'm sure could search for (helm|avy)-(grep|ag|rgrep)-projectile and you should find an equivalent with your choice of tools.

michaelwfogleman17:11:31

qqq - I'd use projectile-ag, then use (wgrep-change-to-wgrep-mode) to make the results buffer editable, and then use replace-regexp or query-replace-regexp - might be a better way 🙂

qqq18:11:26

so I'm using projectile-replace, and I have one minor complaint: it's not 'interactive'

dpsutton19:11:43

what do you mean interactive?

qqq19:11:07

== when I use search + replace on a single buffer in emacs: 1. when I type the FROM-REGEX, it starts highlighting parts of lines 2. when I type the / TO-REGEX, it shows the new value in red in place == when I use helm-ag , it interactively shows all l8ines from all files that match == when I use projectice-replace, I'm "flying blind" in that it asks me a FROm-REGEX, a TO-REGEX, but I don't see any interactive matching / narrowing

qqq19:11:41

projectile-replace is like a 'literal sed over all project files', - is it possible to get an 'show me intermediate steps after every keystroke' ?

jumar20:11:06

It will "interactively" ask for confirmation to replace each occurrence (or all occurrences in given file / all occurrences in all files). I'd suggest to just use helm-* if you want more interactivity (but then again I don't know the details about projectile-replace - I think I've never used it)

ag20:11:15

@qqq I'm not at my laptop (can't check) usually I would read the docstring and see if command supports universal arguments.