GNU bug report logs - #21409
24.5; Wrong syntactic information for two line statement in an arglist

Previous Next

Packages: cc-mode, emacs;

Reported by: Gulshan Singh <gsingh2011 <at> gmail.com>

Date: Fri, 4 Sep 2015 05:53:01 UTC

Severity: normal

Tags: patch

Found in version 24.5

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Gulshan Singh <gsingh2011 <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Alan Mackenzie <acm <at> muc.de>, 21409 <at> debbugs.gnu.org
Subject: bug#21409: 24.5; Wrong syntactic information for two line statement in an arglist
Date: Fri, 11 Mar 2022 17:52:38 -0800
[Message part 1 (text/plain, inline)]
I know this is an old bug report, but I just realized it got a response,
and it seems like the behavior hasn't changed.

On Thu, Dec 3, 2020 at 3:07 AM Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

> Gulshan Singh <gsingh2011 <at> gmail.com> writes:
>
> > In c-mode (and all derivatives), the following code has the wrong
> > syntactic information (at least, in my opinion):
> >
> > foo(bar
> >     .baz()
> >     .qux());
> >
> > Putting point at `.baz()` and pressing C-c C-s shows it as an
> > `arglist-cont-nonempty`, when I'd expect it to be a
> > `statement-cont`. This causes the code to have the wrong indentation, as
> > above I would like to have the continued statements to be indented one
> > c-basic-offset, not aligned to the opening brace.
>
> (This bug report unfortunately got no response at the time.)
>
> I'm not sure how that should be indented, really -- the current
> indentation looks reasonable to me, I think?
>

It's definitely reasonable, but it's not what I'd prefer, which would be
this:

foo(bar
      .baz()
      .qux());

`.baz()` and `.qux()` are indented two spaces (my value for
`c-basic-offset`) from the start of `bar`, as opposed to aligned with
`bar`. This matches what happens if the call to `foo` isn't there:

bar
  .baz()
  .qux();

In any case, regardless of what indentation one would prefer for this case,
the issue remains that `c-show-syntactic-information` should be showing
`statement-cont` instead of `arglist-cont-nonempty` at `.baz()`.
[Message part 2 (text/html, inline)]

This bug report was last modified 3 years and 34 days ago.

Previous Next


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