-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit-cc-mode.el
executable file
·65 lines (50 loc) · 2.01 KB
/
init-cc-mode.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
(defun c-wx-lineup-topmost-intro-cont (langelem)
(save-excursion
(beginning-of-line)
(if (re-search-forward "EVT_" (line-end-position) t)
'c-basic-offset
(c-lineup-topmost-intro-cont langelem))))
;C/C++ SECTION
(defun my-c-mode-hook ()
(local-set-key "\M-f" 'c-forward-into-nomenclature)
(local-set-key "\M-b" 'c-backward-into-nomenclature)
(setq c-basic-offset 4)
(setq c-style-variables-are-local-p nil)
;give me NO newline automatically after electric expressions are entered
(setq c-auto-newline nil)
;if (0) becomes if (0)
; { {
; ; ;
; } }
(c-set-offset 'substatement-open 0)
;first arg of arglist to functions: tabbed in once
;(default was c-lineup-arglist-intro-after-paren)
(c-set-offset 'arglist-intro '+)
;second line of arglist to functions: tabbed in once
;(default was c-lineup-arglist)
(c-set-offset 'arglist-cont-nonempty '+)
;switch/case: make each case line indent from switch
(c-set-offset 'case-label '+)
;make the ENTER key indent next line properly
(local-set-key "\C-m" 'newline-and-indent)
;syntax-highlight aggressively
;(setq font-lock-support-mode 'lazy-lock-mode)
(setq lazy-lock-defer-contextually t)
(setq lazy-lock-defer-time 0)
;make DEL take all previous whitespace with it
(c-toggle-hungry-state 1)
;make open-braces after a case: statement indent to 0 (default was '+)
(c-set-offset 'statement-case-open 0)
;make a #define be left-aligned
(setq c-electric-pound-behavior (quote (alignleft)))
;wxwdigets stuff
(c-set-offset 'topmost-intro-cont 'c-wx-lineup-topmost-intro-cont)
;do not impose restriction that all lines not top-level be indented at least
;1 (was imposed by gnu style by default)
(setq c-label-minimum-indentation 0)
; @see https://github.com/seanfisk/cmake-flymake
; make sure you project use cmake
(flymake-mode)
)
(add-hook 'c-mode-common-hook 'my-c-mode-hook)
(provide 'init-cc-mode)