[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#64442: 29.0.92; treesit-beginning-of-defun fails in DEFUN functions
From: |
Eli Zaretskii |
Subject: |
bug#64442: 29.0.92; treesit-beginning-of-defun fails in DEFUN functions in C |
Date: |
Mon, 14 Aug 2023 14:59:02 +0300 |
> From: Yuan Fu <casouri@gmail.com>
> Date: Sun, 13 Aug 2023 22:20:56 -0700
> Cc: 64442@debbugs.gnu.org
>
> > I like this much better than what we have now, thanks. But I have a
> > question: can we perhaps recognize the "function" of the body as such,
> > and then automatically move to the previous defun, which is the right
> > place? The "defun" that is the body has no name, so maybe that could
> > be used as a sign?
>
> We can easily tell the body from the declaration, but we can’t easily tell
> whether we should automatically move forward or backward. When point arrives
> at the point between the declaration and the body, should it move to the
> beginning of the next defun or the beginning of the declaration? This, plus
> it’s not straightforward to know whether we are in between a body and a
> declaration. I really don’t want to add even more cursed hacks into
> c-ts-mode.el :-)
Too bad, but okay.
> > That would allow "C-x 4 a" to work inside a DEFUN,
> > something that still works less reliably with this patch: you must be
> > in the "first defun" to get it to find the name of the function.
>
> C-x 4 a should’ve been fixed already. And it shouldn’t rely on this fix to
> work. Do you have a recipe for when it doesn’t work?
Just try it with your patch. If point is inside the body, the
function's name is not captured by "C-x 4 a".