GNU Emacs: Avoid huge indentations in Java
Posted by Dimitar Panayotov on 29 November 2006, 2:41
Ever going crazy of default indenting of Java sources by Emacs? What about code like this?

Much better, right? Here I use two things:
- No tabs — see No tabs article.
- I use custom
c-mode-hook.
The custom hook should reside in your “.emacs” file like that:
(defun my-c-mode-hook () (c-set-offset 'substatement-open 2) (setq c-basic-offset 2))
It is “plugged” to do its work when pressing TAB in Emacs, like that:
(add-hook 'c-mode-common-hook 'my-c-mode-hook)