GNU bug report logs - #60543
29.0.60; c-ts-mode: Labels are not properly indented

Previous Next

Package: emacs;

Reported by: Mohammed Sadiq <sadiq <at> sadiqpk.org>

Date: Wed, 4 Jan 2023 07:29:02 UTC

Severity: normal

Found in version 29.0.60

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 60543 in the body.
You can then email your comments to 60543 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#60543; Package emacs. (Wed, 04 Jan 2023 07:29:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mohammed Sadiq <sadiq <at> sadiqpk.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 04 Jan 2023 07:29:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mohammed Sadiq <sadiq <at> sadiqpk.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.60; c-ts-mode: Labels are not properly indented
Date: Wed, 04 Jan 2023 12:58:03 +0530
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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60543; Package emacs. (Fri, 06 Jan 2023 06:10:01 GMT) Full text and rfc822 format available.

Message #8 received at 60543 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Mohammed Sadiq <sadiq <at> sadiqpk.org>
Cc: 60543 <at> debbugs.gnu.org
Subject: Re: bug#60543: 29.0.60; c-ts-mode: Labels are not properly indented
Date: Thu, 5 Jan 2023 23:09:52 -0700
Mohammed Sadiq <sadiq <at> sadiqpk.org> writes:

> 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 ();
> }
>

Thanks for the report! As I said in another message, I’ll work on them
once I get back home. Stay tuned :-)

Yuan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60543; Package emacs. (Sun, 08 Jan 2023 02:17:01 GMT) Full text and rfc822 format available.

Message #11 received at 60543 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Mohammed Sadiq <sadiq <at> sadiqpk.org>
Cc: 60543 <at> debbugs.gnu.org
Subject: Re: bug#60543: 29.0.60; c-ts-mode: Labels are not properly indented
Date: Sat, 7 Jan 2023 18:15:56 -0800
Mohammed Sadiq <sadiq <at> sadiqpk.org> writes:

> 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 ();
> }

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60543; Package emacs. (Sun, 08 Jan 2023 08:37:01 GMT) Full text and rfc822 format available.

Message #14 received at 60543 <at> debbugs.gnu.org (full text, mbox):

From: Mohammed Sadiq <sadiq <at> sadiqpk.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: 60543 <at> debbugs.gnu.org
Subject: Re: bug#60543: 29.0.60; c-ts-mode: Labels are not properly indented
Date: Sun, 08 Jan 2023 14:06:46 +0530
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)


cheers,
Mohammed Sadiq




Reply sent to Yuan Fu <casouri <at> gmail.com>:
You have taken responsibility. (Mon, 09 Jan 2023 01:07:02 GMT) Full text and rfc822 format available.

Notification sent to Mohammed Sadiq <sadiq <at> sadiqpk.org>:
bug acknowledged by developer. (Mon, 09 Jan 2023 01:07:02 GMT) Full text and rfc822 format available.

Message #19 received at 60543-done <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Mohammed Sadiq <sadiq <at> sadiqpk.org>
Cc: 60543-done <at> debbugs.gnu.org
Subject: Re: bug#60543: 29.0.60; c-ts-mode: Labels are not properly indented
Date: Sun, 8 Jan 2023 17:06:39 -0800
Mohammed Sadiq <sadiq <at> sadiqpk.org> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60543; Package emacs. (Mon, 09 Jan 2023 05:46:01 GMT) Full text and rfc822 format available.

Message #22 received at 60543 <at> debbugs.gnu.org (full text, mbox):

From: Mohammed Sadiq <sadiq <at> sadiqpk.org>
To: 60543 <at> debbugs.gnu.org
Subject: Re: bug#60543: closed (Re: bug#60543: 29.0.60; c-ts-mode: Labels are
 not properly indented)
Date: Mon, 09 Jan 2023 11:15:42 +0530
On 2023-01-09 06:37, help-debbugs <at> gnu.org wrote:
> 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.

This is still not fixed.  Was this closed accidentally?




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 06 Feb 2023 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 131 days ago.

Previous Next


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