From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Quokka Newsgroups: gmane.emacs.help Subject: Re: Doing numbered changes in a buffer Date: Fri, 16 Dec 2005 09:10:15 +0800 Message-ID: <43a213b3$0$1345$5a62ac22@per-qv1-newsreader-01.iinet.net.au> References: <1134683622.782732.293210@g47g2000cwa.googlegroups.com> NNTP-Posting-Host: main.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 1134695704 22103 80.91.229.2 (16 Dec 2005 01:15:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 16 Dec 2005 01:15:04 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Dec 16 02:15:00 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1En4BL-0003ox-Bl for geh-help-gnu-emacs@m.gmane.org; Fri, 16 Dec 2005 02:14:47 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1En4C0-0000ui-Lf for geh-help-gnu-emacs@m.gmane.org; Thu, 15 Dec 2005 20:15:28 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!news.glorb.com!nntp.waia.asn.au!203.59.27.186.MISMATCH!newsfeed.iinet.net.au!newsfeed.iinet.net.au!per-qv1-newsstorage1.iinet.net.au!per-qv1-newsstorage1.iinet.net.au!per-qv1-newsreader-01.iinet.net.au!not-for-mail User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Thunderbird/1.0.6 Mnenhy/0.7.2.0 Original-Newsgroups: gnu.emacs.help In-Reply-To: <1134683622.782732.293210@g47g2000cwa.googlegroups.com> Original-Lines: 41 Original-NNTP-Posting-Host: 203.59.9.243 Original-X-Trace: 1134695347 per-qv1-newsreader-01.iinet.net.au 1345 203.59.9.243 Original-Xref: shelby.stanford.edu gnu.emacs.help:136337 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:31977 Archived-At: gamename wrote: > Hi, > > I have a tcl file with lots of messages which are about as descriptive > as this: > > puts "something went wrong" > ... > puts "something went wrong" > > Is there any way to do a string replace in the buffer such that each > instance of "puts" would be assigned a unique message number? For > example: > > puts "001 - something went wrong" > ... > puts "002 - something went wrong" You could use a keyboard macro and the keyboard macro counter From the help: The command `C-x C-k C-i' (`kmacro-insert-counter') inserts the current value of the keyboard macro counter and increments the counter by 1. You can use a numeric prefix argument to specify a different increment. If you just specify a `C-u' prefix, the last inserted counter value is repeated and the counter is not incremented. For example, if you enter the following sequence while defining a macro So the sequence is C-x ( search for puts "something went wrong" move cursor back to start of string C-x C-k -Ci -> inserts the current counter value C-x ) The C-x e to repeat. Hope that helps Paul