From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: emacs-tree-sitter and Emacs Date: Thu, 02 Apr 2020 22:03:19 +0300 Message-ID: <83a73tyako.fsf@gnu.org> 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> <83d08pyc8f.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="7820"; mail-complaints-to="usenet@ciao.gmane.io" Cc: mwd@md5i.com, stephen_leake@stephe-leake.org, emacs-devel@gnu.org To: Michael Welsh Duggan Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Apr 02 21:04:20 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 1jK58V-0001oI-1E for ged-emacs-devel@m.gmane-mx.org; Thu, 02 Apr 2020 21:04:19 +0200 Original-Received: from localhost ([::1]:46232 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK58T-0001iY-T0 for ged-emacs-devel@m.gmane-mx.org; Thu, 02 Apr 2020 15:04:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32989) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK57t-0001IL-U0 for emacs-devel@gnu.org; Thu, 02 Apr 2020 15:03:42 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:35175) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jK57r-0005QZ-Pb; Thu, 02 Apr 2020 15:03:39 -0400 Original-Received: from [176.228.60.248] (port=3401 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jK57q-00073L-R0; Thu, 02 Apr 2020 15:03:39 -0400 In-Reply-To: (message from Michael Welsh Duggan on Thu, 02 Apr 2020 14:50:18 -0400) 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:246288 Archived-At: > From: Michael Welsh Duggan > Cc: , , > Date: Thu, 02 Apr 2020 14:50:18 -0400 > > If this is correct, I also think we could avoid (1) as an optimization. > In this case we only send the text from (save-restriction (widen) > (point-min)) to (window-end) to the parser as soon as the buffer is > visible. Then treat scrolling down as a change that adds text to the > buffer (from the parser's point of view). This may not produce correct > semantic information in all cases, but it is probably a reasonable first > approximation in the event that we want to avoid (1). Yes, with one correction: ideally, it should be unnecessary to start from point-min (which could be a long way away). Most languages should do well enough with starting from the beginning of the outermost function or class that affects the displayed text. IOW, start from window-start, then go back until you find the top-level syntactic construct; then parse from there.