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 16:05:10 -0800 Message-ID: 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 (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="33674"; 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 01:06:14 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 1p5blO-0008Y2-Sk for ged-emacs-devel@m.gmane-mx.org; Thu, 15 Dec 2022 01:06:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p5bkV-0001pf-3w; Wed, 14 Dec 2022 19:05:19 -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 1p5bkS-0001oS-4L for emacs-devel@gnu.org; Wed, 14 Dec 2022 19:05:16 -0500 Original-Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p5bkQ-00048r-6K; Wed, 14 Dec 2022 19:05:15 -0500 Original-Received: by mail-pf1-x42a.google.com with SMTP id w26so5614410pfj.6; Wed, 14 Dec 2022 16:05:13 -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=PPQUiL3NblQND1r/Q+2RYF8aLvvcInMJbPvQ2ieG5Go=; b=jCFqpYqSwKTYeI+B50ASQf0eOq8TfOyDURUF7/Cg7YJD6FaELRyfvGx9/iP3bm3mJO bo9eeLsERFVX3banxXgyxjkT5mk621vjiG69XsJfpTWe94OZEkan5QHKDVpF+cQmc0Ju 69g37sC5+2O/LzqZz5DENkVQd+4rrSTtJ22WFZJzTrb6kAA+Nd6rQhxa0IQKXv/c0kVa wzi4/8u+bSskmxcitBtMQQwp4MdjeJ1eohWscVUoP0RZAEt8Hr/NOG/UQwofgEweINJE LaH/Fjrt5KnmNDgcCEVwWvpgc142chSGJekRatmbhI5zyE3MfYd5nXqYJNrH4FJEVKEW y1GA== 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=PPQUiL3NblQND1r/Q+2RYF8aLvvcInMJbPvQ2ieG5Go=; b=sh0WpGRH7W5AELSCGdmmYYr0DWtoosOvvTS9GVzHEw5xz6YdDjMG7ZP70qJi4kHE39 /T3ZAUZY9KfvdHgQ39GL07aiiW9fxrzK6JrS9b+gT+6FjU+itVAV2QXH1r6R+VZLNgf1 15aeMwJG/+mnTeusHDwG4WKbZnWPZZzzyrnsVOHUziriBziuqfHmq6jbGmDE0ZY/7yLd woxeJZTW1tZknY8i8VNhyhbXiwXBM2p6+MYyYHqBERxxnupcgp7DcLIqcUHeouWTjXvk 56/E7k7vXCZ7065XQrlLJwSfU2TJGgRhhZ+A6MG07l+j6DZ/QPoDVQ2z3z51WTxX4TUS VZdg== X-Gm-Message-State: ANoB5pmbMJ7exOEuEjF2KZTn3RT/VKXNedWTx41d1zD0R+ZzKks+Ue0Q qf1q51FNtic2WDjas48BGHY= X-Google-Smtp-Source: AA0mqf5DSISPqu8BxaWZGk6PKfVjmgz4AlyQ350iH14meBP2eTQqHxlBCMk312FR5wylWVaP5mO6Ig== X-Received: by 2002:a62:e519:0:b0:575:bf29:d1e0 with SMTP id n25-20020a62e519000000b00575bf29d1e0mr28578207pff.26.1671062712147; Wed, 14 Dec 2022 16:05:12 -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 j1-20020a625501000000b0057447bb0ddcsm420300pfb.49.2022.12.14.16.05.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Dec 2022 16:05:11 -0800 (PST) In-Reply-To: <0CA63C32-432C-42C5-BBAD-C6E1A7CE1806@gmail.com> X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=casouri@gmail.com; helo=mail-pf1-x42a.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:301428 Archived-At: > On Dec 14, 2022, at 3:31 PM, Yuan Fu wrote: >=20 >=20 >=20 >> 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. >=20 > 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. Ok, upon closer inspection, forward-list isn=E2=80=99t exactly what = I=E2=80=99m thinking about, it moves over lists, but I=E2=80=99m = thinking about moving over elements of a list. If you think about it, there are two kinds of constructs in an = AST/grammar: those are repeatable, and those are not. Statements are = repeatable, you can stack multiple ones together and it still makes = sense. Identifiers are not repeatable, put two together doesn=E2=80=99t = make sense (in most languages). And these repeatable constructs appears at every level of the AST, from = top-level stuff like function definition, to statements, to small stuff = like arguments in an argument list. That makes them very good unit of = navigation. Navigation commands, IMO, needs to be extremely easy to predict and = requires no thinking. That=E2=80=99s the reason why avy never grow on = me: yes you can move to anywhere you want, but it takes so much = cognitive load to use. Much better to type a few C-n, C-M-f, etc to get = their, because I don=E2=80=99t need to think about it. Does this make sense?=20 Yuan=