From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: YOUNG Newsgroups: gmane.emacs.help Subject: Re: c preprocessor and indent problem in c-mode? Date: Sun, 25 Jan 2009 18:03:26 -0800 (PST) Organization: http://groups.google.com Message-ID: <1bacb975-07b5-43e4-ac5c-cf0e8bfebdfa@p36g2000prp.googlegroups.com> References: <035566ec-3070-441e-8040-6f44c5c0d96c@p36g2000prp.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1232937647 15035 80.91.229.12 (26 Jan 2009 02:40:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 26 Jan 2009 02:40:47 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 26 03:42:00 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LRHQD-0001Ez-Fd for geh-help-gnu-emacs@m.gmane.org; Mon, 26 Jan 2009 03:41:57 +0100 Original-Received: from localhost ([127.0.0.1]:38454 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LRHOv-0006tu-Ht for geh-help-gnu-emacs@m.gmane.org; Sun, 25 Jan 2009 21:40:37 -0500 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2.glorb.com!postnews.google.com!p36g2000prp.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 44 Original-NNTP-Posting-Host: 216.31.211.11 Original-X-Trace: posting.google.com 1232935406 32294 127.0.0.1 (26 Jan 2009 02:03:26 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Mon, 26 Jan 2009 02:03:26 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: p36g2000prp.googlegroups.com; posting-host=216.31.211.11; posting-account=1n6WnAoAAACbXH3nD5I7RQWqdkbTxZki User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 (.NET CLR 3.5.30729), gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:166325 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:61647 Archived-At: On Jan 25, 4:46=A0pm, YOUNG wrote: > Hi, > > If there is a following code, emacs does not present indent correctly. > > #incude > > int main(void) { > =A0 int a =3D 10; > #ifdef AAA > =A0 if (a =3D=3D 10) { > =A0 =A0 printf("a:%d\n", a); > #else > =A0 =A0 if (b =3D=3D 10) { > =A0 =A0 =A0 printf("b=3D10\n"); > #endif > =A0 =A0 } > > #endif > =A0 } > > 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 int main(void) { int a =3D 10; int b=3D10; #ifdef AAA if (a =3D=3D 10) { printf("a:%d\n", a); #else if (b =3D=3D 10) { printf("b=3D10\n"); #endif } } And, as you could see, emacs seems to confuse the indent the code.