From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.help Subject: Re: the second most recent key Date: Thu, 26 Oct 2006 19:54:30 +0200 Organization: Organization?!? Message-ID: <85odrzt12h.fsf@lola.goethe.zz> References: <8A921A5AACA1A64F936C730FC1F817214691CF@zw67246c.societe.mma.fr> <200610251541.35643.help-gnu-emacs@vsbe.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1161888126 30177 80.91.229.2 (26 Oct 2006 18:42:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 26 Oct 2006 18:42:06 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Oct 26 20:42:01 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GdAAg-0000wc-JI for geh-help-gnu-emacs@m.gmane.org; Thu, 26 Oct 2006 20:41:42 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GdAAg-00007N-4k for geh-help-gnu-emacs@m.gmane.org; Thu, 26 Oct 2006 14:41:42 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsserver.news.garr.it!kanaga.switch.ch!switch.ch!news.belwue.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help X-Face: 2FEFf>]>q>2iw=B6, xrUubRI>pR&Ml9=ao@P@i)L:\urd*t9M~y1^:+Y]'C0~{mAl`oQuAl \!3KEIp?*w`|bL5qr,H)LFO6Q=qx~iH4DN; i"; /yuIsqbLLCh/!U#X[S~(5eZ41to5f%E@'ELIi$t^ Vc\LWP@J5p^rst0+('>Er0=^1{]M9!p?&:\z]|;&=NP3AhB!B_bi^]Pfkw User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:hJ9XpjQiMlm+NpJ7zMDprHnKKlc= Original-Lines: 34 Original-NNTP-Posting-Date: 26 Oct 2006 19:55:33 CEST Original-NNTP-Posting-Host: 0897993f.newsspool1.arcor-online.net Original-X-Trace: DXC=BKO7^^ List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:38308 Archived-At: vb writes: > On Thursday 26 October 2006 08:38, Kevin Rodgers wrote: >> vb wrote: >> > Is there a way to know what was the key pressed immediately before the >> > last key pressed. >> > >> > Say there is a macro assigned to a certain key, and the function of this >> > certain key depends on the key pressed immediately before the function >> > was invoked. >> > >> > Is there a way to know what key that was? >> >> (let* ((recent-keys (recent-keys)) >> (keys-length (length recent-keys))) ; should be 100 >> (aref recent-keys (- keys-length (length (this-command-keys)) 1))) > > Kevin, > > thank you for spending your time writing this code. Looks like this > is exactly what's needed, even accounting for the number of keys > involved in the current command. > > Do I understand it right that Lisp allows local variable named > exactly the same as a function (recent-keys in your example)? An > interesting feature... Not just local variables, but variables in general. Lisp symbols have a four-fold existence: they have a value, a function, a property list, and a name. You can access those with `symbol-value', `symbol-function', `symbol-plist', and `symbol-name'. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum