From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#61026: 29.0.60; c-ts-mode: Broken indentation for loops and conditions without brace Date: Wed, 25 Jan 2023 23:54:08 -0800 Message-ID: <8E212F23-55C2-49AB-8753-90BA6C2B4EAF@gmail.com> References: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) 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="22576"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Mohammed Sadiq , 61026@debbugs.gnu.org To: Theodor Thornhill Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 26 08:55:19 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 1pKx6M-0005gQ-JY for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 26 Jan 2023 08:55:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKx69-0006yK-9z; Thu, 26 Jan 2023 02:55:05 -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 1pKx66-0006xn-8m for bug-gnu-emacs@gnu.org; Thu, 26 Jan 2023 02:55: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 1pKx65-0003D2-WD for bug-gnu-emacs@gnu.org; Thu, 26 Jan 2023 02:55:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pKx65-0005tj-PH for bug-gnu-emacs@gnu.org; Thu, 26 Jan 2023 02:55:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Jan 2023 07:55: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.167471967122624 (code B ref 61026); Thu, 26 Jan 2023 07:55:01 +0000 Original-Received: (at 61026) by debbugs.gnu.org; 26 Jan 2023 07:54:31 +0000 Original-Received: from localhost ([127.0.0.1]:60546 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKx5a-0005sq-Ut for submit@debbugs.gnu.org; Thu, 26 Jan 2023 02:54:31 -0500 Original-Received: from mail-pf1-f174.google.com ([209.85.210.174]:46848) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKx5Y-0005sY-Ih for 61026@debbugs.gnu.org; Thu, 26 Jan 2023 02:54:29 -0500 Original-Received: by mail-pf1-f174.google.com with SMTP id 20so599787pfu.13 for <61026@debbugs.gnu.org>; Wed, 25 Jan 2023 23:54:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=IV+Z35Hmkirp9KOpM/MZ8OwfMVrh33lbu9yNfs32UMg=; b=i4WgJS+gno+fPNu7XtF9W9V0Lo55RWW8k8lHPToDRiDVncKqo6ObS+hkB8Ges/iU2v boZABKVXDLrSBLWnc+v9RGoPXVlER9TTuXAn+kySVARPnM6fIpj78gL9AzlZulAM6rW7 KQMyXwnZj9ZcfZPdq8AAYLK6vYJ9wqxkbozUulWfwGajNUVMibj/tvVktHOEibiAXKz1 7A34GpKoIxoQA2zMQ2mZZkiPFmzIjfspnQMLH4Ue7psDuHKgO/7vs2JwuHFatenj6Iky OXwmPue3uTOofqqSHaBUmriuf9AA8SDPvx5giOpjZdjdnd4U2q0jKGA2GfTRMs6z7SVJ cAkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IV+Z35Hmkirp9KOpM/MZ8OwfMVrh33lbu9yNfs32UMg=; b=NmsI8mvp9d9uVfJbwnGcXSkTDDAoW+3c7EtlQZOKGw0QhsDeIojCovWX6HjgFudGVX SJkkQB2EMputXI7GU7fsAPwkWNHIZ5pSZWas5WH+R0qL8Mev2emlOsxA1BX4lWLorgIX 18EGJESNhV1WFWl+Cq1utGFgN6Wio7KEKuS9zjA0uViCmINs3NCNT6ccf881jOjwxtJR XJ5QjRAifbL+eK+44DHjhs2TFXHVN2/o7R+Lig54QPXZZsOGDEcI/Q4NDwHLWzJYzoZm Q5xr0qx2Yf86E8sppZe4AEgzkpFtF0MAUzG+GK7JhOEtMSnLogvr5HRiCJ5gP8GqfV+K 0xzw== X-Gm-Message-State: AFqh2kqZeo5dBbufcsOgfZlYnGXJc2JgeCgBjMA8VKZyM90SvFht8Dtx +Wx0sp7RhLxzdoixLbrHkZY= X-Google-Smtp-Source: AMrXdXuQPeOB0CyXCL/RHIi6T70pvBCCilM0/1UCtyahOqUFRAqYobsuCkXdKcTLrRc8/DDqQ2qnvg== X-Received: by 2002:a05:6a00:1887:b0:588:cb81:9274 with SMTP id x7-20020a056a00188700b00588cb819274mr50576163pfh.32.1674719660555; Wed, 25 Jan 2023 23:54:20 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id o125-20020a62cd83000000b00575fbe1cf2esm333017pfg.109.2023.01.25.23.54.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jan 2023 23:54:19 -0800 (PST) X-Mailer: Apple Mail (2.3731.300.101.1.3) 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:254184 Archived-At: 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 = config): >> >> 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 = only need to add a special-case for C/C++, so it isn=E2=80=99t too bad. Yuan