bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#12527: 24.2; idented preprocessor directives confusing cc-mode inden


From: Alex
Subject: bug#12527: 24.2; idented preprocessor directives confusing cc-mode indent
Date: Sun, 14 Aug 2016 14:51:49 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

close 12527 24.5
quit

Kevin Burge <kcburge@gmail.com> writes:

> Summary: Indenting the preprocessor blocks at least 1 space completely
> throws off the cc-mode indentation for anything after the
> preprocessor block.
>
> To reproduce: Create the simple file "test.cpp":
>
> ===
> int f(void) {
>   #if defined(A)
>   printf("test\n");
>   #endif
>
>   if (test) {
>     int i = 0;
>   }
> }
> ===
>
> IMPORTANT: "#if.....#endif" block MUST be indented at least 1 space.
>
> If you navigate inside the "if (test)" block and hit tab, it
> un-indents the line, and any lines after it, to the end of the file.
> If you reindent the entire file, it works just fine, because the
> indented preprocessor directives, which works around the problem.
>
> You have to play around with this, too.  There are certain variations
> of the #if line that affect the behavior.  And, each time you test,
> you MUST re-open the file, because the caching seems to completely
> throw it off.
>
> I.e. if you change the #if block to
>
> ===
>   #if 0
>   printf("test\n");
>   #endif
> ===
>
> And re-load the file, then try to indent the "if (test)" block, it
> does what it should.  Also, changing it to (and reloading):
>
> ===
>   #if A
>   printf("test\n");
>   #endif
> ===
>
> Is sufficient to break it again.  So, it seems like whatever follows
> the #if affects the behavior.

This appears to work fine in 24.5.





reply via email to

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