unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 63390@debbugs.gnu.org
Subject: bug#63390: 29.0.90; c-ts-mode fails to recognize functions in xterm.c
Date: Wed, 17 May 2023 23:19:22 -0700	[thread overview]
Message-ID: <5DD50A1C-F069-4FA8-8F2B-F273409310AE@gmail.com> (raw)
In-Reply-To: <83o7ml26fo.fsf@gnu.org>



> On May 15, 2023, at 4:13 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Sun, 14 May 2023 22:47:06 -0700
>> Cc: 63390@debbugs.gnu.org
>> 
>>>> (function_declarator declarator: (identifier)
>>>>  parameters: 
>>>>   (parameter_list (
>>>>    (parameter_declaration
>>>>     type: (struct_specifier struct name: (type_identifier))
>>>>     declarator: (pointer_declarator * declarator: (identifier)))
>>>>    )))
>>>> 
>>>> Same with the next function, x_draw_composite_glyph_string_foreground.
>>>> But the function after that, x_draw_glyphless_glyph_string_foreground,
>>>> is again recognized as function definition.  I wonder if the
>>>> preprocessor conditionals around there have something to do with that.
>> 
>> 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 ;-)

Yuan






  reply	other threads:[~2023-05-18  6:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-09 12:03 bug#63390: 29.0.90; c-ts-mode fails to recognize functions in xterm.c Eli Zaretskii
2023-05-12 11:11 ` Eli Zaretskii
2023-05-15  5:47   ` Yuan Fu
2023-05-15 11:13     ` Eli Zaretskii
2023-05-18  6:19       ` Yuan Fu [this message]
2023-05-18  6:56         ` Eli Zaretskii
2023-05-19 23:13           ` Yuan Fu
2023-05-20  5:42             ` Eli Zaretskii
2023-05-20  8:17               ` Yuan Fu
2023-05-20  9:38                 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5DD50A1C-F069-4FA8-8F2B-F273409310AE@gmail.com \
    --to=casouri@gmail.com \
    --cc=63390@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).