GNU bug report logs - #60398
29.0.60; c++-ts-mode: Strange indentation of function body when parameter list has newline

Previous Next

Package: emacs;

Reported by: Knut Anders Hatlen <kahatlen <at> gmail.com>

Date: Thu, 29 Dec 2022 07:50:01 UTC

Severity: normal

Merged with 59686, 60496

Found in versions 29.0.60, 30.0.50

Full log


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

From: Theodor Thornhill <theo <at> thornhill.no>
To: Yuan Fu <casouri <at> gmail.com>, Knut Anders Hatlen <kahatlen <at> gmail.com>
Cc: 60398 <at> debbugs.gnu.org
Subject: Re: bug#60398: 29.0.60; c++-ts-mode: Strange indentation of
 function body when parameter list has newline
Date: Thu, 29 Dec 2022 11:45:47 +0100
Yuan Fu <casouri <at> gmail.com> writes:

>> On Dec 28, 2022, at 11:49 PM, Knut Anders Hatlen <kahatlen <at> gmail.com> wrote:
>> 
>> 
>> Function bodies are indented strangely in c++-ts-mode if the parameter
>> list has a newline between two parameters. For example:
>> 
>> int f1(int x, int y) {
>>  // Indented as expected.
>>  return x + y;
>> }
>> 
>> int f2(int x,
>>       int y) {
>> 	 // Indented too much.
>> 	 return x + y;
>>       };
>
> I implemented a fix in 784e509bded, Theo, WDYT? Could this be used on other C-like modes, too?
>

LGTM!

I believe that should work for most other cases of this, but IIRC there
are some cases where the compound statements are considered as siblings,
not children, but I forgot what it was exactly...

But I think this should work in most cases, at least!

Theo




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

Previous Next


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