From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Using incremental parsing in Emacs Date: Mon, 06 Jan 2020 07:33:27 +0200 Message-ID: <5CFA58D6-8A85-4636-AB0E-1548D235D681@gnu.org> References: <83blrkj1o1.fsf@gnu.org> <20200105141900.GA71296@breton.holly.idiocy.org> <83eewdg3vy.fsf@gnu.org> <834kx9g08y.fsf@gnu.org> <83v9ppdzed.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="56365"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: K-9 Mail for Android Cc: alan@idiocy.org, monnier@iro.umontreal.ca To: emacs-devel@gnu.org, HaiJun Zhang , arthur miller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 06 06:33:43 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ioL1K-000EWB-00 for ged-emacs-devel@m.gmane.org; Mon, 06 Jan 2020 06:33:42 +0100 Original-Received: from localhost ([::1]:48284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioL1I-0002tG-TQ for ged-emacs-devel@m.gmane.org; Mon, 06 Jan 2020 00:33:40 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46337) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioL1B-0002rp-8H for emacs-devel@gnu.org; Mon, 06 Jan 2020 00:33:34 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:49690) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ioL1A-0005TZ-28; Mon, 06 Jan 2020 00:33:32 -0500 Original-Received: from [176.12.180.157] (port=34070 helo=[10.212.47.98]) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1ioL19-000724-0U; Mon, 06 Jan 2020 00:33:31 -0500 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:244021 Archived-At: On January 6, 2020 6:39:02 AM GMT+02:00, HaiJun Zhang wrote: > Could someone explain how the jit-lock in Emacs works in the following > case? >=20 > 1=2E emacs -Q > 2=2E open the attachment file and goto end of buffer > 3=2E M-x desktop-save and quit emacs > 4=2E emacs -Q > 5=2E M-x desktop-read >=20 > I see the buffer is fontified correctly=2E Does it parse the whole > buffer? >=20 >=20 > =E5=9C=A8 2020=E5=B9=B41=E6=9C=886=E6=97=A5 +0800 AM11:42=EF=BC=8CEli Za= retskii =EF=BC=8C=E5=86=99=E9=81=93=EF=BC=9A > > > From: arthur miller > > > CC: "monnier@iro=2Eumontreal=2Eca" , > "alan@idiocy=2Eorg" > > > , "emacs-devel@gnu=2Eorg" > > > Date: Sun, 5 Jan 2020 20:28:43 +0000 > > > > > > When I said batch-processing I ment processing a file or chunk of > buffer (region) just before it is to be > > > displayed to a user=2E Same for other "insertions" from macro > expansions or similar=2E > > > > Then we always do "batch processing", because the display engine has > > no good idea what exactly changed in the buffer=2E So it always > > processes some minimal chunk of text that it can prove to itself > that > > the changes were all inside that chunk=2E > > > > > I also don't think teee-sitter is needed for syntax coloring=2E > Tree-sitter seems to be very expensive regex engine > > > in that case=2E > > > > They claim to be less expensive than regexp-based coloring, > especially > > with very long lines=2E > > We never parse the whole buffer, only its chunk that is slightly larger th= an what would be actually displayed in a window=2E This works by the display engine calling the fontification-functions for t= he buffer text it is about to display, whenever it finds a chunk of text wh= ose 'fontified' text property is nil=2E