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: Sat, 09 Dec 2023 10:23:29 +0200 Message-ID: <83ttoryebi.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> <83cyvs7jte.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15674"; 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 Sat Dec 09 09:25:13 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 1rBse8-0003lX-Dl for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Dec 2023 09:25:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rBsdm-0005IC-60; Sat, 09 Dec 2023 03:24:50 -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 1rBsdl-0005I3-44 for bug-gnu-emacs@gnu.org; Sat, 09 Dec 2023 03:24:49 -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 1rBsdk-0006aC-Ri for bug-gnu-emacs@gnu.org; Sat, 09 Dec 2023 03:24:48 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rBsdy-0002LE-80 for bug-gnu-emacs@gnu.org; Sat, 09 Dec 2023 03:25:02 -0500 X-Loop: help-debbugs@gnu.org 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 Original-Received: via spool by 67357-submit@debbugs.gnu.org id=B67357.17021102468866 (code B ref 67357); Sat, 09 Dec 2023 08:25:02 +0000 Original-Received: (at 67357) by debbugs.gnu.org; 9 Dec 2023 08:24:06 +0000 Original-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 Original-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 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 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==; In-Reply-To: <83cyvs7jte.fsf@gnu.org> (message from Eli Zaretskii on Wed, 29 Nov 2023 15:47:25 +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:275827 Archived-At: 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. > > > >