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 14:46:41 -0700

> > Should we make it configurable, then? A variable that makes
> > tree-sitter defun navigation switch between two modes: top-level only
> > and not top-level only.

In CC Mode, it has been configurable via the user option c-defun-tactic
for somewhere between ten and fifteen years.  When c-defun-tactic is t,
C-M-a/e go to the start/end of the top level defuns.  When it is the
symbol go-outward, C-M-a/e move to the next start/end of defun, if any,
at the current level of class/namespace nesting, and move outwards to
the next level of class/namespace nesting when a class/namespace boundary
is reached.

The 'go-outward behavior is the one I have implemented.

I don't remember any complaints about this mechanism.

> And for functions nested in a class: if you type C-M-e at the beginning
> of a class, should it go to the end of the first function in that
> class, or should it go to the end of the class? Right now because of
> how end-of-defun works, it will jump to the end of the class if point
> is at the beginning of the class (1), and jump to the first function if
> point is before the beginning of the class (2).

This doesn't seem sensible.

I tend to agree. I would expect it to go to the nearest node (either class or function) and not bypass a class node in favor of function nodes. 

--
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]