From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nikos Apostolakis Newsgroups: gmane.emacs.help Subject: Re: Apply a saved macro to region Date: Thu, 31 Jan 2008 20:10:43 -0500 Message-ID: <87myqlwkfg.fsf@Sullivan.bcc.cuny.edu> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1201828288 5042 80.91.229.12 (1 Feb 2008 01:11:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 1 Feb 2008 01:11:28 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Feb 01 02:11:49 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 1JKkRY-0005ir-Tt for geh-help-gnu-emacs@m.gmane.org; Fri, 01 Feb 2008 02:11:49 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JKkR7-0005lT-8g for geh-help-gnu-emacs@m.gmane.org; Thu, 31 Jan 2008 20:11:21 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JKkQs-0005lE-T8 for help-gnu-emacs@gnu.org; Thu, 31 Jan 2008 20:11:06 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JKkQr-0005ky-FR for help-gnu-emacs@gnu.org; Thu, 31 Jan 2008 20:11:06 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JKkQr-0005kv-Cp for help-gnu-emacs@gnu.org; Thu, 31 Jan 2008 20:11:05 -0500 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JKkQr-0002wI-0v for help-gnu-emacs@gnu.org; Thu, 31 Jan 2008 20:11:05 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1JKkQo-0002Zh-Is for help-gnu-emacs@gnu.org; Fri, 01 Feb 2008 01:11:02 +0000 Original-Received: from 199.219.160.30 ([199.219.160.30]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 01 Feb 2008 01:11:02 +0000 Original-Received: from nikos.ap by 199.219.160.30 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 01 Feb 2008 01:11:02 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 32 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 199.219.160.30 User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux) Cancel-Lock: sha1:uiXgcYSIudTrYUhjZJNs2c1ly6A= X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) 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:51146 Archived-At: "Ankur Jain" writes: > Hi > > I saved a macro which appends a comma(,) at the end of a line. I want to apply > this saved macro to a region now. I mean, I select a region in emacs and do > "append_comma" macro command to apply this to the whole region. > > If that's possible, kindly reply. > There are two solutions that come to mind. The first one is to use "C-x C-k C-n" etc to bring the desired macro at the front of the keyboard macro ring (yes, emacs has one of those) and then call "apply-macro-to-region-lines" as usual. Also, looking at the documentation of "apply-macro-to-region-lines" we see that it takes an optional argument "macro", the problem is that the this argument cannot be given interactively. So one could do something like (defun my-apply-macro-to-region-lines (start end macro) "Wrapper of apply-macro-to-region-lines." (interactive "r\nCnamed kboard macro to apply: ") (apply-macro-to-region-lines start end macro)) and then provide the name of the saved macro at the prompt. Note that this hasn't being really tested, and my elisp skills are not that great, but it should work. HTH, Nikos