From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: emacs rendering comparisson between emacs23 and emacs26.3 Date: Sat, 4 Apr 2020 19:20:27 +0000 Message-ID: <20200404192027.GF5329@ACM> References: <834ku43c61.fsf@gnu.org> <83k12zz6ds.fsf@gnu.org> <054393f3-3873-ab6e-b325-0eca354d8838@gmx.at> <20200403174757.GA8266@ACM> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="120469"; mail-complaints-to="usenet@ciao.gmane.io" Cc: eliz@gnu.org, rrandresf@gmail.com, rms@gnu.org, emacs-devel@gnu.org To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Apr 04 21:21:15 2020 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 1jKoLy-000VEE-Rw for ged-emacs-devel@m.gmane-mx.org; Sat, 04 Apr 2020 21:21:14 +0200 Original-Received: from localhost ([::1]:41674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKoLx-0002FP-RZ for ged-emacs-devel@m.gmane-mx.org; Sat, 04 Apr 2020 15:21:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45427) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKoLM-0001di-6L for emacs-devel@gnu.org; Sat, 04 Apr 2020 15:20:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKoLK-0007h9-Nc for emacs-devel@gnu.org; Sat, 04 Apr 2020 15:20:36 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:21168 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1jKoLI-0007fd-LW for emacs-devel@gnu.org; Sat, 04 Apr 2020 15:20:34 -0400 Original-Received: (qmail 85997 invoked by uid 3782); 4 Apr 2020 19:20:30 -0000 Original-Received: from acm.muc.de (p2E5D54F1.dip0.t-ipconnect.de [46.93.84.241]) by localhost.muc.de (tmda-ofmipd) with ESMTP; Sat, 04 Apr 2020 21:20:28 +0200 Original-Received: (qmail 1209 invoked by uid 1000); 4 Apr 2020 19:20:27 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.1 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:246423 Archived-At: Hello again, Martin. On Sat, Apr 04, 2020 at 10:56:27 +0200, martin rudalics wrote: > > This assumption proved to be very problematic. The fact is, people put > > parentheses in column zero inside comments, and nothing we can say or do > > will stop them. Why should it? these parentheses are perfectly valid > > in so many languages. Most notoriously was bug #22884, where there were > > such parentheses in Emacs's own C sources. And there were quite a lot > > of ostensible bugs in CC Mode caused by these parentheses. > All these problems could have been cured easily: People who want such > parentheses would have set 'open-paren-in-column-0-is-defun-start' to > nil (or used a default value of nil) and everybody would have been > happy. But throwing out the child with the bathwater by eliminating the > effect of that variable completely has left us no clue as to what makes > scrolling so slow in the present situation. > >> Recent Emacsen either ignore that variable or silently reset it to nil > >> internally so it doesn't get into their way. > > The one place which matters where o-p-i-c-0-i-d-s used to be used was in > > back_comment() in syntax.c. This was removed for the above reasons. > IIRC that was just the last nail in the variable's coffin. My impression was that this was the single place in the syntax routines it was ever used, though back_comment is called from several places in syntax.c. [ .... ] > >> Moreover, our underlying mechanism for syntax highlighting always > >> marks the entire rest of a buffer as dirty after every single > >> editing change. > > I have always been sceptical of the wisdom of this. Why invalidate > > the entire rest of the buffer, when a typical buffer change will > > cause at most local changes to the fontification? I think this can > > only be for ease of coding in the font-lock functions. > I recall that more than a decade ago I tried to convince Stefan that a > buffer change that leaves the ppss unchanged should not invalidate the > rest of the buffer. He initially liked the idea but didn't want to > implement it. That sounds like a shame. > > Another approach would be somehow to divide a buffer into cells, > > something like one cell per function. A buffer change would then > > invalidate the fontification only to the end of the current cell, > > not EOB. This would be faster, but somewhat complicated to > > implement. > Why? Because we'd need somehow to detect when the cell boundaries change, possibly coalescing two cells, possibly creating a new one. This would involve delicate coding in an after-change-function, possibly in a before-c-f too. We'd need to avoid prematurely coalescing two functions (for example, when typing in an open paren in emacs-lisp-mode). Also, new data structures would be needed in font-lock. I'm not saying it couldn't be done, but it would take some effort, and might be politically difficult, too. [ .... ] > >> So since you earlier asked for "a switch to turn off the changes" > >> then my answer is that such a switch already exists but has been > >> deactivated. > > As already stated, it was deactivated for good reasons. If we were > > to bring it back, I think we would need to add heuristics around > > paren-in-column-0 detection to the former rather crass 100% quitting > > of back_comment when one is encountered. I've considered this quite > > a bit in the past, and can't conceive of anything both helpful and > > fast. Maybe the following would do it: on every open paren at column 0 within a string or comment, apply a text property called `syntax-not-defun-start'. back_comment would skip past any such paren with that property. It would be the responsibility of the major mode code to add and remove the property. Again, this would mean a moderately intricate after-change-function, possibly paired with a before-change-function. This would perhaps remove the trouble from o-p-i-c-0-i-d-s and allow us to put it back, but I'm not sure Stefan M. would like it. > I still don't understand why it had to be eliminated. Defaulting it to > nil but respecting a non-nil value would have been completely sufficient > IMHO. I think you might well be right, there. > martin -- Alan Mackenzie (Nuremberg, Germany).