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#60197: 30.0.50; beginning-of-defun broken after new treesit impl Date: Wed, 21 Dec 2022 06:58:53 +0100 Message-ID: <2D3D9864-F4F4-4AB2-A88D-5FD0919AEF12@thornhill.no> References: <9AC22A2A-6ED8-4778-95CE-EB29A7FC4633@gmail.com> Reply-To: Theodor Thornhill Mime-Version: 1.0 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="38350"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60197@debbugs.gnu.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 21 07:00:28 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 1p7s9T-0009lB-NW for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 21 Dec 2022 07:00:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7s9C-0004PQ-Sy; Wed, 21 Dec 2022 01:00:12 -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 1p7s95-0004NE-1z for bug-gnu-emacs@gnu.org; Wed, 21 Dec 2022 01:00:05 -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 1p7s94-0004Qp-Oi for bug-gnu-emacs@gnu.org; Wed, 21 Dec 2022 01:00:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p7s94-000295-K4 for bug-gnu-emacs@gnu.org; Wed, 21 Dec 2022 01:00: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: Wed, 21 Dec 2022 06:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60197 X-GNU-PR-Package: emacs Original-Received: via spool by 60197-submit@debbugs.gnu.org id=B60197.16716023448193 (code B ref 60197); Wed, 21 Dec 2022 06:00:02 +0000 Original-Received: (at 60197) by debbugs.gnu.org; 21 Dec 2022 05:59:04 +0000 Original-Received: from localhost ([127.0.0.1]:49594 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7s87-000285-IM for submit@debbugs.gnu.org; Wed, 21 Dec 2022 00:59:03 -0500 Original-Received: from out-151.mta0.migadu.com ([91.218.175.151]:37927) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7s85-00027i-Pw for 60197@debbugs.gnu.org; Wed, 21 Dec 2022 00:59:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1671602339; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fNsLZJM75yV7EKn5mGZmtn5stUzxIfGPArfOVH6aOo0=; b=1F3AvyO4z525weYS6lAkyTJQlZuR8U4slElHhCoGVuRxndrHqQtaqQ00v79r2RjStEaUBE aSCvwLBON+1AwXEn02I2CW6Bh1ZaYAPvb/MibhVMpQ73l1T6kB8IWHQnH5q36nPl+nyrpH +Z/HmQtfquDv4WacXMPDmpaHhDuDj1Do8Jnf6Cjc8LbWoLg9K0kHpVgXgo8zdxa66RkZUX VMEK5SHQBsZZ6z3hJHzsFdzHf59i82uLz5HRSv3+xE7kEuRZudaECP33X8jMAvOZwhofYz nbvJ3GXULy2LZJZUQmosSv5ziFrIwMePiNvtp/A9oK+bkA+jixH/LO8b16e3CA== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-Reply-To: <9AC22A2A-6ED8-4778-95CE-EB29A7FC4633@gmail.com> 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:251566 Archived-At: On 21 December 2022 05:08:09 CET, Yuan Fu wrote: > >Theodor Thornhill writes: > >> Hi, Yuan! >> >> It seems 'prog-fill-reindent-defun' is broken after the latest changes >> to treesit-beginning-of-defun=2E The culprit is that we now use remap >> instead of setting the beginning-of-defun-function=2E What is the >> reasoning behind that change? Can't we just rely on the variable >> beginning-of-defun-function? > >Not really, end-of-defun uses beginning/end-of-defun-function in a way >that=E2=80=99s incompatible with nested defuns[1]=2E So if we want to sup= port >navigation nested defuns reliably we need to remap the commands instead= =2E >In the future (ie emacs 30), we can extend the current >beginning/end-of-defun to support nested defuns, then we don=E2=80=99t ne= ed to >remap the commands anymore=2E > >> I see you mentioned it is inteded to be used as a command, but surely >> both should be possible? > >Could you remind me where is this function defined? I should have >updated it when I changed the defun navigation implementation=2E (It was >broken by my change before the defun nav change which you noticed, I >thought I=E2=80=99m going to fix it with the new defun nav functions, but= I >forgot=2E=2E=2E) > >Yuan > It is in prog-mode=2Eel, in the master branch=2E But the biggest issue now= is that every function or command that relies on beginning-of-defun and e= nd-of-defun is broken=2E=20 > >[1] For example, a nested defun like this: > >def parent: > (1) > def child: > return 0 >(2) return 1 >(3) > >When point is at (1), end-of-defun calls beginning-of-defun-function >followed by end-of-defun-function to check if point is in a defun: if >point ends up after the starting point, then starting point is inside a >defun, and we can stop there=2E In this case, point ends up at >(3), because b-o-d-f goes to previous b-o-d, which is the beg of parent, >then e-o-d-f goes to (3), which is the end of that parent, and >end-of-defun stops at (3)=2E > >However, we should have gone to (2), which is the immediately following >end-of-defun=2E > That depends on the tactic chosen, right? >Thanks, >Yuan Are you sure this isn't compatible?