help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Apply a saved macro to region


From: Colin S. Miller
Subject: Re: Apply a saved macro to region
Date: Thu, 31 Jan 2008 20:03:40 +0000
User-agent: Icedove 1.5.0.14pre (X11/20071018)

Tom Tromey wrote:
"Ankur" == Ankur Jain <address@hidden> writes:

Ankur> I saved a macro which appends a comma(,) at the end of a
Ankur> line. I want to apply this saved macro to a region now. I mean,
Ankur> I select a region in emacs and do "append_comma" macro command
Ankur> to apply this to the whole region.

What I would usually do is make a keyboard macro that operates on the
current line and then moves to the next line.  That way if I run it
multiple times it will do the right thing.

Then to apply it to a region, I would 'C-x n n' (narrow-to-region),
move to the start, and run it enough times.  You can do this using C-u
a lot.  Finally, 'C-x n w' to widen to the whole buffer again.
Tom, Ankur,

C-u 0 C-x e
repeats the last macro until the bell rings. (C-u nnn C-x erepeats the macro 
'nnn' times).

As previous commentators have said, you are better of with regexps (they are 
lot faster).
Disabling font-lock-mode (or even putting the buffer into fundamental-mode) 
will speed up macros.

HTH,
Colin S. Miller


Tom





--
Replace the obvious in my email address with the first three letters of the 
hostname to reply.


reply via email to

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