unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Retrieving current prefix key
@ 2009-05-06 10:19 Nikolaj Schumacher
  2009-05-06 12:37 ` Lennart Borgman
  0 siblings, 1 reply; 3+ messages in thread
From: Nikolaj Schumacher @ 2009-05-06 10:19 UTC (permalink / raw)
  To: help-gnu-emacs

Does anybody know a way to retrieve the prefix key entered by the user?

e.g.

1. User presses C-x
2. timer fires
3. User presses o

In position 2, how can I tell the user is in the middle of entering a command?

regards,
Nikolaj Schumacher




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Retrieving current prefix key
  2009-05-06 10:19 Retrieving current prefix key Nikolaj Schumacher
@ 2009-05-06 12:37 ` Lennart Borgman
  2009-05-07  8:18   ` Nikolaj Schumacher
  0 siblings, 1 reply; 3+ messages in thread
From: Lennart Borgman @ 2009-05-06 12:37 UTC (permalink / raw)
  To: Nikolaj Schumacher; +Cc: help-gnu-emacs

On Wed, May 6, 2009 at 12:19 PM, Nikolaj Schumacher <me@nschum.de> wrote:
> Does anybody know a way to retrieve the prefix key entered by the user?
>
> e.g.
>
> 1. User presses C-x
> 2. timer fires
> 3. User presses o
>
> In position 2, how can I tell the user is in the middle of entering a command?


I am doing something like that in mumamo.el (part of nXhtml). Look at
mumamo-unread-command-events there.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Retrieving current prefix key
  2009-05-06 12:37 ` Lennart Borgman
@ 2009-05-07  8:18   ` Nikolaj Schumacher
  0 siblings, 0 replies; 3+ messages in thread
From: Nikolaj Schumacher @ 2009-05-07  8:18 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: help-gnu-emacs

Lennart Borgman <lennart.borgman@gmail.com> wrote:

> I am doing something like that in mumamo.el (part of nXhtml). Look at
> mumamo-unread-command-events there.

Thanks.  I must have been blind.  What I needed was indeed just
`this-command-keys.

I didn't think it would be updated immediately, since the prefix keys
don't trigger post-command-hooks, either.


Anyway, this seems to work:

;; Check if in the middle of entering a key combination.
(or (equal (this-command-keys-vector) [])
    (not (keymapp (key-binding (this-command-keys-vector)))))


regards,
Nikolaj Schumacher




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-05-07  8:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-06 10:19 Retrieving current prefix key Nikolaj Schumacher
2009-05-06 12:37 ` Lennart Borgman
2009-05-07  8:18   ` Nikolaj Schumacher

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