From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#59853: 30.0.50; tree-sitter modes have unexpected beginning-of-defun behavior Date: Tue, 06 Dec 2022 09:31:38 +0100 Message-ID: <87k035vsph.fsf@thornhill.no> References: <87lenlnjc1.fsf@posteo.net> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37644"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59853@debbugs.gnu.org To: Brian Leung Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 06 09:32:22 2022 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 1p2TNF-0009TA-4Y for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 06 Dec 2022 09:32:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p2TMz-0003Hi-Nk; Tue, 06 Dec 2022 03:32:05 -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 1p2TMx-0003FQ-2I for bug-gnu-emacs@gnu.org; Tue, 06 Dec 2022 03:32:03 -0500 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 1p2TMw-0007cD-Oc for bug-gnu-emacs@gnu.org; Tue, 06 Dec 2022 03:32:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p2TMw-0004Yq-J8 for bug-gnu-emacs@gnu.org; Tue, 06 Dec 2022 03:32:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 06 Dec 2022 08:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59853 X-GNU-PR-Package: emacs Original-Received: via spool by 59853-submit@debbugs.gnu.org id=B59853.167031550517504 (code B ref 59853); Tue, 06 Dec 2022 08:32:02 +0000 Original-Received: (at 59853) by debbugs.gnu.org; 6 Dec 2022 08:31:45 +0000 Original-Received: from localhost ([127.0.0.1]:41476 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p2TMf-0004YB-2V for submit@debbugs.gnu.org; Tue, 06 Dec 2022 03:31:45 -0500 Original-Received: from out2.migadu.com ([188.165.223.204]:46909) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p2TMb-0004Y4-VI for 59853@debbugs.gnu.org; Tue, 06 Dec 2022 03:31:43 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1670315499; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=klDA80WQGLiHmw5Ki1FFAE9ctlhPV1IY2sBJeeVLzjE=; b=1H1oytCzbhRv7Fbd2CaHDCna6nU4aUOIrgSkQ3Xt99jd+NqkNI6ITePYYcu0mdwbwNNIPr vp6wyJ+Z2nxA7p7IOgLCVwNtI5ejZLC0mmd2taoUf9BA2xzLzwekmlMRZYQ0GnomtDyrXt QzD5TYipJ9qTMzds3bqhUJ9bPkyAnmy+CxhIUpKI2Rw0dNWV2Bc7dSb6GdVl1kXCWO3d58 shIVXeOkmb6KXGXr+nhlrGoNbrlNioDJWK1qdrrTFdpjX70ImjTG7cwtiuEoEyqmCJKnlT RgOPGp5f/nfDUS703fZRoIayThgnY1ppb/WnL/zEQosdpJbWKgcyi9WMhTTYDQ== In-Reply-To: <87lenlnjc1.fsf@posteo.net> (Brian Leung's message of "Tue, 06 Dec 2022 06:21:18 +0000") X-Migadu-Flow: FLOW_OUT 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:250092 Archived-At: Hi Brian and thanks for the report! Brian Leung writes: > Given the following Java file: > > public abstract class Class { > public static interface Interface { > void someMethod(); > > void [o]therMethod(); > } > } > > If point is at the "o" in otherMethod, pressing C-M-a in java-ts-mode > moves point to the beginning of that line. However, in java-mode, point > moves to the beginning of Interface's declaration. > I see. To me this looks like java-ts-mode is "correct", in that the next step "outwards" is to the method start itself. The point is in fact inside the method still, IIUC. > In the following Python file: > > def outer(): > def inner(i): > return i > > [r]eturn 42 > > If point is at the "r" in the outer return statement, pressing C-M-a in > python-ts-mode moves point to the beginning of the line where the > function "inner" is declared. However, in python-mode, point moves to > the beginning of the line where "outer" is declared. > In this case I think python-mode is correct, becase the 'inner' function is a sibling to the return statement, and it would make sense to go directly to outer. > This discrepancy in behavior makes it harder to use narrow-to-defun effectively. > Yeah, I understand. Do you agree on my points above? I just want to make the problem clear to me :-) Theo