unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Colin S. Miller" <no-spam-thank-you@csmiller.demon.co.uk>
To: help-gnu-emacs@gnu.org
Subject: Re: Apply a saved macro to region
Date: Thu, 31 Jan 2008 20:03:40 +0000	[thread overview]
Message-ID: <47a22af8$0$90264$14726298@news.sunsite.dk> (raw)
In-Reply-To: <mailman.6814.1201797949.18990.help-gnu-emacs@gnu.org>

Tom Tromey wrote:
>>>>>> "Ankur" == Ankur Jain <ankurj@gmail.com> 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.


  parent reply	other threads:[~2008-01-31 20:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-31 15:18 Apply a saved macro to region Ankur Jain
2008-01-31 15:22 ` Michael Hoffman
2008-01-31 15:46   ` Ankur Jain
2008-01-31 15:50 ` Andreas Röhler
2008-01-31 16:06 ` Tom Tromey
     [not found] ` <mailman.6814.1201797949.18990.help-gnu-emacs@gnu.org>
2008-01-31 20:03   ` Colin S. Miller [this message]
2008-02-01  1:10 ` Nikos Apostolakis

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='47a22af8$0$90264$14726298@news.sunsite.dk' \
    --to=no-spam-thank-you@csmiller.demon.co.uk \
    --cc=help-gnu-emacs@gnu.org \
    /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).