From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: Plug treesit.el into other emacs constructs Date: Wed, 14 Dec 2022 15:31:20 -0800 Message-ID: <0CA63C32-432C-42C5-BBAD-C6E1A7CE1806@gmail.com> References: <87wn6whete.fsf@thornhill.no> <87r0x3gnv5.fsf@thornhill.no> <04BB786A-3ED1-4918-8583-17AA01A1E453@gmail.com> <4E3940CA-67A6-45B7-8785-4E60FDECCDFB@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) 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="18721"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Theodor Thornhill , emacs-devel , eliz@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Dec 15 00:32:12 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 1p5bES-0004dN-E6 for ged-emacs-devel@m.gmane-mx.org; Thu, 15 Dec 2022 00:32:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p5bDm-0001ey-Jh; Wed, 14 Dec 2022 18:31:30 -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 1p5bDh-0001br-SU for emacs-devel@gnu.org; Wed, 14 Dec 2022 18:31:26 -0500 Original-Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p5bDg-0006ZN-3x; Wed, 14 Dec 2022 18:31:25 -0500 Original-Received: by mail-pl1-x62d.google.com with SMTP id d3so5031579plr.10; Wed, 14 Dec 2022 15:31:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=f4P1FhNsteRQ9pv9fjCgsssBRBgAVkPH4lLLmARsYNQ=; b=gmDIoqsIT34EcGol7PkWQ5duQiWvAIy66GbcO9IAI0YYY8OpvbtjP71EI+UpUk7mr0 5MoLIPmrHl3KPCLCrpi7jAsQFtMMBMWE1suXziD0DeLaaqGk1a9bq7AqDm9YTyZ+IsJZ r7dUL6X7xDgZ4YE72foRqfw9P2fSe8+aEHrtSWKO/9oTM4xNGBFDE8PyWCU4wU116b1/ f9ve1csf/63S4w0AI5uNtl7rSH+LaAJhaLneNyDSnBJBHpKWnKFMg+wsxbILSQHPk0xO oBjLQmEZZvI7Sm3Al+omkqPscRgdBWWSX4oR6vc1xugfeYEm9iepZm0353C5AAVCkyAY 6pJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=f4P1FhNsteRQ9pv9fjCgsssBRBgAVkPH4lLLmARsYNQ=; b=axM9jG/BDaPieomAVPKJqKBadj77mMKW64T1bW7s2NvgGU+tH72zljut2XHWFlbbqK WOgGcCIioHZORc5jsSxo7Kmq73IRn67QEL2TSGtn4YqqZWXVEGjOMgtBfaREMRwRyMkc SwErRhGj+todXeevkBbPoMO3eLoFNEzSvU0zpqiurpkvC31QrgLfqSl1r1/ESYsVLAgd DhlMbfjhE9D0pWr33JkmJSv4wvmHUYgsMk/mVt/PX7fGf09SvfKFrhNxrWMt1Z5l9oTb ++V47pn30vNa/ijVjbv8X8veYwHpIFHYnkBVvcR/0yUXnLWUgASTf4VfgEtSeqIzTlsz rHEw== X-Gm-Message-State: ANoB5plIbYSDB3VFoX+m3HkcoCHwsBdiV3ztDI+NJA6ueolTpOgkMy2m AU5vndFF4SIHMdNj1QIpOe0= X-Google-Smtp-Source: AA0mqf68SB9o6IswWO5aw9SmcGDsuqlwcKCfnBajIi74ehX7CktJogQcuLWw2hc81FIUlvrav1TvAQ== X-Received: by 2002:a17:902:7001:b0:189:760d:c5ed with SMTP id y1-20020a170902700100b00189760dc5edmr27470438plk.28.1671060682011; Wed, 14 Dec 2022 15:31:22 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id p10-20020a170902780a00b001897bfc9800sm2395348pll.53.2022.12.14.15.31.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Dec 2022 15:31:21 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=casouri@gmail.com; helo=mail-pl1-x62d.google.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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:301424 Archived-At: > 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 = in >> a list. >=20 > There are different ways to look at it. 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. I see, so maybe sexp means the general, flexible AST entity. And = thinking 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, among the ones that are already brought up. >=20 > The semantics I chose for SMIE is what I found to be closest to > past practice. 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 ;-) >> But if we move over the smallest >> subtree, I=E2=80=99d imagine it only move across the semicolon after = [1]. >=20 > In my view ";" is not a substree. It's the node of a substree. > 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. Ah, so by =E2=80=9Csmallest subtree=E2=80=9D you basically mean = =E2=80=9Csmallest non-leaf node=E2=80=9D? Is the following logic what = you have in mind? forward-sexp: Among all nodes that starts right after point: 1. if we can find a smallest non-leaf node -> skip over it 2. 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 = applying either 1 or 2) Yuan=