GNU bug report logs - #60197
30.0.50; beginning-of-defun broken after new treesit impl

Previous Next

Package: emacs;

Reported by: Theodor Thornhill <theo <at> thornhill.no>

Date: Mon, 19 Dec 2022 10:14:01 UTC

Severity: normal

Found in version 30.0.50

Fixed in version 29.1

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Theodor Thornhill <theo <at> thornhill.no>
To: Yuan Fu <casouri <at> gmail.com>
Cc: 60197 <at> debbugs.gnu.org
Subject: bug#60197: 30.0.50; beginning-of-defun broken after new treesit impl
Date: Thu, 22 Dec 2022 08:48:25 +0100
Yuan Fu <casouri <at> gmail.com> writes:

> Theodor Thornhill <theo <at> thornhill.no> writes:
>
>> On 21 December 2022 07:50:04 CET, Yuan Fu <casouri <at> gmail.com> wrote:
>>>
>>>Yuan Fu <casouri <at> gmail.com> writes:
>>>
>>>> Theodor Thornhill <theo <at> thornhill.no> 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’s 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’t need to
>>>> remap the commands anymore.
>>>
>>>I see the problem now... Many other functions uses
>>>beginning/end-of-defun. I didn’t thought about that initially :-(
>>>
>>>But I don’t 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’ll 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?

Theo




This bug report was last modified 2 years and 133 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.