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: New defun navigation for tree-sitter (Was: Code navigation for sh-mode with Tree-sitter) Date: Tue, 13 Dec 2022 10:56:42 -0800 Message-ID: References: <1B9F9B3A-A757-4A65-9653-CD0112EB8895@gmail.com> <5BB6E79A-B1FA-40F4-B48A-DADF63A30DDC@gmail.com> <0B190C0C-24BE-490C-9C7D-1439B77EE9D5@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="39834"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Monnier , Alan Mackenzie , emacs-devel@gnu.org To: =?utf-8?Q?Jo=C3=A3o_Paulo_Labegalini_de_Carvalho?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 13 19:57:25 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 1p5ASy-000ABi-FJ for ged-emacs-devel@m.gmane-mx.org; Tue, 13 Dec 2022 19:57:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p5ASR-0003fU-Oh; Tue, 13 Dec 2022 13:56:51 -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 1p5ASQ-0003fB-DS for emacs-devel@gnu.org; Tue, 13 Dec 2022 13:56:50 -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 1p5ASO-00037b-TX for emacs-devel@gnu.org; Tue, 13 Dec 2022 13:56:50 -0500 Original-Received: by mail-pf1-x42a.google.com with SMTP id 124so2894405pfy.0 for ; Tue, 13 Dec 2022 10:56:48 -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=3NC6Hhi6m5ZtOMOr6MRc0cQP/IDMXFuZAgo+c6/A6dU=; b=X2NHCnKtbjwWZNhlLR304iwYFEh8O89e7bW3SiCDHHdBI9n0HHQ//p7Gt1vjChDuTF jp+1UBgFwtgw335SOnOQI0fP1CYlkymT8tIaxhkXvUQPwdny5oPFw+u5VCv5xvq/fZw1 XOu5XmUXQSfFeJwB1zTh/UniIetskzZbx/Zba0cKR4+t9BEnMtAIMY6ybWDKmMSrbhp/ zh1K8DoahScGo/Wbiz4CFh15bIYtdBnfd+Sx0sDYYp88egkpfXQpCmIvCuY1FabI+Lnx 9BTI1sJqmfUNM/FKHwyB625o0xFtRqxZXGwhsTtSDI+/2y8honJPfK+8B9x/k8BeRaf7 0AeQ== 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=3NC6Hhi6m5ZtOMOr6MRc0cQP/IDMXFuZAgo+c6/A6dU=; b=wXWwFrn/AbR4Qli1sSIesg7Bb4wlGBelWM087Raw1xWKv5wP9rMP+pZsuywsiILm7i F9UAZwiWPmrYbdZeCim/VcMDbWqYxidaQOKheqUYlB6z3dzLwkXCe+/ALyEcYXPewdKp 0cz3aQirPhqQ6d9BmwSGqf/qTQjmc9tmObbB9L2MDBE6xTY9PQPaiHUj3CwWnZkPbsQA qxSgP2693VN3FP8i/iTfpLm+hyPa+d44GapqqQM5Z91FPArbUxF+Vy6KlY0VcCM5YPp2 gH+2HJKVEKWY4PzgVIQgXFd/ZYqBYRHkWj8nyfU0B3ZQLAq25GMk3gG36iorG3d2soyT KF+A== X-Gm-Message-State: ANoB5pmaeT6Ud/nhuSJxhKOQI8Eh4HqwOaUbBBKDDplX057jmmshtRlq LHwHhj6WgFz4P+rSyNRer5E= X-Google-Smtp-Source: AA0mqf6rW0c9yuKAarZ4FD1RBimH4/9a9G1mHAUkKbAuQWuuMdAqdnKzoh/t2M8EB/qSY5OAfTTk5w== X-Received: by 2002:aa7:97a3:0:b0:578:2e3b:472e with SMTP id d3-20020aa797a3000000b005782e3b472emr14611078pfq.29.1670957807356; Tue, 13 Dec 2022 10:56:47 -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 q18-20020aa79832000000b005745635c5b5sm8009973pfl.183.2022.12.13.10.56.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Dec 2022 10:56:46 -0800 (PST) In-Reply-To: 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:301348 Archived-At: > On Dec 13, 2022, at 10:48 AM, Jo=C3=A3o Paulo Labegalini de Carvalho = wrote: >=20 >=20 > On Tue, Dec 13, 2022 at 11:07 AM Yuan Fu wrote: > Treesit--navigate-defun should, as you did in bash-ts-mode, only = navigate in the same level (siblings) or higher (parents). Could you = show an example of the unexpected behavior? >=20 > I must have forgotten to evaluate something on my setup file. It is = indeed working as you described. Sorry for the noise. >=20 > Should I add key bindings to use the new tree-sitter navigation = functions to bash-ts-mode or is it planned an integration with = beginning/end-of-defun? I will repurpose two functions, treesit-beginning-of-defun/end, and make = treesit-major-mode-setup set them up automatically. I=E2=80=99m thinking = about remapping beginning/end-of-defun to their tree-sitter counterparts = in (current-local-map), in treesit-major-mode-setup. That way major = modes don=E2=80=99t need to explicitly bind tree-sitter functions in = their keymaps. Stefan, would that be a good idea? So if everything goes as planned, bash-ts-mode only needs to set = treesit-defun-type-regexp. Yuan=