From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.devel Subject: Re: Doing search and replace via *grep* buffer Date: Thu, 15 Feb 2007 13:35:44 +0100 Message-ID: <45D453A0.6030902@gmail.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1171542986 21877 80.91.229.12 (15 Feb 2007 12:36:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 15 Feb 2007 12:36:26 +0000 (UTC) Cc: emacs-devel@gnu.org To: "Kim F. Storm" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 15 13:36:19 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HHfqS-0004Jh-6m for ged-emacs-devel@m.gmane.org; Thu, 15 Feb 2007 13:36:16 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HHfqR-0008Tr-OQ for ged-emacs-devel@m.gmane.org; Thu, 15 Feb 2007 07:36:15 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HHfqH-0008Tc-DM for emacs-devel@gnu.org; Thu, 15 Feb 2007 07:36:05 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HHfqF-0008TQ-10 for emacs-devel@gnu.org; Thu, 15 Feb 2007 07:36:04 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HHfqE-0008TN-S2 for emacs-devel@gnu.org; Thu, 15 Feb 2007 07:36:02 -0500 Original-Received: from ch-smtp02.sth.basefarm.net ([80.76.149.213]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1HHfqE-0006Zc-DM for emacs-devel@gnu.org; Thu, 15 Feb 2007 07:36:02 -0500 Original-Received: from c83-254-145-24.bredband.comhem.se ([83.254.145.24]:63035 helo=[127.0.0.1]) by ch-smtp02.sth.basefarm.net with esmtp (Exim 4.63) (envelope-from ) id 1HHfqC-0002YO-7i; Thu, 15 Feb 2007 13:36:00 +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 In-Reply-To: X-Antivirus: avast! (VPS 000713-4, 2007-02-14), Outbound message X-Antivirus-Status: Clean X-Scan-Result: No virus found in message 1HHfqC-0002YO-7i. X-Scan-Signature: ch-smtp02.sth.basefarm.net 1HHfqC-0002YO-7i 03427459304d5840f218880635902295 X-detected-kernel: Linux 2.6? (barebone, rare!) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:66419 Archived-At: 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.)