From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Re: cc-mode fontification feels random Date: Tue, 31 Aug 2021 20:02:52 +0300 Message-ID: <838s0hsg1v.fsf@gnu.org> References: <835yvmka50.fsf@gnu.org> <9377d9ec-a3e5-ceea-8a9a-523a420f13f7@dancol.org> <83v93lsq83.fsf@gnu.org> <83eea9shyj.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33940"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dancol@dancol.org, monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Aug 31 19:28:04 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mL7YJ-0008S8-VE for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Aug 2021 19:28:03 +0200 Original-Received: from localhost ([::1]:39580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL7YI-0006mJ-U7 for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Aug 2021 13:28:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50402) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL7AE-00085E-Oz for emacs-devel@gnu.org; Tue, 31 Aug 2021 13:03:10 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:45814) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL7A5-00071P-SA; Tue, 31 Aug 2021 13:03:03 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2168 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL7A4-0004wY-3Z; Tue, 31 Aug 2021 13:03:01 -0400 In-Reply-To: (message from Alan Mackenzie on Tue, 31 Aug 2021 16:46:15 +0000) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:273616 Archived-At: > Date: Tue, 31 Aug 2021 16:46:15 +0000 > Cc: monnier@iro.umontreal.ca, dancol@dancol.org, emacs-devel@gnu.org > From: Alan Mackenzie > > > You want to limit the fontification of a chunk to that time, but we > > don't have an efficient method of doing that, because Emacs is not an > > interrupt-driven program. > > On my 4 year old HW, approximately 5 CC Mode chunks fit into that time, > on average. I think the way to do it is to fontify a chunk at a time, > and if the 0.05s hasn't yet been used up, fontify another one, and so > on. It mostly does, but sometimes doesn't. We all know that there are some chunks of C code whose fontification takes a long time. IME, this happens frequently enough (judging by the time it sometimes takes Emacs to respond to a keypress) to be mildly annoying. > > So if a Lisp program starts some heavy processing, it will only be > > able to stop when it gets to looking at how much time passed, or tests > > some flag set by a signal handler. There can be no guarantee this can > > never exceed 50 msec. > > No. But doing a chunk at a time, checking the clock after each chunk, > will probably be granular enough. Until you bump into a chunk where it doesn't. > Again, lets try it and see. Yes, let's.