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#68652: 29.1.50; treesit defun commands broken near beginning of function Date: Sat, 27 Jan 2024 12:40:35 +0200 Message-ID: <86h6iz83fg.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24998"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 68652@debbugs.gnu.org To: Troy Brown , Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 27 11:41:16 2024 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 1rTg7f-0006Jw-Lm for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 27 Jan 2024 11:41:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rTg7T-0001Mb-Ka; Sat, 27 Jan 2024 05:41:03 -0500 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 1rTg7N-0001KV-7W for bug-gnu-emacs@gnu.org; Sat, 27 Jan 2024 05:40:57 -0500 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 1rTg7L-0007Po-Ja for bug-gnu-emacs@gnu.org; Sat, 27 Jan 2024 05:40:56 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rTg7S-0000D6-I9 for bug-gnu-emacs@gnu.org; Sat, 27 Jan 2024 05:41:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 27 Jan 2024 10:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68652 X-GNU-PR-Package: emacs Original-Received: via spool by 68652-submit@debbugs.gnu.org id=B68652.1706352052776 (code B ref 68652); Sat, 27 Jan 2024 10:41:02 +0000 Original-Received: (at 68652) by debbugs.gnu.org; 27 Jan 2024 10:40:52 +0000 Original-Received: from localhost ([127.0.0.1]:53542 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTg7I-0000CR-8D for submit@debbugs.gnu.org; Sat, 27 Jan 2024 05:40:52 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54762) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTg7G-0000CE-1r for 68652@debbugs.gnu.org; Sat, 27 Jan 2024 05:40:50 -0500 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 1rTg73-0007Ov-2b; Sat, 27 Jan 2024 05:40:37 -0500 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=dbc7xdQGQbI+d54xRIpKciDBX0OpAtYt797LPtahldM=; b=JpR4dus7tLGy xqMOWtKyOfbj2W+LFszSbSHDIwe31ene/i4x8GfrFfFrcYHw7/rVxdgVhLTrX1wMQrluRMjIyf7j5 zx1CeSTUgiCk8o7buLUQ7oztuUfdHWxOHcBVH7I4pKcqHnq/rDm2hlVCVgMgbm9u0pcR5fYzC3Ami Gnhn6Z0huHitxvQ30z/02NfWK9SU4/ljWBxOtyier/fcF2UajEuEOmMtKDs5h8rn8vnoxDEbuHv1+ hax30BFJYvt9jxEnEAmp37KGeNQMU3xwgsyb2b3EPPl2pYqZnMFYbOO7eSaDwBIWzHP4NNr7ALQgE n7b6aoV3T2JCRCrIg8GlEQ==; In-Reply-To: (message from Troy Brown on Sun, 21 Jan 2024 23:47:08 -0500) 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:278989 Archived-At: > From: Troy Brown > Date: Sun, 21 Jan 2024 23:47:08 -0500 > > I've noticed that "defun" related treesit commands/functions do not > appear to work correctly near the beginning of a function. I've seen > this behavior in multiple languages and believe the problem is an issue > in the treesit.el library. Also, I believe the issue occurs on the > first token of the function definition. The following example uses > c-ts-mode to demonstrate the issue. > > --8<---------------cut here---------------start------------->8--- > // -*- mode: c-ts -*- > > void previous (void); > void next (void); > > void previous (void) { > } > > void main (void) { > previous(); > next(); > printf("Hello, world!\n"); > } > > void next (void) { > } > --8<---------------cut here---------------end--------------->8--- > > To reproduce the issue, place point between the "o" and "i" of the > "void" return type for the "main" function. When point is at this > location, I've noticed incorrect behavior for the following commands: > > M-x treesit-beginning-of-defun RET > > Moves point to the beginning of the previous function instead of the > beginning of the current (i.e., "main") function. > > M-x treesit-end-of-defun RET > > This does not move point, when it should move to the end of the current > function. > > I've also noticed functions, such as "treesit-defun-at-point" behave > incorrectly here as well (i.e., returns "nil" instead of the function > definition node). This seems to be already fixed on the master branch, so I think we can close this bug. Yuan, any comments?