From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Corey Foote Newsgroups: gmane.emacs.help Subject: Applying macro to lines which match regexp Date: Wed, 15 Oct 2008 15:21:15 -0400 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_e2a76838-8930-41e0-a78a-b6e5e5942ee7_" X-Trace: ger.gmane.org 1224098516 7920 80.91.229.12 (15 Oct 2008 19:21:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 15 Oct 2008 19:21:56 +0000 (UTC) To: Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 15 21:22:56 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KqBxF-0006Ts-Si for geh-help-gnu-emacs@m.gmane.org; Wed, 15 Oct 2008 21:22:46 +0200 Original-Received: from localhost ([127.0.0.1]:50236 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KqBwB-0004Qs-5y for geh-help-gnu-emacs@m.gmane.org; Wed, 15 Oct 2008 15:21:39 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KqBvr-0004OW-Bx for help-gnu-emacs@gnu.org; Wed, 15 Oct 2008 15:21:19 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KqBvp-0004N3-Op for help-gnu-emacs@gnu.org; Wed, 15 Oct 2008 15:21:19 -0400 Original-Received: from [199.232.76.173] (port=47523 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KqBvp-0004Mi-Je for help-gnu-emacs@gnu.org; Wed, 15 Oct 2008 15:21:17 -0400 Original-Received: from blu0-omc4-s7.blu0.hotmail.com ([65.55.111.146]:34344) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KqBvp-0001Dk-B2 for help-gnu-emacs@gnu.org; Wed, 15 Oct 2008 15:21:17 -0400 Original-Received: from BLU105-W12 ([65.55.111.136]) by blu0-omc4-s7.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 15 Oct 2008 12:21:15 -0700 X-Originating-IP: [75.67.96.217] Importance: Normal X-OriginalArrivalTime: 15 Oct 2008 19:21:15.0530 (UTC) FILETIME=[3148E6A0:01C92EFB] X-detected-operating-system: by monty-python.gnu.org: Windows 2000 SP4, XP SP1+ 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:58816 Archived-At: --_e2a76838-8930-41e0-a78a-b6e5e5942ee7_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I was reading through the Emacs manual today=2C and came across C-x C-k r (= apply-macro-to-region-lines) which applies the last keyboard macro to each = line that begins in the region. How would I apply the last keyboard macro t= o each line that begins in the region which match a certain regular express= ion. For example=2C say I was editing a Perl script and wanted to apply the= last macro to all line which consist solely of a comment. For example: 1 # Print some text 2 print "foo"=3B 3 print "foobar"=3B 4 5 # And then a while later 6 print "foobarbaz"=3B I would want to apply the macro to lines 1 and 6 which match the regular ex= pression ^\s-*#. Thanks a bunch! Corey Foote Toby Software _________________________________________________________________ Stay up to date on your PC=2C the Web=2C and your mobile phone with Windows= Live. http://clk.atdmt.com/MRT/go/msnnkwxp1020093185mrt/direct/01/= --_e2a76838-8930-41e0-a78a-b6e5e5942ee7_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I was reading through the Emacs manual today=2C and came across C-x C-k r (= apply-macro-to-region-lines) which applies the last keyboard macro to each = line that begins in the region. How would I apply the last keyboard macro t= o each line that begins in the region which match a certain regular express= ion. For example=2C say I was editing a Perl script and wanted to apply the= last macro to all line which consist solely of a comment. For example:
=
1 =3B =3B =3B # Print some text
2 =3B =3B = =3B print "foo"=3B
3 =3B =3B =3B print "foobar"=3B
4
5=  =3B =3B =3B # And then a while later
6 =3B =3B = =3B print "foobarbaz"=3B

I would want to apply the macro to lines 1 = and 6 which match the regular expression ^\s-*#. Thanks a bunch!

Cor= ey Foote
Toby Software

Stay up to date on your PC=2C the Web= =2C and your mobile phone with Windows Live. See Now = --_e2a76838-8930-41e0-a78a-b6e5e5942ee7_--