[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to know if a key is pressed without getting it?
From: |
Stefan Monnier |
Subject: |
Re: How to know if a key is pressed without getting it? |
Date: |
Mon, 27 Sep 2010 01:36:36 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
> I defined the following function using input-pending-p:
> (defun test-input ()
> (read-char "char: ")
> (while (input-pending-p)
> (insert (format "{%S}" unread-command-events)))
> (message "{%S} END" last-input-char))
> Execute the function above via: M-: (test-input) RET
> Then hold space key.
> The only message returned is "{32} END" followed by all spaces that
> I pressed (except the first one).
This probably depends on how quickly the read-char returns and the
input-pending-p gets run, but it seems reasonable to expect it to be run
in (much) less time than your repeat rate, so when the input-pending-p
is run, there is indeed no input pending yet.
Stefan
- Re: How to know if a key is pressed without getting it?, (continued)
Re: How to know if a key is pressed without getting it?, Andreas Schwab, 2010/09/26