GNU bug report logs -
#64442
29.0.92; treesit-beginning-of-defun fails in DEFUN functions in C
Previous Next
Reported by: Eli Zaretskii <eliz <at> gnu.org>
Date: Mon, 3 Jul 2023 17:14:01 UTC
Severity: normal
Found in version 29.0.92
Done: Yuan Fu <casouri <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
> On Aug 14, 2023, at 4:59 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>
>> From: Yuan Fu <casouri <at> gmail.com>
>> Date: Sun, 13 Aug 2023 22:20:56 -0700
>> Cc: 64442 <at> 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”.
My bad, I must’ve been trying C-x 4 a in a different Emacs session, which worked. Anyway, I updated the patch and C-x 4 a should now work.
Yuan
[defun.patch (application/octet-stream, attachment)]
[Message part 3 (text/plain, inline)]
This bug report was last modified 1 year and 332 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.