From unknown Mon Aug 18 04:46:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#65885: 29.1.50; wrong behaviour of treesit-beginning-of-defun in c++-ts-mode Resent-From: Yang Yingchao Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 12 Sep 2023 04:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 65885 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 65885@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Reply-To: yang.yingchao@qq.com Received: via spool by submit@debbugs.gnu.org id=B.169449251427125 (code B ref -1); Tue, 12 Sep 2023 04:22:02 +0000 Received: (at submit) by debbugs.gnu.org; 12 Sep 2023 04:21:54 +0000 Received: from localhost ([127.0.0.1]:55652 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfuuP-00073R-Mc for submit@debbugs.gnu.org; Tue, 12 Sep 2023 00:21:54 -0400 Received: from lists.gnu.org ([2001:470:142::17]:38828) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfuuK-000730-5m for submit@debbugs.gnu.org; Tue, 12 Sep 2023 00:21:52 -0400 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 1qfuu8-0005WF-0G for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 00:21:36 -0400 Received: from xmbgsz7.mail.foxmail.com ([61.241.55.164]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qfuu2-0000LI-4x for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 00:21:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1694492471; bh=FczVmXhgWDsSvXajJY85Vq5BsU6XlO1BFQUzsdrxudM=; h=From:To:Subject:Date:Reply-To; b=KmzFJ4BB6pBA34zvATjLXesE3CN4kOJ6qjfjp5rkNaI3exvROJVZYmvwuF9mhRjJ+ bOY8oAJM+yKVKiuAi2QpXYRvHMY0VYD9nAzIctvKsHeXDYu0S7Km6F+6glYjaIxj8Q 7knCeau2ln2Jl4+7tdWQK4vmaJliM+kQ0t6i1YcM= Received: from tdesk ([60.26.149.220]) by newxmesmtplogicsvrsza7-0.qq.com (NewEsmtp) with SMTP id 16E2C21B; Tue, 12 Sep 2023 12:05:46 +0800 X-QQ-mid: xmsmtpt1694491546tn33kcdci Message-ID: X-QQ-XMAILINFO: N26DAMVpW7UEqNOsdc83d/kRDM1kWb/zwSmiq6p+7rhrV/gYS/Pm1rOMnW5qlV ixTeKexvGPNQZhuCcgeqJhlIL2BjfHb9kLsL9sbqC2uVHLXIo8ZSiI5pbgx/VXi5HfVhxoKGZ/x8 6kiwbgFWgjsxvH55EWoet8hhcboKEdHZFUMWBp7HJkQklePRWtBtr4DJ8lJijuudY1WJS46zTRzx 3bO3RYmFwQJltGw3SXfVf1vN7AxatVdWpurFexScBYTrtlzUBJ7Da/ilR194uqwfUja+5c8Y2VLv DP5ENVTyItougbs7WoGiNAp6seAnW5+QlUcUnrgLuR1T7B3/udxpVs83AORFIm6xc6vzB6QnswNi YtA0xJaKUhIqZ2myengjZWqZtbTLTwdgnjftNNAlvC8FxkIo/7NcYql9o1ge9SvoNocto7p6stRB dUIfGWdxMh1PH9a6pyksOnBAAtDoxbDEoUdfQD9MfZduJLZH7/oNugx7oF4LVGL7usTudywvtg+C ItGyH86TFWleb95DDVcgUfz1sY+baMyycSP/vE5633M+rDqGdsevxpHQ+9q3sNaVUPT0eYDeIMjj 7+Y5wfpTgIr7YhPAPmERU/fNDr7KJBxYgKGKxZWARVx2HRHabF0aXcib+MwabNUaWN/EQCwBmYOB AE/9AU+FmkNHTaVFe5RHcK8zZ3LxzeMpjwp9S+FEXx6Goarbc8WKb15n/eh6u0kLofRvOhT50q7j Tv5UKiBekOLz2RvIxx1QJP9s5ByjNDA3n+c9cBBaV3XHU88W+x3iozssE62togeBHn2SVKA1NbfL yLSN4ch521ugpLcVZlGCo3m7WecYY24BOHCftjnlTXdOEs329MAScJvkjnGzXKXuLLSv/ieOJvjS bdwE/F25D43bRQ5tx1Qk9EDB8LWRh76qQFT0XNfwSde0ezlKReDto= X-QQ-XMRINFO: MSVp+SPm3vtS1Vd6Y4Mggwc= From: Yang Yingchao Date: Tue, 12 Sep 2023 12:04:47 +0800 User-agent: mu4e 1.10.6; emacs 29.1.50 Message-ID: <871qf4doit.fsf@qq.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=61.241.55.164; envelope-from=yang.yingchao@qq.com; helo=xmbgsz7.mail.foxmail.com X-Spam_score_int: 16 X-Spam_score: 1.6 X-Spam_bar: + X-Spam_report: (1.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, EMPTY_MESSAGE=2.32, FREEMAIL_FROM=0.001, PYZOR_CHECK=1.392, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, TVD_SPACE_RATIO=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 2.3 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Content analysis details: (2.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (yang.yingchao[at]qq.com) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.9 SPF_FAIL SPF: sender does not match SPF record (fail) [SPF failed: Please see http://www.openspf.org/Why?s=mfrom;id=yang.yingchao%40qq.com;ip=2001%3A470%3A142%3A%3A17;r=debbugs.gnu.org] 2.3 EMPTY_MESSAGE Message appears to have no textual parts -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager From unknown Mon Aug 18 04:46:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#65885: Acknowledgement (29.1.50; wrong behaviour of treesit-beginning-of-defun in c++-ts-mode) Resent-From: Yang Yingchao Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 12 Sep 2023 04:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65885 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 65885@debbugs.gnu.org Reply-To: yang.yingchao@qq.com Received: via spool by 65885-submit@debbugs.gnu.org id=B65885.169449375329127 (code B ref 65885); Tue, 12 Sep 2023 04:43:02 +0000 Received: (at 65885) by debbugs.gnu.org; 12 Sep 2023 04:42:33 +0000 Received: from localhost ([127.0.0.1]:55664 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfvEO-0007Zj-T4 for submit@debbugs.gnu.org; Tue, 12 Sep 2023 00:42:33 -0400 Received: from out203-205-221-235.mail.qq.com ([203.205.221.235]:42134) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfvEJ-0007ZM-5N for 65885@debbugs.gnu.org; Tue, 12 Sep 2023 00:42:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1694493732; bh=oRFSBqHveYWS5AbLM3eQBX/pYrsiqsPiBhD4aTM0ols=; h=From:To:Subject:Date:References:Reply-To:In-reply-to; b=D6QjRokdrUM4pKJoCWyQFWZ4O8bOtdaNTtzry+0B8a3rxUDjL0LQXQdxaRft8utd6 xLpQ/B8akNDz7ZWE5DSxm1dmoHxQBcREMSO1X6JJR0RTirTkffJStalTlmxwU/Gg8j 1Rc6YnmOYaXXAZ0DaMGk+ckgmaM9GgDmN4RcmY4E= Received: from tdesk ([60.26.149.220]) by newxmesmtplogicsvrszb1-0.qq.com (NewEsmtp) with SMTP id A8B18C88; Tue, 12 Sep 2023 12:42:11 +0800 X-QQ-mid: xmsmtpt1694493731tlejm8g2s Message-ID: X-QQ-XMAILINFO: MziGzrjZeogZU2wq9H5vKaqqI9XFdcaLLA/sk/QD9twHFwcjOk2B/GFqCIN8qU sGVfikzq0iarvMrrrptEdPSDnv6sLZUKn5NNADsYaM25zkk4l/6OwgpTDdftbdHDMm7yzCUIPp0g +9lPURyA9dWrppF4FK3Bvr7k65fJx1V6TxJdl4C6ogBCT0Nj+y2W7b8dUC9thuJCu9umY8Hnpkdh JsAuxxj1TVGGIfwXMAwp1p5mM/JOq5iMzKbJpnS4/pLmmXkE8JSd0J1GIhmk7BrpHPPththfQCgd cSpJVq2PQDgb1xThXFC/KOHHQ3hdL1LLQsaMucGQ/2OVyhid30AVJdM1Spy8jYNqlWOHLRUfEVVL iwGX9UZVGI+pmnQKpV1B3jgrKBoeMVAcwYTFMw6wPvxNPObAvgcV/zxZXerK677A3PkYpuvaRw47 kyyZoKBUWvfHxVC3/RZ3+JpisCOSoFHgQ7XaWMiv+Yj9Y9/sJ0vHWJbgHxB6iewbzvCCDHAsrlmn FqDVvPVkxxSG1GT4nl/n76Z4UoSnnM3c6bXcM5CPjSB4OXlxN0wvfbKe2nzL+tPlRtsQrXm/fZV0 mDoBfilEA2hHeBmeoXu9mH6jYlJT9xf21C1lHrvYvZpfFKyFqoUNnthRL7hO4whUc6i1CPHR8TgM SQHyD+6ooJajYi5EYAlfww1caSlmWnPZREY1HhX0fqbMMR0/AbtKc4TdUInCXIVFK77GL797H4H0 4wxRKr+M2hpuTvXpqeraapCMswfrKo8SBZUhxkUIt9uYTbPawrC9QXxNarYMNGP3PkqUme6XP2+O 5IlQfAY3Jtde7Vqai/iWvcJrEyaMrEyID644niDNTp3PuRWS9xu5GF5v1pZIdiNrFPpsktFMRpBr Ure+rCeZrF4RAg4EmPYfaJk/joIariUpHhffsj37Jsa/BRmde1mc3WAztOLzH/DgQxa0NHHj8CU8 I+/WOGmdDHoE55HxbtsXfKbJ8rvV0t X-QQ-XMRINFO: MPJ6Tf5t3I/ycC2BItcBVIA= From: Yang Yingchao Date: Tue, 12 Sep 2023 12:41:32 +0800 References: <871qf4doit.fsf@qq.com> User-agent: mu4e 1.10.6; emacs 29.1.50 In-reply-to: Message-ID: <87zg1sc89p.fsf@qq.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 3.6 (+++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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 co [...] Content analysis details: (3.6 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [203.205.221.235 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (yang.yingchao[at]qq.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 3.2 HELO_DYNAMIC_IPADDR Relay HELO'd using suspicious hostname (IP addr 1) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 2.6 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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 co [...] Content analysis details: (2.6 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [203.205.221.235 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (yang.yingchao[at]qq.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 3.2 HELO_DYNAMIC_IPADDR Relay HELO'd using suspicious hostname (IP addr 1) -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager --=-=-= Content-Type: text/plain Content-Disposition: inline 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. Regards. On Tue, Sep 12 2023, help-debbugs@gnu.org (GNU bug Tracking System) wrote: > Thank you for filing a new bug report with debbugs.gnu.org. > > This is an automatically generated reply to let you know your message > has been received. > > Your message is being forwarded to the package maintainers and other > interested parties for their attention; they will reply in due course. > > Your message has been sent to the package maintainer(s): > bug-gnu-emacs@gnu.org > > If you wish to submit further information on this problem, please > send it to 65885@debbugs.gnu.org. > > Please do not send mail to help-debbugs@gnu.org unless you wish > to report a problem with the Bug-tracking system. Regards, -- *Yang Yingchao* --=-=-=-- From unknown Mon Aug 18 04:46:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#65885: Acknowledgement (29.1.50; wrong behaviour of treesit-beginning-of-defun in c++-ts-mode) 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 X-GNU-PR-Keywords: To: yang.yingchao@qq.com Cc: 65885@debbugs.gnu.org Received: via spool by 65885-submit@debbugs.gnu.org id=B65885.169452168412389 (code B ref 65885); Tue, 12 Sep 2023 12:29:02 +0000 Received: (at 65885) by debbugs.gnu.org; 12 Sep 2023 12:28:04 +0000 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 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 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==; Date: Tue, 12 Sep 2023 15:27:35 +0300 Message-Id: <83h6nzpoeg.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (bug-gnu-emacs@gnu.org) References: <871qf4doit.fsf@qq.com> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > 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. From unknown Mon Aug 18 04:46:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#65885: Acknowledgement (29.1.50; wrong behaviour of treesit-beginning-of-defun in c++-ts-mode) Resent-From: Yang Yingchao Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Sep 2023 00:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65885 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 65885@debbugs.gnu.org Reply-To: yang.yingchao@qq.com Received: via spool by 65885-submit@debbugs.gnu.org id=B65885.16945640108477 (code B ref 65885); Wed, 13 Sep 2023 00:14:01 +0000 Received: (at 65885) by debbugs.gnu.org; 13 Sep 2023 00:13:30 +0000 Received: from localhost ([127.0.0.1]:60317 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgDVZ-0002Cf-Tn for submit@debbugs.gnu.org; Tue, 12 Sep 2023 20:13:30 -0400 Received: from out162-62-57-87.mail.qq.com ([162.62.57.87]:53925) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgDVV-0002CO-GH for 65885@debbugs.gnu.org; Tue, 12 Sep 2023 20:13:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1694563984; bh=HI0vhiTKy8mQ9EA4UpCAYmpnfrQOos6hkrHmMJm0epI=; h=From:To:Cc:Subject:Date:References:Reply-To:In-reply-to; b=YBNb8hqtGhFcVGBjYENSGwF1Ohf9hCNrfKTrNxrImSL0ade+BB/4+HTXSFw3FWRfJ A1OTwMfrgivfELFC4DkNaKrlkfaBcCKlOWbH50/L7Q/A0z20kveGRocrYiW1agO0mZ 4tKIMraPBFm0E1TXg91C9vWoEFsqikvHnqh+1M70= Received: from tdesk ([60.26.149.220]) by newxmesmtplogicsvrszc2-0.qq.com (NewEsmtp) with SMTP id 34299823; Wed, 13 Sep 2023 08:13:02 +0800 X-QQ-mid: xmsmtpt1694563982tgvfb4q7r Message-ID: X-QQ-XMAILINFO: N9lasXYeZMXWD6wnEFrb3VW8IdQeB443bMgyDKTh5zzx4OqytSYubuziGwKfZ/ 6F6J6eRBioGeJzWdI2iS6K7ABVVhD3hEYwrYkUt39WlV0qtxuAkxb8h34RtT1MEw2JFOyKrhBWDL OPd9AIeNXuAWykD/huJXUpfWMEph7IdVGom1DFoIikXEYkMmAywPzOaxQ3s9aVQ9c8DLJvRJqMA1 Z1skKZXHaNyoNaplz2t1hV9F2r1OYPV32ndypxqhRVPGSZvJD3zYWtwmsG19jTESWTa5xTHgn9lu 0T3dheDA7kqH0NeHZr1iAnkfoqGbw438exYeQrDw9JJzm0gDFPV4KQEfTcQntdxLttgMgtWAKDX0 ZXfETWtB/OI1x2a7MnXK3XrL5ETPDKJ58v7bsim1zycna1Zjo9VhuQcp1W7He8/TNhd0rbofoAnY gXRCbBKUClcMU0HBFePJqWDnIWYOX5qLxpSgvJczbYyJrKjThtITwWQkyy8dAZMmq3VcyzATOxZv kVeM/eomHLnNXaqeUbtaq46cdVgSHItiGY1Mb5x0rjYuaMc+eZzOnwPMDIb263qWBTDOodEd9AdM 9SwxwYJX6WLR9blsJpiHwzIMAUXaWLoR84qDlfWXksGmMeFNiwpiA2NKrp9AB1OT09z/59LAKXHl IoXVTRCbiUwMdvOW1pQiPiEnfSsvERqW9NEA50LgF40r/owpoa3DUYKKoBQ/kySkbXHM0hZiAaa1 N+uwyX7r5pH0+tlwXKxFnMwLQ3wZnQNfjac0SRiU0sFxUUuNqQtWibb8AfXPA38/nrILnyavq2iy WfZ2IFzNyjBUqgKxTI1ObCrIG7waN1ppHwh0nhQAwiKz69kNZdtKe5WRt6OWapr+ov4DbX+fxjmA 4kwF7WoX30aKrC5QdhJ3vS6Yow2I3MjUU3Zjd/gTqnfONQds2Pfu1Iu7xM5FYaHtM86muVRvHji1 WZNmBmxIo= X-QQ-XMRINFO: OD9hHCdaPRBwq3WW+NvGbIU= From: Yang Yingchao Date: Wed, 13 Sep 2023 08:03:48 +0800 References: <871qf4doit.fsf@qq.com> <83h6nzpoeg.fsf@gnu.org> User-agent: mu4e 1.10.6; emacs 29.1.50 In-reply-to: <83h6nzpoeg.fsf@gnu.org> Message-ID: <87wmwv9bhu.fsf@qq.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 3.6 (+++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: >> 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 `t [...] Content analysis details: (3.6 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [162.62.57.87 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [162.62.57.87 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (yang.yingchao[at]qq.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 3.2 HELO_DYNAMIC_IPADDR Relay HELO'd using suspicious hostname (IP addr 1) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 2.6 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: >> 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 `t [...] Content analysis details: (2.6 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [162.62.57.87 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [162.62.57.87 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (yang.yingchao[at]qq.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 3.2 HELO_DYNAMIC_IPADDR Relay HELO'd using suspicious hostname (IP addr 1) -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager --=-=-= Content-Type: text/plain Content-Disposition: inline >> 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. I apologize, but I realized that I have already asked this question before. However, setting 'treesit-defun-tactic' to 'top-level' could cause other issues, as seen in the following snippets: ,---- | class Name { | public: | Name() | { | // cursor here | } | | void func() | { | static int a; | } | | }; `---- Suppose the cursor is in line 5, and "C-M-a" is pressed: - In 'c++-mode', the cursor will be moved to the start of the function 'Name()', which is the expected behavior. - In 'c++-ts-mode': - With 'treesit-defun-tactic' set to 'nested', it behaves the same as in 'c++-mode'. - With 'treesit-defun-tactic' set to 'top-level', the cursor is moved to the beginning of the class, i.e., line 1. Is it possible to make 'c++-ts-mode' behave the same as in 'c++-mode'? Regards. --=-=-=-- From unknown Mon Aug 18 04:46:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#65885: Acknowledgement (29.1.50; wrong behaviour of treesit-beginning-of-defun in c++-ts-mode) Resent-From: Yang Yingchao Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Sep 2023 00:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65885 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii , 65885@debbugs.gnu.org Reply-To: yang.yingchao@qq.com Received: via spool by 65885-submit@debbugs.gnu.org id=B65885.169456610811843 (code B ref 65885); Wed, 13 Sep 2023 00:49:02 +0000 Received: (at 65885) by debbugs.gnu.org; 13 Sep 2023 00:48:28 +0000 Received: from localhost ([127.0.0.1]:60325 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgE3Q-00034u-3I for submit@debbugs.gnu.org; Tue, 12 Sep 2023 20:48:28 -0400 Received: from out162-62-57-87.mail.qq.com ([162.62.57.87]:54327) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgE3J-00033U-BH for 65885@debbugs.gnu.org; Tue, 12 Sep 2023 20:48:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1694566082; bh=E9E+CzVmeZ+ENpGFfXacTR8m4AFmK632mA8ONvQciio=; h=From:To:Subject:Date:References:Reply-To:In-reply-to; b=RaXptm+cVriRyf0726Db7IvGycgKhM4eIGu0IPN41SHhHY2kQCIiQvHfj2C/aejsf Ag2Z+P39dCXr6eAKBT+NsMoBm1DUmqiDnzVe00Ef/RLlTpuMrU0kvZjUVGopwzqIPQ orOidoNhyf8FwpCTMh68EV4uwMQ7DoumYsOGRHCo= Received: from tdesk ([60.26.149.220]) by newxmesmtplogicsvrszc5-0.qq.com (NewEsmtp) with SMTP id C00ADE84; Wed, 13 Sep 2023 08:48:00 +0800 X-QQ-mid: xmsmtpt1694566080tq8jszb4s Message-ID: X-QQ-XMAILINFO: OVFdYp27KdlJCLXy1OvRdJ3wh3IOdv5s1yigTwgrEKNaOm4rCwCn6RdIqI0YZ6 Ge3W8MMB0xqgOpndaXi9JNPvv3Ges5FmUfg3Ka8sUXBnLMgNAJAJTC0+3zUxYtxHJII4TzxyZMth 2FzPsjep34tqiddgd3+uJVVvOIsJf9OMv/efg2O463hxmIKswtSEoHuR3KvL/yDrCHsTcIhSm5IU TfcN6NeKE1b1VSbLssdkAnqximy0+MlrUWxsiHOvxifjau8fgx3bDDjPDbhx1LFhzUce/1f6HZly rnxFobiq3+qt6nb6JufFWTJ1/HNQdTu+uBPQeOfvc+iR33am7Oip4tvvS+ZeJs3BqDJ7PGv+xTQ6 eFUlo8oRvaIcKHeKal7yNRVsaM82rwTRbi4exGrhdHIUXeXChv7aCAgqOcs0pXW9ZDELm+vEoBhG aJbHkMwZeY37wo+PVDhC1kq77e1IX1cLe20PU7FyyAAFJ1mJ44/ZVCaROmufmvuXb+hUaeyo9hko EMdnznPPE8o12xupLVEByZa4AYGTV5wHkwWHfObdoxxRJXnQjdzVFNYUUbYCD0YFpeWRo8YAsVMG ApkF+W2jcvQ+k7e5u5nPvwcRY2jffTKP8rgEc/EO03WjtPm1GYOWEOsQCTwXg0Pto6zvCg/xluHj 5iw/QaLUpi+g5JinUyI5NSQZAdWo3Q7bekBp9CioYqGkD95o4v3fuHZe5snzWhJp9CmE9NgQYiBN ederUY+iNzDd2SE+wzbzAr9EX08DGvY1Zxa/qXdOCHlDNIk4+Je3cjKXcZizrv7A91oqSzu3cvy3 wAm3MdUlquBtO8EUv0cjvyuiMYGi4Q9czmmhLeWscAaEUp1XzhjAByWnUP7GWJE3eKMHg8ouch4o XZ3cac9X5B3RFMIJIC8Al1UYHYb+kp/Oc6rERJh6I/Ah2K7FN9BzTVEDHn5vDfZJ8FOoZFHe/ed/ hEZsTW8hoG2FZeDa/HqqmsYfCHQo9QKFGSpcP9Y6slyVkvz+uA+/ezikcTq7jJ4cCbTjuXNupIUT T/At0yN3gIR6K0uUsa X-QQ-XMRINFO: MPJ6Tf5t3I/ycC2BItcBVIA= From: Yang Yingchao Date: Wed, 13 Sep 2023 08:41:27 +0800 References: <871qf4doit.fsf@qq.com> <83h6nzpoeg.fsf@gnu.org> <87wmwv9bhu.fsf@qq.com> User-agent: mu4e 1.10.6; emacs 29.1.50 In-reply-to: <87wmwv9bhu.fsf@qq.com> Message-ID: <87v8ceaofz.fsf@qq.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 3.6 (+++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: >>> 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 [...] Content analysis details: (3.6 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [162.62.57.87 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (yang.yingchao[at]qq.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [162.62.57.87 listed in wl.mailspike.net] 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 3.2 HELO_DYNAMIC_IPADDR Relay HELO'd using suspicious hostname (IP addr 1) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 2.6 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: >>> 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 [...] Content analysis details: (2.6 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [162.62.57.87 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [162.62.57.87 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (yang.yingchao[at]qq.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 3.2 HELO_DYNAMIC_IPADDR Relay HELO'd using suspicious hostname (IP addr 1) -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager --=-=-= Content-Type: text/plain Content-Disposition: inline >>> 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. > > > I apologize, but I realized that I have already asked this question before. > > However, setting 'treesit-defun-tactic' to 'top-level' could cause other > issues, as seen in the following snippets: > > > ,---- > | class Name { > | public: > | Name() > | { > | // cursor here > | } > | > | void func() > | { > | static int a; > | } > | > | }; > `---- > > Suppose the cursor is in line 5, and "C-M-a" is pressed: > > - In 'c++-mode', the cursor will be moved to the start of the function 'Name()', which is the expected behavior. > - In 'c++-ts-mode': > - With 'treesit-defun-tactic' set to 'nested', it behaves the same as in 'c++-mode'. > - With 'treesit-defun-tactic' set to 'top-level', the cursor is moved to the beginning of the class, i.e., line 1. > > Is it possible to make 'c++-ts-mode' behave the same as in 'c++-mode'? > > Regards. Maybe I'm wrong, but I would like to suggest reconsidering the solution to the 'begging-of-defun' issue related to the static *variable*. It feels strange to me to fix this issue by changing the 'treesit-defun-tactic', which is meant to apply to a *function* literally... --=-=-=-- From unknown Mon Aug 18 04:46:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#65885: Acknowledgement (29.1.50; wrong behaviour of treesit-beginning-of-defun in c++-ts-mode) Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Sep 2023 12:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65885 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: yang.yingchao@qq.com, Yuan Fu Cc: 65885@debbugs.gnu.org Received: via spool by 65885-submit@debbugs.gnu.org id=B65885.169460722524016 (code B ref 65885); Wed, 13 Sep 2023 12:14:02 +0000 Received: (at 65885) by debbugs.gnu.org; 13 Sep 2023 12:13:45 +0000 Received: from localhost ([127.0.0.1]:32803 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgOka-0006FI-JY for submit@debbugs.gnu.org; Wed, 13 Sep 2023 08:13:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46738) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgOkX-0006F4-Tj for 65885@debbugs.gnu.org; Wed, 13 Sep 2023 08:13:43 -0400 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 1qgOkK-0004Rc-NT; Wed, 13 Sep 2023 08:13:29 -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=/bFQLG4CsvaUoDRNZls+U0jZnR2A9idxbu7LvN/4yt4=; b=ey7fWxVqoTH5 uY/j3bjyKza0h3XjvG336cgvWodTmjyvClxvDoKfloKRnCUx9i642w9Zqx0eHj6UC2+75Y4T0uGiN xdOcPP2aVASGA9LWUL5bYaUzD6fRf2EmCMV49f3+4Ta3XKu/BgoHF6xEYs6ni3yoxuMKagdAdlXNK 2Ej7doqgV/nR/qdc+N8hwCHV+P280tBAzbINO7tmxhoSIjgHOMLf64GYYA22qvfPaMsZ5StfoAXgF lF4J0x5gfa2yIHmpIOmxCX5tyJRWON5FnMlQoUJq4WZFw0PJeRTS9n8nEXMFxB4tmJomXi4awClwG 7jk7o2GsvNEZsPfSJldP+A==; Date: Wed, 13 Sep 2023 15:13:14 +0300 Message-Id: <83h6nynued.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Yang Yingchao on Wed, 13 Sep 2023 08:41:27 +0800) References: <871qf4doit.fsf@qq.com> <83h6nzpoeg.fsf@gnu.org> <87wmwv9bhu.fsf@qq.com> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Yang Yingchao > Date: Wed, 13 Sep 2023 08:41:27 +0800 > > >>> 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. > > > > > > I apologize, but I realized that I have already asked this question before. > > > > However, setting 'treesit-defun-tactic' to 'top-level' could cause other > > issues, as seen in the following snippets: > > > > > > ,---- > > | class Name { > > | public: > > | Name() > > | { > > | // cursor here > > | } > > | > > | void func() > > | { > > | static int a; > > | } > > | > > | }; > > `---- > > > > Suppose the cursor is in line 5, and "C-M-a" is pressed: > > > > - In 'c++-mode', the cursor will be moved to the start of the function 'Name()', which is the expected behavior. > > - In 'c++-ts-mode': > > - With 'treesit-defun-tactic' set to 'nested', it behaves the same as in 'c++-mode'. > > - With 'treesit-defun-tactic' set to 'top-level', the cursor is moved to the beginning of the class, i.e., line 1. > > > > Is it possible to make 'c++-ts-mode' behave the same as in 'c++-mode'? > > > > Regards. > > Maybe I'm wrong, but I would like to suggest reconsidering the solution to the 'begging-of-defun' issue related to the static *variable*. It feels strange to me to fix this issue by changing the 'treesit-defun-tactic', which is meant to apply to a *function* literally... Yuan, any ideas or suggestions? From unknown Mon Aug 18 04:46:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#65885: Acknowledgement (29.1.50; wrong behaviour of treesit-beginning-of-defun in c++-ts-mode) Resent-From: Yang Yingchao Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 Sep 2023 00:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65885 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: Yuan Fu , 65885@debbugs.gnu.org Reply-To: yang.yingchao@qq.com Received: via spool by 65885-submit@debbugs.gnu.org id=B65885.16946509716890 (code B ref 65885); Thu, 14 Sep 2023 00:23:01 +0000 Received: (at 65885) by debbugs.gnu.org; 14 Sep 2023 00:22:51 +0000 Received: from localhost ([127.0.0.1]:36355 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qga8A-0001n2-Ij for submit@debbugs.gnu.org; Wed, 13 Sep 2023 20:22:51 -0400 Received: from out162-62-57-64.mail.qq.com ([162.62.57.64]:59967) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qga86-0001mk-Qt for 65885@debbugs.gnu.org; Wed, 13 Sep 2023 20:22:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1694650946; bh=CJArjXW6QKw0duLh9m01aOE9SnNGejvbE80l/F9Z+Bs=; h=From:To:Cc:Subject:Date:References:Reply-To:In-reply-to; b=HH3cCUEzSyyTsLVlQXvwSnxmVUieIajQdqMej3y7Q/h5RuERy8lq79Ypt4Nby/0a4 pj8VOYQKPth8KHx/IYtQi/HVSiAvCaJoVINsffTsG375KKa/H1EkGEaG9/HC7axtTA R27khDyhN/3PICpQ5qkp4rl/M6/l5C8YeGnprSys= Received: from tdesk ([60.26.149.220]) by newxmesmtplogicsvrszb9-0.qq.com (NewEsmtp) with SMTP id 5992A2BE; Thu, 14 Sep 2023 08:22:25 +0800 X-QQ-mid: xmsmtpt1694650945t81uonxya Message-ID: X-QQ-XMAILINFO: MzI8mhixeh+ubo5hGtcXPQ48YJE+ecWvlaofF/PmMONxFmw6vmyAYIRYgVuuBC KwG21TbQ3n3CreGxdLap84zHRIr5Yx8Fq4U84TbdUFOfX9rsA6xdl1wMWEZWkPyAKsZr7NbyQ0ww 4BOrAD/HcmORMRK1Mxe6XWgnU/ydjnjbro31eLIdxhlLHqzl41Qx2SAh9AefKYOS/c+1aCB48UpU EA7BQLc9om5aWbigmFdBPh442Fe4Ko/Iskj9TSQkzYG3AGGZ7TcKJEWE2u8NfjIlqz13BpTKzdI9 buKbNFfGDjIrX48ZbySfM0s7ly2y0puYMfjZ1RxK2EMD2uXsnKAbYBkyw7tS2aeVDxpo+7CPJgZS L+z/WX8zza6wokXjJiMXkqsVWuAfmxWxOSrcfVzRQa5Zx4o06+2AJNRn0Gz+TUIWkxNoEC9Icj0x 2IBDgrzM99HQ70EUREye+pIgKHnzUNHJw8BM1egIMLCoxuXlN/sRMJbf99IPUUoHtZ1NEKSW4lsJ wdcE2ZgIVbT1OdDUs+ff6Ui6Ms9+0BfvhrX8ruH5OVX9Fw352uSq0hQoCQ/YmjAlfcsEEqbyOfcr 3k8d796E5iLwpeQ71li++cE+Ol5fiCJhIuUW3hD0a4W6Bt15us8prOd6oR+Whal9kHFLr6Y6dHZs WlqeEsxRJ9iDum2mMFW1vYj6koveJMGehkj4Av2vwCj1+IurRmVk8InVoJExzgXpRDZ5gg2xBQwC RAQPyjsfiS4K1nlSfIhvG8w6A42Jaa4ahGqycYxmAm2p0BPdMTLacblI2Box6XVr8rRCojh/rfyl 4rYLhZ3wFIbuBWXmrkf77xEIWtLvOmS54HgHnNBLj5A8Ddm1FGoEZlfS5wRQ9ZZWzJaco9Plxv2Q JfZ6hyknHNngkZnogM7r7ycekLa2Dfkl/UjF+PF5bxSxjo5+OCipUtBcVuE0CbuitCp6MvBKLbmV iL6NV+1aY= X-QQ-XMRINFO: Nq+8W0+stu50PRdwbJxPCL0= From: Yang Yingchao Date: Thu, 14 Sep 2023 08:17:56 +0800 References: <871qf4doit.fsf@qq.com> <83h6nzpoeg.fsf@gnu.org> <87wmwv9bhu.fsf@qq.com> <83h6nynued.fsf@gnu.org> User-agent: mu4e 1.10.6; emacs 29.1.50 In-reply-to: <83h6nynued.fsf@gnu.org> Message-ID: <87led9hadb.fsf@qq.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 3.6 (+++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: >> From: Yang Yingchao >> Date: Wed, 13 Sep 2023 08:41:27 +0800 >> >> >>> Date: Tue, 12 Sep 2023 12:41:32 +0800 >> >>> From: Yang Yingchao via "Bug reports for GNU Emacs, >> >>> the Swiss army knife [...] Content analysis details: (3.6 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [162.62.57.64 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (yang.yingchao[at]qq.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [162.62.57.64 listed in list.dnswl.org] 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 3.2 HELO_DYNAMIC_IPADDR Relay HELO'd using suspicious hostname (IP addr 1) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 2.6 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: >> From: Yang Yingchao >> Date: Wed, 13 Sep 2023 08:41:27 +0800 >> >> >>> Date: Tue, 12 Sep 2023 12:41:32 +0800 >> >>> From: Yang Yingchao via "Bug reports for GNU Emacs, >> >>> the Swiss army knife [...] Content analysis details: (2.6 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [162.62.57.64 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [162.62.57.64 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (yang.yingchao[at]qq.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 3.2 HELO_DYNAMIC_IPADDR Relay HELO'd using suspicious hostname (IP addr 1) -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager --=-=-= Content-Type: text/plain Content-Disposition: inline >> From: Yang Yingchao >> Date: Wed, 13 Sep 2023 08:41:27 +0800 >> >> >>> 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. >> > >> > >> > I apologize, but I realized that I have already asked this question before. >> > >> > However, setting 'treesit-defun-tactic' to 'top-level' could cause other >> > issues, as seen in the following snippets: >> > >> > >> > ,---- >> > | class Name { >> > | public: >> > | Name() >> > | { >> > | // cursor here >> > | } >> > | >> > | void func() >> > | { >> > | static int a; >> > | } >> > | >> > | }; >> > `---- >> > >> > Suppose the cursor is in line 5, and "C-M-a" is pressed: >> > >> > - In 'c++-mode', the cursor will be moved to the start of the function 'Name()', which is the expected behavior. >> > - In 'c++-ts-mode': >> > - With 'treesit-defun-tactic' set to 'nested', it behaves the same as in 'c++-mode'. >> > - With 'treesit-defun-tactic' set to 'top-level', the cursor is moved to the beginning of >> > the class, i.e., line 1. >> > >> > Is it possible to make 'c++-ts-mode' behave the same as in 'c++-mode'? >> > >> > Regards. >> >> Maybe I'm wrong, but I would like to suggest reconsidering the solution to the >> 'begging-of-defun' issue related to the static *variable*. It feels strange to me to fix this >> issue by changing the 'treesit-defun-tactic', which is meant to apply to a *function* >> literally... > > Yuan, any ideas or suggestions? Just FYI, I made some modifications to 'treesit--navigate-thing' in my own branch to fix this specific issue: ,---- | 1 file changed, 8 insertions(+) | lisp/treesit.el | 8 ++++++++ | | modified lisp/treesit.el | @@ -2092,6 +2092,14 @@ treesit--navigate-thing | (pcase-let | ((`(,prev ,next ,parent) | (treesit--things-around pos regexp pred))) | + | + ;; YYC: Special handling for static variable inside defun... | + (when (and (equal (treesit-node-type prev) | + "storage_class_specifier") | + (equal (treesit-node-type (treesit-node-parent prev)) | + "declaration")) | + (setq prev nil)) | + | ;; When PARENT is nil, nested and top-level are the same, if | ;; there is a PARENT, make PARENT to be the top-level parent | ;; and pretend there is no nested PREV and NEXT. | `---- --=-=-=--