all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Deniz Dogan <deniz.a.m.dogan@gmail.com>
To: Emacs-Devel devel <emacs-devel@gnu.org>
Subject: Function to insert a key sequence
Date: Fri, 25 Dec 2009 02:38:03 +0100	[thread overview]
Message-ID: <7b501d5c0912241738n2d30cadcgefd37b4391fdb1e0@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 248 bytes --]

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 Dogan

[-- Attachment #2: insert-key-sequence.el --]
[-- Type: application/octet-stream, Size: 504 bytes --]

(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 "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))))

             reply	other threads:[~2009-12-25  1:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-25  1:38 Deniz Dogan [this message]
2009-12-25  3:29 ` Function to insert a key sequence Lennart Borgman
2009-12-25 13:34   ` Deniz Dogan
2009-12-26 22:14 ` Jeff Kowalczyk
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

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

  git send-email \
    --in-reply-to=7b501d5c0912241738n2d30cadcgefd37b4391fdb1e0@mail.gmail.com \
    --to=deniz.a.m.dogan@gmail.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 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.