GNU bug report logs - #78703
beginning-of-defun and friends still wrong in typescript-ts-mode

Previous Next

Package: emacs;

Reported by: Daniel Colascione <dancol <at> dancol.org>

Date: Thu, 5 Jun 2025 23:41:02 UTC

Severity: normal

Full log


Message #11 received at 78703 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Daniel Colascione <dancol <at> dancol.org>, 78703 <at> debbugs.gnu.org
Subject: Re: bug#78703: beginning-of-defun and friends still wrong in
 typescript-ts-mode
Date: Fri, 6 Jun 2025 00:23:23 -0700

> On Jun 6, 2025, at 12:01 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> From: Daniel Colascione <dancol <at> dancol.org>
>> Date: Thu, 05 Jun 2025 16:40:03 -0700
>> 
>> Right now, C-M-a runs treesit-beginning-of-defun which goes to the
>> start of the previous defun in buffer text, not the enclosing defun.
>> 
>> If we have this program:
>> 
>>    1 function foo() {
>>    2   function bar() {
>>    3     return 5
>>    4   }
>>    5   return 7
>>    6 }
>> 
>> 
>> and point is on line 5, then if we hit C-M-a, point goes to line 2, not
>> line 1.  In every single situation, when I use beginning-of-defun, I
>> intend to go to the start of my enclosing defun not the one that happens
>> to be previous in buffer linearization.
> 
> I think you want to set treesit-defun-tactic to 'top-level’.

Yes. Most likely top-level is what you want. 

Yuan






This bug report was last modified 4 days ago.

Previous Next


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