From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Vinicius Jose Latorre Newsgroups: gmane.emacs.devel Subject: Re: How to know if a key is pressed without getting it? Date: Sun, 26 Sep 2010 22:08:23 -0300 Message-ID: <4C9FEE87.1050701@ig.com.br> 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=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1285549509 8674 80.91.229.12 (27 Sep 2010 01:05:09 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 27 Sep 2010 01:05:09 +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 03:05:08 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 1P029T-00024R-2O for ged-emacs-devel@m.gmane.org; Mon, 27 Sep 2010 03:05:07 +0200 Original-Received: from localhost ([127.0.0.1]:46260 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P029S-0000oO-3C for ged-emacs-devel@m.gmane.org; Sun, 26 Sep 2010 21:05:06 -0400 Original-Received: from [140.186.70.92] (port=39927 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P029K-0000o6-14 for emacs-devel@gnu.org; Sun, 26 Sep 2010 21:04:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1P029I-0005Rj-QQ for emacs-devel@gnu.org; Sun, 26 Sep 2010 21:04:57 -0400 Original-Received: from mail-yx0-f169.google.com ([209.85.213.169]:37415) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P029I-0005RT-Hy for emacs-devel@gnu.org; Sun, 26 Sep 2010 21:04:56 -0400 Original-Received: by yxk8 with SMTP id 8so2154347yxk.0 for ; Sun, 26 Sep 2010 18:04:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=db0XAFNWk5NXf8CRICqTb763IovH017Gqi/O+3mScv8=; b=MzFtjt0zuBqc0cbQiEb95ihxzqi4RsHkfZ99/sw2vcXz/wbvKSjqgAd7MumZ5UQX6N 7pT3sBD0o/9JW3QQwaGY2l2gyBOxEH8XAvzgJ0vraIXGjdoSWVKTHv6oW7v8MJyig1V/ uBYSjxjOV4YV8MvJfMcQLsHVTEds/4/jXBkwE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=TsHOUcQmmrAjsoA6p6r2Xu/l6XUd3oUL4U8LPlrIKwf+kq2vihUtivoGsew1NTO4xK 4D2vVuh1yZVtnnr7MCKub7cnvSY3FIcRqX9MBef0nl7yHkePl3J9e1sLY0Vyh0V9AoPT 5DGoVQeGOfPV2sCOLsAFotR5mzIndpHsriY3Q= Original-Received: by 10.151.148.18 with SMTP id a18mr7775040ybo.299.1285549496160; Sun, 26 Sep 2010 18:04:56 -0700 (PDT) Original-Received: from [192.168.0.101] ([201.82.131.118]) by mx.google.com with ESMTPS id m11sm7374731ybn.4.2010.09.26.18.04.54 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 26 Sep 2010 18:04:55 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.13) Gecko/20100914 SeaMonkey/2.0.8 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:130964 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. > Despite jit-font-lock-refontify args, this was not a problem in Emacs 22. In Emacs 22, jit-font-lock-refontify was called at each end of line with or without trailing spaces. I had to modify this because since Emacs 23, calling jit-font-lock-refontify causes a slow down in whitespace-mode. > 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. > Yes, you're right. >> 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. I agree.