From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: Re: emacs-tree-sitter and Emacs Date: Fri, 03 Apr 2020 09:24:38 -0800 Message-ID: <86h7y0fpnt.fsf@stephe-leake.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> <865zehgw5r.fsf@stephe-leake.org> <831rp5xbtp.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="54514"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (windows-nt) To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Apr 03 19:50:23 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 1jKQSU-000E4J-Sh for ged-emacs-devel@m.gmane-mx.org; Fri, 03 Apr 2020 19:50:22 +0200 Original-Received: from localhost ([::1]:59010 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKQST-00035a-Ti for ged-emacs-devel@m.gmane-mx.org; Fri, 03 Apr 2020 13:50:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49472) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jKQRZ-00022S-RC for emacs-devel@gnu.org; Fri, 03 Apr 2020 13:49:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jKQRY-0008J9-4q for emacs-devel@gnu.org; Fri, 03 Apr 2020 13:49:25 -0400 Original-Received: from [50.116.126.2] (port=48679 helo=gateway36.websitewelcome.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jKQRX-0008Hn-RE for emacs-devel@gnu.org; Fri, 03 Apr 2020 13:49:24 -0400 Original-Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway36.websitewelcome.com (Postfix) with ESMTP id F3A57408C2163 for ; Fri, 3 Apr 2020 11:41:37 -0500 (CDT) Original-Received: from host2007.hostmonster.com ([67.20.76.71]) by cmsmtp with SMTP id KQ3gjlR4NXVkQKQ3gjzsoX; Fri, 03 Apr 2020 12:24:44 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=stephe-leake.org; s=default; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:References:Subject:To:From:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=UFEPnbXAkJ0UTJkxykYNT+1qq/0eQaVovrf57adwgio=; b=QPFl+5tG7FC6a6vmkUPlrxYmY Qre0UnUmUj7559kar0XgxhHB7qytseeZ9oNXWChIM3XuVgCMUbbRcxGkEaMyiefMpSsKKtfXwFQo/ KUseYqBhWCAvbzsOGbYLU0rJuS/wifpuoDVXLwoHWD5glLF6qNmhTgwOE1PdKDUA/fHj6raCoTgEX o/kFGnu5JbqPAY3+x/Cr3KyMUxXw4P7qjepjezHKNmcoZQPAZheI/R2qWtcTrFuOXXt6TSPqC7FOb QUf46j0wrjanub/z4weYn1ftBOVauc9fZKpaQ6yfQawLi8UqfpDTFLgHNpJIsnG42fSjMVMBlyRT5 gXjK+v6aA==; Original-Received: from [76.77.182.20] (port=64196 helo=Takver4) by host2007.hostmonster.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1jKQ3g-0003t3-0c for emacs-devel@gnu.org; Fri, 03 Apr 2020 11:24:44 -0600 In-Reply-To: <831rp5xbtp.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 03 Apr 2020 10:33:54 +0300") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host2007.hostmonster.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stephe-leake.org X-BWhitelist: no X-Source-IP: 76.77.182.20 X-Source-L: No X-Exim-ID: 1jKQ3g-0003t3-0c X-Source-Sender: (Takver4) [76.77.182.20]:64196 X-Source-Auth: stephen_leake@stephe-leake.org X-Email-Count: 2 X-Source-Cap: c3RlcGhlbGU7c3RlcGhlbGU7aG9zdDIwMDcuaG9zdG1vbnN0ZXIuY29t X-Local-Domain: yes X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 50.116.126.2 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:246345 Archived-At: Eli Zaretskii writes: >> >> I would think that you at least need to parse everything displayed and >> >> everything before what is displayed. (You need all prior context. What >> >> if someone opened a comment on line 1 and hasn't closed it, for >> >> example?) >> > >> > Each buffer always knows which part of it remains unchanged. >> >> Only because jit-lock-after-change on after-change-functions updates >> that knowledge, via the fontified text property. But that in turn >> assumes that the entire buffer has been fontified, which is typically >> not the case; I rarely scroll thru an entire file. >> >> Unless there is some other mechanism that maintains change locations? > > I meant BEG_UNCHANGED and END_UNCHANGED. Ah; I was unaware of those. It would be good if these values were accessible from modules and elisp. That might remove the need for ada-mode's after-change-functions; I'd have to try it to be sure. For one thing, ada-mode maintains a list of changed regions, while this lumps them all together, and includes unchanged text in between. That would trigger parses that are not actually needed, but that might be a good trade. Hmm. Browsing the emacs C source to see if there is such a function (I didn't find one, but I could have missed it), I found this in keyboard.c: /* If the previous command tried to force a specific window-start, forget about that, in case this command moves point far away from that position. But also throw away beg_unchanged and end_unchanged information in that case, so that redisplay will update the whole window properly. */ BUF_BEG_UNCHANGED (b) = BUF_END_UNCHANGED (b) = 0; which means BEG_UNCHANGED can indicate changes when there are actually none. As long as that doesn't happen too often, it's acceptable. -- -- Stephe