GNU bug report logs - #77369
typescript-ts-mode's defun definition is wrong

Previous Next

Package: emacs;

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

Date: Sat, 29 Mar 2025 18:18:01 UTC

Severity: normal

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: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Daniel Colascione <dancol <at> dancol.org>
Subject: bug#77369: closed (Re: bug#77369: typescript-ts-mode's defun
 definition is wrong)
Date: Sun, 30 Mar 2025 04:22:01 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#77369: typescript-ts-mode's defun definition is wrong

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 77369 <at> debbugs.gnu.org.

-- 
77369: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=77369
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Yuan Fu <casouri <at> gmail.com>
To: Daniel Colascione <dancol <at> dancol.org>
Cc: Theodor Thornhill <theo <at> thornhill.no>, 77369-done <at> debbugs.gnu.org
Subject: Re: bug#77369: typescript-ts-mode's defun definition is wrong
Date: Sat, 29 Mar 2025 21:21:05 -0700

> On Mar 29, 2025, at 11:17 AM, Daniel Colascione <dancol <at> dancol.org> wrote:
> 
> Not sure whether this is a bug or just surprising design, but in this
> code:
> 
>    function Blah(foo) {
>      const foo = 1;
>      const bar = 2;
>    }
> 
> with point on "const foo", I do not expect end-of-defun to go to "const
> bar".  I expect it to go to the closing curly brace.

Yeah, that’s because const foo = 1; is a “lexical_declaration”, which is considered a defunct in typescript-ts-mode, because in js you can have arrow functions like

const Blah = (foo) => {
  return true;
};

Which is also a “lexical_declaration”. I guess we can refine the pattern matching to check if it’s an arrow function and only then consider it a defun.

I did that, now on latest master, end-of-defun should move to the end of the function in your example.

Yuan
[Message part 3 (message/rfc822, inline)]
From: Daniel Colascione <dancol <at> dancol.org>
To: bug-gnu-emacs <at> gnu.org
Subject: typescript-ts-mode's defun definition is wrong
Date: Sat, 29 Mar 2025 14:17:15 -0400
Not sure whether this is a bug or just surprising design, but in this
code:

    function Blah(foo) {
      const foo = 1;
      const bar = 2;
    }

with point on "const foo", I do not expect end-of-defun to go to "const
bar".  I expect it to go to the closing curly brace.



This bug report was last modified 101 days ago.

Previous Next


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