Tuesday, September 21, 2010

Adjusting emacs tabs in namespaces only

Dealing with a large project with lots of c++ namespaces and scoping; Here is how to kill the indents from the namespace regions in emacs

;; Basic indentation
(setq c-basic-offset 4)

(defun my-c-setup ()
  (c-set-offset 'innamespace 0))
(add-hook 'c++-mode-hook 'my-c-setup)

To find out your current syntax state hit \C-c\C-s (crtl-c ctrl-s)


Refer:
http://www.emacswiki.org/emacs/IndentingC
http://google-styleguide.googlecode.com/svn/trunk/google-c-style.el

1 comment: