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

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

Re: CC-mode indentation after macros


From: Ola Nilsson
Subject: Re: CC-mode indentation after macros
Date: Tue, 19 Oct 2004 19:22:49 GMT
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

Ola Nilsson <sds024five1@sydpost.nospam.nu> writes:

> I'm working with code that contains a number of debug
> macros. Typically the look like this:
>
> #ifdef DEBUG 
> #define DEB(x) x 
> #else 
> #define DEB(x) 
> #endif
>
> These are used in the code like this:
>
> void foo(void) 
> { 
>   ...
>   DEB(printf("Debug print";) 
>   ...
> }
>
> That is, in many places the semicolon is inside the macro not outside
> (that would generate empty statements that lint would complain over).
>
> Now, my problem is that cc-mode wants to indent the next line, but I
> would like to have int on the same indentation level as the DEB
> line. How can I get this behaviour? Do I need to add regexps for the
> DEB() types of macros? And in that case, where should I add them?

First, thanks Laurent for your reply. Unfortunately I'm not useing GCC
for the code described. If it was only my project, I would easily
adopt your suggestion.

I seem to have found something that works for me, the statement-cont
indentation configuration. So far it seems to do what I want. I added:

  (c-set-offset 'statement-cont 0)

to my c-mode hook. Now the line after the DEB macro get's indented
like I want. There is probably some draw back that I've not yet found,
but so far so good.

And I got to try the lisp debugger and debug-on-entry ;-)

Again, thanks!
-- 
/Ola Nilsson


reply via email to

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