all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Function to insert a key sequence
@ 2009-12-25  1:38 Deniz Dogan
  2009-12-25  3:29 ` Lennart Borgman
  2009-12-26 22:14 ` Jeff Kowalczyk
  0 siblings, 2 replies; 5+ messages in thread
From: Deniz Dogan @ 2009-12-25  1:38 UTC (permalink / raw)
  To: Emacs-Devel devel

[-- 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))))

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-12-27  1:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2009-12-27  1:51   ` Deniz Dogan

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.