unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* cc-mode identifies brace-enclosed initializer list as statement block
@ 2018-04-18  7:24 Jefferson Carpenter
  0 siblings, 0 replies; only message in thread
From: Jefferson Carpenter @ 2018-04-18  7:24 UTC (permalink / raw)
  To: emacs-devel

I'm concerned about the indentation of the following code:

     void build_pages() {
         idx = &mk_hcj<text>(*new hcj, {
             {},
             {{
                     "hi"
                 }},
         });
     }

I would like the "hi" text to be indented one level - not two.  IOW, I 
want it to be indented like this:

     void build_pages() {
         idx = &mk_hcj<text>(*new hcj, {
             {},
             {{
                 "hi"
             }},
         });
     }

Placing point on the line containing "hi" and running 
(c-guess-basic-syntax), the output is:

     ((statement-block-intro 63) (brace-list-intro 63))

So cc-mode appears to be confusing my nested brace-init-lists with 
statement blocks.  I understand that if two separate brace-list-intro's 
were recognized, it might still indent two levels unless they were 
combined somehow, but I think a good starting point would be for the 
parser to be able to understand nested list-initialization.

Jefferson



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-18  7:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-18  7:24 cc-mode identifies brace-enclosed initializer list as statement block Jefferson Carpenter

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).