From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#61026: 29.0.60; c-ts-mode: Broken indentation for loops and conditions without brace Date: Sun, 29 Jan 2023 09:55:42 +0100 Message-ID: <1A70D229-1DCF-449D-A2F2-6003CA907039@thornhill.no> References: <68C0658F-BA18-4DEE-84AC-035A85AFCE36@gmail.com> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19485"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Mohammed Sadiq , 61026@debbugs.gnu.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 29 09:56:30 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 1pM3UE-0004ru-6S for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 29 Jan 2023 09:56:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pM3Tr-0007cP-CE; Sun, 29 Jan 2023 03:56:08 -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 1pM3Tm-0007c9-GK for bug-gnu-emacs@gnu.org; Sun, 29 Jan 2023 03:56:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pM3Tm-0003Cr-2e for bug-gnu-emacs@gnu.org; Sun, 29 Jan 2023 03:56:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pM3Tl-0002Vf-Iq for bug-gnu-emacs@gnu.org; Sun, 29 Jan 2023 03:56:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 29 Jan 2023 08:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61026 X-GNU-PR-Package: emacs Original-Received: via spool by 61026-submit@debbugs.gnu.org id=B61026.16749825539630 (code B ref 61026); Sun, 29 Jan 2023 08:56:01 +0000 Original-Received: (at 61026) by debbugs.gnu.org; 29 Jan 2023 08:55:53 +0000 Original-Received: from localhost ([127.0.0.1]:42282 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pM3Tc-0002VG-J3 for submit@debbugs.gnu.org; Sun, 29 Jan 2023 03:55:52 -0500 Original-Received: from out2.migadu.com ([188.165.223.204]:29445) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pM3TY-0002V4-6B for 61026@debbugs.gnu.org; Sun, 29 Jan 2023 03:55:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1674982546; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W321pN3FzrWBpfTMRueiEEp60SOUSVu/dnnzLljmEx4=; b=BzTFd4C/sJN4/HjCksEAebst01ZYJkZkkTkl2f5hn8W5IgDPvJp9oMI8bQYyzypm5WFIOo bi9dsocX8wf5LCWs+38ubnmlbLdBxMmOb7aYvSM2K+Y6oXhY3SjoNWYefGi6RWOp44dsZR ClJB8vTegFWbLGi+d4hSJ6VnR8DthLzusLtNsJKQZZRfhdGbqI2BUdK5HQmmqlGHS50vqu vIwgWWui3K9BqjJL44ZWyA2ejVlANWb/XCfhqZzDwZPpidUywv2T26U+aVgElpTE3oexEf NM8orRdQKnEFgBDc+nOV+ZoJXiSKU/Tl4itqekiaqS6f7GERd1cOTWnbd+Kb6w== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-Reply-To: <68C0658F-BA18-4DEE-84AC-035A85AFCE36@gmail.com> X-Migadu-Flow: FLOW_OUT 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:254344 Archived-At: On 29 January 2023 09:22:26 CET, Yuan Fu wrote: > >Theodor Thornhill writes: > >> Yuan Fu writes: >> >>> Theodor Thornhill writes: >>> >>>> Mohammed Sadiq writes: >>>> >>>>> The following code has broken indentation with c-ts-mode: >>>>> >>>>> while (true) >>>>> if (true) { >>>>> puts ("Hello"); >>>>> } >>>>> >>>>> if (true) >>>>> if (true) >>>>> { >>>>> puts ("World"); >>>>> } >>>>> >>>>> For which, I expect to get the following indentation (with default c= onfig): >>>>> >>>>> while (true) >>>>> if (true) { >>>>> puts ("Hello"); >>>>> } >>>>> >>>>> if (true) >>>>> if (true) >>>>> { >>>>> puts ("World"); >>>>> } >>>>> >>>>> >>>> >>>> Thanks, Mohammed! >>>> >>>> Yuan, I'm not sure the new brace counting method is a good enough >>>> improvement just yet considering its complexity and the number of iss= ues >>>> we are seeing=2E Do you see any simple fixes for these issues? >>> >>> I fixed it=2E >>> >>>> I can try to debug this this weekend, but not sure I really have time= to >>>> fix it=2E All of these issues work fine in js-ts-mode or java-ts-mod= e, if >>>> I'm not mistaken=2E >>> >>> Yes, because js and java doesn=E2=80=99t allow omitting brackets=2E So= we only >>> need to add a special-case for C/C++, so it isn=E2=80=99t too bad=2E >>> >>> Yuan >> >> They allow that just fine, don't they?=20 > >You are right=2E I made the fix general and moved everything to >c-ts-common=2Eel=2E The next step is to make other modes use it=2E > >Yuan Nice!