From: Alex <agrambot@gmail.com>
To: Kevin Burge <kcburge@gmail.com>
Cc: 12527@debbugs.gnu.org
Subject: bug#12527: 24.2; idented preprocessor directives confusing cc-mode indent
Date: Sun, 14 Aug 2016 14:51:49 -0600 [thread overview]
Message-ID: <87eg5rqdju.fsf@gmail.com> (raw)
In-Reply-To: <CAEb-Ao-PFw9UXijesXrDv0w62hJzZLsNy_rar58QsRxDAn_F2Q@mail.gmail.com> (Kevin Burge's message of "Thu, 27 Sep 2012 13:22:39 -0500")
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.
prev parent reply other threads:[~2016-08-14 20:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-27 18:22 bug#12527: 24.2; idented preprocessor directives confusing cc-mode indent Kevin Burge
2016-08-14 20:51 ` Alex [this message]
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=87eg5rqdju.fsf@gmail.com \
--to=agrambot@gmail.com \
--cc=12527@debbugs.gnu.org \
--cc=kcburge@gmail.com \
/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.