From: Helmut Eller <eller.helmut@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: C99 compound literals in c-mode
Date: Tue, 15 Aug 2017 11:57:17 +0200 [thread overview]
Message-ID: <m2mv71jgqq.fsf@caladan> (raw)
In-Reply-To: jwvzib1i4oq.fsf-monnier+gmane.emacs.devel@gnu.org
On Tue, Aug 15 2017, Stefan Monnier wrote:
>> C-mode doesn’t seem to understand C99’s compound literals, resulting in
>> rather broken indentation. Is this correct and, if so, how difficult would
>> it be to add support for it?
>
> Could you show some example problematic code?
I think code like this:
int foo (void)
{
return (struct bar) { .f1 = 10,
.f2 = 20,
};
}
should be indented better. Maybe so:
return (struct bar) { .f1 = 10,
.f2 = 20,
};
There are also strange interactions with declarations, eg. adding a
a declaration before the return changes the indentation to:
int foo (void)
{
int i = 1;
return (struct bar) { .f1 = 10,
.f2 = 20,
};
}
Helmut
next prev parent reply other threads:[~2017-08-15 9:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-15 8:04 C99 compound literals in c-mode Nikolai Weibull
2017-08-15 9:03 ` Stefan Monnier
2017-08-15 9:56 ` Nikolai Weibull
2017-08-15 9:57 ` Helmut Eller [this message]
2017-08-15 9:57 ` Nikolai Weibull
2017-08-16 17:26 ` Alan Mackenzie
2017-08-16 17:52 ` Nikolai Weibull
2017-08-20 20:40 ` Alan Mackenzie
2017-08-23 10:01 ` Nikolai Weibull
2017-08-24 16:37 ` Alan Mackenzie
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=m2mv71jgqq.fsf@caladan \
--to=eller.helmut@gmail.com \
--cc=emacs-devel@gnu.org \
/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).