From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry OReilly Newsgroups: gmane.emacs.help Subject: Re: How to get in progress Key Sequence from Elisp Date: Mon, 3 Dec 2012 09:37:08 -0500 Message-ID: References: <0A9AD948985444A1BB410F4B8A960BA3@us.oracle.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=20cf3071cf98172c3104cff3afc0 X-Trace: ger.gmane.org 1354545452 2341 80.91.229.3 (3 Dec 2012 14:37:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 3 Dec 2012 14:37:32 +0000 (UTC) Cc: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Dec 03 15:37:45 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TfX9Q-0004A7-Rj for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Dec 2012 15:37:40 +0100 Original-Received: from localhost ([::1]:43953 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfX9E-0000Sa-Sy for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Dec 2012 09:37:28 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:32956) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfX92-0000S5-QK for help-gnu-emacs@gnu.org; Mon, 03 Dec 2012 09:37:22 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TfX8v-00068x-2s for help-gnu-emacs@gnu.org; Mon, 03 Dec 2012 09:37:16 -0500 Original-Received: from mail-vc0-f169.google.com ([209.85.220.169]:64960) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfX8u-00068p-Sh for help-gnu-emacs@gnu.org; Mon, 03 Dec 2012 09:37:08 -0500 Original-Received: by mail-vc0-f169.google.com with SMTP id gb23so2236886vcb.0 for ; Mon, 03 Dec 2012 06:37:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=HkMa5/OWKfMy+qysEAeRmZ6sHpPhmPBuHSdYQxoUiPQ=; b=h9yNdPSvZb0v6XEMqGbiE0pTVQJMF7XQLeLSEaXhtyf4QC26Q9vrfSQwlevHxGjzIm zFqfNP7wY94fuJFJz4GGW3fxaDTtrQ9FGDK5NuocPDKyu+qwtHquBVT2C781NcfQhVtA Zid8++ddFPJlsuYC+Uris1xSc7fLBqYLMfZ9p4Ahc9Mc0tVCmycNhbY6qO8fVtRh4rdG UI60yXngHNh2CgERq+IN4TDdTVjRXhwVFKd034x8TbCXwDUmdrCRDT6vJd4exOlT+A41 UxI6sq8MBBn5highfK1YqA5TiqcMKS4zSbkZI1du64kCsQy1Mim/z6N2L55IaZyNhPQF NCcA== Original-Received: by 10.52.75.72 with SMTP id a8mr7642688vdw.66.1354545428376; Mon, 03 Dec 2012 06:37:08 -0800 (PST) Original-Received: by 10.58.156.71 with HTTP; Mon, 3 Dec 2012 06:37:08 -0800 (PST) In-Reply-To: <0A9AD948985444A1BB410F4B8A960BA3@us.oracle.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.220.169 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:88028 Archived-At: --20cf3071cf98172c3104cff3afc0 Content-Type: text/plain; charset=ISO-8859-1 That's exactly what I needed, thanks! On Sun, Dec 2, 2012 at 4:15 PM, Drew Adams wrote: > > When I'm in the middle of inputting a Key Sequence, how may > > I get a data structure with the Key Sequence entered thus > > far from Elisp? > > ... > > I can do this if I can get the Key Sequence as the user has > > been entered at that time. > > If I understand what you are asking, see `this-command-keys'. E.g.: > > (defun foo () > "..." > (let* ((this-key (this-command-keys)) > (prefix (substring > this-key > 0 (1- (length this-key))))) > ;; (message "PREFIX: %S, DESCRIPTION: %S" > ;; prefix (key-description prefix)) > prefix)) > > This is what I use in the code for Icicles key completion. > > --20cf3071cf98172c3104cff3afc0 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable That's exactly what I needed, thanks!


On Sun, Dec 2, 2012 at 4:15 PM, Drew Adams <drew.adams@oracle.com= > wrote:
> When I'm in the m= iddle of inputting a Key Sequence, how may
> I get a data structure with the Key Sequence entered thus
> far from Elisp?
> ...
> I can do this if I can get the Key Sequence as the u= ser has
> been entered at that time.

If I understand what you are asking, see `this-command-keys'. =A0= E.g.:

(defun foo ()
=A0 "..."
=A0 (let* ((this-key =A0(this-command-keys))
=A0 =A0 =A0 =A0 =A0(prefix =A0 =A0(substring
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0this-key
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A00 (1- (length this-key)))))
=A0 =A0 ;; (message "PREFIX: %S, DESCRIPTION: %S"
=A0 =A0 ;; =A0 =A0 =A0 =A0 =A0prefix (key-description prefix))
=A0 =A0 prefix))

This is what I use in the code for Icicles key completion.


--20cf3071cf98172c3104cff3afc0--