emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Code navigation for sh-mode with Tree-sitter


From: João Paulo Labegalini de Carvalho
Subject: Re: Code navigation for sh-mode with Tree-sitter
Date: Tue, 6 Dec 2022 15:41:58 -0700

On Tue, Dec 6, 2022 at 3:36 PM Stefan Monnier <monnier@iro.umontreal.ca> 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.

--
João Paulo L. de Carvalho
Ph.D Computer Science |  IC-UNICAMP | Campinas , SP - Brazil
Postdoctoral Research Fellow | University of Alberta | Edmonton, AB - Canada
joao.carvalho@ic.unicamp.br
joao.carvalho@ualberta.ca

reply via email to

[Prev in Thread] Current Thread [Next in Thread]