Copyright (C) 2000-2012 |
GNU Info (efaq)Indenting switch statementsHow do I change the indentation for `switch'? ============================================= Many people want to indent their `switch' statements like this: f() { switch(x) { case A: x1; break; case B: x2; break; default: x3; } } The solution at first appears to be: set `c-indent-level' to 4 and `c-label-offset' to -2. However, this will give you an indentation spacing of four instead of two. The _real_ solution is to use `cc-mode' (the default mode for C programming in Emacs 20 and later) and add the following line to yoyr `.emacs': (c-set-offset 'case-label '+) There appears to be no way to do this with the old `c-mode'. automatically generated by info2www version 1.2.2.9 |