Subject: Re: bug#78680: typescript-ts-mode "fills" code when using (fill-paragraph)

From: Juri Linkov <[email-masked]>
Date: Tue, 03 Jun 2025 18:41:35 +0300

close 78680 31.0.50
thanks

> This is on latest master (50e3bce315e). To reproduce:
>
> 1. Create test.ts with this content:
>
> 	// test
> 	console.log("hello world")
>
> 2. Open as `emacs -Q test.ts`
> 3. Evaluate (progn (require 'treesit) (typescript-ts-mode))
> 4. Put caret at the word `test1`
> 5. Press M-q
>
> Expected: nothing.
> Actual: the code gets moved into the comment
>
> -------------
>
> I investigated the problem, it seems to be because `fill-comment-
> function` is nil. From my understanding, it's supposed to be set by
> invoking a common helper (c-ts-common-comment-setup), which I
> implemented in the attached patch.
>
> I am testing this to make sure there wouldn't be any adverse effects.
>
> What's odd is that I don't seem to remember having this problem before,
> and; and as a matter of fact we even have investigated a bug #77727
> which wouldn't be possible with this issue. Seems like a regression.

'c-ts-common-comment-setup' is a too confusing name.
It does more than just setting comment-related variables.
So 8bccccedb65a should have retained 'c-ts-common-comment-setup'.
Therefore I restored it in js-ts-mode and typescript-ts-base-mode.