unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* c indentation problem
@ 2006-08-28  9:28 jodocus
  0 siblings, 0 replies; only message in thread
From: jodocus @ 2006-08-28  9:28 UTC (permalink / raw)


Hi, 

I have the following problem: for a project I am working on, the C code at
the start of a function is indented as follows:

void func ( arglist a )
{
int somevar;
char someothervar;

    do_something();
    if( cond )
    {
        action;
    }
}

As you can see, the declaration of variables at the start of the function
body is not indented. Then, there is an empty line, and the rest of the
function (the "real" body containing statements that are not variable
declarations) is indented. How do I get emacs to understand this?

I already have the following code in my .emacs, which works pretty well,
except for the above problem.

(defconst my-c-style
  '((c-basic-offset . 4) 
	(c-comment-only-line-offset . 0)
    (c-offsets-alist (statement-block-intro . +) 
;					 (knr-argdecl-intro . 0) 
;					 (knr-argdecl . 0)
;					 (topmost-intro . 0)
;					 (topmost-intro-cont . 0)
					 (substatement-open . 0) 
					 (label . 0) 
					 (case-label . +)
					 (statement-cont . +) 
					 (inline-open . 0) 
					 (inexpr-class . 0))
	)
  "MY style")

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-08-28  9:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-28  9:28 c indentation problem jodocus

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).