From: Jeff Kowalczyk <jtk@yahoo.com>
To: emacs-devel@gnu.org
Subject: Re: Function to insert a key sequence
Date: Sat, 26 Dec 2009 22:14:18 +0000 (UTC) [thread overview]
Message-ID: <loom.20091226T230824-984@post.gmane.org> (raw)
In-Reply-To: 7b501d5c0912241738n2d30cadcgefd37b4391fdb1e0@mail.gmail.com
Deniz Dogan <deniz.a.m.dogan <at> gmail.com> writes:
> Attached is a little function for inserting a key sequence entered by
> the user into the current buffer. I don't know if it fits into any
> existing Emacs library, but I find it quite useful, so I thought I'd
> just throw it out there.
Deniz,
Thanks, this function is interesting. It could be useful in tools like
ScreencastMode [1].
Is this version intended for use with Emacs 23? I had to change read-key to
read-key-sequence to get the prompt, but the function does not exit on C-g:
(defun insert-key-sequence ()
"Reads a sequence of keys until C-g is hit, and inserts the
prettified key sequence with C-g excluded."
(interactive)
(let ((result "")
key)
(while (progn
(setq key (read-key-sequence "Enter the key sequence: "))
(unless (eq 7 key)
(setq result (concat result (key-description (list key)) " ")))
(not (eq 7 key))))
(when (not (string= result ""))
(insert result)
(backward-delete-char 1))))
Thanks,
Jeff
[1] http://www.emacswiki.org/emacs/ScreencastMode
next prev parent reply other threads:[~2009-12-26 22:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-25 1:38 Function to insert a key sequence Deniz Dogan
2009-12-25 3:29 ` Lennart Borgman
2009-12-25 13:34 ` Deniz Dogan
2009-12-26 22:14 ` Jeff Kowalczyk [this message]
2009-12-27 1:51 ` Deniz Dogan
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=loom.20091226T230824-984@post.gmane.org \
--to=jtk@yahoo.com \
--cc=emacs-devel@gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).