From: vb <help-gnu-emacs@vsbe.com>
Cc: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: the second most recent key
Date: Thu, 26 Oct 2006 10:48:14 -0700 [thread overview]
Message-ID: <200610261048.14403.help-gnu-emacs@vsbe.com> (raw)
In-Reply-To: <ehqkqo$dc9$1@sea.gmane.org>
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
next prev parent reply other threads:[~2006-10-26 17:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-25 7:45 pasting many times Bourgneuf Francois
2006-10-25 19:57 ` Eli Zaretskii
2006-10-25 22:41 ` the second most recent key vb
2006-10-25 23:03 ` Peter Dyballa
2006-10-25 23:14 ` vb
2006-10-26 15:38 ` Kevin Rodgers
2006-10-26 17:48 ` vb [this message]
[not found] ` <mailman.282.1161884908.27805.help-gnu-emacs@gnu.org>
2006-10-26 17:54 ` David Kastrup
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200610261048.14403.help-gnu-emacs@vsbe.com \
--to=help-gnu-emacs@vsbe.com \
--cc=ihs_4664@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).