inextern-lang offset to 0 in
c-offsets-alist for your indentation style.
Here's some code adapted from my own init file that creates a C style called
wvxvw and defines it to have 4-space indents, indented
case statements inside
switch blocks, non-indented labels, and non-indented
extern blocks (the other settings are just to illustrate some of the possibilities).
(defun cc-style-make-my-wvxvw ()
(let ((entry (assoc "wvxvw" c-style-alist)))
(setq entry (cons "wvxvw" nil))
(setq c-style-alist (cons entry c-style-alist)))
(setcdr entry '((c-basic-offset . 4)
(label . 0)
(case-label . +)
(inextern-lang . 0)
(eval-after-load "cc-styles" '(cc-style-make-wvxvw))
The obvious follow-up is how to get this style to apply automatically. There are multiple solutions; what I do is, at the top of the directory where I want to use this style, I use the following
(c-file-style . "wvxvw")))
If other people working on the same code use Emacs, you may want to share these definitions. You can put any string in
c-file-style in a file or directory local variable declaration, but it's annoying for people who don't have the style name defined. Unfortunately, you can't define a style or tweak offsets through file-local variables. So if you want to share the style, you need all Emacs users to copy the style definition to (a file loaded by) their own init file.