Right now the standard emacs indentation works like the following:
switch (cond) {
case 0: {
command;
}
break;
}
I want the break; to line up with case.
Also, is there a list of the c-set-offset commands somewhere?
Right now the standard emacs indentation works like the following:
switch (cond) {
case 0: {
command;
}
break;
}
I want the break; to line up with case.
Also, is there a list of the c-set-offset commands somewhere?
The biggest help (I've found) in customizing indentation is figuring out what cc-mode uses to indent the current line. That's what C-c C-o aka M-x c-set-offset can do - it'll allow you to customize the offset for a syntactic element, and it shows you what element was used for the current line!
Here's how you can customize it. Move your cursor to the break;
line.
C-c C-o RET 0 RET
At which point, your code will be indented like:
switch (cond) {
case 0: {
command;
}
break;
}
For documentation on the offsets, check out the docstring for the variable 'c-offsets-alist
C-h v c-offsets-alist RET
Similarly, you can add this to your .emacs:
(setq c-offsets-alist '((statement-case-intro . 0)))
The documentation for customizing indention is here and is worth reading. There are tons of ways to do it, so reading the manual is worth the time (if you want non-default indentation). And here's a pointer to all the syntactic symbols used in cc-mode.