Re:Emacs Rocks
by barrkel on Sunday November 16, 2014 @02:37PM
(#8615158)
I find that you need to be willing to write your own little elisp routines to get the best out of Emacs. If whole-file replacements is how you like your search and replace, then write a routine for that. My bugbear with regex replace - apart from rebinding it to M-r - was that, when applied to a region, it didn't keep the region. So I wrote a macro that "advised" the function (and any other function I choose) with code that restored the region after the command was finished.
Be aware, however, of iedit-mode. Select a region of text and enable iedit-mode, and any change to the selected region will be propagated to every other instance of the region's text throughout the document.
Using iedit-mode in combination with rgrep (recursive grep) and wgrep (editable grep buffer that propagates changes to the underlying documents) is a decent way of doing project-wide refactorings.
And of course, neither iedit nor wgrep are part of the base emacs install. Using the package manager is essential.
Be aware, however, of iedit-mode. Select a region of text and enable iedit-mode, and any change to the selected region will be propagated to every other instance of the region's text throughout the document.
Using iedit-mode in combination with rgrep (recursive grep) and wgrep (editable grep buffer that propagates changes to the underlying documents) is a decent way of doing project-wide refactorings.
And of course, neither iedit nor wgrep are part of the base emacs install. Using the package manager is essential.