Subject: Re: bug#59628: 29.0.50; treesit-beginning/end-of-defun problems in C/C++

From: Daniel Martín <[email-masked]>
Date: Tue, 29 Nov 2022 01:12:59 +0100

Yuan Fu <[email-masked]> writes:

>
> Different languages have different grammars that give different names to
> function definitions and class definitions. So it is necessary to have a
> regexp variable. Finding such a regexp isn’t too hard, so I don’t think
> we need a default value. If we do have a default, it would be often wrong,
> given differences between language grammars.

I see that each major mode sets the value of that buffer-local variable.
c-ts-mode sets it to "\\(?:definition\\|specifier\\)" but, is that
correct?  In C code, treesit-explore-mode shows function definition
nodes as "function_definition", so I think the regexp is matching more
nodes than expected, causing C-M-a C-M-e to move to weird places in the
buffer.