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 14:53:04 +0300 Message-ID: <83mtoxu8yn.fsf@gnu.org> References: <835yvmka50.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7139"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dancol@dancol.org, 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 13:53:50 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 1mL2Kr-0001fC-Vt for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Aug 2021 13:53:49 +0200 Original-Received: from localhost ([::1]:60572 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL2Kq-000722-KI for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Aug 2021 07:53:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mL2KJ-0006Nq-3z for emacs-devel@gnu.org; Tue, 31 Aug 2021 07:53:15 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:59944) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mL2KI-0001Kr-Mk; Tue, 31 Aug 2021 07:53:14 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2587 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 1mL2KI-000362-9Q; Tue, 31 Aug 2021 07:53:14 -0400 In-Reply-To: (message from Alan Mackenzie on Mon, 30 Aug 2021 20:03:01 +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:273576 Archived-At: > Date: Mon, 30 Aug 2021 20:03:01 +0000 > Cc: dancol@dancol.org, emacs-devel@gnu.org > From: Alan Mackenzie > > > So you are saying that this will cause the display of the visible > > portion of the window to flicker whenever jit-lock-stealth finds such > > a "new type"? > > There will be a one-time change from no fontification of foo to > font-lock-type-face. The actual area of the screen getting refontified > is one declaration. > > > That could annoy, can't it? > > It might. It didn't annoy me whilst trying it out. The real question > is, will it annoy less than having types permanently unfontified. I don't think we will know soon enough. Which is why I think this should be optional behavior. > > jit-lock-stealth is for fontifying portions of the buffer(s) that are > > not on display, it would be wrong for it to apply this enhancement, I > > think, certainly by default. > > jit-lock has a presumption that the fontification of one part of a buffer > doesn't influence the fontification of another part. More accurately, that fontification of some part doesn't affect the parts of the buffer before that. > My impression is that jit-lock isn't much used. It's disabled by > default. What I'm envisaging is repurposing it to solve a real problem. As one user who uses jit-stealth-lock all the time, I don't think it's wise to make jit-stealth-lock do this additional job by default. They are two separate jobs, and the optimal values of parameters that control jit-stealth-lock are different for each job. So this re-purposing shouldn't be unconditional, IMO. > > And jit-lock-stealth-time of 1 sec is too short. I use 16, because > > once jit-lock-stealth starts fontifying a chunk, Emacs can be > > relatively slow to react to keyboard input, so I prefer to let > > jit-lock-stealth start its thing only when there's a very good chance > > I indeed stopped typing, not just thinking about something for a > > second or two. > > On my first try this evening with jit-lock, I set jit-lock-stealth-nice > to zero. I completely lost control of my session, and hat to abort it > and restart. Of course, you aren't supposed to do that. > But with the parameters set appropriately, can stealth really make > Emacs slow to react? IME, yes, because we our way of interrupting a Lisp program is not quick enough in some real-life situations. > Well, I was thinking of these enhancements to stealth being more of an > option than forced upon people. For example, a new variable > jit-lock-stealth-time-block could be nil by default, or set to 0.05 to > fontify for 0.05 seconds before attending to user input. IME, 0.05 sec is already borderline for good responsiveness UX. > > If you want that, you can easily arrange for Emacs to behave like that > > without changing any code. > > I didn't see any way of doing it while looking at the code earlier on. > What exactly are you thinking of, here? Lower jit-lock-stealth-nice and jit-lock-stealth-time to small values. Optionally, enlarge jit-lock-chunk-size as well.