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#62825: 29.0.90; c-ts-mode doesn't recognize DEFUN functions Date: Fri, 14 Apr 2023 09:59:42 +0300 Message-ID: <83v8hzeyox.fsf@gnu.org> References: <831qkngdyx.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36234"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 62825@debbugs.gnu.org To: Yuan Fu , Theodor Thornhill Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 14 09:00:30 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 1pnDQ6-0009EI-LA for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 14 Apr 2023 09:00:30 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pnDPr-0000ZT-6q; Fri, 14 Apr 2023 03:00:15 -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 1pnDPg-0000Yy-MX for bug-gnu-emacs@gnu.org; Fri, 14 Apr 2023 03:00:06 -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 1pnDPf-0005kA-3y for bug-gnu-emacs@gnu.org; Fri, 14 Apr 2023 03:00:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pnDPe-0003Fz-Kc for bug-gnu-emacs@gnu.org; Fri, 14 Apr 2023 03:00: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: Fri, 14 Apr 2023 07:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62825 X-GNU-PR-Package: emacs Original-Received: via spool by 62825-submit@debbugs.gnu.org id=B62825.168145559512476 (code B ref 62825); Fri, 14 Apr 2023 07:00:02 +0000 Original-Received: (at 62825) by debbugs.gnu.org; 14 Apr 2023 06:59:55 +0000 Original-Received: from localhost ([127.0.0.1]:45328 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pnDPW-0003FA-JV for submit@debbugs.gnu.org; Fri, 14 Apr 2023 02:59:54 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:40486) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pnDPU-0003Ew-FK for 62825@debbugs.gnu.org; Fri, 14 Apr 2023 02:59:53 -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 1pnDPN-0005gK-9J; Fri, 14 Apr 2023 02:59:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=sZQ5qa5FHOBkKrYG+YC+3X0dTTFjw7iMTFyvPytaOhw=; b=cvEIrCc5nijI t/l9Nr3f/SPmhc3yY8+wbnDDRgGIXiuc8ZrPB+tAhzp+Az0LdyriqK9WPRab3GuhYGWKFhxDDX2+l OPOEO0O/+FpckdQg5SUP4lhjxfogvkr58m1es8QXmUJ2o55hf81LRk4GyD58wj95eJbmJ3E8SsUfP xSWbtU1aHCDMgOcen+CvMWY6VhBh4z3d+PRqAPRnzfS6S5bMBI/ZaBeov1OFbNkmYGfevbIipAeE6 XODhf7q8rNJ+Rksszjyfd/Rj6/wFNrPvx1sxVObsYUyl1ukSDvowVONcRxNYbgCbMu79mwRlQj4Ny 309I5gjAY9BXut87V0Acbw==; 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 1pnDPM-0003dX-DI; Fri, 14 Apr 2023 02:59:44 -0400 In-Reply-To: <831qkngdyx.fsf@gnu.org> (message from Eli Zaretskii on Fri, 14 Apr 2023 09:44:22 +0300) 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:259895 Archived-At: > Date: Fri, 14 Apr 2023 09:44:22 +0300 > From: Eli Zaretskii > > Evaluating '(treesit-defun-at-point)' inside a function defined via > the DEFUN macro yields nil, when the buffer is under c-ts-mode. This > gets in the way of significant functionalities, like > c-ts-mode-indent-defun and generating ChangeLog-style log entries > using "C-x 4 a" and the likes. > > To reproduce, visit any of the Emacs C source files, like treesit.c, > with c-ts-mode, move point to a function defined via DEFUN, and type > "C-x 4 a". The resulting ChangeLog entry will have the file name, but > not the expected function name in parentheses. > > Please fix this ASAP, this is a bad regression for those, like myself, > who want to use c-ts-mode. Using treesit-explore-mode I see that c-ts-mode regards DEFUN functions as a sequence of 2 expression_statement nodes. Here's the tree corresponding to the DEFUN macro call: (expression_statement (call_expression function: (call_expression function: (identifier) <<<<<<<<<<<<<<<<<<< arguments: (argument_list ( (string_literal " ") , (identifier) , (identifier) , (number_literal) , (number_literal) , (number_literal) , (identifier) (ERROR :) (comment) ))) arguments: (argument_list ( (identifier) (ERROR (identifier)) , (identifier) (ERROR (identifier)) ))) ;) The identifier node on the line indicated with "<<<<<" is "DEFUN", so maybe we can recognize this. The body of the DEFUN is another compound_statement node, following the DEFUN's node.