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-tree-sitter and Emacs Date: Thu, 02 Apr 2020 13:39:15 -0400 Message-ID: References: <83eeta3sa0.fsf@gnu.org> <86369ojbig.fsf@stephe-leake.org> <83lfnfz6jr.fsf@gnu.org> <864ku3htmb.fsf@stephe-leake.org> <83v9mix9vk.fsf@gnu.org> <87pncq55f8.fsf@md5i.com> <83imihyl42.fsf@gnu.org> <83h7y1yikx.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="13081"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: mwd@md5i.com, Eli Zaretskii , stephen_leake@stephe-leake.org, Michael Welsh Duggan , emacs-devel@gnu.org To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Apr 02 19:40:08 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 1jK3p2-0003Ku-2p for ged-emacs-devel@m.gmane-mx.org; Thu, 02 Apr 2020 19:40:08 +0200 Original-Received: from localhost ([::1]:45352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK3p1-0000wH-1w for ged-emacs-devel@m.gmane-mx.org; Thu, 02 Apr 2020 13:40:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48870) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK3oL-0000KX-84 for emacs-devel@gnu.org; Thu, 02 Apr 2020 13:39:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jK3oJ-00022o-J6 for emacs-devel@gnu.org; Thu, 02 Apr 2020 13:39:24 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:53976) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jK3oF-00021J-IQ; Thu, 02 Apr 2020 13:39:20 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 34E5444FBB1; Thu, 2 Apr 2020 13:39:18 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 812C444FBAF; Thu, 2 Apr 2020 13:39:16 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1585849156; bh=H+AGzD3dmYkpPnjuwEigeP5M/IwaZao/MhjpMkXSFCc=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=dIszZNwKne+FoB7c+HYAPsel8n3oLYcrH4OyCpbPQj74fvVE3KFk5JYbh/mYY1um9 /vcl8LXLXUBvGVaNnCDZk0Ivo9twJIGEbdrzRt70wBqaYlQbH2TiFK6kUdR3SIEqBh OLxn7QYgWXSz2OzYX5vVSiARdcjBFsPM2jT4VIQtpVPtXjwyf6Yu3eUIm5POzxPVAd FjzlM6JZmmT6YbZCNu+MsVOmSi2iWzXGbaGCCbbjty73qjlG0Owyn8L24d0luOZK9B o3NC3zxxcoYZi+FVm5sDCx4CCFH3yQXmLOHo/KULsDXtEFhLOpv5oTmcmYrPwgvib/ mwwvP2xOi1LZA== Original-Received: from alfajor (unknown [104.247.241.114]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id DB23D12079C; Thu, 2 Apr 2020 13:39:15 -0400 (EDT) In-Reply-To: (Yuan Fu's message of "Thu, 2 Apr 2020 13:18:51 -0400") 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:246279 Archived-At: > Can we do something similar to fontified text property? I.e., only parse the > first screen full of text when a buffer is opened, and mark the rest as > unparsed with text property. Then when we need to access the parse tree (for > fortification, etc), send all unparsed text before some point (e.g., last > visible char in the window) to the parser. If you follow the idea that parsing is always done "from point-min", then you don't need text-properties: you only need to remember the position up to which parsing has been done. That's what `syntax-propertize` does, and it keeps the corresponding info in `syntax-propertize--done` (it doesn't even need to be marker since any changes to the text before `syntax-propertize--done` should cause it to be reset to the beginning of those modifications). As mentioned in some other message, this design becomes inefficient when you have two windows displaying a large buffer, one display near the end, and the other near the beginning, and you make changes at the beginning of the buffer. I haven't seen any performance bug-reports or complaints about it, so it appears that those circumstances are very rare. BTW, one of the potential benefits of font-locking done via tree-sitter is that it generally doesn't care about lines, so it should be possible to make it work just as efficiently on long lines (that won't solve all the problems we have with long lines, but still). Stefan