GNU bug report logs - #60496
29.0.60; c-ts-mode: Broken indentation with linux style conditionals

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Mohammed Sadiq <sadiq@HIDDEN>; merged with #59686, #60398; dated Mon, 2 Jan 2023 15:58:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 60496 <at> debbugs.gnu.org:


Received: (at 60496) by debbugs.gnu.org; 15 Jan 2023 09:24:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 15 04:24:00 2023
Received: from localhost ([127.0.0.1]:56102 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pGzFA-0003W9-0N
	for submit <at> debbugs.gnu.org; Sun, 15 Jan 2023 04:24:00 -0500
Received: from mail-pl1-f177.google.com ([209.85.214.177]:43528)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <casouri@HIDDEN>)
 id 1pGzF6-0003Ve-AQ; Sun, 15 Jan 2023 04:23:57 -0500
Received: by mail-pl1-f177.google.com with SMTP id d3so27501315plr.10;
 Sun, 15 Jan 2023 01:23:56 -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=XUt8CmYvOAqndeajKxKqQoDiBG9HvdpRha5qDKw258Y=;
 b=LoNdkXnWInZWOyUSiz9jjvlDLEaJI3YYhz7Jh16SHWnG2iaCy8LdiHzCefShUrzPtf
 V2njRovqGxh7ga4S1GxfJ6ToEjUWAEAcKm8tnMGk3Kn+FgBT+slDFLNYgYvdLW2NF+c7
 yYw7BbeVTbJE0K+aKj9SFTaytXg5J0yNXIed+hfhqQJzV4vrQ5YjYjXNInFmmXz17Pb7
 wtMt9i96h1DVk8iUiflVT91DbsPCEbbQNDpEkFF+t6zUgKtcennOnMKgiRgO+/9ERkRF
 3Q88CiqWDPmWEnxCLSq3vm4zORjiLpuGXX97Oid2fJ6AufrXh3x43I2PVZWVBwkuaccL
 4xbA==
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=XUt8CmYvOAqndeajKxKqQoDiBG9HvdpRha5qDKw258Y=;
 b=PMmMqMDFpaY9hsPOWH+iwobxQA0wXuBaqGReLQDyPcPVkn7UaRCKhf1B04nL/CvTXK
 kwZkUSiEknF5mLYuBluNBWVVwLDGfNzMIaSKMnm6LI+7+pFkUboVpkejF8YlM7IrJ15/
 FfzyUwfRty4CeiN/xxF1jJ8bcZWetrmvpsj1UgmklYYRtJ6KXUy9897CQkDmq76Yt9Kw
 zoiUzC/5lgID8lQ5/i0o+2f6k/ptLr9clsL855xV9ymeoMToH4/1v+OrzmGsIhq9zwvb
 RPvLezy0VCaxz+YqktSHW6G+axhXXdssVABvNXRiOcPocxU1Eq83AWLlx8ZAR5lvSe3r
 B/FA==
X-Gm-Message-State: AFqh2krQ5HTS0IFdrtUx2mSem/LbM+D/T7TFljzjWkDnBhL38woeNjVS
 jax9YxPengPTEytxbo4DW3A=
X-Google-Smtp-Source: AMrXdXv4DdrCUVMRZOCYDhE3ISRLMoEjW9CDGEUHknY+YlApmPtWuCis4TKAOt89Z6S7Jy91pxybaw==
X-Received: by 2002:a17:903:1d2:b0:194:7aae:f272 with SMTP id
 e18-20020a17090301d200b001947aaef272mr7630081plh.30.1673774629138; 
 Sun, 15 Jan 2023 01:23:49 -0800 (PST)
Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com.
 [172.117.161.177]) by smtp.gmail.com with ESMTPSA id
 ik9-20020a170902ab0900b00183c67844aesm17081200plb.22.2023.01.15.01.23.48
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 15 Jan 2023 01:23:48 -0800 (PST)
From: Yuan Fu <casouri@HIDDEN>
Content-Type: text/plain;
	charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\))
Subject: Re: bug#60496: 29.0.60; c-ts-mode: Broken indentation with linux 
 style conditionals
Message-Id: <14D85B96-4968-45D9-8296-819E440F01C3@HIDDEN>
Date: Sun, 15 Jan 2023 01:23:45 -0800
To: Theodor Thornhill <theo@HIDDEN>
X-Mailer: Apple Mail (2.3696.120.41.1.1)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 60496
Cc: bruce.stephens@HIDDEN, eliz@HIDDEN, 60496 <at> debbugs.gnu.org,
 59686 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


Yuan Fu <casouri@HIDDEN> writes:

>> On Dec 3, 2022, at 3:08 AM, Theodor Thornhill <theo@HIDDEN> =
wrote:
>>=20
>>=20
>>=20
>> On 3 December 2022 11:48:34 CET, Yuan Fu <casouri@HIDDEN> wrote:
>>>=20
>>> Theodor Thornhill <theo@HIDDEN> writes:
>>>=20
>>>> Bruce Stephens <bruce.stephens@HIDDEN> writes:
>>>>=20
>>>>> On 02/12/2022 08:39, Eli Zaretskii wrote:
>>>>>=20
>>>>>> FWIW, this is an unusual style, so I see no catastrophe if it is =
not 110%
>>>>>> according to expectations.  Users can easily fix that by tweaking =
their BOLs
>>>>>> where important.
>>>>>=20
>>>>>=20
>>>>> The example I gave would be unusual, I think, but I'd argue that =
the
>>>>> situations where I saw the problem are quite natural.
>>>>>=20
>>>>> For example,
>>>>>=20
>>>>>                 } else if ( MYSTRCMP (attname, =
SOME_PREFIX_X400ADDRESS) ||
>>>>>                             MYSTRCMP (attname, SOME_PREFIX_X400) ) =
{
>>>>>                     FOO_ptr orp =3D foo_std2foo (val);
>>>>>=20
>>>>> or a function declaration with several arguments with types that =
are
>>>>> rather long.
>>>>>=20
>>>>> I agree it's not a critical bug but if there's no appropriate =
general
>>>>> fix it would be helpful to have some guidance for users to resolve =
our
>>>>> specific cases.
>>>>=20
>>>> This is the case I was thinking of.  In the for-loop a =
grand-parent-bol
>>>> on compound_statement rule would match the 'for' keyword, so the
>>>> indentation will be correct, but this one will not, IIRC.  I plan =
to dig
>>>> into this some more soon, but motivation left me a little on that =
issue.
>>>> Maybe we could make a preset like:
>>>>=20
>>>> ```
>>>> (seq
>>>> (parent-is "compound_statement") parent (parent-is "for_statement") =
bol)
>>>> ```
>>>>=20
>>>>=20
>>>> In other words, make other presets execute sequentially, move =
point,
>>>> check again, and if all are true, pick indent offset.  Or allow =
multiple
>>>> captures, like so:
>>>>=20
>>>> ```
>>>> (for_statement @offset-anchor
>>>>  body: (compound_statement (_) @to-indent))
>>>> ```
>>>>=20
>>>> Here the @to-indent capture would get the new indent level based on
>>>> treesit-node-start of for_statement.
>>>>=20
>>>> What do you think, Yuan?
>>>=20
>>> I think we can just test for the grandparent, there is an
>>> (undocumented) matcher n-p-gp which matches parent and grandparent.
>>>=20
>>> Yuan
>>=20
>> Yeah I know, but that doesn't work in every case we see this =
behavior.
>
> I see, but at least it fixes common cases that I can think of right =
now, namely if, for, while. What are some other cases?

I just pushed a change (189d976dbae) that I think fixes this kind of
problems. Instead of trying to figure out the right anchor, we simply
count the number of {} blocks between the node at point and the root
node, and use that number (multiplied by c-ts-mode-indent-offset) as the
indentation.

If you think about it, both

for (a;b;c)
{
  |
}

and

for (a;
     b;
     c)
{
  |    =20
}

are one block-level deep.  So multi-line conditions is not an issue
anymore.

And

int main()
{
  if ()
    {
      |
    }
}

is 2 block-level deep, etc.

Yuan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#60496; Package emacs. Full text available.
Merged 59686 60398 60496. Request was from Yuan Fu <casouri@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Merged 59686 60496. Request was from Yuan Fu <casouri@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 60496 <at> debbugs.gnu.org:


Received: (at 60496) by debbugs.gnu.org; 7 Jan 2023 12:18:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 07 07:18:44 2023
Received: from localhost ([127.0.0.1]:56649 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pE89s-00069f-5o
	for submit <at> debbugs.gnu.org; Sat, 07 Jan 2023 07:18:44 -0500
Received: from out2.migadu.com ([188.165.223.204]:24204)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <theo@HIDDEN>) id 1pE89p-00069U-Qm
 for 60496 <at> debbugs.gnu.org; Sat, 07 Jan 2023 07:18:42 -0500
X-Report-Abuse: Please report any abuse attempt to abuse@HIDDEN and
 include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no;
 s=key1; t=1673093920;
 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=No37CIdGg+jF0emiGDmwzmAWV4WHrnhks1luzB3AhX4=;
 b=N0pWBXpnE3MI1pR6t+t9qiFTPM9gQkzgkQqX2FBwInr9bKbVc5nvA08Nd9GLBIkNVtkkry
 V+Z9AfnLj7g/0Fqogh4Tua7LcY3ZAo4wM3GXu2zgYxWZVCth4z8ftGYfcnRn9NbJqZ541v
 nyqNY476k1b3tMv2PTGwYJy9TZY/7mDwma66t+S1L7sV1I62xPgj1XMSvIQRZrlF9kex73
 F1XOcopusFwF+S3Ydg7+XJutBjm+PdiLXem4eUuK+rTlyhfu0UyZ5Tk+6O37nRnH3SilYV
 NUJ02Qhcqr7OXVlHbikXzlnnhSn3jS+kIXNRgHqiko49ch7QPHVvSz1SZOyRXQ==
From: Theodor Thornhill <theo@HIDDEN>
To: Mohammed Sadiq <sadiq@HIDDEN>
Subject: Re: bug#60496: 29.0.60; c-ts-mode: Broken indentation with linux
 style conditionals
In-Reply-To: <1d37d77b75e3ede545e68c9521fcb171@HIDDEN> (Mohammed Sadiq's
 message of "Tue, 03 Jan 2023 14:39:52 +0530")
References: <68A07E57-06EE-4F38-A2BC-A426B85BE56A@HIDDEN>
 <1d37d77b75e3ede545e68c9521fcb171@HIDDEN>
Date: Sat, 07 Jan 2023 13:18:38 +0100
Message-ID: <87ilhitu5d.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Migadu-Flow: FLOW_OUT
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 60496
Cc: Yuan Fu <casouri@HIDDEN>, 60496 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Mohammed Sadiq <sadiq@HIDDEN> writes:

> On 2023-01-03 03:59, Yuan Fu wrote:
>> Mohammed Sadiq <sadiq@HIDDEN> writes:
>>=20
>>> Indentation of the following C code with linux style is broken:
>>> int main (void)
>>> {
>>>   if (a) {
>>>     func_a ();
>>>   } else if (b) {
>>> 	   func_b ();
>>> 	 } else {
>>> 	   func_c ();
>>> 	 }
>>> }
>>>=20
>> Thanks. I=E2=80=99m not familiar with the linux style, is the problem wi=
th the
>> closing brackets? Could you give me a correct example so I know exactly
>> what=E2=80=99s wrong?
>> Yuan
>
>
> The expected indentation style for the given code (this one is provided
> by c-mode), with the default indentation values:
>
> int
> main (void)
> {
>   if (a) {
>     func_a ();
>   } else if (b) {
>     func_b ();
>   } else {
>     func_c ();
>   }
> }

Yuan, this is a regression after the
c-ts-mode--bracket-children-anchor. IIRC this was one of the cases that
gave me headeaches.  IIUC now the grand-parent cannot help because we
could have infinite else ifs, right?  And the c grammar nests these
"alternative:" nodes deeper and deeper.

Reverting to

diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index dec866f762f..6c8c671550a 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -118,7 +118,7 @@ c-ts-mode--indent-styles
          `(((parent-is "translation_unit") parent-bol 0)
            ((node-is ")") parent 1)
            ((node-is "]") parent-bol 0)
-           ((node-is "}") c-ts-mode--bracket-children-anchor 0)
+           ((node-is "}") parent-bol 0)
            ((node-is "else") parent-bol 0)
            ((node-is "case") parent-bol 0)
            ((node-is "preproc_arg") no-indent)
@@ -134,7 +134,7 @@ c-ts-mode--indent-styles
            ((match "preproc_function_def" "compound_statement") point-min =
0)
            ((match "preproc_call" "compound_statement") point-min 0)
            ((parent-is "compound_statement")
-            c-ts-mode--bracket-children-anchor c-ts-mode-indent-offset)
+            parent-bol c-ts-mode-indent-offset)
            ((parent-is "function_definition") parent-bol 0)
            ((parent-is "conditional_expression") first-sibling 0)
            ((parent-is "assignment_expression") parent-bol c-ts-mode-inden=
t-offset)
@@ -155,7 +155,7 @@ c-ts-mode--indent-styles
                '(((node-is "access_specifier") parent-bol 0)))
            ((parent-is "field_declaration_list") parent-bol c-ts-mode-inde=
nt-offset)
            ((parent-is "initializer_list") parent-bol c-ts-mode-indent-off=
set)
-           ((parent-is "if_statement") parent-bol c-ts-mode-indent-offset)
+           ((parent-is "if_statement") c-ts-mode--bracket-children-anchor =
c-ts-mode-indent-offset)
            ((parent-is "for_statement") parent-bol c-ts-mode-indent-offset)
            ((parent-is "while_statement") parent-bol c-ts-mode-indent-offs=
et)
            ((parent-is "switch_statement") parent-bol c-ts-mode-indent-off=
set)

Fixes this issue, but then we again have the problem with code such as:

```
int
main (void)
{
  for(;
    ;) {
      // wrong...
    }
}
```

Theo




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#60496; Package emacs. Full text available.

Message received at 60496 <at> debbugs.gnu.org:


Received: (at 60496) by debbugs.gnu.org; 3 Jan 2023 09:10:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 03 04:10:05 2023
Received: from localhost ([127.0.0.1]:44721 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pCdJ6-0002NX-PH
	for submit <at> debbugs.gnu.org; Tue, 03 Jan 2023 04:10:05 -0500
Received: from relay10.mail.gandi.net ([217.70.178.230]:53879)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sadiq@HIDDEN>) id 1pCdJ4-0002Mv-8V
 for 60496 <at> debbugs.gnu.org; Tue, 03 Jan 2023 04:10:04 -0500
Received: (Authenticated sender: sadiq@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPA id 17236240011;
 Tue,  3 Jan 2023 09:09:52 +0000 (UTC)
MIME-Version: 1.0
Date: Tue, 03 Jan 2023 14:39:52 +0530
From: Mohammed Sadiq <sadiq@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
Subject: Re: bug#60496: 29.0.60; c-ts-mode: Broken indentation with linux
 style conditionals
In-Reply-To: <68A07E57-06EE-4F38-A2BC-A426B85BE56A@HIDDEN>
References: <68A07E57-06EE-4F38-A2BC-A426B85BE56A@HIDDEN>
Message-ID: <1d37d77b75e3ede545e68c9521fcb171@HIDDEN>
X-Sender: sadiq@HIDDEN
Content-Type: text/plain; charset=UTF-8;
 format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 60496
Cc: 60496 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

On 2023-01-03 03:59, Yuan Fu wrote:
> Mohammed Sadiq <sadiq@HIDDEN> writes:
> 
>> Indentation of the following C code with linux style is broken:
>> 
>> int main (void)
>> {
>>   if (a) {
>>     func_a ();
>>   } else if (b) {
>> 	   func_b ();
>> 	 } else {
>> 	   func_c ();
>> 	 }
>> }
>> 
> 
> Thanks. I’m not familiar with the linux style, is the problem with the
> closing brackets? Could you give me a correct example so I know exactly
> what’s wrong?
> 
> Yuan


The expected indentation style for the given code (this one is provided
by c-mode), with the default indentation values:

int
main (void)
{
   if (a) {
     func_a ();
   } else if (b) {
     func_b ();
   } else {
     func_c ();
   }
}




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#60496; Package emacs. Full text available.

Message received at 60496 <at> debbugs.gnu.org:


Received: (at 60496) by debbugs.gnu.org; 2 Jan 2023 22:29:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 02 17:29:14 2023
Received: from localhost ([127.0.0.1]:44269 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pCTIw-000613-42
	for submit <at> debbugs.gnu.org; Mon, 02 Jan 2023 17:29:14 -0500
Received: from mail-qt1-f181.google.com ([209.85.160.181]:43777)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <casouri@HIDDEN>) id 1pCTIs-00060j-3f
 for 60496 <at> debbugs.gnu.org; Mon, 02 Jan 2023 17:29:13 -0500
Received: by mail-qt1-f181.google.com with SMTP id a16so23323456qtw.10
 for <60496 <at> debbugs.gnu.org>; Mon, 02 Jan 2023 14:29:10 -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=CsgmGDF5e72sEU8vojvu1w9L8JXVYTrHJFrx+O0Xtik=;
 b=GDrl7uitw0clU9Jd6asLFcByylqSq7etG5i+GYb3Lm5i+Gc6z/xtZBt0RKZ+g93qXA
 8fG999lPxVHjD7LLQRrFIJu4s5j1vRhYsgsbjVh5o/OiP3N4A9jNFWS0UpYMv8OwzZ1K
 2ujiBWhgRAHVK8zfpG6WAWphpq9Z272ribTedx8JItfSTi/LPJgi7I5qvJTxNDKBqKLt
 vGA/si8kE2kgPSd9bhv4TA82Ahe/9c6oFHVmUmt5CBAfAsOE5plIDfpC9/xYWHqr1wwM
 aYa7EQkrRb3EOE81GVo3t1v1ylLfzco7yx/o5iU2FnH6ZlT3tPPmq1IIcYJEpxuPSr2g
 LxEw==
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=CsgmGDF5e72sEU8vojvu1w9L8JXVYTrHJFrx+O0Xtik=;
 b=r8r6UDo7h5cx73oRLHaPK6hcpKoSaMLI2RFZpBHt+PTF0vLu1KCRxidIgYhMxmdqfV
 ffnSxCUq0P5C5WGPudATBUWtvzaKQPrESMmAiQOivEho0lKQitCkxSA8lm9vimo/RPTR
 a0ip5WYA0s16bhLmK1SDXGnoat/h7kaCtFKnjpKO/1nuv7pd4GP/G9AKCGFtdolWU1W1
 5H1/sIXhhOjrVinxU5KbYyMKUC8sPUoQhq0/1p+Nz65yAsuJY6cWJt/tSV4LEe/MDHSv
 ynYJptSP6vzStrIYsABFS8HnOCH0HgJiOvBFYX4n2xA8dxdlrhEx1lL2yb7Iedn81skJ
 9q/A==
X-Gm-Message-State: AFqh2kopKqkSfLf4YGqs80fZraf0/MQpdV+G63Vkwu7kw4sswvp16+ua
 GfLtzg3b2TDLivEfWOo2dTS89szFNZaK+w==
X-Google-Smtp-Source: AMrXdXsrwrZsQ/fkj0hQqK+SOx7On6D5slLJjT0wTshfWA5/d/sP35WiANMtlh+FCTjaD8mb00lb2w==
X-Received: by 2002:ac8:128b:0:b0:3a5:758d:8f5e with SMTP id
 y11-20020ac8128b000000b003a5758d8f5emr56468798qti.19.1672698544571; 
 Mon, 02 Jan 2023 14:29:04 -0800 (PST)
Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com.
 [172.117.161.177]) by smtp.gmail.com with ESMTPSA id
 z18-20020ac875d2000000b003995f6513b9sm17923136qtq.95.2023.01.02.14.29.04
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 02 Jan 2023 14:29:04 -0800 (PST)
From: Yuan Fu <casouri@HIDDEN>
Content-Type: text/plain;
	charset=utf-8
Content-Transfer-Encoding: quoted-printable
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\))
Subject: Re: bug#60496: 29.0.60; c-ts-mode: Broken indentation with linux 
 style conditionals
Message-Id: <68A07E57-06EE-4F38-A2BC-A426B85BE56A@HIDDEN>
Date: Mon, 2 Jan 2023 14:29:02 -0800
To: Mohammed Sadiq <sadiq@HIDDEN>
X-Mailer: Apple Mail (2.3696.120.41.1.1)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 60496
Cc: 60496 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


Mohammed Sadiq <sadiq@HIDDEN> writes:

> Indentation of the following C code with linux style is broken:
>
> int main (void)
> {
>   if (a) {
>     func_a ();
>   } else if (b) {
> 	   func_b ();
> 	 } else {
> 	   func_c ();
> 	 }
> }
>

Thanks. I=E2=80=99m not familiar with the linux style, is the problem =
with the
closing brackets? Could you give me a correct example so I know exactly
what=E2=80=99s wrong?

Yuan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#60496; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 2 Jan 2023 15:57:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 02 10:57:38 2023
Received: from localhost ([127.0.0.1]:43864 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pCNBy-0007Xd-Gx
	for submit <at> debbugs.gnu.org; Mon, 02 Jan 2023 10:57:38 -0500
Received: from lists.gnu.org ([209.51.188.17]:33370)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sadiq@HIDDEN>) id 1pCNBw-0007XU-0w
 for submit <at> debbugs.gnu.org; Mon, 02 Jan 2023 10:57:37 -0500
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 <sadiq@HIDDEN>) id 1pCNBt-0003Zs-7D
 for bug-gnu-emacs@HIDDEN; Mon, 02 Jan 2023 10:57:35 -0500
Received: from relay3-d.mail.gandi.net ([217.70.183.195])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <sadiq@HIDDEN>) id 1pCNBp-0004Xb-Uo
 for bug-gnu-emacs@HIDDEN; Mon, 02 Jan 2023 10:57:32 -0500
Received: (Authenticated sender: sadiq@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPA id 1DA4A60008
 for <bug-gnu-emacs@HIDDEN>; Mon,  2 Jan 2023 15:57:25 +0000 (UTC)
MIME-Version: 1.0
Date: Mon, 02 Jan 2023 21:27:25 +0530
From: Mohammed Sadiq <sadiq@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 29.0.60; c-ts-mode: Broken indentation with linux style conditionals
Message-ID: <91001d1f8d7fe3db33aefffaa0829f26@HIDDEN>
X-Sender: sadiq@HIDDEN
Content-Type: text/plain; charset=US-ASCII;
 format=flowed
Content-Transfer-Encoding: 7bit
Received-SPF: pass client-ip=217.70.183.195; envelope-from=sadiq@HIDDEN;
 helo=relay3-d.mail.gandi.net
X-Spam_score_int: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7,
 RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.6 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.6 (--)

Indentation of the following C code with linux style is broken:

int main (void)
{
   if (a) {
     func_a ();
   } else if (b) {
	   func_b ();
	 } else {
	   func_c ();
	 }
}



In GNU Emacs 29.0.60 (build 5, x86_64-pc-linux-gnu, GTK+ Version
  3.24.35, cairo version 1.16.0) of 2023-01-02 built on purism
Repository revision: 2569ede9c496bb060e0b88428cb541088aaba1f9
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 
11.0.12101005
System Description: Debian GNU/Linux bookworm/sid




Acknowledgement sent to Mohammed Sadiq <sadiq@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#60496; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 15 Jan 2023 09:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.