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#65885: Acknowledgement (29.1.50; wrong behaviour of treesit-beginning-of-defun in c++-ts-mode) Date: Tue, 12 Sep 2023 15:27:35 +0300 Message-ID: <83h6nzpoeg.fsf@gnu.org> References: <871qf4doit.fsf@qq.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10549"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65885@debbugs.gnu.org To: yang.yingchao@qq.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 12 14:29:09 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 1qg2Vu-0002UA-LH for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 12 Sep 2023 14:29:06 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qg2Vn-0003yJ-KL; Tue, 12 Sep 2023 08:28:59 -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 1qg2Vm-0003xw-6u for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 08:28:58 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qg2Vl-0002Pi-VK for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 08:28:57 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qg2Vq-0003F0-HL for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 08:29: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: Tue, 12 Sep 2023 12:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65885 X-GNU-PR-Package: emacs Original-Received: via spool by 65885-submit@debbugs.gnu.org id=B65885.169452168412389 (code B ref 65885); Tue, 12 Sep 2023 12:29:02 +0000 Original-Received: (at 65885) by debbugs.gnu.org; 12 Sep 2023 12:28:04 +0000 Original-Received: from localhost ([127.0.0.1]:56410 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qg2Uu-0003Dk-8d for submit@debbugs.gnu.org; Tue, 12 Sep 2023 08:28:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32936) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qg2Ur-0003DH-VU for 65885@debbugs.gnu.org; Tue, 12 Sep 2023 08:28:03 -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 1qg2Ug-0002FK-RS; Tue, 12 Sep 2023 08:27:50 -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=tEj92hWY6VzVDlQbAHPDBBfTsVkIwxkvXSJ82m+QDlc=; b=W6kJbko55smu JyJT8Mm7Vc0/0q/mAOT2Q1bZaAsO91biPZ70fnLZUFrzWRtNLzcBgJm9BHPmx2SLGcF+Q2ryABo3n MOwV6Em1niAc+FH7UzxJAu5yOq29IgOkGKQmTkhQK7PT57B0QNArNyLS0+VhBGPnB95HrhE/arVpn 5yE4xuTsaSYY6pYmP2tgoJeQcM2MVXgyKZTwqVbQo60UN/wtCpmHTP9DdRgW8cy6/eU2Il37oiakq GgBW02U4WLHM+okK451fR0LEXGf7/DKX3Uvo2ayWb59iCM4siMRoZ7JILIcTx6WMwJlxEMmvJ2zCI uRy0r6Zqttm2ediwbl/JKg==; In-Reply-To: (bug-gnu-emacs@gnu.org) 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:270160 Archived-At: > Date: Tue, 12 Sep 2023 12:41:32 +0800 > From: Yang Yingchao via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > It seams that there is an issue with the behavior of `treesit-beginning-of-defun` function in > `c++-ts-mode` when there are static variables present in the source code. For instance, in the > provided code snippet, if the cursor is initially placed on the line containing `int b`, and the > "C-M-a" is pressed, the cursor is positioned on line 4 instead of line 1 where the beginning of > the function is located. > > ,---- > | void func // c-ts-mode: treesit-beginning-of-defun stops in this line, RIGHT > | { > | char * msg; > | static int a; // c++-ts-mode: treesit-beginning-of-defun stops in this line, WRONG > | int b; // PUT CUSOR HERE > | } > `---- > > it works in c-ts-mode works normally. If you want c++-ts-mode to work like c-ts-mode, set treesit-defun-tactic to 'top-level'. By default, we try to support nested defuns in C++, but not in C.