From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?utf-8?B?7KGw7ISx67mI?= Newsgroups: gmane.emacs.devel Subject: Re: emacs-tree-sitter and Emacs Date: Fri, 3 Apr 2020 04:39:08 +0900 Message-ID: References: <83a73tyako.fsf@gnu.org> Mime-Version: 1.0 (1.0) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="48356"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Michael Welsh Duggan , mwd@md5i.com, stephen_leake@stephe-leake.org, Emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Apr 02 21:41:03 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 1jK5i3-000CSD-Bf for ged-emacs-devel@m.gmane-mx.org; Thu, 02 Apr 2020 21:41:03 +0200 Original-Received: from localhost ([::1]:46670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5i2-00068P-Fn for ged-emacs-devel@m.gmane-mx.org; Thu, 02 Apr 2020 15:41:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37818) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK5gI-0004Va-Tp for emacs-devel@gnu.org; Thu, 02 Apr 2020 15:39:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jK5gH-0007uW-QJ for emacs-devel@gnu.org; Thu, 02 Apr 2020 15:39:14 -0400 Original-Received: from pv50p00im-zteg10011501.me.com ([17.58.6.42]:42417) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jK5gH-0007tT-KI for emacs-devel@gnu.org; Thu, 02 Apr 2020 15:39:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; s=1a1hai; t=1585856352; bh=1daY9c7le7184C8qjQciLWtHzIqob2zuFR/TutXp/MI=; h=Content-Type:From:Subject:Date:Message-Id:To; b=uz++Ei1jxiF938gOAFO0xHpnh6Db3UsIjsG5zdcAZ4KpeuH5O37iPweVcC+S0Ie7C hVOP4x/kFAKWze5Zy6Exc905qVyWLjwS/pa8BdII5OgsEm1vcuvrZSWRLsIVFDfo5B 6oECnNYldd8AHN+FrKDTAz+OkqLQ+f1LePV/IkdH7ivdItsEnKIjTINAi5y+f8hXL3 NsVjvaK6O0Kfs6T/Vwy4DBUWV3zSWKGCdJUZU07tzNRnA0NrWn8nHkiyX2pAm0NWyz rLb6EIX7PzU+SQ/HMyxhFYkAfXBbgEeSMMk6CqJ1Qe1e72IHbWBHUno+0FiHGwrfY1 6GK9T302NECFQ== Original-Received: from [192.168.0.3] (unknown [1.230.108.64]) by pv50p00im-zteg10011501.me.com (Postfix) with ESMTPSA id 75E26B003F6; Thu, 2 Apr 2020 19:39:11 +0000 (UTC) In-Reply-To: <83a73tyako.fsf@gnu.org> X-Mailer: iPhone Mail (17E255) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2020-04-02_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-2004020144 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 17.58.6.42 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:246290 Archived-At: > 2020. 4. 3. =EC=98=A4=EC=A0=84 4:04, Eli Zaretskii =EC=9E=91= =EC=84=B1: >=20 > =EF=BB=BF >>=20 >> From: Michael Welsh Duggan >> Cc: , , >> Date: Thu, 02 Apr 2020 14:50:18 -0400 >>=20 >> 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). >=20 > 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. AFAIU, determining that starting point is a non-trivial task, and if Emacs w= ants to present the user an exact representation, the text from point-min is= still needed: just a hypothetical case would be having a file with all code= commented out. Trying to find out the starting point in lisp would be hard enough and possi= bly will be slower than just passing everything to tree-sitter.=20 > IOW, > start from window-start, then go back until you find the top-level > syntactic construct; then parse from there. >=20