Subject: bug#60543: closed (Re: bug#60543: 29.0.60; c-ts-mode: Labels are not properly indented)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 09 Jan 2023 01:07:02 +0000

Your bug report

#60543: 29.0.60; c-ts-mode: Labels are not properly indented

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
60543: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60543
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#60543: 29.0.60; c-ts-mode: Labels are not properly indented
From: Yuan Fu <[email-masked]>
To: Mohammed Sadiq <[email-masked]>
Cc: [email-masked]
Date: Sun, 8 Jan 2023 17:06:39 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Mohammed Sadiq <[email-masked]> writes:

> On 2023-01-08 07:45, Yuan Fu wrote:
>> After reading the manual for GNU indent, I think Linux style asks for
>> indenting labels to column 1, not the GNU style. And c-ts-mode’s
>> current
>> GNU style indentation agrees with GNU indent.
>> So I only added a rule to indent labels to column 1 in Linux style.
>> Feel
>> free to correct me, of course.
>> Yuan
>
> As per
> https://www.kernel.org/doc/html/v6.0/process/coding-style.html#centralized-exiting-of-functions
> the label has no indent from the parent block
>
> And for GNU style, I couldn't find an example the style manual, nor in
> GNU hello.
> So I except c-ts-mode to have the same behavior as c-mode (even if
> it's wrong
> as per GNU indent,).
>
> In short, I expect c-ts-mode to behave the same as c-mode because
> that's what
> users often expect (ie, for those who uses GNU indent, their code will
> indent
> right regardless of how c-mode or c-ts-mode behave.  But for the users
> who
> migrate from c-mode - the anticipated user base of c-ts-mode - expects
> it to
> be no different from c-mode)

Thanks. You are completely right. Linux style indents to column 0, and
GNU style indents to column 1 in top-level function and base indent
level of the parent in nested blocks (which is ... interesting).

I changed it to indent like that.

Yuan

Subject: 29.0.60; c-ts-mode: Labels are not properly indented
From: Mohammed Sadiq <[email-masked]>
To: [email-masked]
Date: Wed, 04 Jan 2023 12:58:03 +0530
List-Id: <debbugs-submit.debbugs.gnu.org>

With the default "gnu" style, labels are not properly indented.

Eg., for the following code:

int
main (void)
{
end:
   clean ();
}

I expect to get the following indentation for "end:" (single space
before "end" for "gnu" style, and no indentation for "linux" style):

int
main (void)
{
  end:
   clean ();
}

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