From: Quokka <NoSpam@iinet.net.au>
Subject: Re: Doing numbered changes in a buffer
Date: Fri, 16 Dec 2005 09:10:15 +0800 [thread overview]
Message-ID: <43a213b3$0$1345$5a62ac22@per-qv1-newsreader-01.iinet.net.au> (raw)
In-Reply-To: <1134683622.782732.293210@g47g2000cwa.googlegroups.com>
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
next prev parent reply other threads:[~2005-12-16 1:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-15 21:53 Doing numbered changes in a buffer gamename
2005-12-16 1:10 ` Quokka [this message]
2005-12-16 16:54 ` Brendan Halpin
2005-12-17 21:29 ` gamename
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='43a213b3$0$1345$5a62ac22@per-qv1-newsreader-01.iinet.net.au' \
--to=nospam@iinet.net.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).