From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#59853: 30.0.50; tree-sitter modes have unexpected beginning-of-defun behavior Date: Thu, 22 Dec 2022 00:59:15 -0800 Message-ID: References: <87lenlnjc1.fsf@posteo.net> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5632"; mail-complaints-to="usenet@ciao.gmane.io" Cc: leungbk@posteo.net, 59853@debbugs.gnu.org To: Theodor Thornhill Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 22 10:00:13 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 1p8HQy-0001G1-BR for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 22 Dec 2022 10:00:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p8HQt-0002sG-EE; Thu, 22 Dec 2022 04:00:07 -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 1p8HQp-0002rO-92 for bug-gnu-emacs@gnu.org; Thu, 22 Dec 2022 04:00:04 -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 1p8HQo-0005DQ-VQ for bug-gnu-emacs@gnu.org; Thu, 22 Dec 2022 04:00:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p8HQo-0004eE-KU for bug-gnu-emacs@gnu.org; Thu, 22 Dec 2022 04:00:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <87lenlnjc1.fsf@posteo.net> Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 22 Dec 2022 09:00: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.167169956517834 (code B ref 59853); Thu, 22 Dec 2022 09:00:02 +0000 Original-Received: (at 59853) by debbugs.gnu.org; 22 Dec 2022 08:59:25 +0000 Original-Received: from localhost ([127.0.0.1]:57104 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8HQD-0004da-6X for submit@debbugs.gnu.org; Thu, 22 Dec 2022 03:59:25 -0500 Original-Received: from mail-pj1-f44.google.com ([209.85.216.44]:55902) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8HQA-0004dU-PL for 59853@debbugs.gnu.org; Thu, 22 Dec 2022 03:59:23 -0500 Original-Received: by mail-pj1-f44.google.com with SMTP id u5so1249367pjy.5 for <59853@debbugs.gnu.org>; Thu, 22 Dec 2022 00:59:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=9QwiAIZpvxoUTVJ6WkD4xztmHuP++/B9NUlRibPYDOU=; b=ht5JHJQ732rITYt88t1ZektMKoCPEd7SIqwY2W8HJCyjH3OL64gqd/V9Qj0nhXw2BE kyqBTLkacHSfR0kWafO0+CrJ4W5ZvxGnOjhWpP4yqDmQnYRQ6ohTey/DP/VtpXTYSohI lQkE6EvfzlfIlbRKQeWlPXFX6+a8xo2dVKYs5/89j0IP6LDoC4SfDKHLLDI4bJzPI2AP 6Q6kdfyg+d8bRsZnafnBiOyR2AUkQUBL/0ttgBv2a1dm7HDar/xqu0Jgh1DCq7gQc4W3 5NaXZofdlKHhvCdESONLOQt+0Q8pJrA3iX25tnRg6fO0NnIBy6A1fki8mXqVk7OZj06b BR0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9QwiAIZpvxoUTVJ6WkD4xztmHuP++/B9NUlRibPYDOU=; b=avCP2qNhTEzMcz6RcMK+Heu/BkmmhqLghTaswXHAXMhMGXqlN9Eqaqpc8zbVcFqgI0 vW4hF1AlqLTJOo3XaQd36UMiegHNO8xRToEs1u2FkMv5q1NtFEtA7EKGOYkQPF58jplD kBKIrAYbd0cAzR4bGzRUevUnis6+OuaqpybOF73dLY0YSZRLc8NkGaCTKjxyl7GabbwS tjzyu2I4e8gDm4YRysSmXPakyiiwK0Rih4N4Axpjyq2yLlGgg4rSpr1zHlBnE+q+hJNV mLApK5FQh8yuy7uTXuu/t0TJehxFeAA5LU1JDiUrH8tN97sriR7Pc7qGkwZ2BZoSna0g 8xKg== X-Gm-Message-State: AFqh2kodW9DnOkdcByCo2uoHLfg5SFAMiDTfsv6ERDR7iaxPB7wJ9t3G lgGfwhbfUs5BKcOquxc/F4c= X-Google-Smtp-Source: AMrXdXunJk6HiHFKGlCXUxkQMg+bQAt2HJBplaOzm63CH2Bv3EHUdNsK32bepaKXSpIg5tXth9Z1HA== X-Received: by 2002:a17:902:8f87:b0:189:b36a:5448 with SMTP id z7-20020a1709028f8700b00189b36a5448mr4942760plo.44.1671699556817; Thu, 22 Dec 2022 00:59:16 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id u6-20020a170902e5c600b00189e1522982sm12885535plf.168.2022.12.22.00.59.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Dec 2022 00:59:16 -0800 (PST) X-Mailer: Apple Mail (2.3696.120.41.1.1) 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:251654 Archived-At: Yuan Fu writes: > Theodor Thornhill writes: > >> Brian Leung writes: >> >>> Theodor Thornhill writes: >>> >>>>> 2. When point is anywhere in the first line of the class=20 >>>>> declaration, mark-defun highlights "void otherMethod()",=20 >>>>> instead=20 >>>>> of the entire class declaration. >>>> >>>> Yeah, I think I've fixed this in a patch I just submitted. >>> >>> Which commit are you referring to? >>> >> >> I believe it was the one I included as a patch here. >> >>>>> 3a. When point is at the [*] in between someMethod and=20 >>>>> otherMethod, narrow-to-defun captures "void otherMethod()". I=20 >>>>> feel=20 >>>>> that since the methods inside the interface declaration have no=20 >>>>> bodies, it makes more sense to capture the entire interface=20 >>>>> definition if point is at [*]. >>>> >>>> Maybe, but I don't believe this is wrong either. >>> >>> Let me rephrase my request. Consider the following example: >>> >>>> class Cow implements Animal { >>>> public void animalSound() { >>>> // The body of animalSound() is provided here >>>> System.out.println("The cow says: moo"); >>>> } >>>> >>>> [*] >>>> >>>> public void sleep() { >>>> // The body of sleep() is provided here >>>> System.out.println("Zzz"); >>>> } >>>> } >>> >>> Both the methods have bodies. If point is at the [*], I would like=20= >>> for narrow-to-defun to capture the entire class declaration, since=20= >>> point is not really contained in either method. (For this=20 >>> particular example, java-mode presently agrees with java-ts-mode.) >>> >>> Is there a clean way of ensuring that, when point lies between=20 >>> (and is not contained in) those two methods, point is not treated=20 >>> as if it were in one of those methods' tree-sitter nodes? That=E2=80=99s hard to do with the current narrow-to-defun, we can add a new version that is aware of nested defuns and remap narrow-to-defun to it in tree-sitter modes. In the future we can improve stock narrow-to-defun to support nested defuns. Yuan