How to customize indentation in C, C++, and Java buffers?
The Emacs cc-mode features an interactive procedure for customizing the indentation style, which is fully explained in the CC Mode manual that is part of the Emacs distribution, see section `Customization Indentation’ in The CC Mode Manual. Here’s a short summary of the procedure: • Go to the beginning of the first line where you don’t like the indentation and type C-c C-o. Emacs will prompt you for the syntactic symbol; type RET to accept the default it suggests. • Emacs now prompts for the offset of this syntactic symbol, showing the default (the current definition) inside parentheses. You can choose one of these: 0 No extra indentation. + Indent one basic offset. – Outdent one basic offset. ++ Indent two basic offsets — Outdent two basic offsets. * Indent half basic offset. / Outdent half basic offset. • After choosing one of these symbols, type C-c C-q to reindent the line or the block according to what you just specified. • If you don’t like the result, go back to step 1. Otherwi