emacs-devel
[Top][All Lists]
Advanced

[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:11:16 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

> The problem that I'm trying to fix is an specific slow down in whitespace
> when user holds space key pressed at end of a line. The slow down is caused
> by whitespace which call jit-font-lock-refontify each time the user press
> a space at end of line. If it is possible to detect that user is still
> pressing a key, I could fix the slow down by not calling
> jit-font-lock-refontify while user is pressing a key.

Calling it without any BEG and END args is a bad idea for something that
can run at each key press.

You could try to check input-pending-p, but note that the pending input
may end up not running any command, so you may end up with a display in
an incorrect state for an unlimited amount of time, since the next
post-command-hook may not be run for the same unlimited amount of time.

> BTW, calling jit-font-lock-refontify in Emacs 22 didn't cause any slow down,
> but this happens in Emacs 23 and 24. Probably jit-font-lock-refontify or
> some part of font-lock was modified in Emacs 23.

I can't think of what that slowdown may come from, so it might be
worth investigating.


        Stefan



reply via email to

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