all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "David Vanderschel" <DJV1@Austin.RR.com>
Subject: Re: How do I bind a macro to a key?
Date: Wed, 15 Oct 2003 03:10:39 -0500	[thread overview]
Message-ID: <JIGdnYqH6PNhnRCiRTvUqg@texas.net> (raw)
In-Reply-To: mailman.1454.1065750051.21628.help-gnu-emacs@gnu.org

"Dan Anderson" <dan@mathjunkies.com> in message
news:<mailman.1454.1065750051.21628.help-gnu-emacs@gnu.org> wondered:
> Is it possible to create a macro and bind it to a key (or set of keys)
> for the rest of the session?  ...

I do that so frequently that (many years ago) I
created a function to facilitate the operation:

(defun dv-functionize-kbd-macro (sym) "Make 'function' of kbd macro."
  (interactive "SName for last kbd macro and the 'function': ")
  (name-last-kbd-macro sym)
  (insert ";;  \n;;  \n")
  (insert-kbd-macro sym)
  (insert "(global-set-key \[")
  (save-excursion
    (insert (concat "\] '" (symbol-name sym) ")\n\n"))
    (fill-region (re-search-backward "^(") (re-search-backward "^ "))))
(global-set-key [f12 ?m] 'dv-functionize-kbd-macro)

I usually do it in a file which is loaded as part of
my initialization, so the 'function' derived from the
macro is not just for the current session.

Regards,
  David V.

  parent reply	other threads:[~2003-10-15  8:10 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 ` How do I bind a macro to a key? roodwriter
2003-10-15  8:10 ` David Vanderschel [this message]
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=JIGdnYqH6PNhnRCiRTvUqg@texas.net \
    --to=djv1@austin.rr.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.