Subject: Re: bug#64442: 29.0.92; treesit-beginning-of-defun fails in DEFUN functions in C

From: Eli Zaretskii <[email-masked]>
Date: Fri, 07 Jul 2023 09:40:12 +0300

> From: Yuan Fu <[email-masked]>
> Date: Thu, 6 Jul 2023 23:15:00 -0700
> Cc: [email-masked]
> 
> > On Jul 4, 2023, at 4:39 AM, Eli Zaretskii <[email-masked]> wrote:
> > 
> > Why cannot we look for a top-level expression_statement node which is
> > a call_expression whose function identifier is "DEFUN" and whose
> > position is between the place where C-M-a was invoked and the place
> > where it does find a defun?
> 
> It’s gonna be ugly, but I can take a jab at it this weekend. I’m thinking of a wrapper function that tries to detect DEFUN before falling back to the ordinary tree-sitter defun movement function.

Thanks.  let's see how ugly it is before deciding whether it's worth it.

> > DEFUN's cannot be nested, so we don't need to consider that.
> 
> Yeah, in general C sources don’t have nested defuns, only C++ ones do.

No, I meant the use of DEFUN macros in Emacs cannot be nested.