emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C99 compound literals in c-mode


From: Nikolai Weibull
Subject: Re: C99 compound literals in c-mode
Date: Tue, 15 Aug 2017 11:57:25 +0200

On Tue, Aug 15, 2017 at 11:03 AM, Stefan Monnier
<address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]