How To Debug Emacs Cpp Indentation
This post provides step by step instructions for you to automate your Ubuntu installation process.
Do Syntactic Analysis
Do c-show-syntactic-information
or C-c C-s
to get an syntactic analysis first, you should get something like this
Syntactic analysis: ((statement-block-intro 930))
At the same time, emacs will also highlight the anchor point.
Set c-set-offset
Do the following to adjust the indentation.
(defun c-indentation-hook ()
(c-set-offset 'statement-block-intro 2)
)
(add-hook 'c-mode-common-hook 'c-indentation-hook)
You’ll need to reopen the file to allow the above change to take effect.