From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill Newsgroups: gmane.emacs.devel Subject: Re: Plug treesit.el into other emacs constructs Date: Thu, 15 Dec 2022 06:59:29 +0100 Message-ID: <96DD7ED2-231B-4017-A2E6-D1910DDBF2B6@thornhill.no> References: <87wn6whete.fsf@thornhill.no> <87r0x3gnv5.fsf@thornhill.no> <04BB786A-3ED1-4918-8583-17AA01A1E453@gmail.com> <4E3940CA-67A6-45B7-8785-4E60FDECCDFB@gmail.com> <0CA63C32-432C-42C5-BBAD-C6E1A7CE1806@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27320"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel , eliz@gnu.org To: Yuan Fu , Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Dec 15 07:00:56 2022 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 1p5hId-0006v1-72 for ged-emacs-devel@m.gmane-mx.org; Thu, 15 Dec 2022 07:00:55 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p5hHY-0005so-Ds; Thu, 15 Dec 2022 00:59:48 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p5hHW-0005sQ-Tu for emacs-devel@gnu.org; Thu, 15 Dec 2022 00:59:46 -0500 Original-Received: from out-64.mta0.migadu.com ([91.218.175.64]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p5hHR-0002hB-GD for emacs-devel@gnu.org; Thu, 15 Dec 2022 00:59:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1671083978; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G2HLjYiRgWw2nXtTBsz9SbaZpNwRBT5ZsK3ZN8SKQwQ=; b=t+1SKVZZk7zbvD8Q35ZznI7y+z8Bj7+vH65Lm80O4n3w2Teei2npzHWFjczsfVjEZozX6U iw3m6SupkRaijgiqkmJzYQv6zfv3LpPa1GagoX5hXeHobFSsrBquIRFYPg7vG6aCdTuQcg QNn4DweLcxikpDpSYP0iJzNWkT8MkCjKZIVXJnuHsBU3SuqwBnme6kGD5uop/rl0vxRds0 1L4uZovAZTsNkknQM44VFumHmNu+KOoq4rph69nBO1E7FQUvsFzfRdLsUkFWukzfVHU9tO kGpNbAGShp7tQP9u00AlpOnb/qoHPcu+EtGaL9YjQ5Hr4t8x3/YnNghTfo7d9Q== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-Reply-To: <0CA63C32-432C-42C5-BBAD-C6E1A7CE1806@gmail.com> X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=91.218.175.64; envelope-from=theo@thornhill.no; helo=out-64.mta0.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:301433 Archived-At: On 15 December 2022 00:31:20 CET, Yuan Fu wrote: > > >> On Dec 14, 2022, at 6:01 AM, Stefan Monnier wrote: >>=20 >>> I would argue that the purpose of forward-sexp is to move over items i= n >>> a list=2E >>=20 >> There are different ways to look at it=2E In the Lisp context where it >> emerged, we only have "identifiers" and "parenthesized thingies", so >> that doesn't give much guidance about what to do in-between=2E > >I see, so maybe sexp means the general, flexible AST entity=2E And thinki= ng of it, my idea is just forward-list :-) And we definitely should include= forward-list into the list of navigation commands we want to support, amon= g the ones that are already brought up=2E > >>=20 >> The semantics I chose for SMIE is what I found to be closest to >> past practice=2E > >That=E2=80=99 great! You=E2=80=99ve done all the experiments and thinking= , and all I need to do is to understand it ;-) > Are you working on this, yuan? If so I'll get out of your hair=2E >>> But if we move over the smallest >>> subtree, I=E2=80=99d imagine it only move across the semicolon after [= 1]=2E >>=20 >> In my view ";" is not a substree=2E It's the node of a substree=2E >> We can't actually move over a proper subtree in that case because there >> is no substree whose left boundary starts right before the ";", so the >> closest is to move over the ";" *plus* its right child=2E > >Ah, so by =E2=80=9Csmallest subtree=E2=80=9D you basically mean =E2=80=9C= smallest non-leaf node=E2=80=9D? Is the following logic what you have in mi= nd? > >forward-sexp: >Among all nodes that starts right after point: >1=2E if we can find a smallest non-leaf node > -> skip over it >2=2E if we can only find leaf node > -> go to the end of the immediate (smallest) parent node > that covers point, and skip over its next sibling (by recursively a= pplying either 1 or 2) > >Yuan