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