all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nikolai Weibull <now@disu.se>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Emacs Developers <emacs-devel@gnu.org>
Subject: Re: C99 compound literals in c-mode
Date: Tue, 15 Aug 2017 11:57:25 +0200	[thread overview]
Message-ID: <CADdV=MtiJ1MXLu34BTp-h1mOxe1C0Wc2XZw2MJufY3GwGzQ5aQ@mail.gmail.com> (raw)
In-Reply-To: <jwvzib1i4oq.fsf-monnier+gmane.emacs.devel@gnu.org>

On Tue, Aug 15, 2017 at 11:03 AM, Stefan Monnier
<monnier@iro.umontreal.ca> 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?

Yes:

struct a {
        int b;
};

int
main(void)
{
        return (struct a){
                0
                        }.b;
}

I use the following style:

(c-add-style "now-c-style"
             '("linux"
               (c-hanging-braces-alist . ((brace-entry-open)
                                          (brace-list-open after)
                                          (brace-list-close before)
                                          (class-close before)
                                          (class-open after)
                                          (substatement-open after)
                                          (block-close before)))
               (c-hanging-colons-alist . ((case-label after)
                                          (label after)))))

  Nikolai



  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
2017-08-15  9:57   ` Nikolai Weibull [this message]
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

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

  git send-email \
    --in-reply-to='CADdV=MtiJ1MXLu34BTp-h1mOxe1C0Wc2XZw2MJufY3GwGzQ5aQ@mail.gmail.com' \
    --to=now@disu.se \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.