From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: emacs rendering comparisson between emacs23 and emacs26.3 Date: Thu, 16 Apr 2020 09:52:25 -0400 Message-ID: References: <83r1x1sqkx.fsf@gnu.org> <83lfn9s63n.fsf@gnu.org> <83h7xvqsgc.fsf@gnu.org> <90749329-ccb1-f96e-29c0-b4ecbb81d1d4@yandex.ru> <20200407174217.GC4009@ACM> <50acd968-4459-2fab-1609-7869e1ed072a@yandex.ru> <20200408020913.GA3992@ACM> <20200412153458.GA5249@ACM> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="88093"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: rms@gnu.org, emacs-devel@gnu.org, rudalics@gmx.at, rrandresf@gmail.com, Dmitry Gutov , Eli Zaretskii To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Apr 16 15:53:10 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 1jP4x4-000Mn4-3m for ged-emacs-devel@m.gmane-mx.org; Thu, 16 Apr 2020 15:53:10 +0200 Original-Received: from localhost ([::1]:34536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jP4x3-0001oK-61 for ged-emacs-devel@m.gmane-mx.org; Thu, 16 Apr 2020 09:53:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35816) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jP4wX-000193-UZ for emacs-devel@gnu.org; Thu, 16 Apr 2020 09:52:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jP4wW-0001wZ-GO for emacs-devel@gnu.org; Thu, 16 Apr 2020 09:52:37 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:7852) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jP4wT-0001v4-Qi; Thu, 16 Apr 2020 09:52:33 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 12BE24500D8; Thu, 16 Apr 2020 09:52:33 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id C3E414500D6; Thu, 16 Apr 2020 09:52:26 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1587045146; bh=tOWnv66swt1u07Xd/J0ApYFsGQSPIc4wxJzh5Ala300=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=K7TeVzv9edVYauPCToVfE1fAxCruricd8Tm57Q7jtWIxx14wS3vZCDf900CxP/eUm G8x+IKsAmyBS31OEtgDxO1DoQC851jKPgaBJSXBi4LtvNSicc7KSd/Cexxci3QtuJ8 6YC5/JaEIQPhb3bbZKpvXkGm1U/J22B/4E2OtuiBhVVJizoJjwzcFNmqEMZuMwdX4U f2MriS36UspBfRTHMc5KwBQ7jK8e68maq29DUWFTyVKbnrFMmRz+schYMtPzCxsd4Z Q59Qs34Z/6684BDZgl/foJ6vANGl6Gp5pRXCML1ZnYu4h2OXMFysgmULK345zlYHE8 40Le3JpebLeHw== Original-Received: from alfajor (unknown [104.247.241.114]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 6A9A9120206; Thu, 16 Apr 2020 09:52:26 -0400 (EDT) In-Reply-To: <20200412153458.GA5249@ACM> (Alan Mackenzie's message of "Sun, 12 Apr 2020 15:34:58 +0000") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 132.204.25.50 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:247087 Archived-At: > ;; Rather than a -functions hook, this is a -function because it's easier > ;; to do a single scan than several scans: with multiple scans, one cannot [...] > From my point of view, "multiple scans" are _much_ easier. Obviously it's a matter of opinion. Luckily, you have a Turing complete language at hand, so `syntax-propertize-function` does not *impose* a single scan, it just encourages it (especially with `syntax-propertize-rules`). Your `syntax-propertize-function` can definitely use multiple scans if it wants (and it's simply up to you to be careful about the fact that until the last scan, `syntax-ppss` (and `parse-partial-sexp`) will obviously not give the "final" answer, and if you use `syntax-ppss` there, it's then your responsability to manually flush its cache with `syntax-ppss-flush-cache`). Really, you can use `syntax-propertize-function` with CC-mode without significant changes to the code (i.e. reusing the code mostly unchanged for the actual work). The basic idea is to have CC-mode pretend that the buffer only extends as far as `syntax-propertize--done`: - when opening the file, pretend it's empty (i.e. do the initial scan as if `point-max` were equal to `point-min`). - when `syntax-propertize-function` is called with arguments BEG and END, treat it as if the old code was faced with the following sequence of operations: 1- delete all the text between BEG and `point-max`. 2- insert at the end of file the new text found between BEG and END. Clearly, the old code is supposed to handle correctly all three elements (an empty file, deletion of text at EOB, and insertion of text at EOB), so the old code will be able to handle those requests correctly without any need for a redesign (you just have to "hide" the rest of the buffer from the corresponding code, which might be doable with narrowing). Of course the code of CC-mode is designed to handle many more operations than deletion and insertion at EOB, so after that first step you could try and adjust the code accordingly, but that can only make it simpler, and is not necessary for a first cut. Stefan