unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: YOUNG <breadncup@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: c preprocessor and indent problem in c-mode?
Date: Sun, 25 Jan 2009 18:03:26 -0800 (PST)	[thread overview]
Message-ID: <1bacb975-07b5-43e4-ac5c-cf0e8bfebdfa@p36g2000prp.googlegroups.com> (raw)
In-Reply-To: 035566ec-3070-441e-8040-6f44c5c0d96c@p36g2000prp.googlegroups.com

On Jan 25, 4:46 pm, YOUNG <breadn...@gmail.com> wrote:
> Hi,
>
> If there is a following code, emacs does not present indent correctly.
>
> #incude <stdio.h>
>
> int main(void) {
>   int a = 10;
> #ifdef AAA
>   if (a == 10) {
>     printf("a:%d\n", a);
> #else
>     if (b == 10) {
>       printf("b=10\n");
> #endif
>     }
>
> #endif
>   }
>
> If the curly brace is not closed before the preprocessor, emacs seems
> to confuse to make indent.
>
> Is there anyone who know this problem and how to resolve?

The code I wrote before was not completed, but this is the final one.

#include <stdio.h>

int main(void) {
  int a = 10;
  int b=10;
#ifdef AAA
  if (a == 10) {
    printf("a:%d\n", a);
#else
    if (b == 10) {
      printf("b=10\n");
#endif
    }
  }

And, as you could see, emacs seems to confuse the indent the code.


  reply	other threads:[~2009-01-26  2:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-26  0:46 c preprocessor and indent problem in c-mode? YOUNG
2009-01-26  2:03 ` YOUNG [this message]
2009-01-26  9:00 ` Alan Mackenzie

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1bacb975-07b5-43e4-ac5c-cf0e8bfebdfa@p36g2000prp.googlegroups.com \
    --to=breadncup@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).