GNU bug report logs - #60572
29.0.60; c-ts-mode: String spanning multiple lines are not indented

Previous Next

Package: emacs;

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

Date: Thu, 5 Jan 2023 11:14:02 UTC

Severity: normal

Found in version 29.0.60

To reply to this bug, email your comments to 60572 AT debbugs.gnu.org.

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#60572; Package emacs. (Thu, 05 Jan 2023 11:14: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. (Thu, 05 Jan 2023 11:14: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: String spanning multiple lines are not indented
Date: Thu, 05 Jan 2023 16:42:52 +0530
The following code doesn't indent with TAB on c-ts-mode:

#include <stdio.h>

int
main (void)
{
  char *test = "some "
  "test";

  puts ("more "
  "test");
}


expected indentation:

#include <stdio.h>

int
main (void)
{
  char *test = "some "
    "test";

  puts ("more "
	"test");
}



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#60572; Package emacs. (Fri, 06 Jan 2023 05:52:02 GMT) Full text and rfc822 format available.

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

From: Yuan Fu <casouri <at> gmail.com>
To: Mohammed Sadiq <sadiq <at> sadiqpk.org>
Cc: 60572 <at> debbugs.gnu.org
Subject: Re: bug#60572: 29.0.60; c-ts-mode: String spanning multiple lines 
 are not indented
Date: Thu, 5 Jan 2023 22:51:16 -0700
Mohammed Sadiq <sadiq <at> sadiqpk.org> writes:

> The following code doesn't indent with TAB on c-ts-mode:
>
> #include <stdio.h>
>
> int
> main (void)
> {
>   char *test = "some "
>   "test";
>
>   puts ("more "
>   "test");
> }
>
>
> expected indentation:
>
> #include <stdio.h>
>
> int
> main (void)
> {
>   char *test = "some "
>     "test";
>
>   puts ("more "
> 	"test");
> }
>

Thanks for the report. I’m on the road right now, but I’ll soon get back
and work on this and your other reports, just FYI :-)

Yuan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60572; Package emacs. (Sat, 07 Jan 2023 12:08:02 GMT) Full text and rfc822 format available.

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

From: Theodor Thornhill <theo <at> thornhill.no>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Mohammed Sadiq <sadiq <at> sadiqpk.org>, 60572 <at> debbugs.gnu.org
Subject: Re: bug#60572: 29.0.60; c-ts-mode: String spanning multiple lines
 are not indented
Date: Sat, 07 Jan 2023 13:07:05 +0100
[Message part 1 (text/plain, inline)]
Yuan Fu <casouri <at> gmail.com> writes:

> Mohammed Sadiq <sadiq <at> sadiqpk.org> writes:
>
>> The following code doesn't indent with TAB on c-ts-mode:
>>
>> #include <stdio.h>
>>
>> int
>> main (void)
>> {
>>   char *test = "some "
>>   "test";
>>
>>   puts ("more "
>>   "test");
>> }
>>
>>
>> expected indentation:
>>
>> #include <stdio.h>
>>
>> int
>> main (void)
>> {
>>   char *test = "some "
>>     "test";
>>
>>   puts ("more "
>> 	"test");
>> }
>>
>
> Thanks for the report. I’m on the road right now, but I’ll soon get back
> and work on this and your other reports, just FYI :-)
>
> Yuan

Here is a patch fixing this, Yuan.  Feel free to install at your
convenience.

Do you agree with this patch, Mohammed?

Theo

[0001-Add-indentation-rule-for-concatenated_string-bug-605.patch (text/x-patch, attachment)]

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

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

From: Yuan Fu <casouri <at> gmail.com>
To: Theodor Thornhill <theo <at> thornhill.no>
Cc: Mohammed Sadiq <sadiq <at> sadiqpk.org>, 60572 <at> debbugs.gnu.org
Subject: Re: bug#60572: 29.0.60; c-ts-mode: String spanning multiple lines 
 are not indented
Date: Sat, 7 Jan 2023 18:21:26 -0800
Theodor Thornhill <theo <at> thornhill.no> writes:

> Yuan Fu <casouri <at> gmail.com> writes:
>
>> Mohammed Sadiq <sadiq <at> sadiqpk.org> writes:
>>
>>> The following code doesn't indent with TAB on c-ts-mode:
>>>
>>> #include <stdio.h>
>>>
>>> int
>>> main (void)
>>> {
>>>   char *test = "some "
>>>   "test";
>>>
>>>   puts ("more "
>>>   "test");
>>> }
>>>
>>>
>>> expected indentation:
>>>
>>> #include <stdio.h>
>>>
>>> int
>>> main (void)
>>> {
>>>   char *test = "some "
>>>     "test";
>>>
>>>   puts ("more "
>>> 	"test");
>>> }
>>>
>>
>> Thanks for the report. I’m on the road right now, but I’ll soon get back
>> and work on this and your other reports, just FYI :-)
>>
>> Yuan
>
> Here is a patch fixing this, Yuan.  Feel free to install at your
> convenience.
>
> Do you agree with this patch, Mohammed?
>
> Theo

Thanks! Patch applied.

Yuan




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

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

From: Mohammed Sadiq <sadiq <at> sadiqpk.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Theodor Thornhill <theo <at> thornhill.no>, 60572 <at> debbugs.gnu.org
Subject: Re: bug#60572: 29.0.60; c-ts-mode: String spanning multiple lines are
 not indented
Date: Sun, 08 Jan 2023 13:42:40 +0530
> Theodor Thornhill <theo <at> thornhill.no> writes:
>> 
>> Here is a patch fixing this, Yuan.  Feel free to install at your
>> convenience.
>> 
>> Do you agree with this patch, Mohammed?

The line

  puts ("more"
    "test");

is still not indented right (right in the sense, the behavior is
different from c-mode):

I expect the code to be (with indent-tabs-mode set to nil):

  puts ("more"
        "test");

but I get:

  puts ("more"
    "test");




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

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

From: Theodor Thornhill <theo <at> thornhill.no>
To: Mohammed Sadiq <sadiq <at> sadiqpk.org>, Yuan Fu <casouri <at> gmail.com>
Cc: 60572 <at> debbugs.gnu.org
Subject: Re: bug#60572: 29.0.60; c-ts-mode: String spanning multiple lines are not indented
Date: Sun, 08 Jan 2023 10:18:42 +0100

On 8 January 2023 09:12:40 CET, Mohammed Sadiq <sadiq <at> sadiqpk.org> wrote:
>> Theodor Thornhill <theo <at> thornhill.no> writes:
>>> 
>>> Here is a patch fixing this, Yuan.  Feel free to install at your
>>> convenience.
>>> 
>>> Do you agree with this patch, Mohammed?
>
>The line
>
>  puts ("more"
>    "test");
>
>is still not indented right (right in the sense, the behavior is
>different from c-mode):
>
>I expect the code to be (with indent-tabs-mode set to nil):
>
>  puts ("more"
>        "test");
>
>but I get:
>
>  puts ("more"
>    "test");

Right, thanks. Is this indent style related? Would Linux style do this differently than gnu?

Thanks,
Theo




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

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

From: Mohammed Sadiq <sadiq <at> sadiqpk.org>
To: Theodor Thornhill <theo <at> thornhill.no>
Cc: Yuan Fu <casouri <at> gmail.com>, 60572 <at> debbugs.gnu.org
Subject: Re: bug#60572: 29.0.60; c-ts-mode: String spanning multiple lines are
 not indented
Date: Sun, 08 Jan 2023 15:15:44 +0530
On 2023-01-08 14:48, Theodor Thornhill wrote:
> 
> Right, thanks. Is this indent style related? Would Linux style do this
> differently than gnu?
> 

As per 
https://www.kernel.org/doc/html/v6.0/process/coding-style.html#inline-assembly
and c-mode linux style, both GNU and Linux seem to behave similarly.


cheers,
Mohammed Sadiq




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#60572; Package emacs. (Sat, 21 Jan 2023 08:11:02 GMT) Full text and rfc822 format available.

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

From: Mohammed Sadiq <sadiq <at> sadiqpk.org>
To: Theodor Thornhill <theo <at> thornhill.no>
Cc: Yuan Fu <casouri <at> gmail.com>, 60572 <at> debbugs.gnu.org
Subject: Re: bug#60572: 29.0.60; c-ts-mode: String spanning multiple lines are
 not indented
Date: Sat, 21 Jan 2023 13:40:03 +0530
On 2023-01-07 17:37, Theodor Thornhill wrote:
> Here is a patch fixing this, Yuan.  Feel free to install at your
> convenience.
> 
> Do you agree with this patch, Mohammed?

I believe that the patch is already applied to emacs-29 branch,
I couldn't apply the patch (and reading the code, it looks it's
already in).

Anyway, This still doesn't fixes the following cases:

  some_func (arg1,
             "some really long"
               "string");
  some_func ("some really long"
    "string");


> 
> Theo




This bug report was last modified 1 year and 96 days ago.

Previous Next


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