From unknown Tue Jul 22 23:08:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67357: [PATCH] Fix c-ts-mode block indent when first-siblings are comments Resent-From: Noah Peart Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Nov 2023 01:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 67357 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 67357@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.170061787824470 (code B ref -1); Wed, 22 Nov 2023 01:52:02 +0000 Received: (at submit) by debbugs.gnu.org; 22 Nov 2023 01:51:18 +0000 Received: from localhost ([127.0.0.1]:57769 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r5cOb-0006Mc-PD for submit@debbugs.gnu.org; Tue, 21 Nov 2023 20:51:18 -0500 Received: from lists.gnu.org ([2001:470:142::17]:51926) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r5cOa-0006MQ-AF for submit@debbugs.gnu.org; Tue, 21 Nov 2023 20:51:17 -0500 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 ) id 1r5cOS-00051W-0m for bug-gnu-emacs@gnu.org; Tue, 21 Nov 2023 20:51:08 -0500 Received: from mail-ot1-x336.google.com ([2607:f8b0:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r5cOQ-0008Rt-7Q for bug-gnu-emacs@gnu.org; Tue, 21 Nov 2023 20:51:07 -0500 Received: by mail-ot1-x336.google.com with SMTP id 46e09a7af769-6d7e51638e7so712397a34.1 for ; Tue, 21 Nov 2023 17:51:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700617864; x=1701222664; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=O/6rere6puuXSNoChZqTp9EILX7SU6VnhHGyggSqYrI=; b=eAUpuZlgxrx2Xrbmf11cdHGbynuWAwrIf49CwxES5tlSvhJhQHetIJlaakYE688XwJ rED+J3EwDWm4LNC/bNhIsg/5NSCYs9MDtE7FUEsx1EhakE0WWV2JQNaYG+Ioaf7sET37 YgFefQWkNxgiL53zJRXLwCVIl0AmLtjOErH2AYk0AzM0UKkmqeQnGO78zsihal2SA7nS OmySeGEYvp66fkWU2Jxzn039Q2tfCYTd2MmtBOFLyq0kbsAI+qIl88Dmx72TWMGxMTrA a5zrNwYfCfixo4DxYl5PEu3w/uRJt2xC/ynfVRBbIXMQSB3mArM7uH1qjSvar+C0ka7e UZMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700617864; x=1701222664; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=O/6rere6puuXSNoChZqTp9EILX7SU6VnhHGyggSqYrI=; b=Rbg9RokncO/caDxn1IrszV0GLeaUE1KojK7v2xJc9CtlwG/nJY0AtNH0cD5P7QQ7jv 6LSiN2b6wqUY7I0f8wYxeAoLoazaj4SWS505HOLpR3cprYXQVhv1Yx8UjjFuSdqJ4rtX VEaUPzvHXd1eE9oA13FBwBPVropaWHAYe38nvtf8dL00GEKWbG05mJkAXQWgHf5vnk47 +nnHiCAEZUjGmkGT2kA0McJI61PM3QygxwXQkq/q146mLNxyCOBi1A1AxcIZUMpK3sbk +GSuQ2SI4f2dwApVtuMrf+VozG6tp4Q71W9aIuYVsAbGjMR9krxpSdzh/3V3AYyxjmPl OMBQ== X-Gm-Message-State: AOJu0YxGvl3UyUl334nWsgVO+kRrg27GLhpw8gagUuPkRwlji/9q8kn9 h+a5lBZpwPUfs/yOzEYBGJceiWnfCcE4SHvJioq8gfy5kixalRe9qf4= X-Google-Smtp-Source: AGHT+IGvleYWSNCaV0yKsDGieLQZmW7VVMso8ihOo/mVrawqjEaxs5tafLhMWiRV2GDYa4TcVR/m6e0tkYY7IiQU828= X-Received: by 2002:a05:6871:e40c:b0:1e9:d8a4:5523 with SMTP id py12-20020a056871e40c00b001e9d8a45523mr1423963oac.41.1700617863969; Tue, 21 Nov 2023 17:51:03 -0800 (PST) MIME-Version: 1.0 From: Noah Peart Date: Tue, 21 Nov 2023 17:50:52 -0800 Message-ID: Content-Type: multipart/mixed; boundary="000000000000ae57b1060ab3f31a" Received-SPF: pass client-ip=2607:f8b0:4864:20::336; envelope-from=noah.v.peart@gmail.com; helo=mail-ot1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --000000000000ae57b1060ab3f31a Content-Type: multipart/alternative; boundary="000000000000ae57b0060ab3f318" --000000000000ae57b0060ab3f318 Content-Type: text/plain; charset="UTF-8" Tags: patch I wasn't sure if these should be two separate bugs, so I separated them just in case. * lisp/progmodes/c-ts-mode.el(c-ts-mode--indent-styles): Fix indentation in block statements for cases when the first-sibling(s) are comments or nested keywords (else_clause/do while). Bug: The first statement in a compound statement that is preceded by a comment (or multiple comments) isn't indented. For example, the `if` statement isnt indented in the following code in `c-ts-mode` using `linux` style. int main() { while (true) { /* foo */ if (true) { // this line isnt indented puts ("Hello"); // and this isnt either } } } * lisp/progmodes/c-ts-mode.el(c-ts-mode--indent-styles): Fix indentation for else_clause and do-while in bracket-less block statements using `linux` style. Bug: There is no matching indent rule for bracket-less else_clause statements and the "while" in a bracket-less do-while statement is indented to the same level as the do body. To reproduce, using `linux` style in `c-ts-mode`. int main() { if (true) puts("Hello"); else puts("No matched rule!"); do puts("Hello"); while (indented_as_part_of_block); } In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2023-11-18 built on noah-X580VD Repository revision: 47b497b4dac91e5ea56102018223bdeb5e21a93b Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101004 System Description: Ubuntu 22.04.3 LTS Configured using: 'configure --prefix=/usr/local --with-modules --with-tree-sitter --with-threads --with-x-toolkit=gtk3 --with-xwidgets --with-gnutls --with-json --with-mailutils --with-jpeg --with-png --with-rsvg --with-tiff --with-xml2 --with-xpm --with-imagemagick CC=gcc-12 CXX=gcc-12' --000000000000ae57b0060ab3f318 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Tags: patch

I wasn't sure if these should be tw= o separate bugs, so I separated them just=C2=A0
in case.

* lisp/= progmodes/c-ts-mode.el(c-ts-mode--indent-styles): Fix indentation
in blo= ck statements for cases when the first-sibling(s) are comments or
nested= keywords (else_clause/do while).

Bug: The first statement in a comp= ound statement that is preceded by a
comment (or multiple comments) isn&= #39;t indented.

For example, the `if` statement isnt indented in the= following code in
`c-ts-mode` using `linux` style.

=C2=A0 =C2=A0= int main() {
=C2=A0 =C2=A0 =C2=A0 while (true) { /* foo */
=C2=A0 = =C2=A0 =C2=A0if (true) { // this line isnt indented
=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 puts ("Hello"); // and this isnt either
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 }

= * lisp/progmodes/c-ts-mode.el(c-ts-mode--indent-styles): Fix indentationfor else_clause and do-while in bracket-less block statements using
`li= nux` style.

Bug: There is no matching indent rule for bracket-less e= lse_clause
statements and the "while" in a bracket-less do-whi= le statement is
indented to the same level as the do body.

To rep= roduce, using `linux` style in `c-ts-mode`.

=C2=A0 =C2=A0 int main()= {
=C2=A0 =C2=A0 =C2=A0 if (true)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 puts(&= quot;Hello");
=C2=A0 =C2=A0 =C2=A0 else
=C2=A0 =C2=A0 =C2=A0 pu= ts("No matched rule!");
=C2=A0 =C2=A0 =C2=A0 do
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 puts("Hello");
=C2=A0 =C2=A0 =C2=A0 =C2=A0 w= hile (indented_as_part_of_block);
=C2=A0 =C2=A0 }


In GNU Emac= s 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.33, cairo ver= sion 1.16.0) of 2023-11-18 built on noah-X580VD
Repository revision: 47b= 497b4dac91e5ea56102018223bdeb5e21a93b
Repository branch: master
Windo= wing system distributor 'The X.Org Foundation', version 11.0.121010= 04
System Description: Ubuntu 22.04.3 LTS

Configured using:
= =C2=A0'configure --prefix=3D/usr/local --with-modules --with-tree-sitte= r
--with-threads --with-x-toolkit=3Dgtk3 --with-xwidgets --with-gnutls--with-json --with-mailutils --with-jpeg --with-png --with-rsvg
--with= -tiff --with-xml2 --with-xpm --with-imagemagick CC=3Dgcc-12
CXX=3Dgcc-12= '
--000000000000ae57b0060ab3f318-- --000000000000ae57b1060ab3f31a Content-Type: text/x-patch; charset="US-ASCII"; name="c-ts-mode-first-sib-comments.patch" Content-Disposition: attachment; filename="c-ts-mode-first-sib-comments.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lp93xha40 RnJvbSBmNWM3NWE1MTViMWZlZDE5ZDk4ZjQxZDdhMWJjOTVkMjg1ZGM0ZGYwIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBudmVybm8gPG5vYWgudi5wZWFydEBnbWFpbC5jb20+CkRhdGU6 IFR1ZSwgMjEgTm92IDIwMjMgMTY6MzM6MDQgLTA4MDAKU3ViamVjdDogW1BBVENIXSBmaXggYy10 cy1tb2RlIGluZGVudGF0aW9uIHdoZW4gZmlyc3Qtc2libGluZyBpcyBhIGNvbW1lbnQKCi0tLQog bGlzcC9wcm9nbW9kZXMvYy10cy1tb2RlLmVsICAgICAgICAgICAgICAgICAgIHwgIDYgKysrLQog Li4uL3Byb2dtb2Rlcy9jLXRzLW1vZGUtcmVzb3VyY2VzL2luZGVudC5lcnRzIHwgMzIgKysrKysr KysrKysrKysrKysrLQogMiBmaWxlcyBjaGFuZ2VkLCAzNiBpbnNlcnRpb25zKCspLCAyIGRlbGV0 aW9ucygtKQoKZGlmZiAtLWdpdCBhL2xpc3AvcHJvZ21vZGVzL2MtdHMtbW9kZS5lbCBiL2xpc3Av cHJvZ21vZGVzL2MtdHMtbW9kZS5lbAppbmRleCA3MDcxN2E5MGNhYS4uYTkzZDhiZWIyNzIgMTAw NjQ0Ci0tLSBhL2xpc3AvcHJvZ21vZGVzL2MtdHMtbW9kZS5lbAorKysgYi9saXNwL3Byb2dtb2Rl cy9jLXRzLW1vZGUuZWwKQEAgLTQ0Myw3ICs0NDMsOSBAQCBjLXRzLW1vZGUtLWluZGVudC1zdHls ZXMKIAogICAgICAgICAgICA7OyBTdGF0ZW1lbnQgaW4ge30gYmxvY2tzLgogICAgICAgICAgICAo KG9yIChtYXRjaCBuaWwgImNvbXBvdW5kX3N0YXRlbWVudCIgbmlsIDEgMSkKLSAgICAgICAgICAg ICAgICAobWF0Y2ggbnVsbCAiY29tcG91bmRfc3RhdGVtZW50IikpCisgICAgICAgICAgICAgICAg KG1hdGNoIG51bGwgImNvbXBvdW5kX3N0YXRlbWVudCIpCisgICAgICAgICAgICAgICAgOzsgQ2Fz ZSB3aGVuIGZpcnN0IHNpYmxpbmcocykgYXJlIGNvbW1lbnRzCisgICAgICAgICAgICAgICAgKHF1 ZXJ5ICIoY29tcG91bmRfc3RhdGVtZW50IF8gKGNvbW1lbnQpIChfKSBAaW5kZW50KSIpKQogICAg ICAgICAgICAgc3RhbmRhbG9uZS1wYXJlbnQgYy10cy1tb2RlLWluZGVudC1vZmZzZXQpCiAgICAg ICAgICAgICgocGFyZW50LWlzICJjb21wb3VuZF9zdGF0ZW1lbnQiKSBjLXRzLW1vZGUtLWFuY2hv ci1wcmV2LXNpYmxpbmcgMCkKICAgICAgICAgICAgOzsgT3BlbmluZyBicmFja2V0LgpAQCAtNDU0 LDggKzQ1NiwxMCBAQCBjLXRzLW1vZGUtLWluZGVudC1zdHlsZXMKICAgICAgICAgICAgOzsgVGVz dGVkIGJ5IHRoZSAiQnJhY2tldGxlc3MgU2ltcGxlIFN0YXRlbWVudCIgdGVzdC4KICAgICAgICAg ICAgKChwYXJlbnQtaXMgImlmX3N0YXRlbWVudCIpIHN0YW5kYWxvbmUtcGFyZW50IGMtdHMtbW9k ZS1pbmRlbnQtb2Zmc2V0KQogICAgICAgICAgICAoKHBhcmVudC1pcyAiZm9yX3N0YXRlbWVudCIp IHN0YW5kYWxvbmUtcGFyZW50IGMtdHMtbW9kZS1pbmRlbnQtb2Zmc2V0KQorICAgICAgICAgICAo KG1hdGNoICJ3aGlsZSIgImRvX3N0YXRlbWVudCIpIHBhcmVudC1ib2wgMCkgOyAoZG9fc3RhdGVt ZW50ICJ3aGlsZSIpCiAgICAgICAgICAgICgocGFyZW50LWlzICJ3aGlsZV9zdGF0ZW1lbnQiKSBz dGFuZGFsb25lLXBhcmVudCBjLXRzLW1vZGUtaW5kZW50LW9mZnNldCkKICAgICAgICAgICAgKChw YXJlbnQtaXMgImRvX3N0YXRlbWVudCIpIHN0YW5kYWxvbmUtcGFyZW50IGMtdHMtbW9kZS1pbmRl bnQtb2Zmc2V0KQorICAgICAgICAgICAoKHBhcmVudC1pcyAiZWxzZV9jbGF1c2UiKSBzdGFuZGFs b25lLXBhcmVudCBjLXRzLW1vZGUtaW5kZW50LW9mZnNldCkKIAogICAgICAgICAgICAoKHBhcmVu dC1pcyAiY2FzZV9zdGF0ZW1lbnQiKSBzdGFuZGFsb25lLXBhcmVudCBjLXRzLW1vZGUtaW5kZW50 LW9mZnNldCkKIApkaWZmIC0tZ2l0IGEvdGVzdC9saXNwL3Byb2dtb2Rlcy9jLXRzLW1vZGUtcmVz b3VyY2VzL2luZGVudC5lcnRzIGIvdGVzdC9saXNwL3Byb2dtb2Rlcy9jLXRzLW1vZGUtcmVzb3Vy Y2VzL2luZGVudC5lcnRzCmluZGV4IDIyMWIzZDgwOWFmLi5kMjkzNzBiNDFlNiAxMDA2NDQKLS0t IGEvdGVzdC9saXNwL3Byb2dtb2Rlcy9jLXRzLW1vZGUtcmVzb3VyY2VzL2luZGVudC5lcnRzCisr KyBiL3Rlc3QvbGlzcC9wcm9nbW9kZXMvYy10cy1tb2RlLXJlc291cmNlcy9pbmRlbnQuZXJ0cwpA QCAtMzEwLDcgKzMxMCw3IEBAIGxhYmVsOgogCiBOYW1lOiBCcmFja2V0LWxlc3MgQmxvY2stU3Rh dGVtZW50IChMaW51eCBTdHlsZSkgKGJ1ZyM2MTAyNikKIAotPS09LT0KKz0tPQogaW50IG1haW4o KSB7CiAgIHdoaWxlICh0cnVlKQogICAgIGlmICh0cnVlKSB7CkBAIC0zMzEsNiArMzMxLDggQEAg aW50IG1haW4oKSB7CiAgICAgaWYgKHRydWUpIHsKICAgICAgIHB1dHMgKCJIZWxsbyIpOwogICAg IH0KKyAgICBlbHNlCisgICAgICBwdXRzKCJIZWxsbyIpOwogfQogPS09LT0KIApAQCAtMzc5LDYg KzM4MSwzNCBAQCB2b2lkIGZvbygKIH0KID0tPS09CiAKK05hbWU6IEJsb2NrLVN0YXRlbWVudCB3 aGVyZSBmaXJzdCBzaWJsaW5ncyBhcmUgY29tbWVudHMgKExpbnV4IFN0eWxlKQorCis9LT0KK2lu dCBtYWluKCkgeworICB3aGlsZSAodHJ1ZSkgeyAvKiBmb28gKi8KKyAgICBpZiAodHJ1ZSkgeyAv LyBiYXIKKyAgICAgIHB1dHMgKCJIZWxsbyIpOworICAgIH0KKyAgfQorICBmb3IgKDs7KSB7ICAv LyAxLiBmb29vCisgICAgLyogMi4gYmFhYSAqLworICAgIC8qIDMuIHJyciAqLworICAgIGlmICh0 cnVlKQorICAgICAgLy8gMi4gYmFhYQorICAgICAgcHV0cyAoIkhlbGxvIik7CisgIH0KKyAgaWYg KDEpIHsgLy8gMQorICAgIC8qCisgICAgICogMgorICAgICAqLworICAgIGlmICgxKSAvKjMqLyB7 CisgICAgICAvKiA0ICovCisgICAgICBwdXRzKCJIZWxsbyIpOworICAgIH0KKyAgfQorfQorPS09 LT0KKwogTmFtZTogSW5pdGlhbGl6ZXIgTGlzdCAoTGludXggU3R5bGUpIChCdWcjNjEzOTgpCiAK ID0tPQotLSAKMi4zNC4xCgo= --000000000000ae57b1060ab3f31a-- From unknown Tue Jul 22 23:08:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67357: [PATCH] Fix c-ts-mode block indent when first-siblings are comments Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Nov 2023 07:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67357 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Noah Peart , Yuan Fu Cc: 67357@debbugs.gnu.org Received: via spool by 67357-submit@debbugs.gnu.org id=B67357.170072493327021 (code B ref 67357); Thu, 23 Nov 2023 07:36:01 +0000 Received: (at 67357) by debbugs.gnu.org; 23 Nov 2023 07:35:33 +0000 Received: from localhost ([127.0.0.1]:60502 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r64FJ-00071k-7f for submit@debbugs.gnu.org; Thu, 23 Nov 2023 02:35:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46868) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r64FH-00071V-T7 for 67357@debbugs.gnu.org; Thu, 23 Nov 2023 02:35:32 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r64F8-0006tC-DR; Thu, 23 Nov 2023 02:35:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=XOtiJgumrENgJl8V/N//qqOC1ezCLWZV9JFF9BglNXs=; b=esq3drPej0R4 ECwuhu0Xs/YmbVhDAXV57aBQXC1wbwHhlZ0yahmmjdfrDUP71rfYLWcU1bnaThtwNEqs8l+KG8mwr hSj9glzqksSAdk7Ub4fXu7f90BJUd9k9p4VlZkw9ebft/UQSs1GslfbCRb/LXNWpvk5VIavlqFcFm 9PLV1uUm3J2UTVqvnapg0nMvlFRM3VFMSyvlbNlI2WcrJkpJ6pu6vR9M72VFwLp6QlwpSF1UAqGX0 xucTqvKStJKT6j/xi6zndo6jLeQS926aqUEi9RyEtT7/wXgY+9/OkX2fvmw7h5dAFko16CjEUErkk nw2OOD3q9R3/8+2Cc+e8Mg==; Date: Thu, 23 Nov 2023 09:35:13 +0200 Message-Id: <834jhchqha.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Noah Peart on Tue, 21 Nov 2023 17:50:52 -0800) References: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Noah Peart > Date: Tue, 21 Nov 2023 17:50:52 -0800 > > I wasn't sure if these should be two separate bugs, so I separated them just > in case. > > * lisp/progmodes/c-ts-mode.el(c-ts-mode--indent-styles): Fix indentation > in block statements for cases when the first-sibling(s) are comments or > nested keywords (else_clause/do while). > > Bug: The first statement in a compound statement that is preceded by a > comment (or multiple comments) isn't indented. > > For example, the `if` statement isnt indented in the following code in > `c-ts-mode` using `linux` style. > > int main() { > while (true) { /* foo */ > if (true) { // this line isnt indented > puts ("Hello"); // and this isnt either > } > } > } > > * lisp/progmodes/c-ts-mode.el(c-ts-mode--indent-styles): Fix indentation > for else_clause and do-while in bracket-less block statements using > `linux` style. > > Bug: There is no matching indent rule for bracket-less else_clause > statements and the "while" in a bracket-less do-while statement is > indented to the same level as the do body. > > To reproduce, using `linux` style in `c-ts-mode`. > > int main() { > if (true) > puts("Hello"); > else > puts("No matched rule!"); > do > puts("Hello"); > while (indented_as_part_of_block); > } I'm not sure I can reproduce these, it seems to me that the indentation is correct in these case when I try the examples. So please show a detailed recipe, starting from "emacs -Q", for each of the two problems, so that we could be sure that we are seeing the same problems. Also, please tell if the same problems exist on the emacs-29 branch. Adding Yuan to the discussion. From unknown Tue Jul 22 23:08:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67357: [PATCH] Fix c-ts-mode block indent when first-siblings are comments Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Nov 2023 13:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67357 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii , Noah Peart , Yuan Fu Cc: 67357@debbugs.gnu.org Received: via spool by 67357-submit@debbugs.gnu.org id=B67357.17007454786642 (code B ref 67357); Thu, 23 Nov 2023 13:18:02 +0000 Received: (at 67357) by debbugs.gnu.org; 23 Nov 2023 13:17:58 +0000 Received: from localhost ([127.0.0.1]:32893 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r69af-0001j4-Ft for submit@debbugs.gnu.org; Thu, 23 Nov 2023 08:17:57 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:51867) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r69ad-0001is-JH for 67357@debbugs.gnu.org; Thu, 23 Nov 2023 08:17:56 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 56B715C01F1; Thu, 23 Nov 2023 08:17:46 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 23 Nov 2023 08:17:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1700745466; x=1700831866; bh=DjEiMYpbOdhl0ywJy98LuU4eEP/kcCUR8Fw 8+ahIjjY=; b=DDyy1atzLEUvbvRFx7Vxpq7bHKducuy8bD0AOP5XUsSLwW1gBZ1 RG9RuHQvNm8mIjjg7Iwqp7jkrNqNcLBx8rY3FhpHaS7TJAP2XJSbWBakkuxyb/sd +BF8RYQXUUB7pvU9x0aGPn9GylJwBxvR/tMpECxJqaOPze5Ll39KIhFxvD3a9RA5 zCp6gXbGQeZ5sLrPJkRnuZAJoPUvPrVs1NWc9nQTe73LEXff4T//mdLL/aYfkImj QKUibOR3uJT9qHd66ZfE661yhZzagrPAHYkxP5iMh4ADtTyeWhuxdhHtL/y1vous zOjqoEEhRVhZv8IzwdHlMLcEMr0FgqLN9+Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1700745466; x=1700831866; bh=DjEiMYpbOdhl0ywJy98LuU4eEP/kcCUR8Fw 8+ahIjjY=; b=i+yhFL8SwGF6adG2PrnikGKsCYDVguqwyE7VFEvo1SmKZk7x8RQ 669ze5BmU3pKcv/H9BjDnRc+BEEukt7aIc+Ghdz91NG7s7d6TMC2n5iOwt/3lHbo jIrZoYS901iDIDK/773NtLksYIB/zJzmFizQiwXQyzrgSKKldzxXFPa7mm78kJ7f vv8M/oyWCf0x93tzoFFvZLVQgVluJpmVGi4jg6GPAKgWCGpSnoocQXMmmU8b9veX xKxIG7cnAgNGjkWOrxBi5R9T6ZsmLAPCeDf/21Iy0ZcsB6VF/kf4XhgrzxuAmu+p MG9GUWa3g68HrT3R35+5d5sjaL2sFHDyFbg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehfedggeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 23 Nov 2023 08:17:44 -0500 (EST) Message-ID: <08e16d44-174d-87e6-aa17-8cf55202227b@gutov.dev> Date: Thu, 23 Nov 2023 15:17:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US References: <834jhchqha.fsf@gnu.org> From: Dmitry Gutov In-Reply-To: <834jhchqha.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.9 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.9 (---) On 23/11/2023 09:35, Eli Zaretskii wrote: >> From: Noah Peart >> Date: Tue, 21 Nov 2023 17:50:52 -0800 >> >> I wasn't sure if these should be two separate bugs, so I separated them just >> in case. >> >> * lisp/progmodes/c-ts-mode.el(c-ts-mode--indent-styles): Fix indentation >> in block statements for cases when the first-sibling(s) are comments or >> nested keywords (else_clause/do while). >> >> Bug: The first statement in a compound statement that is preceded by a >> comment (or multiple comments) isn't indented. >> >> For example, the `if` statement isnt indented in the following code in >> `c-ts-mode` using `linux` style. >> >> int main() { >> while (true) { /* foo */ >> if (true) { // this line isnt indented >> puts ("Hello"); // and this isnt either >> } >> } >> } >> >> * lisp/progmodes/c-ts-mode.el(c-ts-mode--indent-styles): Fix indentation >> for else_clause and do-while in bracket-less block statements using >> `linux` style. >> >> Bug: There is no matching indent rule for bracket-less else_clause >> statements and the "while" in a bracket-less do-while statement is >> indented to the same level as the do body. >> >> To reproduce, using `linux` style in `c-ts-mode`. >> >> int main() { >> if (true) >> puts("Hello"); >> else >> puts("No matched rule!"); >> do >> puts("Hello"); >> while (indented_as_part_of_block); >> } > I'm not sure I can reproduce these, it seems to me that the > indentation is correct in these case when I try the examples. So > please show a detailed recipe, starting from "emacs -Q", for each of > the two problems, so that we could be sure that we are seeing the same > problems. I can easily reproduce the first one (comment-related): the two indicated lines just don't reindent at all. That's with the default 'gnu' indentation style, but also with 'linux' and perhaps others (I haven't tried). To reproduce the second one, you first need to enable the 'linux' style: (setq c-ts-mode-indent-style 'linux) M-x c-ts-mode Then 'while' indents the same level as 'puts'. Unless this is actually indended for the 'linux' style (I have no idea), it's a bug too. From unknown Tue Jul 22 23:08:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67357: [PATCH] Fix c-ts-mode block indent when first-siblings are comments Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Nov 2023 14:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67357 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Dmitry Gutov Cc: noah.v.peart@gmail.com, casouri@gmail.com, 67357@debbugs.gnu.org Received: via spool by 67357-submit@debbugs.gnu.org id=B67357.170075004925140 (code B ref 67357); Thu, 23 Nov 2023 14:35:02 +0000 Received: (at 67357) by debbugs.gnu.org; 23 Nov 2023 14:34:09 +0000 Received: from localhost ([127.0.0.1]:32945 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r6AmP-0006XQ-2t for submit@debbugs.gnu.org; Thu, 23 Nov 2023 09:34:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36946) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r6AmM-0006X5-HN for 67357@debbugs.gnu.org; Thu, 23 Nov 2023 09:34:07 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r6AmC-00004r-Hl; Thu, 23 Nov 2023 09:33:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=F0uh5e1nww78Q1ivxB8TZ6bekrnW/jfLl+L6SJCDyl8=; b=Oypsz8GKFcwp kYwtqOf626PdwL88iv8ZsCu1yMN47Kslv9hJvJsF3FHQp2e/YrITgJRSkkecA1Hhib061KfL9sHoa Vr//V50KwL4olv+WhffmisrcB74SA4k5f4DctWYK+Nv597zGq75ae6Z8HMS3x5om1ZtCQJ7aNLlpq eqGPQrc36Ee8eDyMSbAB0scX44xhaSGSqORWgJMVjgg6JuqZ9SVqQjd30q95aX7L7cMwQK6MlIiMX bKVR0U3Hrb2dWIPt2gdz2aZ7jdNWEhOG1sRn1gFky1YT2CZjt398Ft3BpgOF7xIkHghZfGjwzCsIL Z/R2xBasdMI+xGV09pXmEg==; Date: Thu, 23 Nov 2023 16:33:48 +0200 Message-Id: <83wmu8fsj7.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <08e16d44-174d-87e6-aa17-8cf55202227b@gutov.dev> (message from Dmitry Gutov on Thu, 23 Nov 2023 15:17:40 +0200) References: <834jhchqha.fsf@gnu.org> <08e16d44-174d-87e6-aa17-8cf55202227b@gutov.dev> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Thu, 23 Nov 2023 15:17:40 +0200 > Cc: 67357@debbugs.gnu.org > From: Dmitry Gutov > > On 23/11/2023 09:35, Eli Zaretskii wrote: > > I'm not sure I can reproduce these, it seems to me that the > > indentation is correct in these case when I try the examples. So > > please show a detailed recipe, starting from "emacs -Q", for each of > > the two problems, so that we could be sure that we are seeing the same > > problems. > > I can easily reproduce the first one (comment-related): the two > indicated lines just don't reindent at all. That's with the default > 'gnu' indentation style, but also with 'linux' and perhaps others (I > haven't tried). I don't understand what you mean by "reindent". That wasn't what the original report was about, AFAIU. I still think a complete recipe is needed. > To reproduce the second one, you first need to enable the 'linux' style: I tried to reproduce _only_ with the 'linux' style, as the bug report said. > (setq c-ts-mode-indent-style 'linux) > M-x c-ts-mode The style is a per-buffer setting, so AFAIU one needs to set the style after turning on the mode in a buffer, whether manually or automatically. A full recipe is supposed to remove all those confusing details and potential mistakes. From unknown Tue Jul 22 23:08:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67357: [PATCH] Fix c-ts-mode block indent when first-siblings are comments Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Nov 2023 14:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67357 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: noah.v.peart@gmail.com, casouri@gmail.com, 67357@debbugs.gnu.org Received: via spool by 67357-submit@debbugs.gnu.org id=B67357.170075048825810 (code B ref 67357); Thu, 23 Nov 2023 14:42:01 +0000 Received: (at 67357) by debbugs.gnu.org; 23 Nov 2023 14:41:28 +0000 Received: from localhost ([127.0.0.1]:32959 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r6AtT-0006iE-HL for submit@debbugs.gnu.org; Thu, 23 Nov 2023 09:41:27 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:60429) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r6AtQ-0006i0-Il for 67357@debbugs.gnu.org; Thu, 23 Nov 2023 09:41:25 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 37D705C00C3; Thu, 23 Nov 2023 09:41:15 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 23 Nov 2023 09:41:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1700750475; x=1700836875; bh=wU48G45zmvHkYYzeZj0wfLGpZbkwzSiqvXB HWeHAEU4=; b=CBS476wzfCBZYT0XHxW5TYhANr9ZceDKdBPZCpUXnjmstOTT2Re UrxXJ341EPGCgUTlKVsWVLW2ArYHCd9JU2RsQuprJEbHmv+j72ZPk0kheKyv0H7Y PiM8687EdD2aMoidC9tYWaIJXwzBwhgj4ItQaE+G/CD8qoUg2FYgHozuPYNn1VBk FjyoxIbQljpGNsHBFbJ5LaKZOUBCKBh+tSwae8dLk8iO8ztKlamCR94PutcNPtYm tpdiKtSogmcDLYNxwVQPyrXuNA8vThWSpCM9qcksz2TmBpuxRwQUZAIJQXlEzlny 1WZnT86xQXqmFyCcjfzCpaal1tNjP4iGthQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1700750475; x=1700836875; bh=wU48G45zmvHkYYzeZj0wfLGpZbkwzSiqvXB HWeHAEU4=; b=V7xfkViTxXt9zUjb6DTwTr/dTf5q8OuIffuTor7NFNtJoUHCfoP W68NIvp2/XthmVL+KqBrdtqG9IFmDQzVIsuKgsSSiIBWrt/AcSIcRC9WpxMI0fep bM3bT89wx2VmS3cDyGt2KVhZhLW2lTqmfKzPDQJnwQG4MKR2Fepnx+ko9gdwS6k6 6HQtZP1CGa5sCiYc4FqTY5WySqiHISuBSz7vOSS4lL4sFm3QMK6S3lti/YTI9gvt 6wvCFqn+//UfeZbgkMOSz19mpK2Wwlpi4BAf9bWtm4Ieg5JQwOiVliGHJoioD/K9 BPT+5RVs7Vr6oPeABvy7ZBVRKo0HnlLEXxw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehfedgieeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 23 Nov 2023 09:41:12 -0500 (EST) Message-ID: Date: Thu, 23 Nov 2023 16:41:10 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US References: <834jhchqha.fsf@gnu.org> <08e16d44-174d-87e6-aa17-8cf55202227b@gutov.dev> <83wmu8fsj7.fsf@gnu.org> From: Dmitry Gutov In-Reply-To: <83wmu8fsj7.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.9 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.9 (---) On 23/11/2023 16:33, Eli Zaretskii wrote: >> Date: Thu, 23 Nov 2023 15:17:40 +0200 >> Cc: 67357@debbugs.gnu.org >> From: Dmitry Gutov >> >> On 23/11/2023 09:35, Eli Zaretskii wrote: >>> I'm not sure I can reproduce these, it seems to me that the >>> indentation is correct in these case when I try the examples. So >>> please show a detailed recipe, starting from "emacs -Q", for each of >>> the two problems, so that we could be sure that we are seeing the same >>> problems. >> >> I can easily reproduce the first one (comment-related): the two >> indicated lines just don't reindent at all. That's with the default >> 'gnu' indentation style, but also with 'linux' and perhaps others (I >> haven't tried). > > I don't understand what you mean by "reindent". That wasn't what the > original report was about, AFAIU. Reindent is when you press tab, and the indentation on a given line changes. In that example, no matter which indentation you set on those line, pressing TAB doesn't change it. > I still think a complete recipe is needed. > >> To reproduce the second one, you first need to enable the 'linux' style: > > I tried to reproduce _only_ with the 'linux' style, as the bug report > said. > >> (setq c-ts-mode-indent-style 'linux) >> M-x c-ts-mode > > The style is a per-buffer setting, so AFAIU one needs to set the style > after turning on the mode in a buffer, whether manually or > automatically. Did you use 'M-x c-ts-mode-set-style', then? That also repros for me. The style can be set locally - as the above command does - but initially the global value is used. And it's applied during the major mode's execution, so a simple 'setq' doesn't work. > A full recipe is supposed to remove all those confusing details and > potential mistakes. I don't mind. From unknown Tue Jul 22 23:08:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67357: [PATCH] Fix c-ts-mode block indent when first-siblings are comments Resent-From: Noah Peart Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Nov 2023 13:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67357 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Dmitry Gutov Cc: Eli Zaretskii , 67357@debbugs.gnu.org, casouri@gmail.com Received: via spool by 67357-submit@debbugs.gnu.org id=B67357.170083368219216 (code B ref 67357); Fri, 24 Nov 2023 13:49:02 +0000 Received: (at 67357) by debbugs.gnu.org; 24 Nov 2023 13:48:02 +0000 Received: from localhost ([127.0.0.1]:35968 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r6WXJ-0004ze-J1 for submit@debbugs.gnu.org; Fri, 24 Nov 2023 08:48:02 -0500 Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]:54774) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r6WXD-0004yN-Vv for 67357@debbugs.gnu.org; Fri, 24 Nov 2023 08:47:59 -0500 Received: by mail-ot1-x32f.google.com with SMTP id 46e09a7af769-6d7f3fc69f4so1054729a34.1 for <67357@debbugs.gnu.org>; Fri, 24 Nov 2023 05:47:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700833666; x=1701438466; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=iZIV+PtGSR4uetMj2QBNciiDRAy0GDgLoQQTWaTn7cI=; b=SJ3ni4JRB3/De9IForiAa8bt4ZcHfsYxlyT0gK/AXG5yismcRpXOx76IwzMXCAFaPT azVDgDQ3FaDmwGSUFuXfES7nOtn+S89cFagLWE29/K4ySg/Jnp6EJ6UlScywZziONc4P nIrT0shpe5+HeOGRO95HtIWAiwe4XtOA+DkgXER1n7Z0hgX4wFsy5jaqLqHB/sSNWHtf yJfoS+2N+u7ggAQrxCuUaerC7d2649xK69ULrvZReZLoXOIiNYRDC5HNRkHSV2NT2olm iQqQ/5KF2NEMtHXGtW999I4rSxJphRxvuv22DEhClNnktWKfKLfO2BeTcpQV/sOCf5c6 mgPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700833666; x=1701438466; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=iZIV+PtGSR4uetMj2QBNciiDRAy0GDgLoQQTWaTn7cI=; b=OszqJtWmqzcamIiqZ/yuFU8YpvVMLF9Ze65PWFHeL2RfD1EHvT4lfv9+s7SNTuTFtv uQ3snG67Lh954V8wqhEl15EI7l14iaAq/xTA7/epAfBAEKsd6ltttuvZ7im1Kxb9inFK Yq5wIBvUtCVZRGPeRpu1KS1B3/almpHmlDfPyUDJwZJzRPl5I+V76rXPGggEPvhBAhlL sK12fJ7DChOrgad3Io2X4dSk5uW1iTe/QIfsbDTTDliZRlRlT8HNeXiNmZj1klCVH3zZ QLCuvgPNbh6VTp7DBz014KGKVZBuO3KjlddU5AuVubm3A0HM/MF0f74ziW+QlHEZROEH OUuQ== X-Gm-Message-State: AOJu0Yz8ynxAq0McY0AmvtmtYKr9G4gOOBq+7x28pZCsz4lh/DELMCKc XdUCVxXTR2+obOGFgtrg1EPnxeCVZbJ55E4F6B8= X-Google-Smtp-Source: AGHT+IF7prhNjPuQ1g6Gx3StqoGemxUidlO3qc5YLfgfnWFjeOJMRfVfe98uTIqEExydjXdGDdLq892+thtf4nR/Mz0= X-Received: by 2002:a05:6870:b4a9:b0:1f5:c858:2efe with SMTP id y41-20020a056870b4a900b001f5c8582efemr3121453oap.0.1700833665583; Fri, 24 Nov 2023 05:47:45 -0800 (PST) MIME-Version: 1.0 References: <834jhchqha.fsf@gnu.org> <08e16d44-174d-87e6-aa17-8cf55202227b@gutov.dev> <83wmu8fsj7.fsf@gnu.org> In-Reply-To: From: Noah Peart Date: Fri, 24 Nov 2023 05:47:34 -0800 Message-ID: Content-Type: multipart/alternative; boundary="000000000000758e31060ae63207" X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000758e31060ae63207 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sorry for the confusion: to setup the `c-ts-mode` buffers to reproduce bugs= , run the following to configure `c-ts-mode` with `linux` style: (defun example-setup () (interactive) (c-ts-mode) (setq-local indent-tabs-mode nil) (setq-local c-ts-mode-indent-offset 2) (c-ts-mode-set-style 'linux)) The patch should also fix the missing indent for the `else_clause` mentioned in https://lists.gnu.org/archive/html/bug-gnu-emacs/2023-11/msg01266.html. On Thu, Nov 23, 2023 at 6:41=E2=80=AFAM Dmitry Gutov wro= te: > On 23/11/2023 16:33, Eli Zaretskii wrote: > >> Date: Thu, 23 Nov 2023 15:17:40 +0200 > >> Cc: 67357@debbugs.gnu.org > >> From: Dmitry Gutov > >> > >> On 23/11/2023 09:35, Eli Zaretskii wrote: > >>> I'm not sure I can reproduce these, it seems to me that the > >>> indentation is correct in these case when I try the examples. So > >>> please show a detailed recipe, starting from "emacs -Q", for each of > >>> the two problems, so that we could be sure that we are seeing the sam= e > >>> problems. > >> > >> I can easily reproduce the first one (comment-related): the two > >> indicated lines just don't reindent at all. That's with the default > >> 'gnu' indentation style, but also with 'linux' and perhaps others (I > >> haven't tried). > > > > I don't understand what you mean by "reindent". That wasn't what the > > original report was about, AFAIU. > > Reindent is when you press tab, and the indentation on a given line > changes. In that example, no matter which indentation you set on those > line, pressing TAB doesn't change it. > > > I still think a complete recipe is needed. > > > >> To reproduce the second one, you first need to enable the 'linux' styl= e: > > > > I tried to reproduce _only_ with the 'linux' style, as the bug report > > said. > > > >> (setq c-ts-mode-indent-style 'linux) > >> M-x c-ts-mode > > > > The style is a per-buffer setting, so AFAIU one needs to set the style > > after turning on the mode in a buffer, whether manually or > > automatically. > > Did you use 'M-x c-ts-mode-set-style', then? That also repros for me. > > The style can be set locally - as the above command does - but initially > the global value is used. And it's applied during the major mode's > execution, so a simple 'setq' doesn't work. > > > A full recipe is supposed to remove all those confusing details and > > potential mistakes. > > I don't mind. > --000000000000758e31060ae63207 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Sorry for the confusion: to setup=C2=A0the `c-ts-mode` buf= fers to reproduce bugs,
run the following to configure `c-ts-mode` with= `linux` style:

=C2=A0 =C2=A0 (defun example-setup = ()
=C2=A0 =C2=A0 =C2=A0 (interactive)
=C2=A0 =C2=A0 =C2=A0 (c-ts-mode= )
=C2=A0 =C2=A0 =C2=A0 (setq-local indent-tabs-mode nil)
=C2=A0 =C2= =A0 =C2=A0 (setq-local c-ts-mode-indent-offset 2)
=C2=A0 =C2=A0 =C2=A0 (= c-ts-mode-set-style 'linux))

T= he patch should also fix the missing indent for the `else_clause` mentioned= =C2=A0

On Thu, Nov 23, 2023 at 6:41=E2=80= =AFAM Dmitry Gutov <dmitry@gutov.dev= > wrote:
= On 23/11/2023 16:33, Eli Zaretskii wrote:
>> Date: Thu, 23 Nov 2023 15:17:40 +0200
>> Cc: 673= 57@debbugs.gnu.org
>> From: Dmitry Gutov <dmitry@gutov.dev>
>>
>> On 23/11/2023 09:35, Eli Zaretskii wrote:
>>> I'm not sure I can reproduce these, it seems to me that th= e
>>> indentation is correct in these case when I try the examples.= =C2=A0 So
>>> please show a detailed recipe, starting from "emacs -Q&qu= ot;, for each of
>>> the two problems, so that we could be sure that we are seeing = the same
>>> problems.
>>
>> I can easily reproduce the first one (comment-related): the two >> indicated lines just don't reindent at all. That's with th= e default
>> 'gnu' indentation style, but also with 'linux' and= perhaps others (I
>> haven't tried).
>
> I don't understand what you mean by "reindent".=C2=A0 Th= at wasn't what the
> original report was about, AFAIU.

Reindent is when you press tab, and the indentation on a given line
changes. In that example, no matter which indentation you set on those
line, pressing TAB doesn't change it.

> I still think a complete recipe is needed.
>
>> To reproduce the second one, you first need to enable the 'lin= ux' style:
>
> I tried to reproduce _only_ with the 'linux' style, as the bug= report
> said.
>
>>=C2=A0 =C2=A0 =C2=A0(setq c-ts-mode-indent-style 'linux)
>>=C2=A0 =C2=A0 =C2=A0M-x c-ts-mode
>
> The style is a per-buffer setting, so AFAIU one needs to set the style=
> after turning on the mode in a buffer, whether manually or
> automatically.

Did you use 'M-x c-ts-mode-set-style', then? That also repros for m= e.

The style can be set locally - as the above command does - but initially the global value is used. And it's applied during the major mode's =
execution, so a simple 'setq' doesn't work.

> A full recipe is supposed to remove all those confusing details and > potential mistakes.

I don't mind.
--000000000000758e31060ae63207-- From unknown Tue Jul 22 23:08:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67357: [PATCH] Fix c-ts-mode block indent when first-siblings are comments Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Nov 2023 14:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67357 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Noah Peart Cc: dmitry@gutov.dev, casouri@gmail.com, 67357@debbugs.gnu.org Received: via spool by 67357-submit@debbugs.gnu.org id=B67357.170083487821381 (code B ref 67357); Fri, 24 Nov 2023 14:08:02 +0000 Received: (at 67357) by debbugs.gnu.org; 24 Nov 2023 14:07:58 +0000 Received: from localhost ([127.0.0.1]:36017 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r6Wqb-0005Ym-Mg for submit@debbugs.gnu.org; Fri, 24 Nov 2023 09:07:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60878) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r6WqX-0005YY-CG for 67357@debbugs.gnu.org; Fri, 24 Nov 2023 09:07:56 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r6WqN-0006h1-CB; Fri, 24 Nov 2023 09:07:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=m9IXoKDk/GOMLAvuQoFZW0iQKxNe4C0Zbo4Oe8C1sfE=; b=WH3w8uunViK2 ECz52fs8hjKKE79J/M33eD7mwvcaIxEchKazMrMw6i5bzG7afpMtBozpKY8uUIa3Au71gI24BpLkT g5cI34WuhF1F+ezWShiXSx5Y1vyMyTtdYrWzy1f2pqqmeuPLuh+SsOkuhfHmOnkeL9w0pXgVul/kY 74+voXXKaMdw7VVkpfzX5VW+Ei4BxDcGWko7mj2Vpcci+heKIDP6iUQcRbAhG3wd3ahIivBXaOJb+ e7EijTMH5gZcliBTyBnodwLIUettRuZNFjky+b8vmxflbVrsGTb6PNKC759ft0nm0bQAjOTxgOa9S k+9DLOZsSqIugIigRh47ng==; Date: Fri, 24 Nov 2023 16:07:37 +0200 Message-Id: <8334wvfdna.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Noah Peart on Fri, 24 Nov 2023 05:47:34 -0800) References: <834jhchqha.fsf@gnu.org> <08e16d44-174d-87e6-aa17-8cf55202227b@gutov.dev> <83wmu8fsj7.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Noah Peart > Date: Fri, 24 Nov 2023 05:47:34 -0800 > Cc: Eli Zaretskii , casouri@gmail.com, 67357@debbugs.gnu.org > > Sorry for the confusion: to setup the `c-ts-mode` buffers to reproduce bugs, > run the following to configure `c-ts-mode` with `linux` style: > > (defun example-setup () > (interactive) > (c-ts-mode) > (setq-local indent-tabs-mode nil) > (setq-local c-ts-mode-indent-offset 2) > (c-ts-mode-set-style 'linux)) Thanks, but what to do after (or before?) the above, to actually reproduce the problem? I'm sorry I insist on a complete recipe with all the details, but IME without having such a recipe, it is all too easy to create misunderstandings about the problem, and harder to test solutions. From unknown Tue Jul 22 23:08:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67357: [PATCH] Fix c-ts-mode block indent when first-siblings are comments Resent-From: Noah Peart Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Nov 2023 14:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67357 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: dmitry@gutov.dev, casouri@gmail.com, 67357@debbugs.gnu.org Received: via spool by 67357-submit@debbugs.gnu.org id=B67357.170083653523877 (code B ref 67357); Fri, 24 Nov 2023 14:36:01 +0000 Received: (at 67357) by debbugs.gnu.org; 24 Nov 2023 14:35:35 +0000 Received: from localhost ([127.0.0.1]:36049 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r6XHK-0006D2-Sq for submit@debbugs.gnu.org; Fri, 24 Nov 2023 09:35:35 -0500 Received: from mail-oa1-x2e.google.com ([2001:4860:4864:20::2e]:61493) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r6XHG-0006Cl-2U for 67357@debbugs.gnu.org; Fri, 24 Nov 2023 09:35:33 -0500 Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-1f0f94a08a0so1158531fac.2 for <67357@debbugs.gnu.org>; Fri, 24 Nov 2023 06:35:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700836518; x=1701441318; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=NKUSVMjdyQ2Vy0xiXup7XWvQV3tfvG6yOQcV1tVM0Ck=; b=PP8SPUqLNwo6CwaB+mmA50F4eirGI9xhxytvIHTRl87j+QP35UTjzWF7GqzKgmbrAq jRszOCEU7mSUE3ujGFcLwXS0VmjAe4KIGpCzQn5GcKrJE8Xzw2HC/ZDeZNmUDNhIpBwG n30txCQodEQaThh2ZRKclL1w3Aw2n9FjF3vlY8nYv8XBkX6ETUcvNNFjpjYWAwWX+Apj Yc0OtvGYGXi/7+iF/G+jxiicGK1ScvNCxx7l1sf+fQhOMy+z4hDjbjnWUGbtnOsySZ7q 1ZcK26AbOrD3z/N2cSh3LW6IbiKzHucRaECdsfcI8IWPn8D7DCuYYVCQsm7Qt9gaCBHF d3jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700836518; x=1701441318; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NKUSVMjdyQ2Vy0xiXup7XWvQV3tfvG6yOQcV1tVM0Ck=; b=LE2nQDqvyesr59rgnwoKq1DQPbko1gl7y46DIWk2oYw5AETz33gc15iFVarQUjD1Sz OidOi5C69ZmwsIBkvHetD3xxuIOqUubLHHSJ7CQjVDQOfuxFCL0g8jylttgKqdcaXbEf NGrHkMgNAPCuqFy3DX2s1ibdlEu6tPe9Ybf4eBEOSQp141jBfpzZazrjyuPPjuOMVVQO BGmeIRauN6/hRWZIKfpU6cu7NZ/N16FIoH8ALQ2s6lBf6vcMJ7dEGyja4gaQHB6Te9rG yCufjDiAVxv/M6hee368341NxkHtsEeSDlsPzR4PYNWPXHQLzg2UyqnemWel5bmjzMSn A88w== X-Gm-Message-State: AOJu0YwETs0GDjuOXk3mHfjYjMTNuNn4WcMMuJ76yT6JfjTyOAwZpHqK SDxadq6ck/I+/Y3vFk9+4D/R4DbnmQe6u/Ati4s= X-Google-Smtp-Source: AGHT+IHuckSwfJZCW32iqZ9SUZRLpw8N0jVWX1RVjijfzUy03UHZiincvVRGEtNwp0V5WiipH1vMtTUC3cYObaH6Uig= X-Received: by 2002:a05:6870:5a8b:b0:1f0:8122:554c with SMTP id dt11-20020a0568705a8b00b001f08122554cmr2565228oab.45.1700836517999; Fri, 24 Nov 2023 06:35:17 -0800 (PST) MIME-Version: 1.0 References: <834jhchqha.fsf@gnu.org> <08e16d44-174d-87e6-aa17-8cf55202227b@gutov.dev> <83wmu8fsj7.fsf@gnu.org> <8334wvfdna.fsf@gnu.org> In-Reply-To: <8334wvfdna.fsf@gnu.org> From: Noah Peart Date: Fri, 24 Nov 2023 06:35:06 -0800 Message-ID: Content-Type: multipart/alternative; boundary="00000000000079f95e060ae6dc4f" X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --00000000000079f95e060ae6dc4f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > I'm sorry I insist on a complete recipe with all the details Ok, lemme try again :) To reproduce the indentation bugs for unbracketed `else_clause`, and do-while: 1. open a buffer and insert the following: int main() { if (true) puts("Hello"); else puts("No matched rule!"); // 1 do puts("Hello"); while (indented_as_part_of_block); // 2 } 2. call `M-x example-setup` to configure `c-ts-mode` 3. `M-x indent-region` to indent the whole buffer You should see that the line with comment `1` has not been indented, and the line with comment `2` has been indented to the same level as the previous line. To reproduce the indentation bugs when comments are the first siblings: 1. open a buffer and insert: int main() { while (true) { /* foo */ if (true) { // 1 puts ("Hello"); // 2 } } } 2. call `M-x example-setup` to configure `c-ts-mode` 3. `M-x indent-region` to indent the whole buffer You should see that the lines with comments `1` and `2` have not been indented at all. On Fri, Nov 24, 2023 at 6:07=E2=80=AFAM Eli Zaretskii wrote: > > From: Noah Peart > > Date: Fri, 24 Nov 2023 05:47:34 -0800 > > Cc: Eli Zaretskii , casouri@gmail.com, > 67357@debbugs.gnu.org > > > > Sorry for the confusion: to setup the `c-ts-mode` buffers to reproduce > bugs, > > run the following to configure `c-ts-mode` with `linux` style: > > > > (defun example-setup () > > (interactive) > > (c-ts-mode) > > (setq-local indent-tabs-mode nil) > > (setq-local c-ts-mode-indent-offset 2) > > (c-ts-mode-set-style 'linux)) > > Thanks, but what to do after (or before?) the above, to actually > reproduce the problem? > > I'm sorry I insist on a complete recipe with all the details, but IME > without having such a recipe, it is all too easy to create > misunderstandings about the problem, and harder to test solutions. > --00000000000079f95e060ae6dc4f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
> I'm sorry I insist on a complete recipe with all = the details

Ok, lemme try again :)

<= div>To reproduce the indentation bugs for unbracketed `else_clause`, and=C2= =A0
do-while:
1. open a buffer and insert the following= :

=C2=A0 =C2=A0 int main() {
=C2=A0 =C2=A0 =C2= =A0 if (true)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 puts("Hello");
= =C2=A0 =C2=A0 =C2=A0 else
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 puts("No matched rule!"); // 1
=C2=A0= =C2=A0 =C2=A0 do
=C2=A0 =C2=A0 =C2=A0 =C2=A0 puts("Hello");<= br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 wh= ile (indented_as_part_of_block);=C2=A0 // 2
=C2=A0 =C2=A0 }

2. call `M-x example-setup` to configure `c-ts-mode`
=
3. `M-x indent-region` to indent the whole buffer
You should= see that the line with comment `1` has not been
indented, and th= e line with comment `2` has been indented to the=C2=A0
same level= as the previous line.

To reproduce the indentatio= n bugs when comments are the first
siblings:
1. open a = buffer and insert:

=C2=A0 =C2=A0 int main() {
= =C2=A0 =C2=A0 =C2=A0 while (true) { /* foo */
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (true= ) { // 1
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 puts ("Hello"); // 2
=C2=A0 =C2=A0= =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 }
=
2. call `M-x example-setup` to configure `c-ts-mode`
3. `M-x indent-region` to indent the whole buffer

You should see that the lines with comments `1` and `2` have
<= /div>
not been indented at all.

On Fri, Nov 24, 2023 at 6:07=E2=80= =AFAM Eli Zaretskii <eliz@gnu.org>= ; wrote:
> Fr= om: Noah Peart <noah.v.peart@gmail.com>
> Date: Fri, 24 Nov 2023 05:47:34 -0800
> Cc: Eli Zaretskii <eliz@gnu.org>, casouri@gmail.com, 67357@debbugs.gnu.org
>
> Sorry for the confusion: to setup the `c-ts-mode` buffers to reproduce= bugs,
> run the following to configure `c-ts-mode` with `linux` style:
>
>=C2=A0 =C2=A0 =C2=A0(defun example-setup ()
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(interactive)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(c-ts-mode)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(setq-local indent-tabs-mode nil)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(setq-local c-ts-mode-indent-offset 2)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(c-ts-mode-set-style 'linux))

Thanks, but what to do after (or before?) the above, to actually
reproduce the problem?

I'm sorry I insist on a complete recipe with all the details, but IME without having such a recipe, it is all too easy to create
misunderstandings about the problem, and harder to test solutions.
--00000000000079f95e060ae6dc4f-- From unknown Tue Jul 22 23:08:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67357: [PATCH] Fix c-ts-mode block indent when first-siblings are comments Resent-From: Noah Peart Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Nov 2023 14:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67357 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: dmitry@gutov.dev, casouri@gmail.com, 67357@debbugs.gnu.org Received: via spool by 67357-submit@debbugs.gnu.org id=B67357.170083715124760 (code B ref 67357); Fri, 24 Nov 2023 14:46:01 +0000 Received: (at 67357) by debbugs.gnu.org; 24 Nov 2023 14:45:51 +0000 Received: from localhost ([127.0.0.1]:36054 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r6XRG-0006RI-EL for submit@debbugs.gnu.org; Fri, 24 Nov 2023 09:45:50 -0500 Received: from mail-oa1-x2f.google.com ([2001:4860:4864:20::2f]:60856) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r6XRC-0006R3-04 for 67357@debbugs.gnu.org; Fri, 24 Nov 2023 09:45:48 -0500 Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-1f060e059a3so1169393fac.1 for <67357@debbugs.gnu.org>; Fri, 24 Nov 2023 06:45:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700837136; x=1701441936; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Qzqjpw6J7M6rgOl6tJ089dGw8kw2DR79CTp81R3FntU=; b=ZnQHnu/zx36owxdILpG3V4MB6zCR2ASTebctCssQmfapiJIqs1E6b9baMnFGX+swFA Fdx/SM70bOYGbQ2+4AtpQsMvRH8EYkznSAp7pbFH94ZCWEUo6YKUUbRXZpPKCZIfWy19 hb5X1zsd3tXvDKUAz/fg0jX9SQE88DypSBroyPQ5UgaF1+tk3Z4u6qj2ueWYrVWnwjPV 4kPOJ8Ehi4XuQHQdsCpJ0XLCJGeCZ0jJXDvjlHozeTWvZ5cGLDYBPxJvQYSkp/0d1gEP q3Ar0HU/I9S/3geQLICDzIuNp3AuSMZZ7jdI5Yp+nbDZ20Q1sq6sHFBe7Ssgfq13CM4d 4vGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700837136; x=1701441936; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Qzqjpw6J7M6rgOl6tJ089dGw8kw2DR79CTp81R3FntU=; b=r1shpSJfO+y5SBkfw3Fnp+Y+wLGiR7xCq4mmwJd7p7vrvdM7w0icpMpjIT3lnlu6ke 7owGi/SbLC9EbHUV+qxN9v1E3TO3lYiB52PBPglazBOlkQjs9xbyLZhW2BmByDMuKfcj 4sIyH2HXoJMnkXLFydLvUKxycgqxP8DIUNwAYiPG3RuSvLkVBvv/flQKf5ZofeBnGZiI fRc9Ud8/WSQUXQ0p80pmTJfbX9CmDDfn+ONaaZdgio98UcxJ3y3ngWk93qUYS8KxhuDA 210uoLuq3odav5wMBhQ1hP7wDL+NP/BAAqX2WYwQXqq3okbutcGNAlt70bZ+yUKEvJDV PLtg== X-Gm-Message-State: AOJu0YzblAGJDXu587IkoBJCzvvtGOEmwh81K8KiWfBcypDR/2iIsuXx /xeiEnZJfYf1yiryZ4viwQemOEQTCqNHV7aN790= X-Google-Smtp-Source: AGHT+IFZLN6Y2b3B782Ubamjoc/S2YhumVHKimEvzkn3SG0MKhx4FEqH9imdalFpP53tCCcGzRS9dlEDXcs7XmvaQ0Q= X-Received: by 2002:a05:6870:524b:b0:1a6:a547:ffe1 with SMTP id o11-20020a056870524b00b001a6a547ffe1mr3637257oai.21.1700837135691; Fri, 24 Nov 2023 06:45:35 -0800 (PST) MIME-Version: 1.0 References: <834jhchqha.fsf@gnu.org> <08e16d44-174d-87e6-aa17-8cf55202227b@gutov.dev> <83wmu8fsj7.fsf@gnu.org> <8334wvfdna.fsf@gnu.org> In-Reply-To: From: Noah Peart Date: Fri, 24 Nov 2023 06:45:24 -0800 Message-ID: Content-Type: multipart/alternative; boundary="0000000000004b3434060ae70181" X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --0000000000004b3434060ae70181 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I did notice an issue with testing solutions in `c-ts-mode-resources/indent.erts`. In cases where no indentation is applied (eg. comment is first-sibling) or there is no matching rule (eg. else_clause), the test case can still pass since the test cases are written with the proper indentation already. So, despit= e no indentation being applied, the result still matches the expected result. On Fri, Nov 24, 2023 at 6:35=E2=80=AFAM Noah Peart = wrote: > > I'm sorry I insist on a complete recipe with all the details > > Ok, lemme try again :) > > To reproduce the indentation bugs for unbracketed `else_clause`, and > do-while: > 1. open a buffer and insert the following: > > int main() { > if (true) > puts("Hello"); > else > puts("No matched rule!"); // 1 > do > puts("Hello"); > while (indented_as_part_of_block); // 2 > } > > 2. call `M-x example-setup` to configure `c-ts-mode` > 3. `M-x indent-region` to indent the whole buffer > You should see that the line with comment `1` has not been > indented, and the line with comment `2` has been indented to the > same level as the previous line. > > To reproduce the indentation bugs when comments are the first > siblings: > 1. open a buffer and insert: > > int main() { > while (true) { /* foo */ > if (true) { // 1 > puts ("Hello"); // 2 > } > } > } > > 2. call `M-x example-setup` to configure `c-ts-mode` > 3. `M-x indent-region` to indent the whole buffer > > You should see that the lines with comments `1` and `2` have > not been indented at all. > > On Fri, Nov 24, 2023 at 6:07=E2=80=AFAM Eli Zaretskii wrot= e: > >> > From: Noah Peart >> > Date: Fri, 24 Nov 2023 05:47:34 -0800 >> > Cc: Eli Zaretskii , casouri@gmail.com, >> 67357@debbugs.gnu.org >> > >> > Sorry for the confusion: to setup the `c-ts-mode` buffers to reproduce >> bugs, >> > run the following to configure `c-ts-mode` with `linux` style: >> > >> > (defun example-setup () >> > (interactive) >> > (c-ts-mode) >> > (setq-local indent-tabs-mode nil) >> > (setq-local c-ts-mode-indent-offset 2) >> > (c-ts-mode-set-style 'linux)) >> >> Thanks, but what to do after (or before?) the above, to actually >> reproduce the problem? >> >> I'm sorry I insist on a complete recipe with all the details, but IME >> without having such a recipe, it is all too easy to create >> misunderstandings about the problem, and harder to test solutions. >> > --0000000000004b3434060ae70181 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I did notice an issue with testing solutions in `c-ts-mode= -resources/indent.erts`.
In cases where no indentation is applied (eg. = comment is first-sibling) or there
is no matching rule (eg. else_= clause), the test case can still pass since=C2=A0
the test cases = are written with the proper indentation already.=C2=A0 So, despite
no indentation being applied, the result still=C2=A0matches the expected = result.

On Fri, Nov 24, 2023 at 6:35=E2=80=AFAM Noah Peart <noah.v.peart@gmail.com> wrote:
&= gt; I'm sorry I insist on a complete recipe with all the details
Ok, lemme try again :)

To reproduce t= he indentation bugs for unbracketed `else_clause`, and=C2=A0
do-w= hile:
1. open a buffer and insert the following:

=C2=A0 =C2=A0 int main() {
=C2=A0 =C2=A0 =C2=A0 if (true)
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 puts("Hello");
=C2=A0 =C2=A0 =C2= =A0 else
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 puts("No matched rule!"); // 1
=C2=A0 =C2=A0 =C2=A0 do=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 puts("Hello");
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 while (indented_as_= part_of_block);=C2=A0 // 2
=C2=A0 =C2=A0 }

= 2. call `M-x example-setup` to configure `c-ts-mode`
3. `M-x inde= nt-region` to indent the whole buffer
You should see that the lin= e with comment `1` has not been
indented, and the line with comme= nt `2` has been indented to the=C2=A0
same level as the previous = line.

To reproduce the indentation bugs when comme= nts are the first
siblings:
1. open a buffer and insert= :

=C2=A0 =C2=A0 int main() {
=C2=A0 =C2=A0 =C2= =A0 while (true) { /* foo */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (true) { // 1
=C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 puts ("Hello"); // 2
=C2=A0 =C2=A0 =C2=A0 =C2=A0}=C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 }

2. call `M-x example-setup` to configure `c-ts-mode`
3. `M-x i= ndent-region` to indent the whole buffer

You shoul= d see that the lines with comments `1` and `2` have
not bee= n indented at all.

On Fri, Nov 24, 2023 at 6:07=E2=80=AFAM Eli Zaretsk= ii <eliz@gnu.org&g= t; wrote:
> F= rom: Noah Peart <noah.v.peart@gmail.com>
> Date: Fri, 24 Nov 2023 05:47:34 -0800
> Cc: Eli Zaretskii <eliz@gnu.org>, casouri@gmail.com, 67357@debbugs.gnu.org
>
> Sorry for the confusion: to setup the `c-ts-mode` buffers to reproduce= bugs,
> run the following to configure `c-ts-mode` with `linux` style:
>
>=C2=A0 =C2=A0 =C2=A0(defun example-setup ()
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(interactive)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(c-ts-mode)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(setq-local indent-tabs-mode nil)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(setq-local c-ts-mode-indent-offset 2)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(c-ts-mode-set-style 'linux))

Thanks, but what to do after (or before?) the above, to actually
reproduce the problem?

I'm sorry I insist on a complete recipe with all the details, but IME without having such a recipe, it is all too easy to create
misunderstandings about the problem, and harder to test solutions.
--0000000000004b3434060ae70181-- From unknown Tue Jul 22 23:08:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67357: [PATCH] Fix c-ts-mode block indent when first-siblings are comments Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Nov 2023 14:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67357 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Noah Peart Cc: dmitry@gutov.dev, casouri@gmail.com, 67357@debbugs.gnu.org Received: via spool by 67357-submit@debbugs.gnu.org id=B67357.170083721324875 (code B ref 67357); Fri, 24 Nov 2023 14:47:02 +0000 Received: (at 67357) by debbugs.gnu.org; 24 Nov 2023 14:46:53 +0000 Received: from localhost ([127.0.0.1]:36059 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r6XSH-0006T8-2O for submit@debbugs.gnu.org; Fri, 24 Nov 2023 09:46:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37562) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r6XSD-0006Ss-JL for 67357@debbugs.gnu.org; Fri, 24 Nov 2023 09:46:51 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r6XS2-0001Xn-Ks; Fri, 24 Nov 2023 09:46:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=JwHa9pC9y1nNTcRCe1AIDbT0jVCgbamPyzv0M7QXiDc=; b=C4tNKygJDUiN RE+PCem+7WzeKQ2wD+4MbsKsE6KpmPmEGJJ3S+bH33BE3OBGYtG5p9nlp5kfdN1SGzb1LE6QqLBkO HYQ41v92gkmPoRgSKQBPiQZ/OW3XhkZcE551OM0ZHz58WKbUTjDPfAWXQ9PgYRt/mhpJfxbMTBNsk mJJijkAm75geA4zqYJGlfBq3+nrXPwq9aBf60MrSrvK/5IEszc8IziNFr0wnegcVhzwAP8h3Z97WZ +8vNwoYN2FSB25g4FT9hnvqGQAVfnCOHCanHXDed2F+klJdOoRufZbPi/cZjVvCkCwsGLPB7q9ls4 9IHTiCwRbVjtt4QTBw6V3g==; Date: Fri, 24 Nov 2023 16:46:32 +0200 Message-Id: <83y1endx9z.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Noah Peart on Fri, 24 Nov 2023 06:35:06 -0800) References: <834jhchqha.fsf@gnu.org> <08e16d44-174d-87e6-aa17-8cf55202227b@gutov.dev> <83wmu8fsj7.fsf@gnu.org> <8334wvfdna.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Noah Peart > Date: Fri, 24 Nov 2023 06:35:06 -0800 > Cc: dmitry@gutov.dev, casouri@gmail.com, 67357@debbugs.gnu.org > > To reproduce the indentation bugs for unbracketed `else_clause`, and > do-while: > 1. open a buffer and insert the following: > > int main() { > if (true) > puts("Hello"); > else > puts("No matched rule!"); // 1 > do > puts("Hello"); > while (indented_as_part_of_block); // 2 > } > > 2. call `M-x example-setup` to configure `c-ts-mode` > 3. `M-x indent-region` to indent the whole buffer > You should see that the line with comment `1` has not been > indented, and the line with comment `2` has been indented to the > same level as the previous line. > > To reproduce the indentation bugs when comments are the first > siblings: > 1. open a buffer and insert: > > int main() { > while (true) { /* foo */ > if (true) { // 1 > puts ("Hello"); // 2 > } > } > } > > 2. call `M-x example-setup` to configure `c-ts-mode` > 3. `M-x indent-region` to indent the whole buffer > > You should see that the lines with comments `1` and `2` have > not been indented at all. Thanks, I see the problems now. Let's wait for Yuan to chime in. From unknown Tue Jul 22 23:08:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67357: [PATCH] Fix c-ts-mode block indent when first-siblings are comments Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 29 Nov 2023 13:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67357 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: casouri@gmail.com Cc: noah.v.peart@gmail.com, 67357@debbugs.gnu.org, dmitry@gutov.dev Received: via spool by 67357-submit@debbugs.gnu.org id=B67357.17012656725390 (code B ref 67357); Wed, 29 Nov 2023 13:48:01 +0000 Received: (at 67357) by debbugs.gnu.org; 29 Nov 2023 13:47:52 +0000 Received: from localhost ([127.0.0.1]:49155 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r8Kut-0001Oq-Dc for submit@debbugs.gnu.org; Wed, 29 Nov 2023 08:47:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54112) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r8Kur-0001O0-0b for 67357@debbugs.gnu.org; Wed, 29 Nov 2023 08:47:49 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r8Kud-0001aD-ST; Wed, 29 Nov 2023 08:47:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=oCo1GtRZyI1Y+1w3BXAHsWLA/g9/YyahCu+Uy+q7L/I=; b=sKzRQ1h0omIo htSXQRoWO9Lg4jaGDaxJyWrKkjz08EZ8CqDx0HyhqYkvQzzfaTshrVPlcAltgBMhd0U7msXxaTVMK kKUt89AQWsgJCVMSsy07le1sUnUH8xb+u+MXay5YGNV6u5q9uSxt54RbEsBzafYCbnGgLhCJlqHWt CaAW7Q8AbmXATIuUGIf4YYjbmZTKClDQTtv3vmYyBaJiMPKvDDkDjvbE+aH4FdOOk8K9tRD1hdEDr c0fJMjfaTMdKfpTexIqT1QGxkgqsWa8MpAxhPbWL2bA0XZ1Z5Kts7kYsDItaO4Nmj7Ucbrp8ODkZS 0rgLH77Ptjq4n2lx4uIGkA==; Date: Wed, 29 Nov 2023 15:47:25 +0200 Message-Id: <83cyvs7jte.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <83y1endx9z.fsf@gnu.org> (message from Eli Zaretskii on Fri, 24 Nov 2023 16:46:32 +0200) References: <834jhchqha.fsf@gnu.org> <08e16d44-174d-87e6-aa17-8cf55202227b@gutov.dev> <83wmu8fsj7.fsf@gnu.org> <8334wvfdna.fsf@gnu.org> <83y1endx9z.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Fri, 24 Nov 2023 16:46:32 +0200 > From: Eli Zaretskii > Cc: dmitry@gutov.dev, casouri@gmail.com, 67357@debbugs.gnu.org > > > From: Noah Peart > > Date: Fri, 24 Nov 2023 06:35:06 -0800 > > Cc: dmitry@gutov.dev, casouri@gmail.com, 67357@debbugs.gnu.org > > > > To reproduce the indentation bugs for unbracketed `else_clause`, and > > do-while: > > 1. open a buffer and insert the following: > > > > int main() { > > if (true) > > puts("Hello"); > > else > > puts("No matched rule!"); // 1 > > do > > puts("Hello"); > > while (indented_as_part_of_block); // 2 > > } > > > > 2. call `M-x example-setup` to configure `c-ts-mode` > > 3. `M-x indent-region` to indent the whole buffer > > You should see that the line with comment `1` has not been > > indented, and the line with comment `2` has been indented to the > > same level as the previous line. > > > > To reproduce the indentation bugs when comments are the first > > siblings: > > 1. open a buffer and insert: > > > > int main() { > > while (true) { /* foo */ > > if (true) { // 1 > > puts ("Hello"); // 2 > > } > > } > > } > > > > 2. call `M-x example-setup` to configure `c-ts-mode` > > 3. `M-x indent-region` to indent the whole buffer > > > > You should see that the lines with comments `1` and `2` have > > not been indented at all. > > Thanks, I see the problems now. > > Let's wait for Yuan to chime in. Yuan, could you please comment on the proposed solution? TIA. From unknown Tue Jul 22 23:08:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67357: [PATCH] Fix c-ts-mode block indent when first-siblings are comments Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Dec 2023 08:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67357 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: casouri@gmail.com Cc: noah.v.peart@gmail.com, 67357@debbugs.gnu.org, dmitry@gutov.dev Received: via spool by 67357-submit@debbugs.gnu.org id=B67357.17021102468866 (code B ref 67357); Sat, 09 Dec 2023 08:25:02 +0000 Received: (at 67357) by debbugs.gnu.org; 9 Dec 2023 08:24:06 +0000 Received: from localhost ([127.0.0.1]:46761 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rBsd3-0002Iv-Rj for submit@debbugs.gnu.org; Sat, 09 Dec 2023 03:24:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54714) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rBsd2-0002IC-4j for 67357@debbugs.gnu.org; Sat, 09 Dec 2023 03:24:04 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rBscj-00068U-As; Sat, 09 Dec 2023 03:23:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=V+S2bpwT4zNF75ZVEVQt7tXxiKXJO2YQF5yfvB5bLdA=; b=iz4izSzrV3C0 lEDZB8+Qo+W+ff5UgubRuImejAPUL4euuJXGRTXIgjCFtJuEyC0CzbpvKYk/muaD7/FNjXGjwsjjS Hijk8ydPoSJAE/1WIyKy5T+4QoY3VCrChketn+Lb0ifVKcx8qn8G6H+DBNNJWmas23F31OBd3wm3r lj5QNC7MrC57EiSWhrPNtytuk+dAw9RqSnTUz+jjYGlUPumww3vHGdk1/Hzb95z+K6ceoYiqejOEe DdFNru7xLT/IlKwk9hkTyTapoX15K04vb2kZCPF9nbHl9QHs/+wgruKn89OSouBm/k2KUJ7nqwCED T5Hyw3XgrnI3ujrGViTGzQ==; Date: Sat, 09 Dec 2023 10:23:29 +0200 Message-Id: <83ttoryebi.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <83cyvs7jte.fsf@gnu.org> (message from Eli Zaretskii on Wed, 29 Nov 2023 15:47:25 +0200) References: <834jhchqha.fsf@gnu.org> <08e16d44-174d-87e6-aa17-8cf55202227b@gutov.dev> <83wmu8fsj7.fsf@gnu.org> <8334wvfdna.fsf@gnu.org> <83y1endx9z.fsf@gnu.org> <83cyvs7jte.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Ping! Ping! Yuan, please chime is, as I'm waiting for your comments before we install on the release branch. This and other patches for TS-based modes are currently delaying the release of Emacs 29.2, so please try to be more responsive, okay? > Cc: noah.v.peart@gmail.com, 67357@debbugs.gnu.org, dmitry@gutov.dev > Date: Wed, 29 Nov 2023 15:47:25 +0200 > From: Eli Zaretskii > > > Date: Fri, 24 Nov 2023 16:46:32 +0200 > > From: Eli Zaretskii > > Cc: dmitry@gutov.dev, casouri@gmail.com, 67357@debbugs.gnu.org > > > > > From: Noah Peart > > > Date: Fri, 24 Nov 2023 06:35:06 -0800 > > > Cc: dmitry@gutov.dev, casouri@gmail.com, 67357@debbugs.gnu.org > > > > > > To reproduce the indentation bugs for unbracketed `else_clause`, and > > > do-while: > > > 1. open a buffer and insert the following: > > > > > > int main() { > > > if (true) > > > puts("Hello"); > > > else > > > puts("No matched rule!"); // 1 > > > do > > > puts("Hello"); > > > while (indented_as_part_of_block); // 2 > > > } > > > > > > 2. call `M-x example-setup` to configure `c-ts-mode` > > > 3. `M-x indent-region` to indent the whole buffer > > > You should see that the line with comment `1` has not been > > > indented, and the line with comment `2` has been indented to the > > > same level as the previous line. > > > > > > To reproduce the indentation bugs when comments are the first > > > siblings: > > > 1. open a buffer and insert: > > > > > > int main() { > > > while (true) { /* foo */ > > > if (true) { // 1 > > > puts ("Hello"); // 2 > > > } > > > } > > > } > > > > > > 2. call `M-x example-setup` to configure `c-ts-mode` > > > 3. `M-x indent-region` to indent the whole buffer > > > > > > You should see that the lines with comments `1` and `2` have > > > not been indented at all. > > > > Thanks, I see the problems now. > > > > Let's wait for Yuan to chime in. > > Yuan, could you please comment on the proposed solution? TIA. > > > > From unknown Tue Jul 22 23:08:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67357: [PATCH] Fix c-ts-mode block indent when first-siblings are comments Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Dec 2023 09:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67357 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii , 67357-done@debbugs.gnu.org Cc: noah.v.peart@gmail.com, 67357@debbugs.gnu.org, dmitry@gutov.dev Received: via spool by 67357-submit@debbugs.gnu.org id=B67357.170219938416830 (code B ref 67357); Sun, 10 Dec 2023 09:10:02 +0000 Received: (at 67357) by debbugs.gnu.org; 10 Dec 2023 09:09:44 +0000 Received: from localhost ([127.0.0.1]:49467 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rCFom-0004NN-0t for submit@debbugs.gnu.org; Sun, 10 Dec 2023 04:09:44 -0500 Received: from mail-io1-xd31.google.com ([2607:f8b0:4864:20::d31]:57742) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rCFof-0004Mt-On; Sun, 10 Dec 2023 04:09:42 -0500 Received: by mail-io1-xd31.google.com with SMTP id ca18e2360f4ac-7b7020f03c9so133414139f.3; Sun, 10 Dec 2023 01:09:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702199358; x=1702804158; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=m1SVIHoYRMQPdt+3LlIBi+8+BlHpfwQmFP6P+dnwRl0=; b=OFhrynxyeAq2opHhQEosFycKX7bICxC+b1nb3ESPLYmSuhjRxwPMLoIT6Jq9kKJQGE 4Rpnqi82OtgKuO3k5/x8L3HjgE/Ozlzaj+UcTirHtvrYxfRyWe4OFrJkieAbMNimM260 UW55xRNZJn8Ekfhy7HPBqH/nN27fs0r0c2I+reZfU2lXqcwxE/SrYVBfhl9BoNLKC/j6 q2WssoVcJhNdc/eNMH9v7gmSYwyf0Was5DhOQjPsqX7yLGYzmYHOKDUujPDBXQIkNhfL RlvI/Y7/K9LvE5F+bQe/Y5xYY9o76dseDqJZwFmZI7nwxCHSEWMOsoC8lHx41M2uNcXO uAiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702199358; x=1702804158; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=m1SVIHoYRMQPdt+3LlIBi+8+BlHpfwQmFP6P+dnwRl0=; b=vI/MtWItykYTve8MGSkkRotCprPp3UZpjeWNBGu4oDTiXotCcKrF4PY1nm7G86Gg0i xipl4EjXvYIsuVWpazIjzgz9Wvt9uBUp/j64yqn1cOhv4POL5QSAhlnEnegxATAWnSxW RWrbGfSOIzOZKDU06bH4sLO4ODYs8FX8LTqexEXBHiPExiN8K9Jkg8yC4muHq14c9rLq M2wFiBL7zfBb2Je7zgX+M3iJmQsNGXb8D2My6NJaHBtYSusRVRA49ujYXwwJttn/N3ir eegZ63XriNMNqTEjw/J9YXSjXANHwWiiFM9Ju7i85fLmADB9RELEqyeMpN6TkL4IWybq 63Bg== X-Gm-Message-State: AOJu0YwlbCkIFZ2OdNCdziW+x61wUHaksfmFvj0USUwhr/AsN7QSNRsG 2yVYucWAU4mLJDLmzyLQNys= X-Google-Smtp-Source: AGHT+IHXFUan+HOQ1sZYYB9qkNXTj3XdNy91gQ7EN+DIs12+i5/mM/iNcjz4Hv9GIr2nE0sMilLqeg== X-Received: by 2002:a92:c56c:0:b0:35e:6b97:b8a4 with SMTP id b12-20020a92c56c000000b0035e6b97b8a4mr3951147ilj.4.1702199357865; Sun, 10 Dec 2023 01:09:17 -0800 (PST) Received: from [192.168.1.7] (172-117-161-177.res.spectrum.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id j18-20020a170902c3d200b001cc3a6813f8sm4474514plj.154.2023.12.10.01.09.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 10 Dec 2023 01:09:17 -0800 (PST) Message-ID: <8c7e244d-5dad-4111-89b8-ca7722657ce0@gmail.com> Date: Sun, 10 Dec 2023 01:09:15 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US References: <834jhchqha.fsf@gnu.org> <08e16d44-174d-87e6-aa17-8cf55202227b@gutov.dev> <83wmu8fsj7.fsf@gnu.org> <8334wvfdna.fsf@gnu.org> <83y1endx9z.fsf@gnu.org> <83cyvs7jte.fsf@gnu.org> <83ttoryebi.fsf@gnu.org> From: Yuan Fu In-Reply-To: <83ttoryebi.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > Ping! Ping! Yuan, please chime is, as I'm waiting for your comments > before we install on the release branch. > > This and other patches for TS-based modes are currently delaying the > release of Emacs 29.2, so please try to be more responsive, okay? > Whoa! Sorry, I just switched to a new email client, and direct CC isn't highlight as they were before :-( (And admittedly I haven't been browsing the bug tracker lately.) As for the patch, first of all, thank you, Noah, it's very good. I try to avoid query matchers since they could be slow, plus the fundamental problem isn't with comments, IMO. The problem is when the first sibling isn't on it's own line. (Though in normal C source code, when the first sibling isn't on its own line, that sibling is usually a comment.) Anyway, please see my reasoning in the commit message for 08fc6bace20. I also removed the else_clause rule since it's already added by the patch for bug#67417, and added another test. Yuan From unknown Tue Jul 22 23:08:35 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Noah Peart Subject: bug#67357: closed (Re: bug#67357: [PATCH] Fix c-ts-mode block indent when first-siblings are comments) Message-ID: References: <8c7e244d-5dad-4111-89b8-ca7722657ce0@gmail.com> X-Gnu-PR-Message: they-closed 67357 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 67357@debbugs.gnu.org Date: Sun, 10 Dec 2023 09:10:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1702199403-16871-1" This is a multi-part message in MIME format... ------------=_1702199403-16871-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #67357: [PATCH] Fix c-ts-mode block indent when first-siblings are comments 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 67357@debbugs.gnu.org. --=20 67357: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D67357 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1702199403-16871-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 67357-done) by debbugs.gnu.org; 10 Dec 2023 09:09:44 +0000 Received: from localhost ([127.0.0.1]:49465 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rCFol-0004NG-In for submit@debbugs.gnu.org; Sun, 10 Dec 2023 04:09:43 -0500 Received: from mail-io1-xd31.google.com ([2607:f8b0:4864:20::d31]:57742) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rCFof-0004Mt-On; Sun, 10 Dec 2023 04:09:42 -0500 Received: by mail-io1-xd31.google.com with SMTP id ca18e2360f4ac-7b7020f03c9so133414139f.3; Sun, 10 Dec 2023 01:09:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702199358; x=1702804158; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=m1SVIHoYRMQPdt+3LlIBi+8+BlHpfwQmFP6P+dnwRl0=; b=OFhrynxyeAq2opHhQEosFycKX7bICxC+b1nb3ESPLYmSuhjRxwPMLoIT6Jq9kKJQGE 4Rpnqi82OtgKuO3k5/x8L3HjgE/Ozlzaj+UcTirHtvrYxfRyWe4OFrJkieAbMNimM260 UW55xRNZJn8Ekfhy7HPBqH/nN27fs0r0c2I+reZfU2lXqcwxE/SrYVBfhl9BoNLKC/j6 q2WssoVcJhNdc/eNMH9v7gmSYwyf0Was5DhOQjPsqX7yLGYzmYHOKDUujPDBXQIkNhfL RlvI/Y7/K9LvE5F+bQe/Y5xYY9o76dseDqJZwFmZI7nwxCHSEWMOsoC8lHx41M2uNcXO uAiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702199358; x=1702804158; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=m1SVIHoYRMQPdt+3LlIBi+8+BlHpfwQmFP6P+dnwRl0=; b=vI/MtWItykYTve8MGSkkRotCprPp3UZpjeWNBGu4oDTiXotCcKrF4PY1nm7G86Gg0i xipl4EjXvYIsuVWpazIjzgz9Wvt9uBUp/j64yqn1cOhv4POL5QSAhlnEnegxATAWnSxW RWrbGfSOIzOZKDU06bH4sLO4ODYs8FX8LTqexEXBHiPExiN8K9Jkg8yC4muHq14c9rLq M2wFiBL7zfBb2Je7zgX+M3iJmQsNGXb8D2My6NJaHBtYSusRVRA49ujYXwwJttn/N3ir eegZ63XriNMNqTEjw/J9YXSjXANHwWiiFM9Ju7i85fLmADB9RELEqyeMpN6TkL4IWybq 63Bg== X-Gm-Message-State: AOJu0YwlbCkIFZ2OdNCdziW+x61wUHaksfmFvj0USUwhr/AsN7QSNRsG 2yVYucWAU4mLJDLmzyLQNys= X-Google-Smtp-Source: AGHT+IHXFUan+HOQ1sZYYB9qkNXTj3XdNy91gQ7EN+DIs12+i5/mM/iNcjz4Hv9GIr2nE0sMilLqeg== X-Received: by 2002:a92:c56c:0:b0:35e:6b97:b8a4 with SMTP id b12-20020a92c56c000000b0035e6b97b8a4mr3951147ilj.4.1702199357865; Sun, 10 Dec 2023 01:09:17 -0800 (PST) Received: from [192.168.1.7] (172-117-161-177.res.spectrum.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id j18-20020a170902c3d200b001cc3a6813f8sm4474514plj.154.2023.12.10.01.09.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 10 Dec 2023 01:09:17 -0800 (PST) Message-ID: <8c7e244d-5dad-4111-89b8-ca7722657ce0@gmail.com> Date: Sun, 10 Dec 2023 01:09:15 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#67357: [PATCH] Fix c-ts-mode block indent when first-siblings are comments Content-Language: en-US To: Eli Zaretskii , 67357-done@debbugs.gnu.org References: <834jhchqha.fsf@gnu.org> <08e16d44-174d-87e6-aa17-8cf55202227b@gutov.dev> <83wmu8fsj7.fsf@gnu.org> <8334wvfdna.fsf@gnu.org> <83y1endx9z.fsf@gnu.org> <83cyvs7jte.fsf@gnu.org> <83ttoryebi.fsf@gnu.org> From: Yuan Fu In-Reply-To: <83ttoryebi.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 67357-done Cc: noah.v.peart@gmail.com, 67357@debbugs.gnu.org, dmitry@gutov.dev X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > Ping! Ping! Yuan, please chime is, as I'm waiting for your comments > before we install on the release branch. > > This and other patches for TS-based modes are currently delaying the > release of Emacs 29.2, so please try to be more responsive, okay? > Whoa! Sorry, I just switched to a new email client, and direct CC isn't highlight as they were before :-( (And admittedly I haven't been browsing the bug tracker lately.) As for the patch, first of all, thank you, Noah, it's very good. I try to avoid query matchers since they could be slow, plus the fundamental problem isn't with comments, IMO. The problem is when the first sibling isn't on it's own line. (Though in normal C source code, when the first sibling isn't on its own line, that sibling is usually a comment.) Anyway, please see my reasoning in the commit message for 08fc6bace20. I also removed the else_clause rule since it's already added by the patch for bug#67417, and added another test. Yuan ------------=_1702199403-16871-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 22 Nov 2023 01:51:18 +0000 Received: from localhost ([127.0.0.1]:57769 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r5cOb-0006Mc-PD for submit@debbugs.gnu.org; Tue, 21 Nov 2023 20:51:18 -0500 Received: from lists.gnu.org ([2001:470:142::17]:51926) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r5cOa-0006MQ-AF for submit@debbugs.gnu.org; Tue, 21 Nov 2023 20:51:17 -0500 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 ) id 1r5cOS-00051W-0m for bug-gnu-emacs@gnu.org; Tue, 21 Nov 2023 20:51:08 -0500 Received: from mail-ot1-x336.google.com ([2607:f8b0:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r5cOQ-0008Rt-7Q for bug-gnu-emacs@gnu.org; Tue, 21 Nov 2023 20:51:07 -0500 Received: by mail-ot1-x336.google.com with SMTP id 46e09a7af769-6d7e51638e7so712397a34.1 for ; Tue, 21 Nov 2023 17:51:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700617864; x=1701222664; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=O/6rere6puuXSNoChZqTp9EILX7SU6VnhHGyggSqYrI=; b=eAUpuZlgxrx2Xrbmf11cdHGbynuWAwrIf49CwxES5tlSvhJhQHetIJlaakYE688XwJ rED+J3EwDWm4LNC/bNhIsg/5NSCYs9MDtE7FUEsx1EhakE0WWV2JQNaYG+Ioaf7sET37 YgFefQWkNxgiL53zJRXLwCVIl0AmLtjOErH2AYk0AzM0UKkmqeQnGO78zsihal2SA7nS OmySeGEYvp66fkWU2Jxzn039Q2tfCYTd2MmtBOFLyq0kbsAI+qIl88Dmx72TWMGxMTrA a5zrNwYfCfixo4DxYl5PEu3w/uRJt2xC/ynfVRBbIXMQSB3mArM7uH1qjSvar+C0ka7e UZMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700617864; x=1701222664; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=O/6rere6puuXSNoChZqTp9EILX7SU6VnhHGyggSqYrI=; b=Rbg9RokncO/caDxn1IrszV0GLeaUE1KojK7v2xJc9CtlwG/nJY0AtNH0cD5P7QQ7jv 6LSiN2b6wqUY7I0f8wYxeAoLoazaj4SWS505HOLpR3cprYXQVhv1Yx8UjjFuSdqJ4rtX VEaUPzvHXd1eE9oA13FBwBPVropaWHAYe38nvtf8dL00GEKWbG05mJkAXQWgHf5vnk47 +nnHiCAEZUjGmkGT2kA0McJI61PM3QygxwXQkq/q146mLNxyCOBi1A1AxcIZUMpK3sbk +GSuQ2SI4f2dwApVtuMrf+VozG6tp4Q71W9aIuYVsAbGjMR9krxpSdzh/3V3AYyxjmPl OMBQ== X-Gm-Message-State: AOJu0YxGvl3UyUl334nWsgVO+kRrg27GLhpw8gagUuPkRwlji/9q8kn9 h+a5lBZpwPUfs/yOzEYBGJceiWnfCcE4SHvJioq8gfy5kixalRe9qf4= X-Google-Smtp-Source: AGHT+IGvleYWSNCaV0yKsDGieLQZmW7VVMso8ihOo/mVrawqjEaxs5tafLhMWiRV2GDYa4TcVR/m6e0tkYY7IiQU828= X-Received: by 2002:a05:6871:e40c:b0:1e9:d8a4:5523 with SMTP id py12-20020a056871e40c00b001e9d8a45523mr1423963oac.41.1700617863969; Tue, 21 Nov 2023 17:51:03 -0800 (PST) MIME-Version: 1.0 From: Noah Peart Date: Tue, 21 Nov 2023 17:50:52 -0800 Message-ID: Subject: [PATCH] Fix c-ts-mode block indent when first-siblings are comments To: bug-gnu-emacs@gnu.org Content-Type: multipart/mixed; boundary="000000000000ae57b1060ab3f31a" Received-SPF: pass client-ip=2607:f8b0:4864:20::336; envelope-from=noah.v.peart@gmail.com; helo=mail-ot1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --000000000000ae57b1060ab3f31a Content-Type: multipart/alternative; boundary="000000000000ae57b0060ab3f318" --000000000000ae57b0060ab3f318 Content-Type: text/plain; charset="UTF-8" Tags: patch I wasn't sure if these should be two separate bugs, so I separated them just in case. * lisp/progmodes/c-ts-mode.el(c-ts-mode--indent-styles): Fix indentation in block statements for cases when the first-sibling(s) are comments or nested keywords (else_clause/do while). Bug: The first statement in a compound statement that is preceded by a comment (or multiple comments) isn't indented. For example, the `if` statement isnt indented in the following code in `c-ts-mode` using `linux` style. int main() { while (true) { /* foo */ if (true) { // this line isnt indented puts ("Hello"); // and this isnt either } } } * lisp/progmodes/c-ts-mode.el(c-ts-mode--indent-styles): Fix indentation for else_clause and do-while in bracket-less block statements using `linux` style. Bug: There is no matching indent rule for bracket-less else_clause statements and the "while" in a bracket-less do-while statement is indented to the same level as the do body. To reproduce, using `linux` style in `c-ts-mode`. int main() { if (true) puts("Hello"); else puts("No matched rule!"); do puts("Hello"); while (indented_as_part_of_block); } In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2023-11-18 built on noah-X580VD Repository revision: 47b497b4dac91e5ea56102018223bdeb5e21a93b Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101004 System Description: Ubuntu 22.04.3 LTS Configured using: 'configure --prefix=/usr/local --with-modules --with-tree-sitter --with-threads --with-x-toolkit=gtk3 --with-xwidgets --with-gnutls --with-json --with-mailutils --with-jpeg --with-png --with-rsvg --with-tiff --with-xml2 --with-xpm --with-imagemagick CC=gcc-12 CXX=gcc-12' --000000000000ae57b0060ab3f318 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Tags: patch

I wasn't sure if these should be tw= o separate bugs, so I separated them just=C2=A0
in case.

* lisp/= progmodes/c-ts-mode.el(c-ts-mode--indent-styles): Fix indentation
in blo= ck statements for cases when the first-sibling(s) are comments or
nested= keywords (else_clause/do while).

Bug: The first statement in a comp= ound statement that is preceded by a
comment (or multiple comments) isn&= #39;t indented.

For example, the `if` statement isnt indented in the= following code in
`c-ts-mode` using `linux` style.

=C2=A0 =C2=A0= int main() {
=C2=A0 =C2=A0 =C2=A0 while (true) { /* foo */
=C2=A0 = =C2=A0 =C2=A0if (true) { // this line isnt indented
=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 puts ("Hello"); // and this isnt either
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 }

= * lisp/progmodes/c-ts-mode.el(c-ts-mode--indent-styles): Fix indentationfor else_clause and do-while in bracket-less block statements using
`li= nux` style.

Bug: There is no matching indent rule for bracket-less e= lse_clause
statements and the "while" in a bracket-less do-whi= le statement is
indented to the same level as the do body.

To rep= roduce, using `linux` style in `c-ts-mode`.

=C2=A0 =C2=A0 int main()= {
=C2=A0 =C2=A0 =C2=A0 if (true)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 puts(&= quot;Hello");
=C2=A0 =C2=A0 =C2=A0 else
=C2=A0 =C2=A0 =C2=A0 pu= ts("No matched rule!");
=C2=A0 =C2=A0 =C2=A0 do
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 puts("Hello");
=C2=A0 =C2=A0 =C2=A0 =C2=A0 w= hile (indented_as_part_of_block);
=C2=A0 =C2=A0 }


In GNU Emac= s 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.33, cairo ver= sion 1.16.0) of 2023-11-18 built on noah-X580VD
Repository revision: 47b= 497b4dac91e5ea56102018223bdeb5e21a93b
Repository branch: master
Windo= wing system distributor 'The X.Org Foundation', version 11.0.121010= 04
System Description: Ubuntu 22.04.3 LTS

Configured using:
= =C2=A0'configure --prefix=3D/usr/local --with-modules --with-tree-sitte= r
--with-threads --with-x-toolkit=3Dgtk3 --with-xwidgets --with-gnutls--with-json --with-mailutils --with-jpeg --with-png --with-rsvg
--with= -tiff --with-xml2 --with-xpm --with-imagemagick CC=3Dgcc-12
CXX=3Dgcc-12= '
--000000000000ae57b0060ab3f318-- --000000000000ae57b1060ab3f31a Content-Type: text/x-patch; charset="US-ASCII"; name="c-ts-mode-first-sib-comments.patch" Content-Disposition: attachment; filename="c-ts-mode-first-sib-comments.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lp93xha40 RnJvbSBmNWM3NWE1MTViMWZlZDE5ZDk4ZjQxZDdhMWJjOTVkMjg1ZGM0ZGYwIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBudmVybm8gPG5vYWgudi5wZWFydEBnbWFpbC5jb20+CkRhdGU6 IFR1ZSwgMjEgTm92IDIwMjMgMTY6MzM6MDQgLTA4MDAKU3ViamVjdDogW1BBVENIXSBmaXggYy10 cy1tb2RlIGluZGVudGF0aW9uIHdoZW4gZmlyc3Qtc2libGluZyBpcyBhIGNvbW1lbnQKCi0tLQog bGlzcC9wcm9nbW9kZXMvYy10cy1tb2RlLmVsICAgICAgICAgICAgICAgICAgIHwgIDYgKysrLQog Li4uL3Byb2dtb2Rlcy9jLXRzLW1vZGUtcmVzb3VyY2VzL2luZGVudC5lcnRzIHwgMzIgKysrKysr KysrKysrKysrKysrLQogMiBmaWxlcyBjaGFuZ2VkLCAzNiBpbnNlcnRpb25zKCspLCAyIGRlbGV0 aW9ucygtKQoKZGlmZiAtLWdpdCBhL2xpc3AvcHJvZ21vZGVzL2MtdHMtbW9kZS5lbCBiL2xpc3Av cHJvZ21vZGVzL2MtdHMtbW9kZS5lbAppbmRleCA3MDcxN2E5MGNhYS4uYTkzZDhiZWIyNzIgMTAw NjQ0Ci0tLSBhL2xpc3AvcHJvZ21vZGVzL2MtdHMtbW9kZS5lbAorKysgYi9saXNwL3Byb2dtb2Rl cy9jLXRzLW1vZGUuZWwKQEAgLTQ0Myw3ICs0NDMsOSBAQCBjLXRzLW1vZGUtLWluZGVudC1zdHls ZXMKIAogICAgICAgICAgICA7OyBTdGF0ZW1lbnQgaW4ge30gYmxvY2tzLgogICAgICAgICAgICAo KG9yIChtYXRjaCBuaWwgImNvbXBvdW5kX3N0YXRlbWVudCIgbmlsIDEgMSkKLSAgICAgICAgICAg ICAgICAobWF0Y2ggbnVsbCAiY29tcG91bmRfc3RhdGVtZW50IikpCisgICAgICAgICAgICAgICAg KG1hdGNoIG51bGwgImNvbXBvdW5kX3N0YXRlbWVudCIpCisgICAgICAgICAgICAgICAgOzsgQ2Fz ZSB3aGVuIGZpcnN0IHNpYmxpbmcocykgYXJlIGNvbW1lbnRzCisgICAgICAgICAgICAgICAgKHF1 ZXJ5ICIoY29tcG91bmRfc3RhdGVtZW50IF8gKGNvbW1lbnQpIChfKSBAaW5kZW50KSIpKQogICAg ICAgICAgICAgc3RhbmRhbG9uZS1wYXJlbnQgYy10cy1tb2RlLWluZGVudC1vZmZzZXQpCiAgICAg ICAgICAgICgocGFyZW50LWlzICJjb21wb3VuZF9zdGF0ZW1lbnQiKSBjLXRzLW1vZGUtLWFuY2hv ci1wcmV2LXNpYmxpbmcgMCkKICAgICAgICAgICAgOzsgT3BlbmluZyBicmFja2V0LgpAQCAtNDU0 LDggKzQ1NiwxMCBAQCBjLXRzLW1vZGUtLWluZGVudC1zdHlsZXMKICAgICAgICAgICAgOzsgVGVz dGVkIGJ5IHRoZSAiQnJhY2tldGxlc3MgU2ltcGxlIFN0YXRlbWVudCIgdGVzdC4KICAgICAgICAg ICAgKChwYXJlbnQtaXMgImlmX3N0YXRlbWVudCIpIHN0YW5kYWxvbmUtcGFyZW50IGMtdHMtbW9k ZS1pbmRlbnQtb2Zmc2V0KQogICAgICAgICAgICAoKHBhcmVudC1pcyAiZm9yX3N0YXRlbWVudCIp IHN0YW5kYWxvbmUtcGFyZW50IGMtdHMtbW9kZS1pbmRlbnQtb2Zmc2V0KQorICAgICAgICAgICAo KG1hdGNoICJ3aGlsZSIgImRvX3N0YXRlbWVudCIpIHBhcmVudC1ib2wgMCkgOyAoZG9fc3RhdGVt ZW50ICJ3aGlsZSIpCiAgICAgICAgICAgICgocGFyZW50LWlzICJ3aGlsZV9zdGF0ZW1lbnQiKSBz dGFuZGFsb25lLXBhcmVudCBjLXRzLW1vZGUtaW5kZW50LW9mZnNldCkKICAgICAgICAgICAgKChw YXJlbnQtaXMgImRvX3N0YXRlbWVudCIpIHN0YW5kYWxvbmUtcGFyZW50IGMtdHMtbW9kZS1pbmRl bnQtb2Zmc2V0KQorICAgICAgICAgICAoKHBhcmVudC1pcyAiZWxzZV9jbGF1c2UiKSBzdGFuZGFs b25lLXBhcmVudCBjLXRzLW1vZGUtaW5kZW50LW9mZnNldCkKIAogICAgICAgICAgICAoKHBhcmVu dC1pcyAiY2FzZV9zdGF0ZW1lbnQiKSBzdGFuZGFsb25lLXBhcmVudCBjLXRzLW1vZGUtaW5kZW50 LW9mZnNldCkKIApkaWZmIC0tZ2l0IGEvdGVzdC9saXNwL3Byb2dtb2Rlcy9jLXRzLW1vZGUtcmVz b3VyY2VzL2luZGVudC5lcnRzIGIvdGVzdC9saXNwL3Byb2dtb2Rlcy9jLXRzLW1vZGUtcmVzb3Vy Y2VzL2luZGVudC5lcnRzCmluZGV4IDIyMWIzZDgwOWFmLi5kMjkzNzBiNDFlNiAxMDA2NDQKLS0t IGEvdGVzdC9saXNwL3Byb2dtb2Rlcy9jLXRzLW1vZGUtcmVzb3VyY2VzL2luZGVudC5lcnRzCisr KyBiL3Rlc3QvbGlzcC9wcm9nbW9kZXMvYy10cy1tb2RlLXJlc291cmNlcy9pbmRlbnQuZXJ0cwpA QCAtMzEwLDcgKzMxMCw3IEBAIGxhYmVsOgogCiBOYW1lOiBCcmFja2V0LWxlc3MgQmxvY2stU3Rh dGVtZW50IChMaW51eCBTdHlsZSkgKGJ1ZyM2MTAyNikKIAotPS09LT0KKz0tPQogaW50IG1haW4o KSB7CiAgIHdoaWxlICh0cnVlKQogICAgIGlmICh0cnVlKSB7CkBAIC0zMzEsNiArMzMxLDggQEAg aW50IG1haW4oKSB7CiAgICAgaWYgKHRydWUpIHsKICAgICAgIHB1dHMgKCJIZWxsbyIpOwogICAg IH0KKyAgICBlbHNlCisgICAgICBwdXRzKCJIZWxsbyIpOwogfQogPS09LT0KIApAQCAtMzc5LDYg KzM4MSwzNCBAQCB2b2lkIGZvbygKIH0KID0tPS09CiAKK05hbWU6IEJsb2NrLVN0YXRlbWVudCB3 aGVyZSBmaXJzdCBzaWJsaW5ncyBhcmUgY29tbWVudHMgKExpbnV4IFN0eWxlKQorCis9LT0KK2lu dCBtYWluKCkgeworICB3aGlsZSAodHJ1ZSkgeyAvKiBmb28gKi8KKyAgICBpZiAodHJ1ZSkgeyAv LyBiYXIKKyAgICAgIHB1dHMgKCJIZWxsbyIpOworICAgIH0KKyAgfQorICBmb3IgKDs7KSB7ICAv LyAxLiBmb29vCisgICAgLyogMi4gYmFhYSAqLworICAgIC8qIDMuIHJyciAqLworICAgIGlmICh0 cnVlKQorICAgICAgLy8gMi4gYmFhYQorICAgICAgcHV0cyAoIkhlbGxvIik7CisgIH0KKyAgaWYg KDEpIHsgLy8gMQorICAgIC8qCisgICAgICogMgorICAgICAqLworICAgIGlmICgxKSAvKjMqLyB7 CisgICAgICAvKiA0ICovCisgICAgICBwdXRzKCJIZWxsbyIpOworICAgIH0KKyAgfQorfQorPS09 LT0KKwogTmFtZTogSW5pdGlhbGl6ZXIgTGlzdCAoTGludXggU3R5bGUpIChCdWcjNjEzOTgpCiAK ID0tPQotLSAKMi4zNC4xCgo= --000000000000ae57b1060ab3f31a-- ------------=_1702199403-16871-1-- From unknown Tue Jul 22 23:08:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67357: [PATCH] Fix c-ts-mode block indent when first-siblings are comments Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Dec 2023 09:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67357 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Yuan Fu Cc: noah.v.peart@gmail.com, 67357@debbugs.gnu.org, dmitry@gutov.dev Received: via spool by 67357-submit@debbugs.gnu.org id=B67357.170220120820164 (code B ref 67357); Sun, 10 Dec 2023 09:41:01 +0000 Received: (at 67357) by debbugs.gnu.org; 10 Dec 2023 09:40:08 +0000 Received: from localhost ([127.0.0.1]:49508 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rCGIC-0005F8-3h for submit@debbugs.gnu.org; Sun, 10 Dec 2023 04:40:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47604) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rCGIA-0005Ed-96 for 67357@debbugs.gnu.org; Sun, 10 Dec 2023 04:40:06 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rCGHq-000408-99; Sun, 10 Dec 2023 04:39:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=65GR7y7vhUGRKRNh5cSZKPWMupjmfgd9DR/V6IRrrRA=; b=iRvvOowzFCdQ DuBgM9rGnBJSvslq812WDVYh2+eBYegNQbtp4KOFAy+2ASeC+KO8Kb1GleyB9qVXxIuM3EKxvlRt9 Zlf4EFd4ngOxXXCZikghwjTdV6VocshOBvtb8Ib+DN7eeWFeTSpUmVgH5O7VnFP06yEYAdPv8fsvW MrCSWf2KDLZq+Ey8tfOh/K++Zxo9EzkhLpWM765mSxZ6kwSZE6Zrd6yzYPTBspC+feLh9WoqpDFaF yGsjFPm5BfTL01JHQvGwgN67yVGUG+YsmKqdfxP7fKCasv5nr9SOpaYrnnu38mw7z8SXUrJFuSJk+ h5DTSvMO2lVM6cfhrwm9hA==; Date: Sun, 10 Dec 2023 11:39:31 +0200 Message-Id: <834jgqwg4s.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <8c7e244d-5dad-4111-89b8-ca7722657ce0@gmail.com> (message from Yuan Fu on Sun, 10 Dec 2023 01:09:15 -0800) References: <834jhchqha.fsf@gnu.org> <08e16d44-174d-87e6-aa17-8cf55202227b@gutov.dev> <83wmu8fsj7.fsf@gnu.org> <8334wvfdna.fsf@gnu.org> <83y1endx9z.fsf@gnu.org> <83cyvs7jte.fsf@gnu.org> <83ttoryebi.fsf@gnu.org> <8c7e244d-5dad-4111-89b8-ca7722657ce0@gmail.com> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sun, 10 Dec 2023 01:09:15 -0800 > Cc: noah.v.peart@gmail.com, 67357@debbugs.gnu.org, dmitry@gutov.dev > From: Yuan Fu > > > > Ping! Ping! Yuan, please chime is, as I'm waiting for your comments > > before we install on the release branch. > > > > This and other patches for TS-based modes are currently delaying the > > release of Emacs 29.2, so please try to be more responsive, okay? > > > Whoa! Sorry, I just switched to a new email client, and direct CC isn't > highlight as they were before :-( (And admittedly I haven't been > browsing the bug tracker lately.) OK, but please look also at other bugs and issues where I asked for your opinions. > As for the patch, first of all, thank you, Noah, it's very good. I try > to avoid query matchers since they could be slow, plus the fundamental > problem isn't with comments, IMO. The problem is when the first sibling > isn't on it's own line. (Though in normal C source code, when the first > sibling isn't on its own line, that sibling is usually a comment.) > Anyway, please see my reasoning in the commit message for 08fc6bace20. > > I also removed the else_clause rule since it's already added by the > patch for bug#67417, and added another test. Thanks, but please in the future mention _all_ relevant bug numbers in the log message, or merge them if appropriate. From unknown Tue Jul 22 23:08:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#67357: [PATCH] Fix c-ts-mode block indent when first-siblings are comments Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Dec 2023 01:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67357 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: noah.v.peart@gmail.com, 67357@debbugs.gnu.org, dmitry@gutov.dev Received: via spool by 67357-submit@debbugs.gnu.org id=B67357.170225712915384 (code B ref 67357); Mon, 11 Dec 2023 01:13:02 +0000 Received: (at 67357) by debbugs.gnu.org; 11 Dec 2023 01:12:09 +0000 Received: from localhost ([127.0.0.1]:52152 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rCUq8-000404-Rt for submit@debbugs.gnu.org; Sun, 10 Dec 2023 20:12:09 -0500 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]:53538) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rCUq4-0003zL-Gm for 67357@debbugs.gnu.org; Sun, 10 Dec 2023 20:12:07 -0500 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1d307cf18fdso1950195ad.3 for <67357@debbugs.gnu.org>; Sun, 10 Dec 2023 17:11:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702257104; x=1702861904; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=/+XuQI8dPrrQNccnVQJOCvO4rH+jbMQPtwd3hmazd7w=; b=arqlNtQ+eVlc2D/T/WljJzMkttQWqMvMi9S0ZfTqKRzot19uZIQH0YT9U8Rf6CLlJq vlDzFaJaWNLsK2wV3GaIcpozMMXBe1mp6DHG7yfWcJ2MgJ8zSnPlra1zEs6g9iNUxode avZ5bLA/3gP+cLcluZlZHuH+tPtitwZ9NcolYf/tuv1ZxQk8LStEUn6b8nRvyAbRFgMo kobkHlAwSM5aX+4WQnbaeoh8J8z2v4H/D4HtbSs/OJJ+gPZzp9El8YJhOmlcMYY2jYYH VMh2eicxF7+9ssIYcqO8c/qhUC/3vURikmOMp5pFx7ctzI+kwuZgi0udzbp52TjG7vtu c2oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702257104; x=1702861904; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/+XuQI8dPrrQNccnVQJOCvO4rH+jbMQPtwd3hmazd7w=; b=FfSTJv45tohj9zJWihTcJV2y0E/tt4anmOtl5J7uk5ZxxL0DQXNf9DdJ/I03HEaGfZ V4ipBVpxKO/yEWI0eQu0zVPfHaZWyb/xP8EtuxpmlrL5N4ytt87zcSjaHO3NLUgDFipb btwkTtTCkof6KVxpJT7yYfMybU4uJf2ChdxYIbJ6hW0QXID/vq9KJX5tHQ46/ROFJnRG kW2z0qaRab20ZtPLjXU0VGauIMayeGMMJpVqCgxfiCX32EAveNZDFFxyyDkKLgeYRxKp A7OU8Vt08zmWeNylV9wuV5feyoxV1QhS/S2b6iDqsd9xULoopvZVbyRXs4HtH319O1+p 07NA== X-Gm-Message-State: AOJu0YwtZC6VOIVyBk2tRBD9LkA9zNJYJx4sPdek61ElpwRz8KqPCYNS RMLvXYUJgKAAcXpi4r9W8/k= X-Google-Smtp-Source: AGHT+IE06IRDWFtN8Q2zNWbcCah2jfUXXE6Esevm/ebK+fPPY9wq+0cjYEmo753m/p3Up82cFGLfgQ== X-Received: by 2002:a17:903:11cf:b0:1d3:1bea:eb56 with SMTP id q15-20020a17090311cf00b001d31beaeb56mr396625plh.115.1702257103714; Sun, 10 Dec 2023 17:11:43 -0800 (PST) Received: from [192.168.1.7] (172-117-161-177.res.spectrum.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id n6-20020a170902e54600b001d1cd7e4ad2sm5301678plf.125.2023.12.10.17.11.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 10 Dec 2023 17:11:43 -0800 (PST) Message-ID: <3fa4a664-0b5c-46d8-a3c0-2d954744a5e6@gmail.com> Date: Sun, 10 Dec 2023 17:11:42 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US References: <834jhchqha.fsf@gnu.org> <08e16d44-174d-87e6-aa17-8cf55202227b@gutov.dev> <83wmu8fsj7.fsf@gnu.org> <8334wvfdna.fsf@gnu.org> <83y1endx9z.fsf@gnu.org> <83cyvs7jte.fsf@gnu.org> <83ttoryebi.fsf@gnu.org> <8c7e244d-5dad-4111-89b8-ca7722657ce0@gmail.com> <834jgqwg4s.fsf@gnu.org> From: Yuan Fu In-Reply-To: <834jgqwg4s.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 12/10/23 1:39 AM, Eli Zaretskii wrote: >> Date: Sun, 10 Dec 2023 01:09:15 -0800 >> Cc: noah.v.peart@gmail.com, 67357@debbugs.gnu.org, dmitry@gutov.dev >> From: Yuan Fu >> >> >>> Ping! Ping! Yuan, please chime is, as I'm waiting for your comments >>> before we install on the release branch. >>> >>> This and other patches for TS-based modes are currently delaying the >>> release of Emacs 29.2, so please try to be more responsive, okay? >>> >> Whoa! Sorry, I just switched to a new email client, and direct CC isn't >> highlight as they were before :-( (And admittedly I haven't been >> browsing the bug tracker lately.) > OK, but please look also at other bugs and issues where I asked for > your opinions. Yes, I'm trying to setup something that can prevent this in the future, and there are so many CC's that I missed, apologies! >> As for the patch, first of all, thank you, Noah, it's very good. I try >> to avoid query matchers since they could be slow, plus the fundamental >> problem isn't with comments, IMO. The problem is when the first sibling >> isn't on it's own line. (Though in normal C source code, when the first >> sibling isn't on its own line, that sibling is usually a comment.) >> Anyway, please see my reasoning in the commit message for 08fc6bace20. >> >> I also removed the else_clause rule since it's already added by the >> patch for bug#67417, and added another test. > Thanks, but please in the future mention _all_ relevant bug numbers > in the log message, or merge them if appropriate. I'll keep that in mind. Yuan