From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Pascal Bourguignon Newsgroups: gmane.emacs.help Subject: Re: Pre-processor commands in c-mode Date: 21 Mar 2003 23:33:53 +0100 Organization: informatimago.com Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <874r5wic32.fsf@thalassa.informatimago.com> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1048286259 23836 80.91.224.249 (21 Mar 2003 22:37:39 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 21 Mar 2003 22:37:39 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 21 23:37:38 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18wV8s-0006CH-00 for ; Fri, 21 Mar 2003 23:37:38 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18wV6l-0007j9-09 for gnu-help-gnu-emacs@m.gmane.org; Fri, 21 Mar 2003 17:35:27 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!213.220.35.225!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 57 Original-NNTP-Posting-Host: 213.220.35.225 Original-X-Trace: fu-berlin.de 1048286039 75965711 213.220.35.225 (16 [41911]) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 Original-Xref: shelby.stanford.edu gnu.emacs.help:111304 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:7803 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:7803 Kevin Dziulko writes: > Hello > > Does any one know of a good method / setting / package for better > handling of pre-processor commands in c-mode, specificly spacing > and auto-indentation? > > For example, if I enter the folloeing code, the #endif moves to > the beginning of the line when I press enter after it. > > int main () > { > if (x) > { > #ifdef DEBUG > printf("null"); > #endif > } > } > > Thanks for any help. > Kevin Of course. The normal indentation for cpp directive is column 0: int main () { if (x) { #ifdef DEBUG printf("null"); #endif } } Normally, cpp takes into account only directive whose '#' is in column 0. That's why you sometimes see directives indented this way: #ifdef COND1 # ifdef COND2 # ifdef COND3 # else # endif # endif #else # ifdef COND2 # endif #endif -- __Pascal_Bourguignon__ http://www.informatimago.com/ ---------------------------------------------------------------------- Do not adjust your mind, there is a fault in reality.