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#60197: 30.0.50; beginning-of-defun broken after new treesit impl Date: Thu, 22 Dec 2022 00:51:33 -0800 Message-ID: References: <87edsv7lc4.fsf@thornhill.no> 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="9403"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60197@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 09:52:27 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 1p8HJS-0002E2-3x for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 22 Dec 2022 09:52:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p8HJF-0008Jt-VG; Thu, 22 Dec 2022 03:52:14 -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 1p8HJ4-0008I6-Hm for bug-gnu-emacs@gnu.org; Thu, 22 Dec 2022 03:52:02 -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 1p8HJ4-0003sU-6x for bug-gnu-emacs@gnu.org; Thu, 22 Dec 2022 03:52:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p8HJ3-0004Yv-VX for bug-gnu-emacs@gnu.org; Thu, 22 Dec 2022 03:52:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <87edsv7lc4.fsf@thornhill.no> Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 22 Dec 2022 08:52:01 +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.167169910417525 (code B ref 60197); Thu, 22 Dec 2022 08:52:01 +0000 Original-Received: (at 60197) by debbugs.gnu.org; 22 Dec 2022 08:51:44 +0000 Original-Received: from localhost ([127.0.0.1]:57054 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8HIl-0004YZ-I3 for submit@debbugs.gnu.org; Thu, 22 Dec 2022 03:51:44 -0500 Original-Received: from mail-pj1-f54.google.com ([209.85.216.54]:54242) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8HIj-0004YQ-Nk for 60197@debbugs.gnu.org; Thu, 22 Dec 2022 03:51:42 -0500 Original-Received: by mail-pj1-f54.google.com with SMTP id v23so1239764pju.3 for <60197@debbugs.gnu.org>; Thu, 22 Dec 2022 00:51:41 -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=r9t11hY3FEuM4XVEmIjRn59P5/uN/jlp+LW5O13y250=; b=WQgu7sK9gbvQx6MyJFC/Dej+7dloxr5yeUhvF5x4DuNs9M3515CNEuNL5HU+cwo/fD BWebvrwHVyhTN3z6W1NM17nS7NTmZ8FI89ORPSuYozMhYR/dUgj/RAeKxBK3ZtSp1ojR fYqaZLKWG9j2Y+Elc2eW2INLiJ4DIuf1rht1WDes68Uz+ZbhfekHMe/QMXbgDnWXIM51 uLg/LxIWbb8erOoUVAdNznKdm8FCvXj+BRD/TmGx+cZEzlVurCtjNasVjDOJgApPszsB 5cr2iwyv+ZpLtTq9E3lvvDnZwQ03eTujk8c/PrYZ9z7KuS65WEUGfRZI1+ONhVo2n0Qs lcKw== 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=r9t11hY3FEuM4XVEmIjRn59P5/uN/jlp+LW5O13y250=; b=PINGFm3vTsaaNoskWw4zCdSvVJYbq/sDdGEie1DM9U7e7w/W0dmndgX2nEZCqt1hQA KZRpdwfGLt0/DpVa0kV2MxaWkkQvAZ3ovya1qW0Kd7DEsCyWZ8uAuMZCE7+flz14b4dx 9lDcII27EkaHO7PBtlD5E5NhH7pHP3Lc0oSvjwX4cmvGeJXjcUhqwfGwzp8h7lX9Tp92 t8pd0gGIZCXua9nfB9EMGeYiO5f3xjdzVt0sQWGJsMvMT125f5RCQSAhV/U+jVwQxuOl nrBnS+O5KC7/lz3z9tnkHYlk10DQBqGeg6vMFH7iT6g5aqx6ZqDupJDpfc23PEP7fHMl TfnA== X-Gm-Message-State: AFqh2kqjZ+uKHb12SKlb1AmBhAvqVjeD3022VtsZ4Yp7d72ooKB+AWcw t1USnY7PSoFymi+gA8LzTcPqv0XO5BE= X-Google-Smtp-Source: AMrXdXv8WTX+XePug0T71bYu9Y/5mm0z8ZHXagl9LbDuBvnXZlytR7obWTipipwrLNfbxOqOWZc+yA== X-Received: by 2002:a17:903:32c6:b0:189:df3c:1ba1 with SMTP id i6-20020a17090332c600b00189df3c1ba1mr5943998plr.38.1671699095856; Thu, 22 Dec 2022 00:51:35 -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 l9-20020a170902d34900b00187197c4999sm12850404plk.167.2022.12.22.00.51.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Dec 2022 00:51:35 -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:251651 Archived-At: Theodor Thornhill writes: > Yuan Fu writes: > >> Theodor Thornhill writes: >> >>> On 21 December 2022 07:50:04 CET, Yuan Fu wrote: >>>> >>>>Yuan Fu writes: >>>> >>>>> Theodor Thornhill writes: >>>>> >>>>>> Hi, Yuan! >>>>>> >>>>>> It seems 'prog-fill-reindent-defun' is broken after the latest = changes >>>>>> to treesit-beginning-of-defun. The culprit is that we now use = remap >>>>>> instead of setting the beginning-of-defun-function. 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]. So if we want = to support >>>>> navigation nested defuns reliably we need to remap the commands = instead. >>>>> In the future (ie emacs 30), we can extend the current >>>>> beginning/end-of-defun to support nested defuns, then we don=E2=80=99= t need to >>>>> remap the commands anymore. >>>> >>>>I see the problem now... Many other functions uses >>>>beginning/end-of-defun. I didn=E2=80=99t thought about that = initially :-( >>>> >>>>But I don=E2=80=99t want to make big changes to beg/end-of-deun, = hmmm. >>>> >>>>Yuan >>> >>> >>> I think you can set the functions and remap, right? Maybe you can >>> force the beginning-of-defun-function variant to choose the smallest >>> scope as a default? Or just follow the same tactic the user set? >> >> Maybe, we can have beg-of-defun-function respect = treesit-defun-tactic, >> and end-of-defun-function simply jump to the end of the defun at = point, >> and remap the commands as we do now. I=E2=80=99ll experiment with = that and see >> if it works well. > > Sure! Do you mean some treesit-specific code inside of > beginning-of-defun, or just making treesit-beginning-of-defun callable > non-interactively? I played around, and it seems the best we can do is to simply setting the b/e-of-defun-function. That=E2=80=99s also what cc-mode does. If = cc-mode does that for 20 years and no one complained, I think we are pretty safe. Though we should still improve end-of-defun in Emacs 30. So I did that :-) Yuan