GNU bug report logs - #78680
typescript-ts-mode "fills" code when using (fill-paragraph)

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Konstantin Kharlamov <Hi-Angel@HIDDEN>; Done: Juri Linkov <juri@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
bug marked as fixed in version 31.0.50, send any further explanations to 78680 <at> debbugs.gnu.org and Konstantin Kharlamov <Hi-Angel@HIDDEN> Request was from Juri Linkov <juri@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 78680 <at> debbugs.gnu.org:


Received: (at 78680) by debbugs.gnu.org; 3 Jun 2025 16:50:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 03 12:50:30 2025
Received: from localhost ([127.0.0.1]:40845 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uMUqM-00015R-IY
	for submit <at> debbugs.gnu.org; Tue, 03 Jun 2025 12:50:30 -0400
Received: from mslow3.mail.gandi.net ([217.70.178.249]:60529)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>)
 id 1uMUqK-000158-Vr; Tue, 03 Jun 2025 12:50:29 -0400
Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net
 [217.70.183.195])
 by mslow3.mail.gandi.net (Postfix) with ESMTP id 0E708581A82;
 Tue,  3 Jun 2025 15:42:58 +0000 (UTC)
Received: by mail.gandi.net (Postfix) with ESMTPSA id CA1271FCF0;
 Tue,  3 Jun 2025 15:42:56 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Konstantin Kharlamov <Hi-Angel@HIDDEN>
Subject: Re: bug#78680: typescript-ts-mode "fills" code when using
 (fill-paragraph)
In-Reply-To: <d9bfb991daadb3fd134a189dbb21c49af4d60715.camel@HIDDEN>
Organization: LINKOV.NET
References: <d9bfb991daadb3fd134a189dbb21c49af4d60715.camel@HIDDEN>
Date: Tue, 03 Jun 2025 18:41:35 +0300
Message-ID: <878qm87ryo.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-State: clean
X-GND-Score: 0
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugdeifecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucenucfjughrpefhvfevufgjohhffffkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeffgeetfeevlefhleejfeeuheeiudeitdffhfdutdekfeffgffhveehteegueekheenucfkphepledurdduvdelrddutdefrddvjeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeluddruddvledruddtfedrvdejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepfedprhgtphhtthhopegtohhnthhrohhlseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepjeekieektdesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopefjihdqtehnghgvlheshigrnhguvgigrdhruh
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 78680
Cc: 78680 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78680; Package emacs. Full text available.

Message received at 78680 <at> debbugs.gnu.org:


Received: (at 78680) by debbugs.gnu.org; 3 Jun 2025 16:48:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 03 12:48:25 2025
Received: from localhost ([127.0.0.1]:40817 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uMUoK-0000tl-Sv
	for submit <at> debbugs.gnu.org; Tue, 03 Jun 2025 12:48:25 -0400
Received: from forward501b.mail.yandex.net
 ([2a02:6b8:c02:900:1:45:d181:d501]:57938)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <hi-angel@HIDDEN>)
 id 1uMUoH-0000tE-Uv
 for 78680 <at> debbugs.gnu.org; Tue, 03 Jun 2025 12:48:23 -0400
Received: from mail-nwsmtp-smtp-production-main-67.sas.yp-c.yandex.net
 (mail-nwsmtp-smtp-production-main-67.sas.yp-c.yandex.net
 [IPv6:2a02:6b8:c11:4ab1:0:640:c3ad:0])
 by forward501b.mail.yandex.net (Yandex) with ESMTPS id 8E2BA616D6;
 Tue,  3 Jun 2025 19:14:03 +0300 (MSK)
Received: by mail-nwsmtp-smtp-production-main-67.sas.yp-c.yandex.net
 (smtp/Yandex) with ESMTPSA id 2EeuWheLbW20-HLnj1T4G; 
 Tue, 03 Jun 2025 19:14:03 +0300
X-Yandex-Fwd: 1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail;
 t=1748967243; bh=b2xd7OwSLImiCikg3lgGbL3l8msmu1f7ohn8CSpaFNw=;
 h=References:Date:In-Reply-To:Cc:To:From:Subject:Message-ID;
 b=s04N9LDEofvfwOUiaUGAWJQN40cMkVGwxog5rjRMrOP8WKwLOZHEvQ5DexA+nyU98
 htG2XvhPb49wlKjilID7V0okrBr3+vfLb0hSyP9X+1AJLXP5MUy44vn8Fs1sidBNe9
 pBYec75uSb3qavdNu6/++jRhK4GMsK/JX+8ykXJ8=
Authentication-Results: mail-nwsmtp-smtp-production-main-67.sas.yp-c.yandex.net;
 dkim=pass header.i=@yandex.ru
Message-ID: <decdf1cd8224bf0a928246157f440bc37bb12145.camel@HIDDEN>
Subject: Re: bug#78680: typescript-ts-mode "fills" code when using
 (fill-paragraph)
From: Konstantin Kharlamov <Hi-Angel@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Date: Tue, 03 Jun 2025 19:14:01 +0300
In-Reply-To: <878qm87ryo.fsf@HIDDEN>
References: <d9bfb991daadb3fd134a189dbb21c49af4d60715.camel@HIDDEN>
 <878qm87ryo.fsf@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
User-Agent: Evolution 3.56.1 
MIME-Version: 1.0
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 78680
Cc: 78680 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Tue, 2025-06-03 at 18:41 +0300, Juri Linkov wrote:
> '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.

So you did exactly same thing as my patch, but instead of applying mine
to account for contribution since I researched the problem and wrote
the code, you just wrote same thing yourself. This is not fair.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78680; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 3 Jun 2025 13:41:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 03 09:41:53 2025
Received: from localhost ([127.0.0.1]:33378 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uMRtm-0006le-3T
	for submit <at> debbugs.gnu.org; Tue, 03 Jun 2025 09:41:52 -0400
Received: from lists.gnu.org ([2001:470:142::17]:42574)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <hi-angel@HIDDEN>)
 id 1uMRth-0006kl-Ii
 for submit <at> debbugs.gnu.org; Tue, 03 Jun 2025 09:41:47 -0400
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 <hi-angel@HIDDEN>)
 id 1uMRta-0005hI-J4
 for bug-gnu-emacs@HIDDEN; Tue, 03 Jun 2025 09:41:38 -0400
Received: from forward100d.mail.yandex.net ([2a02:6b8:c41:1300:1:45:d181:d100])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <hi-angel@HIDDEN>)
 id 1uMRtX-0002S0-Tn
 for bug-gnu-emacs@HIDDEN; Tue, 03 Jun 2025 09:41:38 -0400
Received: from mail-nwsmtp-smtp-production-main-57.klg.yp-c.yandex.net
 (mail-nwsmtp-smtp-production-main-57.klg.yp-c.yandex.net
 [IPv6:2a02:6b8:c42:73a9:0:640:b740:0])
 by forward100d.mail.yandex.net (Yandex) with ESMTPS id 6C312609AE
 for <bug-gnu-emacs@HIDDEN>; Tue,  3 Jun 2025 16:41:28 +0300 (MSK)
Received: by mail-nwsmtp-smtp-production-main-57.klg.yp-c.yandex.net
 (smtp/Yandex) with ESMTPSA id RfbJOxQLjiE0-Fv6nRJf6; 
 Tue, 03 Jun 2025 16:41:28 +0300
X-Yandex-Fwd: 1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail;
 t=1748958088; bh=wHc+qWOEmONNj4SQ+Xd1ixWCMjLAb+TYyMRid//bA3U=;
 h=Date:To:From:Subject:Message-ID;
 b=K/rAKdGchkPYbRjIy4DFd44qGbwy8If8FGgtc401I7BVk8TQX0p8jv/FA/E3V8ycP
 +sSbp/OhIyjs+pZLLFzdj5yv2p4yJrrQ1DkHgwcuUz7wF8uIi6l1Rxhn7zE4TH3CZb
 1Fghc8kiav6of0E2RT+Mhzy24CiZ2klFalRDR1OY=
Authentication-Results: mail-nwsmtp-smtp-production-main-57.klg.yp-c.yandex.net;
 dkim=pass header.i=@yandex.ru
Message-ID: <d9bfb991daadb3fd134a189dbb21c49af4d60715.camel@HIDDEN>
Subject: typescript-ts-mode "fills" code when using (fill-paragraph)
From: Konstantin Kharlamov <Hi-Angel@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Date: Tue, 03 Jun 2025 16:41:26 +0300
Content-Type: multipart/mixed; boundary="=-UjtbdAx+x3Dj1kSVEdMU"
User-Agent: Evolution 3.56.1 
MIME-Version: 1.0
Received-SPF: pass client-ip=2a02:6b8:c41:1300:1:45:d181:d100;
 envelope-from=hi-angel@HIDDEN; helo=forward100d.mail.yandex.net
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

--=-UjtbdAx+x3Dj1kSVEdMU
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

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.

--=-UjtbdAx+x3Dj1kSVEdMU
Content-Disposition: attachment; filename="1.patch"
Content-Type: text/x-patch; name="1.patch"; charset="UTF-8"
Content-Transfer-Encoding: base64

RnJvbSA4NjlkMGI5NWJkNDlkZWQyYzY2MjIyZDZiOGFkMDI0MTZjYTFmNDY1IE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBLb25zdGFudGluIEtoYXJsYW1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yBAQCB0eXBlc2NyaXB0LXRzLWJhc2UtbW9kZQogICA6c3lu
dGF4LXRhYmxlIHR5cGVzY3JpcHQtdHMtbW9kZS0tc3ludGF4LXRhYmxlCiAKICAgOzsgQ29tbWVu
dHMuCisgIChjLXRzLWNvbW1vbi1jb21tZW50LXNldHVwKQogICAoc2V0cS1sb2NhbCBjb21tZW50
LXNldHVwLWZ1bmN0aW9uICMnanMtLXRyZWVzaXQtY29tbWVudC1zZXR1cCkKIAogICA7OyBFbGVj
dHJpYwotLSAKMi40OS4wCgo=


--=-UjtbdAx+x3Dj1kSVEdMU--




Acknowledgement sent to Konstantin Kharlamov <Hi-Angel@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#78680; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 3 Jun 2025 17:00:02 UTC

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