From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#63390: 29.0.90; c-ts-mode fails to recognize functions in xterm.c Date: Mon, 15 May 2023 14:13:47 +0300 Message-ID: <83o7ml26fo.fsf@gnu.org> References: <837cthbtkz.fsf@gnu.org> <83ttwh3iuh.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9561"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 63390@debbugs.gnu.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 15 13:14:20 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pyW9i-0002J0-RS for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 May 2023 13:14:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pyW9V-0007sP-Ia; Mon, 15 May 2023 07:14:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyW9T-0007on-8W for bug-gnu-emacs@gnu.org; Mon, 15 May 2023 07:14:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pyW9S-0000gn-VY for bug-gnu-emacs@gnu.org; Mon, 15 May 2023 07:14:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pyW9S-0001FH-8Y for bug-gnu-emacs@gnu.org; Mon, 15 May 2023 07:14:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 May 2023 11:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63390 X-GNU-PR-Package: emacs Original-Received: via spool by 63390-submit@debbugs.gnu.org id=B63390.16841492314761 (code B ref 63390); Mon, 15 May 2023 11:14:02 +0000 Original-Received: (at 63390) by debbugs.gnu.org; 15 May 2023 11:13:51 +0000 Original-Received: from localhost ([127.0.0.1]:42858 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pyW9H-0001Ej-Ac for submit@debbugs.gnu.org; Mon, 15 May 2023 07:13:51 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:51844) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pyW9F-0001EX-EM for 63390@debbugs.gnu.org; Mon, 15 May 2023 07:13:49 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyW99-0000ft-RS; Mon, 15 May 2023 07:13:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=EGt/qTqUioGTyhQhdaZwOonA8Wm4Z+qkc0pNElGD3ZI=; b=pGETQUT5K1R5VuYUd+dE Y7qsoghLH15LmLxLhF9Pm1+8J5R+A2zFhevcGIVNqdOuo7ZtI1mVjuWF3TIIHWtGz072Bp7I6wLcB M/cuRcMhY2a8xCtjc2mpjfCBMuwsZ8/QS/iELSb21NvTMVQ5GUvj1JjwWcNrPuIzcE+454Tt3Y/Dc k+XQHjgFWD6z8zR1zfFSkm1khTcnBLjzQNUnztfUHgEFVWQHywafkicaEUzEsr4K//W2HTcZ8TlnI LKOBV9NaVqQtXg0s982WQxDQ/t062LBUEZXtnYhBKe4RXtZZhwTyyRyjQlz+ji+Bxkdy20ST13bg8 iZFYBg6EKbFXGw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyW99-0003sv-B1; Mon, 15 May 2023 07:13:43 -0400 In-Reply-To: (message from Yuan Fu on Sun, 14 May 2023 22:47:06 -0700) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:261735 Archived-At: > From: Yuan Fu > 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? > 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.