Thursday, March 15, 2012

Set C indent style to 8 characters

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
;;; --- 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)