From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#67357: [PATCH] Fix c-ts-mode block indent when first-siblings are comments Date: Wed, 29 Nov 2023 15:47:25 +0200 Message-ID: <83cyvs7jte.fsf@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> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27563"; mail-complaints-to="usenet@ciao.gmane.io" Cc: noah.v.peart@gmail.com, 67357@debbugs.gnu.org, dmitry@gutov.dev To: casouri@gmail.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 29 14:48:16 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r8KvH-0006xG-S1 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Nov 2023 14:48:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r8Kuz-0005cm-5S; Wed, 29 Nov 2023 08:47:57 -0500 Original-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 1r8Kuw-0005cF-IP for bug-gnu-emacs@gnu.org; Wed, 29 Nov 2023 08:47:54 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r8Kuw-0001cB-94 for bug-gnu-emacs@gnu.org; Wed, 29 Nov 2023 08:47:54 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r8Kv3-0001Q5-P1 for bug-gnu-emacs@gnu.org; Wed, 29 Nov 2023 08:48:01 -0500 X-Loop: help-debbugs@gnu.org 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 Original-Received: via spool by 67357-submit@debbugs.gnu.org id=B67357.17012656725390 (code B ref 67357); Wed, 29 Nov 2023 13:48:01 +0000 Original-Received: (at 67357) by debbugs.gnu.org; 29 Nov 2023 13:47:52 +0000 Original-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 Original-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 Original-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==; In-Reply-To: <83y1endx9z.fsf@gnu.org> (message from Eli Zaretskii on Fri, 24 Nov 2023 16:46:32 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:275227 Archived-At: > 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.