From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_Paulo_Labegalini_de_Carvalho?= Newsgroups: gmane.emacs.devel Subject: Re: Code navigation for sh-mode with Tree-sitter Date: Tue, 6 Dec 2022 15:41:58 -0700 Message-ID: References: <1B9F9B3A-A757-4A65-9653-CD0112EB8895@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000a51a9f05ef3083bf" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5996"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Alan Mackenzie , Yuan Fu , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 06 23:43:35 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 1p2gf1-0001LK-9b for ged-emacs-devel@m.gmane-mx.org; Tue, 06 Dec 2022 23:43:35 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p2ge2-0007go-IU; Tue, 06 Dec 2022 17:42:34 -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 1p2ge0-0007fm-8I for emacs-devel@gnu.org; Tue, 06 Dec 2022 17:42:32 -0500 Original-Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p2gdn-0001Nz-AQ for emacs-devel@gnu.org; Tue, 06 Dec 2022 17:42:24 -0500 Original-Received: by mail-ed1-x531.google.com with SMTP id d14so17527466edj.11 for ; Tue, 06 Dec 2022 14:42:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=z+RSV2zlAuphAKfmQ7h4PjRfJez06vCUMtxaE9ey58E=; b=DBlaYYlDw/y4KGm6wk+55p4PFZSVpZa07x+0XjvMZd89GMrESw5jV39O7bAk0C784q K4dVJGTVbHnxd2/fDgiMJkzbiOO5r0jvLikCxIfEVmIJ9Bp9gBQbxYXvyCmvt9yEwPjw J8u8Dni8ScZEoaMUT8Q4PKzmckbs7xq3my2rzuVsVi/+PjKjR9lk03+X5f4MdguVmJdY dD6NbeeFPSZrJMtx6ecOk441Fw47gn/OQhRAZ/7eq5tboyO5EL/gwW5B6EoVYwCbsfxn KfenTJ0jSB79LC7SRTH7J164n/GGJd19bx/bbpNZpybHYIX72ThceGglIUgIn2MGRUej GHmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=z+RSV2zlAuphAKfmQ7h4PjRfJez06vCUMtxaE9ey58E=; b=hsIE7wm0Gzgs9nIDXo3hzPAvrwVBb0l5ZWc5pd3aUQsZUIY+WyVxAj5SWUiqGgV8dB PJdYzqHBpxtqTVuegDmwVESM1of7vfqG70ZkpGWih6QaAX0QGLmfjnB5pS70MsFcfl9u Y6AbxP31diNjKfGxnTyJKQwvm2m9NQWvAbMDAEN67VCRZOIyviJGdxDwAKnoyD/JTcof qVymq0lA+iQByXFEj3WBbjrlro2AKdYhmeSz3ZPFXPqThX3F/IQYX6QJRBslIzkyQrlH /OYki3UmOa3okM5R6f98WC6k7ygfM33y/aH4xA/MCSDBBxdl8EGpSPChR0xgqUHGiCZH SWKQ== X-Gm-Message-State: ANoB5pnjPXnqB5yKScUVHFRXZjSt0DnpbdJksP4LCiC5IWg1ufrW6+OQ qXvVNOOATiDBWtD+6l8yB2Ax7ywJfAzqsFKefg0= X-Google-Smtp-Source: AA0mqf7AqqgNhU9jtazIcbn6DgI7aeauMd50WMLNzk/uWk6EOYvYXSfQheRr03IQgM6KxEg7y9Ug7U0QBPSMAIiFv08= X-Received: by 2002:a05:6402:1145:b0:46a:d5ee:d150 with SMTP id g5-20020a056402114500b0046ad5eed150mr43733638edw.312.1670366529655; Tue, 06 Dec 2022 14:42:09 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::531; envelope-from=jaopaulolc@gmail.com; helo=mail-ed1-x531.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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 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:300990 Archived-At: --000000000000a51a9f05ef3083bf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Dec 6, 2022 at 3:36 PM Stefan Monnier wrote: > > However, if those functions are bound to `beginning-of-defun-function' > > and `end-of-defun-function', > > Could you clarify? > `beginning-of-defun-function' is a variable holding a function. > Keys can be bound neither to that variable nor to the function it holds > (because it's not a command). > And functions usually aren't "bound" either. > Please ignore my wrong use of terminology. This is what I mean: (keymap-set bash-ts-mode-map "C-M-a" #'sh-mode--treesit-beginning-of-defun) (keymap-set bash-ts-mode-map "C-M-e" #'sh-mode--treesit-end-of-defun) If the above code is evaluated as part of bash-ts-mode startup, invoking C-M-a/e does as intended by the new functions. However, if the variables `beginning-of-defun-function' & `end-of-defun-function' are set as in: (setq-local beginning-of-defun-function #'sh-mode--treesit-beginning-of-defun) (setq-local end-of-defun-function #'sh-mode--treesit-end-of-defun) C-M-a works as intended, but C-M-e with negative arguments does not. --=20 Jo=C3=A3o Paulo L. de Carvalho Ph.D Computer Science | IC-UNICAMP | Campinas , SP - Brazil Postdoctoral Research Fellow | University of Alberta | Edmonton, AB - Canad= a joao.carvalho@ic.unicamp.br joao.carvalho@ualberta.ca --000000000000a51a9f05ef3083bf Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, Dec 6, 2022 at 3:36 PM Stefan Mon= nier <monn= ier@iro.umontreal.ca> wrote:
> However, if those funct= ions are bound to `beginning-of-defun-function'
> and `end-of-defun-function',

Could you clarify?
`beginning-of-defun-function' is a variable holding a function.
Keys can be bound neither to that variable nor to the function it holds
(because it's not a command).
And functions usually aren't "bound" either.
=

=C2=A0Please ignore my wrong use of terminology. This is what I me= an:

(keymap-set bash-ts-mode-map "C-M-a" #'sh-mode--tr= eesit-beginning-of-defun)
(keymap-set bash-ts-mode-map "C-M-e"= #'sh-mode--treesit-end-of-defun)

If the above code is evaluated= as part of bash-ts-mode startup, invoking=C2=A0C-M-a/e does as intended by= the new functions.

However, if the variables `beginning-of-defun-fu= nction' & `end-of-defun-function' are set as in:

(setq-l= ocal beginning-of-defun-function #'sh-mode--treesit-beginning-of-defun)=
(setq-local end-of-defun-function #'sh-mode--treesit-end-of-defun)<= br>

C-M-a works as intended, but C-M-e with negative ar= guments does not.

--
Jo=C3=A3o Paulo L. de Carvalho
Ph.D Computer S= cience | =C2=A0IC-UNICAMP | Campinas , SP - Brazil
Postdoctoral Research= Fellow | University of Alberta | Edmonton, AB - Canada
--000000000000a51a9f05ef3083bf--