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#68664: 29.1.50; treesit defun commands broken with nested functions Date: Sat, 27 Jan 2024 09:32:17 +0200 Message-ID: <86a5or9qpq.fsf@gnu.org> References: <42732D94-583F-4F4A-804E-76EFAE91B210@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22520"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 68664@debbugs.gnu.org, brownts@troybrown.dev, mardani29@yahoo.es To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 27 08:33:21 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 1rTdBp-0005fL-BN for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 27 Jan 2024 08:33:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rTdBQ-0001kv-AP; Sat, 27 Jan 2024 02:32:56 -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 1rTdBP-0001j7-8o for bug-gnu-emacs@gnu.org; Sat, 27 Jan 2024 02:32:55 -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 1rTdBO-0001DU-Vt for bug-gnu-emacs@gnu.org; Sat, 27 Jan 2024 02:32:54 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rTdBV-0003Mz-Oq for bug-gnu-emacs@gnu.org; Sat, 27 Jan 2024 02:33:01 -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 07:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68664 X-GNU-PR-Package: emacs Original-Received: via spool by 68664-submit@debbugs.gnu.org id=B68664.170634075612911 (code B ref 68664); Sat, 27 Jan 2024 07:33:01 +0000 Original-Received: (at 68664) by debbugs.gnu.org; 27 Jan 2024 07:32:36 +0000 Original-Received: from localhost ([127.0.0.1]:53363 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTdB6-0003MB-65 for submit@debbugs.gnu.org; Sat, 27 Jan 2024 02:32:36 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53400) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTdB4-0003Lu-DJ for 68664@debbugs.gnu.org; Sat, 27 Jan 2024 02:32:35 -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 1rTdAq-00017g-9R; Sat, 27 Jan 2024 02:32:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=kKYPk8gc9Q6p0fgPl8mowezfYC71R/9p7whIey58fTE=; b=BPIclokTlulqHE4EFPpj oXT+/CPLmH5eYucORUAhJ0qhWqKZAayyMfjdNQu61t114NWbKAaLgvaTTQSXceN1MnbfJuVlN1sNh OkzSsCwOubknI3zjHb3sBpgcxIWVkH+zrXJh4Y4jIq7S/0464DJphmHz+9PSQC3F4+e8dpzzUpZaP +R+iibopMg4VX/1TxuF8eGmU8L2RClaUDab7cVASY+QXYOT/VuS+BWSxiBNxCwAT99mkAeg8CTxCF qHVKiJGvenFUfD/itZatGRjndZImhqcN3iICvzkmKdvMMBJyvbJ/E9XbcUW1x73C/hxq2cNPvZxmU kbhIWe9nC/3aBg==; In-Reply-To: (message from Yuan Fu on Fri, 26 Jan 2024 20:26:38 -0800) 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:278966 Archived-At: > Cc: 68664@debbugs.gnu.org, Daniel Martín > From: Yuan Fu > Date: Fri, 26 Jan 2024 20:26:38 -0800 > > > To add further support to my belief that the current implementation is > > not the expected behavior, consider how the current implementation > > behaves when used with mark-defun. When the point is on the call to > > innerFunction and I execute "M-x mark-defun RET", the nested function > > following the point (i.e., innerFunction2) is selected rather than the > > function containing point. For comparison, the non-tree-sitter > > python-mode behaves correctly and selects the function containing > > point, not the next nested function. > > Yeah, I mean, I can definitely see the validity of the behavior you’re describing. But I think the current behavior is equally valid. Right now you can easily go to the previous/next sibling in the same level, _and_ go to the beginning/end of the parent. You just need to press a few more times. OTOH if you go straight to the parent, there’s no way to go to siblings. Maybe we could support both behaviors via specially-valued prefix arguments? Like "C-u" means something, "C-u C-u" means something else, etc.? > As for mark-defun, I think it’s similarly equally valid to either mark the next sibling or the parent. Right now mark-defun doesn’t really have a notion of nested defun, we should upgrade it to support nested defun like we did beginning/end-of-defun, either by a toggle like mark-defun-tactic or let user control which defun to mark interactively. Same here. WDYT?