From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: C99 compound literals in c-mode Date: Wed, 16 Aug 2017 17:26:04 +0000 Message-ID: <20170816172604.GD3417@ACM> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1502904455 13410 195.159.176.226 (16 Aug 2017 17:27:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 16 Aug 2017 17:27:35 +0000 (UTC) User-Agent: Mutt/1.7.2 (2016-11-26) Cc: Stefan Monnier , Emacs Developers To: Nikolai Weibull Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 16 19:27:29 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1di26J-00035Q-OG for ged-emacs-devel@m.gmane.org; Wed, 16 Aug 2017 19:27:27 +0200 Original-Received: from localhost ([::1]:34145 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1di26Q-000840-6B for ged-emacs-devel@m.gmane.org; Wed, 16 Aug 2017 13:27:34 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50864) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1di25O-00081p-8S for emacs-devel@gnu.org; Wed, 16 Aug 2017 13:26:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1di25J-0003gZ-BL for emacs-devel@gnu.org; Wed, 16 Aug 2017 13:26:30 -0400 Original-Received: from ocolin.muc.de ([193.149.48.4]:24956 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1di25J-0003fF-4h for emacs-devel@gnu.org; Wed, 16 Aug 2017 13:26:25 -0400 Original-Received: (qmail 29274 invoked by uid 3782); 16 Aug 2017 17:26:22 -0000 Original-Received: from acm.muc.de (p548C6739.dip0.t-ipconnect.de [84.140.103.57]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 16 Aug 2017 19:26:21 +0200 Original-Received: (qmail 9769 invoked by uid 1000); 16 Aug 2017 17:26:04 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.4 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:217589 Archived-At: Hello, Nikolai. On Tue, Aug 15, 2017 at 11:57:25 +0200, Nikolai Weibull wrote: > On Tue, Aug 15, 2017 at 11:03 AM, 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? > Yes: > struct a { > int b; > }; > int > main(void) > { > return (struct a){ > 0 > }.b; > } I'll take a look at it. It shouldn't be too difficult. > 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 -- Alan Mackenzie (Nuremberg, Germany).