From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: How to know if a key is pressed without getting it? Date: Mon, 27 Sep 2010 01:11:16 +0200 Message-ID: References: <4C9F609A.8010303@ig.com.br> <4C9FCC19.5020804@ig.com.br> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1285542697 21849 80.91.229.12 (26 Sep 2010 23:11:37 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 26 Sep 2010 23:11:37 +0000 (UTC) Cc: "GNU Emacs \(devel\)" To: Vinicius Jose Latorre Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 27 01:11:36 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1P00NU-0005AL-U1 for ged-emacs-devel@m.gmane.org; Mon, 27 Sep 2010 01:11:35 +0200 Original-Received: from localhost ([127.0.0.1]:42182 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P00NO-0003j2-8i for ged-emacs-devel@m.gmane.org; Sun, 26 Sep 2010 19:11:22 -0400 Original-Received: from [140.186.70.92] (port=55931 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P00NJ-0003iP-6O for emacs-devel@gnu.org; Sun, 26 Sep 2010 19:11:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1P00NH-0003ei-LU for emacs-devel@gnu.org; Sun, 26 Sep 2010 19:11:16 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]:54416) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P00NH-0003ed-IA for emacs-devel@gnu.org; Sun, 26 Sep 2010 19:11:15 -0400 Original-Received: from dyn.144-85-185-002.dsl.vtx.ch ([144.85.185.2]:24680 helo=fmsmemgm.homelinux.net) by fencepost.gnu.org with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1P00NG-0000PE-JF; Sun, 26 Sep 2010 19:11:15 -0400 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id BCCA26611D; Mon, 27 Sep 2010 01:11:16 +0200 (CEST) In-Reply-To: <4C9FCC19.5020804@ig.com.br> (Vinicius Jose Latorre's message of "Sun, 26 Sep 2010 19:41:29 -0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:130957 Archived-At: > 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