From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "roodwriter@core.com" Newsgroups: gmane.emacs.help Subject: Re: How do I bind a macro to a key? Date: Fri, 10 Oct 2003 00:04:26 -0400 Organization: Posted via Supernews, http://www.supernews.com Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: Reply-To: roodwriter@core.com NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: sea.gmane.org 1065759587 6345 80.91.224.253 (10 Oct 2003 04:19:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 10 Oct 2003 04:19:47 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 10 06:19:46 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1A7okk-0005N3-00 for ; Fri, 10 Oct 2003 06:19:46 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1A7ogn-0000EL-FA for geh-help-gnu-emacs@m.gmane.org; Fri, 10 Oct 2003 00:15:41 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!sn-xit-02!sn-xit-04!sn-xit-01!sn-post-01!supernews.com!corp.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: KNode/0.7.1 Original-X-Complaints-To: abuse@supernews.com Original-Lines: 39 Original-Xref: shelby.stanford.edu gnu.emacs.help:117186 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:13114 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:13114 Dan Anderson wrote: > Is it possible to create a macro and bind it to a key (or set of keys) > for the rest of the session? Sometimes when programming I'll find I > need like 5 separate macros, and I don't know how to C-x e each one > separately except for creating one, running down the code and running > it, and creating another. This seems very inefficient. Is there a > better way? > > Thanks in advance, > > Dan Sure. After you create your macro name it with: M-x name-last-kbd-macro Give it a name and it becomes a command beginning with the usual M-x. If you want to go one step further and come up with a shortcut, use: M-x global-set-key That'll bind it to whatever shortcut you like. Emacs already has a bunch of shortcuts set aside for assignment. They begin with C-c and then a letter. Unless you actually save these macros and shortcuts by inserting them into a file, they disappear when you close Emacs. Enjoy! --Rod -- Author of "Linux for Non-Geeks--Clear-eyed Answered for Practical Consumers" and "Boring Stories from Uncle Rod." Both are available at http://www.rodwriterpublishing.com/index.html To reply by e-mail, take the extra "o" out of the name.