From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: cannot call-last-kbd-macro on named macro Date: Tue, 09 May 2006 15:17:27 -0600 Organization: IHS Message-ID: References: <1147203016.768665.319890@v46g2000cwv.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1147209535 25034 80.91.229.2 (9 May 2006 21:18:55 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 9 May 2006 21:18:55 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 09 23:18:54 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FdZbR-0008NH-Je for geh-help-gnu-emacs@m.gmane.org; Tue, 09 May 2006 23:18:46 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FdZbQ-0005iL-9e for geh-help-gnu-emacs@m.gmane.org; Tue, 09 May 2006 17:18:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FdZbE-0005gx-Gw for help-gnu-emacs@gnu.org; Tue, 09 May 2006 17:18:32 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FdZbC-0005gd-93 for help-gnu-emacs@gnu.org; Tue, 09 May 2006 17:18:31 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FdZbC-0005gT-2L for help-gnu-emacs@gnu.org; Tue, 09 May 2006 17:18:30 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FdZcK-0007Zk-DD for help-gnu-emacs@gnu.org; Tue, 09 May 2006 17:19:40 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FdZb3-0008Ix-2C for help-gnu-emacs@gnu.org; Tue, 09 May 2006 23:18:21 +0200 Original-Received: from 207.167.42.206 ([207.167.42.206]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 09 May 2006 23:18:21 +0200 Original-Received: from ihs_4664 by 207.167.42.206 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 09 May 2006 23:18:21 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Lines: 47 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 207.167.42.206 User-Agent: Thunderbird 1.5.0.2 (Windows/20060308) In-Reply-To: <1147203016.768665.319890@v46g2000cwv.googlegroups.com> 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:34944 Archived-At: james.kingston@gmail.com wrote: > GNU Emacs 21.4.1.... > > I have saved some keyboard macros using insert-kbd-macro into my > .emacs, like the following: > > (fset 'toggle-next-perlsub > [?\C-\M-s ?\\ ?b ?s ?u ?b ?\\ ?b ?\C-m ?\C-\M-s ?{ ?\C-m ?\M-x ?f ?o > ?l ?d ?- ?d ?w ?i ?m ?- ?t ?o ?g ?g ?l ?e return]) > > I can M-x fold-next-perlsub if I want to run the macro, but I cannot > then run call-last-kbd-macro (which I have bound to an F-key)... it's > as if the macro is loaded as a function rather than a kbd macro. No, a keyboard macro is also an interactive function (i.e. a command). But `M-x call-last-kbd-macro' (which is already bound to `C-x e', not any harder to type than ) calls the last keyboard macro that you defined interactively with `C-x (', not the last macro you defined programatically with `fset'. If you want to run the last keyboard macro that you called via `M-x' again, try `M-x M-p'. > As a workaround I could change the binding of the F-key to call my > named macro, but then I wouldn't be able to use the macros with > apply-macro-to-region-lines... So is there some way to push a named > macro onto some sort of macro stack so I can use the macro commands > with my macro? First, note that `M-x apply-macro-to-region-lines' is available as `C-x C-k r' in Emacs 22. But in previous versions I used `C-x E': (global-set-key "\C-xE" 'apply-macro-to-region-lines) ; uppercase `E' To call named macros via apply-macro-to-region-lines, I use `C-u ...': (defadvice apply-macro-to-region-lines (before read-named-macro activate) "With a prefix arg, read a named macro to apply (instead of the last macro)." (interactive (list (region-beginning) (region-end) (if current-prefix-arg (read-command "Name of keyboard macro to apply: "))))) -- Kevin