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: Thu, 26 Jan 2023 08:57:23 +0100 Message-ID: <878rhphgnw.fsf@thornhill.no> References: <8E212F23-55C2-49AB-8753-90BA6C2B4EAF@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="39474"; 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 Thu Jan 26 08:58:21 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 1pKx9J-000A2a-HV for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 26 Jan 2023 08:58:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKx91-0007Ta-TL; Thu, 26 Jan 2023 02:58:03 -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 1pKx90-0007TN-2c for bug-gnu-emacs@gnu.org; Thu, 26 Jan 2023 02:58:02 -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 1pKx8z-0003nn-Qr for bug-gnu-emacs@gnu.org; Thu, 26 Jan 2023 02:58:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pKx8z-0005z9-Md for bug-gnu-emacs@gnu.org; Thu, 26 Jan 2023 02:58: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: Thu, 26 Jan 2023 07:58: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.167471984822952 (code B ref 61026); Thu, 26 Jan 2023 07:58:01 +0000 Original-Received: (at 61026) by debbugs.gnu.org; 26 Jan 2023 07:57:28 +0000 Original-Received: from localhost ([127.0.0.1]:60559 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKx8S-0005y8-5l for submit@debbugs.gnu.org; Thu, 26 Jan 2023 02:57:28 -0500 Original-Received: from out0.migadu.com ([94.23.1.103]:46376) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKx8Q-0005xz-59 for 61026@debbugs.gnu.org; Thu, 26 Jan 2023 02:57:27 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1674719844; 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=U8h1CqsN2i4xN7tp8azZkpDqR1rdF6YD/YQayD/ChSI=; b=c9xWUdcmfCwSoOCCv0Ac21L60za6qYM5QHprRM0BKQXM3cE0wsg3QObieCCsEwVoX4sN1m 58hpSWxD+fEEMrTDLiBOGlKa3OYP7q5W/oSOPJd2x/l5ZQeysJM2xIM45C1MZ+k/1d2wIU 3ezVkGM5kzhuXXbkwaYfEMwtDOVYPQzxB6UpMukrU8z8yepIJcGXVR86skOorGHR1USMBE Fe0FSkjXIkPwhqHCyfSy7nnN1OwJbng1KhD9Yq+Sb27C5X9WcVd1zJMvDDtyExezUpitc5 8F3wvXdMFOTos5ymQRIQLRSfrpB+ThQoMOtv/AyESITIHn4tbP1qpPolPXxtgQ== In-Reply-To: <8E212F23-55C2-49AB-8753-90BA6C2B4EAF@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:254187 Archived-At: 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 conf= ig): >>> >>> 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 issues >> we are seeing. Do you see any simple fixes for these issues? > > I fixed it. > >> I can try to debug this this weekend, but not sure I really have time to >> fix it. All of these issues work fine in js-ts-mode or java-ts-mode, if >> I'm not mistaken. > > Yes, because js and java doesn=E2=80=99t allow omitting brackets. So we o= nly > need to add a special-case for C/C++, so it isn=E2=80=99t too bad. > > Yuan They allow that just fine, don't they?=20