GNU bug report logs - #63390
29.0.90; c-ts-mode fails to recognize functions in xterm.c

Previous Next

Package: emacs;

Reported by: Eli Zaretskii <eliz <at> gnu.org>

Date: Tue, 9 May 2023 12:03:01 UTC

Severity: normal

Found in version 29.0.90

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 63390 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: 63390 <at> debbugs.gnu.org
Subject: Re: bug#63390: 29.0.90; c-ts-mode fails to recognize functions in
 xterm.c
Date: Thu, 18 May 2023 09:56:16 +0300
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Wed, 17 May 2023 23:19:22 -0700
> Cc: 63390 <at> debbugs.gnu.org
> 
> >> Ok, so that’s because there are ifdef’s inside the function, which cuts the function into pieces and tree-sitter can’t make out a function_definition, which is what we use to fontify the function name. A function_declarator alone can be used in many places, like in an argument list for function pointers, I think?
> > 
> > Does this mean that on master movement by defuns will be broken around
> > those functions?
> 
> Yeah, unfortunately, I’ll try accommodate for it. 
> 
> > 
> >> I can fix this by fontifying top-level function_declaration, I think a top-level function_declaration should always be a function definition?
> > 
> > Yes, I think this would be better.
> > 
> >>>> Btw, function declarations in a header file are recognized as such,
> >>>> but the names of the functions there are still correctly fontified.
> >> 
> >> They are fine because there’s a semicolon in the end, so the function_decalration is wrapped in a declaration node, which we (the fontification rules) recognize.
> > 
> > Thanks for explaining this.
> 
> Should I fix this on emacs-29 or master? Sorry for the delay, I was having some distractions lately ;-)

No need to apologize.  We all have our lives, with their "disasters".

If the fix is relatively simple and safe, I'd prefer this to be fixed
on emacs-29.  But if not, we can fix it later; after all, on emacs-29
this is a relatively rare issue, since we don't use tree-sitter for
movement by defuns there.

Thanks.




This bug report was last modified 2 years and 6 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.