I'm using wgrep
quite often for refactoring and generally it performs quite well. However, there are some minor annoyances which I hope can be resolved:
After doing an rgrep
search, changing to wgrep
and performing the changes in the rgrep
buffer, wgrep
will open all files that are to be changed and executes the modifications. However, when doing so, the files are opened normally in emacs, thus they will undergo the normal mode-loading stuff, which can take quite some time if this action involves large source files which are parsed.
Is it possible modify wgrep such that it opens the files in the most basic mode (I guess fundamental-mode
normal-mode) instead?
After executing the changes, wgrep
will not close any newly opened buffers.
Is it possible to change wgrep such that it will automatically close any buffers that were opened during the execution phase (i.e. buffers which were not opened before the wgrep procedure started).
Finally, the meta question: Is this rather an issue to be posted to the issue tracker of the wgrep developer or is it a proper StackOverflow question?
From what I see in the wgrep.el source, you would need to modify (or aggressively defadvice
) some functions of wgrep.el.
In particular, in wgrep-get-file-buffer
the RAWFILE argument of find-file-noselect
should be t, in your case, and the buffer should be added to a list of buffers to kill. In wgrep-finish-edit
a dolist
on that new list could be used to kill the buffers wgrep opened.
So a feature request to the author could be in order :-)
In the meantime, the changes you need are easy to implement (just override the short wgrep-get-file-buffer
and "defadvice after" wgrep-finish-edit
), but you would be vulnerable to upgrades on the package.
[ And of course a patch/pull request could be sent to the author, but in that case maybe a new configuration variable should be added (wgrep-auto-kill-buffer
or something like that) ]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With