From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Deniz Dogan Newsgroups: gmane.emacs.devel Subject: Re: Function to insert a key sequence Date: Sun, 27 Dec 2009 02:51:28 +0100 Message-ID: <7b501d5c0912261751v3c3907dem7c484afa0fe3693e@mail.gmail.com> References: <7b501d5c0912241738n2d30cadcgefd37b4391fdb1e0@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1261878727 22613 80.91.229.12 (27 Dec 2009 01:52:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 27 Dec 2009 01:52:07 +0000 (UTC) Cc: emacs-devel@gnu.org To: Jeff Kowalczyk Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Dec 27 02:52:00 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NOiIX-0007Bi-GR for ged-emacs-devel@m.gmane.org; Sun, 27 Dec 2009 02:51:57 +0100 Original-Received: from localhost ([127.0.0.1]:55130 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NOiIX-0005M7-Ip for ged-emacs-devel@m.gmane.org; Sat, 26 Dec 2009 20:51:57 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NOiIS-0005Lq-UX for emacs-devel@gnu.org; Sat, 26 Dec 2009 20:51:52 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NOiIS-0005La-BG for emacs-devel@gnu.org; Sat, 26 Dec 2009 20:51:52 -0500 Original-Received: from [199.232.76.173] (port=36437 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NOiIS-0005LV-4t for emacs-devel@gnu.org; Sat, 26 Dec 2009 20:51:52 -0500 Original-Received: from ey-out-1920.google.com ([74.125.78.149]:58190) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NOiIR-0006P6-M0 for emacs-devel@gnu.org; Sat, 26 Dec 2009 20:51:51 -0500 Original-Received: by ey-out-1920.google.com with SMTP id 4so467546eyg.34 for ; Sat, 26 Dec 2009 17:51:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:cc:content-type; bh=IX/3+rQGLfcZKevACRBVA3EgIFUTSXo+PPFfXw1Hksw=; b=EJNrlUzixeUsBEJMhxrZTwslRRH+IyCpU0SlxHsSD5CWCjeB5hVK5JtMQmlKO6wsuz N21R6catDw21JIVHCob00uq4gn7ULhvKoaDVR3J6A0mOXZGyxUJd5QN0YnJWQrfOaMn8 jv83q4hR0wgpqvqDTuyCbNSCF7wJDdsANcAYs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=opprqN+Byl8jNNzLRocYxzmXiz7jKu05ONXGGvWcH/0kgGR+eR1tG6tp9bUnrLuf7w 0nNOkBlsEOl+j5mpiyvoQ4uu+Qvki5q7TLiET3XFiXwZMWucRJyzhf6bRez8MmNtreBD zKl/heDxxd+wYxbVggiqdH5tG5AzikckN6laQ= Original-Received: by 10.213.96.221 with SMTP id i29mr17436099ebn.96.1261878708170; Sat, 26 Dec 2009 17:51:48 -0800 (PST) In-Reply-To: X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:118829 Archived-At: 2009/12/26 Jeff Kowalczyk : > Deniz Dogan 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: > Yes, it is intended for use with Emacs 23. read-key is a compiled Lisp function in `subr.el'. (read-key &optional PROMPT) Read a key from the keyboard. Contrary to `read-event' this will not return a raw event but instead will obey the input decoding and translations usually done by `read-key-sequence'. So escape sequences and keyboard encoding are taken into account. When there's an ambiguity because the key looks like the prefix of some sort of escape sequence, the ambiguity is resolved via `read-key-delay'. According to the CVS log, it was added on August 19 2009 by Stefan Monnier (revision 1.644). That said, I don't know off-hand how to make the function work without read-key. -- Deniz Dogan