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 08:14:40 +0100 Message-ID: <871qp1xhnj.fsf@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> <83wn6tkurx.fsf@gnu.org> 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="17903"; mail-complaints-to="usenet@ciao.gmane.io" Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Eli Zaretskii , Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Dec 15 08:15:17 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 1p5iSX-0004Fq-MF for ged-emacs-devel@m.gmane-mx.org; Thu, 15 Dec 2022 08:15:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p5iSK-0004j8-B8; Thu, 15 Dec 2022 02:15:00 -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 1p5iSC-0004eq-HX for emacs-devel@gnu.org; Thu, 15 Dec 2022 02:14:53 -0500 Original-Received: from out2.migadu.com ([188.165.223.204]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p5iS6-0000ja-L1; Thu, 15 Dec 2022 02:14:48 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1671088482; 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=poiQpktBCg+J0anbkVs097dCpPpgzlPoHsIUIVsWuW0=; b=Rp39/putKvb2BQQCBL+T9hjxuCKp7LIiuxcaGEuUGO9U52tHjt+fc3QS8xpO0H756G1Oa1 +u0Vjzslf1Fu6Xw7kpHvqoYrV8bTAWnf4quWNpnOBTCsv26SmB3N/ft7jADC3N8zZ86bHm 9KjjqraomnVUd/XdqE2vDqI3y3jbHw85QiKfHhzfil4tNlSTgpJshalWCQs0wQ75Rh8COB skeAbDVZ2ZoU8ZSvK6YBwZI97Gq0tB7tGRb+wacczIEswaUtrQB41OewaxMDCZ8ecSCSGI BYA0eqjP48riXmhFxVzn7bvZneqfq3d7Q0C/JwTos3rAsmrtWI8VTM8Jb6c23A== In-Reply-To: <83wn6tkurx.fsf@gnu.org> X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=188.165.223.204; envelope-from=theo@thornhill.no; helo=out2.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_PASS=-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:301442 Archived-At: Eli Zaretskii writes: >> From: Yuan Fu >> Date: Wed, 14 Dec 2022 16:05:10 -0800 >> Cc: Theodor Thornhill , >> emacs-devel , >> eliz@gnu.org >>=20 >> > I see, so maybe sexp means the general, flexible AST entity. And think= ing of it, my idea is just forward-list :-) And we definitely should includ= e forward-list into the list of navigation commands we want to support, amo= ng the ones that are already brought up. >>=20 >> 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. >>=20 >> If you think about it, there are two kinds of constructs in an AST/gramm= ar: 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 langu= ages). >>=20 >> And these repeatable constructs appears at every level of the AST, from = top-level stuff like function definition, to statements, to small stuff lik= e arguments in an argument list. That makes them very good unit of navigati= on. >>=20 >> Navigation commands, IMO, needs to be extremely easy to predict and requ= ires no thinking. That=E2=80=99s the reason why avy never grow on me: yes y= ou can move to anywhere you want, but it takes so much cognitive load to us= e. 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. > > FWIW, for me, "sexp" in its C/C++ interpretation always means > "expression". So in > > foobar (a, b + c, 2 * d - f / 10 + pow (g, x), y); > > C-M-f should move to the next comma on the top level (i.e. the comma > inside the 'pow' call doesn't count), and C-M-f inside the 'pow' call > should move by commas on that level. > > More generally, C-M-f should move to the next expression > _on_the_same_level_, without entering inner levels. Exactly like we > do in Lisp. Agreed