unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "roodwriter@core.com" <roodwriter@core.com>
Subject: Re: How do I bind a macro to a key?
Date: Fri, 10 Oct 2003 00:04:26 -0400	[thread overview]
Message-ID: <vocbsr1fvec4e5@corp.supernews.com> (raw)
In-Reply-To: mailman.1454.1065750051.21628.help-gnu-emacs@gnu.org

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.

       reply	other threads:[~2003-10-10  4:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1454.1065750051.21628.help-gnu-emacs@gnu.org>
2003-10-10  4:04 ` roodwriter [this message]
2003-10-15  8:10 ` How do I bind a macro to a key? David Vanderschel
2003-10-10  1:40 Dan Anderson

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=vocbsr1fvec4e5@corp.supernews.com \
    --to=roodwriter@core.com \
    /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).