emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Doing search and replace via *grep* buffer


From: Lennart Borgman (gmail)
Subject: Re: Doing search and replace via *grep* buffer
Date: Thu, 15 Feb 2007 13:35:44 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.9) Gecko/20061207 Thunderbird/1.5.0.9 Mnenhy/0.7.4.666

Kim F. Storm wrote:
Here is a small patch which provides a very handy search and replace
functionality via the normal grep interfaces (including lgrep/rgrep).

It requires that grep regexp highlighting works (I suppose most modern
grep programs do that).


Here is an example of its use, replacing _some_ occurrences of the identifier `oldtext' with `newtext':

First use rgrep to search for oldtext in all .c and .h files:
  M-x rgrep RET oldtext RET ch RET RET

Then in the *grep* buffer, move to the first instance which you want to
replace (use `n' or C-n).

Then hit / and type the replacement text:
  / newtext RET

Now, still in the *grep* buffer, move to the next instance you want
to modify, and just hit . to repeat the replacement, for example:
  n n . n . n . n n n .

(I suppose VI users will find this very familiar).


Looks very interesting, but would it not be possible to use a prompting similar for other replace commands in Emacs?

(From a Viper user.)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]