Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs and C++ { } indenting



Mike Small has already pointed you to the appropriate
Emacs doc. But since I went through the same quest a
couple of years ago, here's what I ended up with
in my .emacs:

(defun my-c-mode-common-hook ()
  ;; default gnu style is mostly OK
  (c-set-style "gnu")
  ;; but some things just annoy me
  (c-set-offset 'substatement-open '0)  
  )
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

The "gnu" style does functions the way you want, but
indents if/while/for bodies. The second call above fixes that.

Ben





BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org