From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Knut Anders Hatlen Newsgroups: gmane.emacs.bugs Subject: bug#61026: 29.0.60; c-ts-mode: Broken indentation for loops and conditions without brace Date: Tue, 7 Feb 2023 11:41:17 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000041a89905f419ca29" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4361"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61026@debbugs.gnu.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 07 11:42:27 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 1pPLQg-0000ul-NY for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 07 Feb 2023 11:42:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPLQK-0005Aq-Tc; Tue, 07 Feb 2023 05:42:04 -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 1pPLQI-0005A5-Il for bug-gnu-emacs@gnu.org; Tue, 07 Feb 2023 05:42: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 1pPLQI-0000rR-Am for bug-gnu-emacs@gnu.org; Tue, 07 Feb 2023 05:42:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pPLQH-0000nJ-QL for bug-gnu-emacs@gnu.org; Tue, 07 Feb 2023 05:42:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Knut Anders Hatlen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Feb 2023 10:42: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.16757664963019 (code B ref 61026); Tue, 07 Feb 2023 10:42:01 +0000 Original-Received: (at 61026) by debbugs.gnu.org; 7 Feb 2023 10:41:36 +0000 Original-Received: from localhost ([127.0.0.1]:51147 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPLPs-0000mc-5a for submit@debbugs.gnu.org; Tue, 07 Feb 2023 05:41:36 -0500 Original-Received: from mail-yb1-f178.google.com ([209.85.219.178]:42825) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pPLPq-0000mL-13 for 61026@debbugs.gnu.org; Tue, 07 Feb 2023 05:41:34 -0500 Original-Received: by mail-yb1-f178.google.com with SMTP id a1so17984334ybj.9 for <61026@debbugs.gnu.org>; Tue, 07 Feb 2023 02:41:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=5p4SUvnADP2z4FkvSkyrD1+nvWtXaLj8oDNcrxBJg+w=; b=Pmcz2lf6zHc9m8YGlzuA8vkc0xui6hKUVGlkC2jY1aPtwzgtOvc05LoAEz3a/K4SMi bRrDs+6JxNVk1mP0n4GjFdF4z3It7rVrJUYeXW5UvrcQS+2Mh5xJJBpcMNqRA20stJqf EHNX90/BP95rOVAxpey4sOE35THOkdVnQDst3x98aB/ExdNAqv3p2lr3sI0YXyk34nrH S8MqPNTl+Wle0l//Vw6UkqBOj6Br2jEktnI0Rrm6Fjqu36kn/L6OVJ4RePgAUL8FSHj8 oXW+OGJoDF67kxXOQra4FKgxgB5MB6qDx8Xmn/O5dBdC+5ytNDYXYQMQXlFXbQuRQ8ac kMqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5p4SUvnADP2z4FkvSkyrD1+nvWtXaLj8oDNcrxBJg+w=; b=oMMAA5jf95Fi5hA6FP4ZPZhHcRwrRqAs6wKqbsEp79AU8+ALyaBr6UuZADoMc/A5d+ WbZVR14z/fAp5++f8NYIThRARnwKGTtfGqRoCxE2Z28yXFJFIwTypGcMb58o3KOu3/9N WWl6vNxtRHw217xsmO6PLIYTMSM4DWawec8aAaEyFc68rgePFlxFL4BDZ0KpGsp//3T+ 1b2OVvjLs1bS4qvnVJQBDQjimKvrXwW4NT0grpSFuCXOhKPvAQHcS90FdTOF5UoxRXdJ vpgAf7gk4YQkNu02UdSumF7RyuVOHTznnp9HkZ1tsY3GtV6mM5yaS2S838tR4+n0uPzx jqpw== X-Gm-Message-State: AO0yUKVqKQIRV/u9WIFiSiIdsITK3GvmyXikZRFdqmQzQ+o9r1ln818M S2l9rDFjgWZYUw7tJT8nPNAxaoI142CAFQEN5g== X-Google-Smtp-Source: AK7set90aC4l25CKNBVvz8M7XcASg/40wNwKnDo45BcVexLuRq9Z71Rc31+6VqymiUi/ZcQtSHDgbKmNcGFb6d783Fc= X-Received: by 2002:a5b:4cf:0:b0:87d:c01e:2205 with SMTP id u15-20020a5b04cf000000b0087dc01e2205mr454323ybp.179.1675766488212; Tue, 07 Feb 2023 02:41:28 -0800 (PST) In-Reply-To: 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:255028 Archived-At: --00000000000041a89905f419ca29 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable tir. 7. feb. 2023 kl. 03:30 skrev Yuan Fu : > > Knut Anders Hatlen writes: > > > Hi, > > > > I'm still seeing odd indentation for conditions without braces. For > > example, invoking c-ts-mode-indent-defun (C-c C-q) with the point insid= e > > this function ... > > > > int f(int x) { > > if (x > 1) > > return x; > > else > > return x + 1; > > } > > > > ... results in the following indentation with the default GNU style: > > > > int f(int x) { > > if (x > 1) > > return x; > > else > > return x + 1; > > } > > > > I would have expected this: > > > > int f(int x) { > > if (x > 1) > > return x; > > else > > return x + 1; > > } > > > > Is something more needed for this bug, or is the problem I'm seeing a > > different bug? > > My bad, I made some changes and didn=E2=80=99t push them, and I=E2=80=99m= sitting here > wondering why everyone is seeing problems... Everything should indent > fine now. > > Yuan > Thanks, Yuan! It now seems to work fine with the GNU style, K&R style and Linux style. With BSD style, however, it ends up like this: int f(int x) { if (x > 1) return x; else return x + 1; } I assume the return statements should have been indented one more level here too? Best regards, --=20 Knut Anders --00000000000041a89905f419ca29 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
tir. 7. feb. 2023 kl. 03:30 skrev Yuan Fu <casouri@gmail.com>:

Knut Anders Hatlen <kahatlen@gmail.com> writes:

> Hi,
>
> I'm still seeing odd indentation for conditions without braces. Fo= r
> example, invoking c-ts-mode-indent-defun (C-c C-q) with the point insi= de
> this function ...
>
> int f(int x) {
> if (x > 1)
> return x;
> else
> return x + 1;
> }
>
> ... results in the following indentation with the default GNU style: >
> int f(int x) {
>=C2=A0 =C2=A0if (x > 1)
> return x;
>=C2=A0 =C2=A0else
> return x + 1;
> }
>
> I would have expected this:
>
> int f(int x) {
>=C2=A0 =C2=A0if (x > 1)
>=C2=A0 =C2=A0 =C2=A0return x;
>=C2=A0 =C2=A0else
>=C2=A0 =C2=A0 =C2=A0return x + 1;
> }
>
> Is something more needed for this bug, or is the problem I'm seein= g a
> different bug?

My bad, I made some changes and didn=E2=80=99t push them, and I=E2=80=99m s= itting here
wondering why everyone is seeing problems... Everything should indent
fine now.

Yuan

Thanks, Yuan!

It now seems to work fine with the GNU style, K&R style and Linux st= yle. With BSD style, however, it ends up like this:

int f(int x) {
=C2=A0 if (x > 1)
=C2=A0 return x;
=C2=A0 else=
=C2=A0 return x + 1;
}

I assume the return = statements should have been indented one more level here too?

Best regards,

--
Knut Anders
--00000000000041a89905f419ca29--