From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.devel Subject: Re: How to know if a key is pressed without getting it? Date: Mon, 27 Sep 2010 01:25:02 +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=UTF-8 X-Trace: dough.gmane.org 1285543533 24121 80.91.229.12 (26 Sep 2010 23:25:33 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 26 Sep 2010 23:25:33 +0000 (UTC) Cc: "GNU Emacs \(devel\)" To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 27 01:25:31 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 1P00b5-00088q-3c for ged-emacs-devel@m.gmane.org; Mon, 27 Sep 2010 01:25:31 +0200 Original-Received: from localhost ([127.0.0.1]:37159 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P00b4-0007st-Fd for ged-emacs-devel@m.gmane.org; Sun, 26 Sep 2010 19:25:30 -0400 Original-Received: from [140.186.70.92] (port=50303 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P00ay-0007so-Np for emacs-devel@gnu.org; Sun, 26 Sep 2010 19:25:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1P00ax-0004na-JQ for emacs-devel@gnu.org; Sun, 26 Sep 2010 19:25:24 -0400 Original-Received: from mail-qw0-f41.google.com ([209.85.216.41]:38987) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P00ax-0004nQ-HR for emacs-devel@gnu.org; Sun, 26 Sep 2010 19:25:23 -0400 Original-Received: by qwf7 with SMTP id 7so4343076qwf.0 for ; Sun, 26 Sep 2010 16:25:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=iC8/VBIyGUACuD6kzPnIAYYOrJwEJ8AZKbi+7l4sSPI=; b=wMeGnDCwjsUXELOsc9pU/e+cuR7fUgH1vckeFx64T1iwhPUdAKcTZGHvoq0eeYS8FD aZKupXtvonwxbJFV/J+IrgNsbGdG/3P1P8z2AP98W+NSLrrmM7a/L+uq4vDKDUgj/Sag LATvOWmHIYRh3FDaFVdQdqLj1w7TkERTZIQEE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=mX+pXDpRQ/ctLhcpdDqOFEJpGwGDHmmyWAU1i9lEq+9CdqOQ/56XH8azFD6ohcEuJl 4tAD2kPZy4jsisCaHEojPUrkslVdMDlOUHcp/6Yf0AegTrLOjHsnmxOaar0+wW71JDi5 CnNexSHpse4R8nflhMeF1vBU06L4hNMxR4Ph0= Original-Received: by 10.229.189.83 with SMTP id dd19mr5017862qcb.92.1285543522221; Sun, 26 Sep 2010 16:25:22 -0700 (PDT) Original-Received: by 10.229.105.68 with HTTP; Sun, 26 Sep 2010 16:25:02 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:130959 Archived-At: On Mon, Sep 27, 2010 at 1:11 AM, Stefan Monnier wrote: >> 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. Running it in an idle timer?