unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Yuan Fu <casouri@gmail.com>, Knut Anders Hatlen <kahatlen@gmail.com>
Cc: 60398@debbugs.gnu.org
Subject: 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	[thread overview]
Message-ID: <87pmc2wkro.fsf@thornhill.no> (raw)
In-Reply-To: <118C936E-3A09-43E4-8FDA-E1755EE8F48F@gmail.com>

Yuan Fu <casouri@gmail.com> writes:

>> On Dec 28, 2022, at 11:49 PM, Knut Anders Hatlen <kahatlen@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





  reply	other threads:[~2022-12-29 10:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-29  7:49 bug#60398: 29.0.60; c++-ts-mode: Strange indentation of function body when parameter list has newline Knut Anders Hatlen
2022-12-29  9:06 ` Yuan Fu
2022-12-29 10:45   ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-12-29 11:33   ` Knut Anders Hatlen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pmc2wkro.fsf@thornhill.no \
    --to=bug-gnu-emacs@gnu.org \
    --cc=60398@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=kahatlen@gmail.com \
    --cc=theo@thornhill.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).