Thursday, March 15, 2012

Set C indent style to 8 characters

;;; --- Add it to C mode Hook
(c-add-style "DAP" 
             '((c-basic-offset  . 8)
               (substatement-open . 0)
               (c-offsets-alist . (
                                   (namespace-open . 0)
                                   (namespace-close . 0)
                                   (innamespace . 0)
                                   ;;; -- brace that opens a substatement block
                                   (substatement-open . 0)
                                   ;;; -- brace that opens an in-class inline me
thod
                                   (inline-open . 0)
                   (case-label . +)
                   (access-label . -2)
                   (class-open . 0)
                                   )
                                )
               ))
(defun dap-hook ()
  (c-set-style "DAP"))
(add-hook 'c-mode-hook 'dap-hook)