unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "jodocus" <bill.cliffordNASPOM@home.nl>
Subject: c indentation problem
Date: Mon, 28 Aug 2006 11:28:53 +0200	[thread overview]
Message-ID: <ecud07$p6v$1@news1.zwoll1.ov.home.nl> (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")

                 reply	other threads:[~2006-08-28  9:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='ecud07$p6v$1@news1.zwoll1.ov.home.nl' \
    --to=bill.cliffordnaspom@home.nl \
    /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).