help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: the second most recent key


From: vb
Subject: Re: the second most recent key
Date: Thu, 26 Oct 2006 10:48:14 -0700
User-agent: KMail/1.9.1

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...

cheers,
/vb




reply via email to

[Prev in Thread] Current Thread [Next in Thread]