From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: HaiJun Zhang Newsgroups: gmane.emacs.devel Subject: Re: Using incremental parsing in Emacs Date: Mon, 6 Jan 2020 12:39:02 +0800 Message-ID: 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: multipart/mixed; boundary="5e12b9ec_3a95f874_b145" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="109948"; mail-complaints-to="usenet@blaine.gmane.org" Cc: alan@idiocy.org, monnier@iro.umontreal.ca, emacs-devel@gnu.org To: arthur miller , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 06 05:39:57 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 1ioKBJ-000SQp-HN for ged-emacs-devel@m.gmane.org; Mon, 06 Jan 2020 05:39:57 +0100 Original-Received: from localhost ([::1]:48036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioKBH-0001y4-OO for ged-emacs-devel@m.gmane.org; Sun, 05 Jan 2020 23:39:55 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39493) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioKAl-0001Xf-EG for emacs-devel@gnu.org; Sun, 05 Jan 2020 23:39:24 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioKAj-0007YQ-Nu for emacs-devel@gnu.org; Sun, 05 Jan 2020 23:39:22 -0500 Original-Received: from mail-oln040092254099.outbound.protection.outlook.com ([40.92.254.99]:6272 helo=APC01-PU1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ioKAg-0007Uu-Al; Sun, 05 Jan 2020 23:39:19 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aRAmfke1I3YDU4iEuHzku3q8AkWwfNRD4ZvNr2/OuKechIsHqk4/uw735j2HnEmq1lzIqaTaZQbcEv4QOVvYzr1qiCiYqxshxIwDZ8kGF03DWuZ6QfmMb6isaaPfodcBl8XkTHZpTSS+XusM4psXr92FC8nl7FgW+3UkGR/hm+1ewmCs1Liw7Pty/g2pc2CyGSwqg1eTYYP78yVQxhb0MqMm23j2pJZPv2I6AADrXGqVnZ2IK8bEyouDo/zlKw/Zg8xQdhCQTZz5wo22NJqL0iR1ZM1ZmBntawkkJcvLhC94twAXjPHtcsBm46NLNp4AQKpixIm2Q9d/7k5ID9GFTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ScsYOBJrT8CM8VtDRkACQje5lQ8eFLtCrRSkp25X2Zs=; b=HzSBFldg++/MwkSOOUiM2GvkW2mFHAx+bkeSNFUwimtMokS2ZkZ4ysNXC6IGPBS/nrFOiMMAaldPhbR3bGZG++a6AGiP857d6JDy9wVagaM/ztohSYPbTrMnUy3taT4pHl//k1GAlm9hRwjvLMRYTq+OFo+oznE24dX3Dq9UTWRZj/Oub/jBAYDPZWzRqnq7j8ucoD4TpO0JT6hk+5PzyPCdU07ZIaLF8bL2Pck8DKEOLOSV4Ks8RVnFwYyCL15KHMzrHCde/AxXfKIuiGaJRlcNUtE4i/Rr/MGQU1ZFV4V4DMcJVB1YygN/G8Hl9Ln0eLz5q6k7vi2fZlJJQaFmHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=outlook.com; dmarc=pass action=none header.from=outlook.com; dkim=pass header.d=outlook.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ScsYOBJrT8CM8VtDRkACQje5lQ8eFLtCrRSkp25X2Zs=; b=PLchVYy2dby6FajNLifGhERnv0QJJLVKqRV6dvW966WE976Stg3z/RzsVte4Z1aiDh7z6jIt9TFj/64aSxzf81DvO6r05Tj2YcErmYfVrpvzafmk/ZFQdmBk+nA9c6rVSP1czQdDE5ytu1ZhQIbYCZTepuxrjVkcIUiqa6xBWMcOxrjJ/knIMg5SNIome+Ck6W9pBd5hduXDIwZQSPuoFM/QOBxjkq5s+C+Zl2DcfN011/UITugg2rXynnWePh+6ZG9dPL1JlD1uzrL4vv/J5M+0Lr93Cyt6RMrdVFCRXEBLDC3+uvetCdmaEGIQRCLfD6VuFaierEDaQSwgka0NNg== Original-Received: from HK2APC01FT063.eop-APC01.prod.protection.outlook.com (10.152.248.53) by HK2APC01HT014.eop-APC01.prod.protection.outlook.com (10.152.248.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11; Mon, 6 Jan 2020 04:39:12 +0000 Original-Received: from PS1PR03MB3606.apcprd03.prod.outlook.com (10.152.248.54) by HK2APC01FT063.mail.protection.outlook.com (10.152.249.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11 via Frontend Transport; Mon, 6 Jan 2020 04:39:12 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:5A717131327FE9807471DE18F4AF9C10BA3E0BA8D1C43769EEF378378722BB19; UpperCasedChecksum:81C661019C8D3A84E1755BB6022349F70DF23F2C83F69F2C13B2850798749384; SizeAsReceived:9089; Count:48 Original-Received: from PS1PR03MB3606.apcprd03.prod.outlook.com ([fe80::b470:80bc:efed:9117]) by PS1PR03MB3606.apcprd03.prod.outlook.com ([fe80::b470:80bc:efed:9117%7]) with mapi id 15.20.2623.008; Mon, 6 Jan 2020 04:39:12 +0000 In-Reply-To: <83v9ppdzed.fsf@gnu.org> X-Readdle-Message-ID: 84047d98-2e4a-45d7-a884-c6ab7f1e1502@Spark X-ClientProxiedBy: HK2PR04CA0058.apcprd04.prod.outlook.com (2603:1096:202:14::26) To PS1PR03MB3606.apcprd03.prod.outlook.com (2603:1096:803:4e::17) X-Microsoft-Original-Message-ID: <84047d98-2e4a-45d7-a884-c6ab7f1e1502@Spark> Original-Received: from [192.168.1.103] (1.199.245.197) by HK2PR04CA0058.apcprd04.prod.outlook.com (2603:1096:202:14::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.10 via Frontend Transport; Mon, 6 Jan 2020 04:39:10 +0000 X-Readdle-Message-ID: 84047d98-2e4a-45d7-a884-c6ab7f1e1502@Spark X-Microsoft-Original-Message-ID: <84047d98-2e4a-45d7-a884-c6ab7f1e1502@Spark> X-TMN: [QDkKZRSrIXgycW1JaHhVdKaXhSn76zU1] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 11f8a2f3-ecac-43cd-aafa-08d792626091 X-MS-Exchange-SLBlob-MailProps: q+fD6XS3/ULD3VaDn2jKBvx0wkr11YTFYfqnQNjrW/+qzX6o34Q6P4pZDG94uwjFDKzGhXf450zHka4SU2uYr/abID441Z9/h0Vzh4FF6yNXuAYbAVI5R6iiBKKUr6lNl1wCCwtRhJwdWwfb3Ld9LGEcr1J0ZPcfk1AQtvbmjqYeg0g8xtcOmDAN0O1UEoucSAF5aPN0p7anu/hRlajOKH+RZCxF207rzV5X6md/sXXyuMyh3bkqt0wU5Fugvom6j6/hhGhzRVE58sV8m2x/s6z5gVnW3iadQJrDQyNak9LD6tEuwtBSutrm8BVHR0IXgZ9HhTgLJQjISeGChfRPa9bIrw2lHkVHxOb4zsRxYFMhZCSh9MW4zgD+sx6boy8kI7k8BBeH9Q/gbl1+/HChVMMu/B2mDKIQwNadSgtHlb6Wlg+CqzCuPKfLqatPHkJtwcZgmfVxeAFQaFQiiLqzQwGOZ4pOS63QnZ1v66xjx0Myh71QrIJL64nk/N10e5Zz3efBnskeY5fddz80+zC8avRm153cQWPF9tHAnn9LCOqH7m1O+Z7DIsSwykWW9GVhhE8+ngnR4abIu3M8P4A+geRUcE/BTZDEkAxXq5E63oqEQ6u0PHddNcTBUOIHkZ14RGbDr7nyRm5X0TTfWoLjk1jJ5RXMYf9XcWNhLsq85wkSacsZutYz126AE2XEbiX25Rpus5j0/we8x57+/p7+WA== X-MS-TrafficTypeDiagnostic: HK2APC01HT014: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U6gmMq6LDIsFdn39A+MkPg7oAP5LID9t4Sr+y+Rrn5edLpOoFz42QkVswOYRADKS4hnqlg5/ksZTAkryMVBQAkMrK0VTUIP0TJIhwE+1fSTLt1FmGHQb3cfOA8Cb15W9/hqztbKK7v6z2lt3GLDoZe35UZYuYfXkTkDqZ6CmuonDCgsUnFfLnvaM4iy07caA X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11f8a2f3-ecac-43cd-aafa-08d792626091 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2020 04:39:12.3402 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2APC01HT014 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.92.254.99 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:244019 Archived-At: --5e12b9ec_3a95f874_b145 Content-Type: multipart/alternative; boundary="5e12b9ec_2901d82_b145" --5e12b9ec_2901d82_b145 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Could someone explain how the jit-lock in Emacs works in the following ca= se=3F 1. emacs -Q 2. open the attachment file and goto end of buffer 3. M-x desktop-save and quit emacs 4. emacs -Q 5. M-x desktop-read I see the buffer is fontified correctly. Does it parse the whole buffer=3F= =E5=9C=A8 2020=E5=B9=B41=E6=9C=886=E6=97=A5 +0800 AM11:42=EF=BC=8CEli Zar= etskii =EF=BC=8C=E5=86=99=E9=81=93=EF=BC=9A > > =46rom: arthur miller > > CC: =22monnier=40iro.umontreal.ca=22 , =22= alan=40idiocy.org=22 > > , =22emacs-devel=40gnu.org=22 > > Date: Sun, 5 Jan 2020 20:28:43 +0000 > > > > When I said batch-processing I ment processing a file or chunk of buf= fer (region) just before it is to be > > displayed to a user. Same for other =22insertions=22 from macro expan= sions or similar. > > Then we always do =22batch processing=22, because the display engine ha= s > no good idea what exactly changed in the buffer. So it always > processes some minimal chunk of text that it can prove to itself that > the changes were all inside that chunk. > > > I also don't think teee-sitter is needed for syntax coloring. Tree-si= tter seems to be very expensive regex engine > > in that case. > > They claim to be less expensive than regexp-based coloring, especially > with very long lines. > --5e12b9ec_2901d82_b145 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Could someone explain how the jit-lock in Emacs works in = the following case?

1. emacs -Q
2. open the attachment file and goto end of buffer
3. M-x desktop-save and quit emacs
4. emacs -Q
5. M-x desktop-read

I see the buffer is fontified correctly. Does it parse the whole buffe= r?


=E5=9C=A8 2020=E5=B9=B41=E6=9C=886=E6=97= =A5 +0800 AM11:42=EF=BC=8CEli Zaretskii <eliz@gnu.org>=EF=BC=8C= =E5=86=99=E9=81=93=EF=BC=9A
From: arthur miller &l= t;arthur.miller@live.com>
CC: "monnier@iro.umontreal.ca" <monnier@iro.umontreal.ca>, = "alan@idiocy.org"
<alan@idiocy.org>, "emacs-devel@gnu.org" <emacs-devel@gn= u.org>
Date: Sun, 5 Jan 2020 20:28:43 +0000

When I said batch-processing I ment processing a file or chunk of buffer (r= egion) just before it is to be
displayed to a user. Same for other "insertions" from macro expan= sions or similar.

Then we always do "batch processing", because the display engine = has
no good idea what exactly changed in the buffer. So it always
processes some minimal chunk of text that it can prove to itself that
the changes were all inside that chunk.

I also don't think tee= e-sitter is needed for syntax coloring. Tree-sitter seems to be very expens= ive regex engine
in that case.

They claim to be less expensive than regexp-based coloring, especially
with very long lines.

--5e12b9ec_2901d82_b145-- --5e12b9ec_3a95f874_b145 Content-Type: application/octet-stream Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="a.cpp" LyojaW5jbHVkZSA8c3RkaW8uaD4KCmludCBtYWluKGludCBhcmdjLCBjaGFyICoqYXJndikKewoJ cHJpbnRmKCJoZWxsbyB3b3JsZFxuIik7CgoJcmV0dXJuIDA7Cn0KCmludCBtYWluKGludCBhcmdj LCBjaGFyICoqYXJndikKewoJcHJpbnRmKCJoZWxsbyB3b3JsZFxuIik7CgoJcmV0dXJuIDA7Cn0K aW50IG1haW4oaW50IGFyZ2MsIGNoYXIgKiphcmd2KQp7CglwcmludGYoImhlbGxvIHdvcmxkXG4i KTsKCglyZXR1cm4gMDsKfQppbnQgbWFpbihpbnQgYXJnYywgY2hhciAqKmFyZ3YpCnsKCXByaW50 ZigiaGVsbG8gd29ybGRcbiIpOwoKCXJldHVybiAwOwp9CmludCBtYWluKGludCBhcm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KQp7CglwcmludGYoImhlbGxvIHdvcmxkXG4iKTsKCgly ZXR1cm4gMDsKfQppbnQgbWFpbihpbnQgYXJnYywgY2hhciAqKmFyZ3YpCnsKCXByaW50ZigiaGVs bG8gd29ybGRcbiIpOwoKCXJldHVybiAwOwp9CmludCBtYWluKGludCBhcmdjLCBjaGFyICoqYXJn dikKewoJcHJpbnRmKCJoZWxsbyB3b3JsZFxuIik7CgoJcmV0dXJuIDA7Cn0KaW50IG1haW4oaW50 IGFyZ2MsIGNoYXIgKiphcmd2KQp7CglwcmludGYoImhlbGxvIHdvcmxkXG4iKTsKCglyZXR1cm4g MDsKfQppbnQgbWFpbihpbnQgYXJnYywgY2hhciAqKmFyZ3YpCnsKCXByaW50ZigiaGVsbG8gd29y bGRcbiIpOwoKCXJldHVybiAwOwp9CmludCBtYWluKGludCBhcmdjLCBjaGFyICoqYXJndikKewoJ cHJpbnRmKCJoZWxsbyB3b3JsZFxuIik7CgoJcmV0dXJuIDA7Cn0KaW50IG1haW4oaW50IGFyZ2Ms IGNoYXIgKiphcmd2KQp7CglwcmludGYoImhlbGxvIHdvcmxkXG4iKTsKCglyZXR1cm4gMDsKfQpp bnQgbWFpbihpbnQgYXJnYywgY2hhciAqKmFyZ3YpCnsKCXByaW50ZigiaGVsbG8gd29ybGRcbiIp OwoKCXJldHVybiAwOwp9CmludCBtYWluKGludCBhcmdjLCBjaGFyICoqYXJndikKewoJcHJpbnRm KCJoZWxsbyB3b3JsZFxuIik7CgoJcmV0dXJuIDA7Cn0KaW50IG1haW4oaW50IGFyZ2MsIGNoYXIg Kiphcmd2KQp7CglwcmludGYoImhlbGxvIHdvcmxkXG4iKTsKCglyZXR1cm4gMDsKfQppbnQgbWFp bihpbnQgYXJnYywgY2hhciAqKmFyZ3YpCnsKCXByaW50ZigiaGVsbG8gd29ybGRcbiIpOwoKCXJl dHVybiAwOwp9CmludCBtYWluKGludCBhcmdjLCBjaGFyICoqYXJndikKewoJcHJpbnRmKCJoZWxs byB3b3JsZFxuIik7CgoJcmV0dXJuIDA7Cn0KaW50IG1haW4oaW50IGFyZ2MsIGNoYXIgKiphcmd2 KQp7CglwcmludGYoImhlbGxvIHdvcmxkXG4iKTsKCglyZXR1cm4gMDsKfQppbnQgbWFpbihpbnQg YXJnYywgY2hhciAqKmFyZ3YpCnsKCXByaW50ZigiaGVsbG8gd29ybGRcbiIpOwoKCXJldHVybiAw Owp9Cg== --5e12b9ec_3a95f874_b145--