3 ;---------------------------------------------------------------------------------------
7 (setenv "LD_LIBRARY_PATH" "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/")
9 ;( add-to-list 'load-path (expand-file-name "~/.emacs.d/irony-mode/elisp/"))
11 (add-hook 'c++-mode-hook 'irony-mode)
12 (add-hook 'c-mode-hook 'irony-mode)
13 (add-hook 'objc-mode-hook 'irony-mode)
15 ;; replace the `completion-at-point' and `complete-symbol' bindings in
16 ;; irony-mode's buffers by irony-mode's function
17 (defun my-irony-mode-hook ()
18 (define-key irony-mode-map [remap completion-at-point]
19 'irony-completion-at-point-async)
20 (define-key irony-mode-map [remap complete-symbol]
21 'irony-completion-at-point-async))
22 (add-hook 'irony-mode-hook 'my-irony-mode-hook)
23 (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
26 ;---------------------------------------------------------------------------------------
27 ;; auto-complete, yasnippt, auto-complete-c-headers, iedit
29 ;; c/c++ auto-complete, yasnippet, auto-complet-c-headers
30 ;;https://www.youtube.com/watch?v=HTUE03LnaXA&list=PL-mFLc7R_MJet8ItKipCtYc7PWoS5KTfM
35 ;; auto-complete-c-headers
36 (defun my:ac-c-header-init ()
37 (require 'auto-complete-c-headers)
38 (add-to-list 'ac-sources 'ac-source-c-headers)
39 (add-to-list 'achead:include-directories "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include")
41 (add-hook 'c++-mode-hook 'my:ac-c-header-init)
42 (add-hook 'c-mode-hook 'my:ac-c-header-init)
44 ;;; iedit, fix iedit bug in Mac, C-c ; to trigger multiple cursor edit
45 (define-key global-map (kbd "C-c ;") 'iedit-mode)
48 ;; flymake-google-cpplint-load
49 ;; define a function for flymake initialization
50 ;(defun my:flymake-google-init ()
51 ; (require 'flymake-google-cpplint)
52 ; (custom-set-variables
53 ; '(flymake-google-cpplint-command "/usr/local/bin/cpplint"))
54 ; (flymake-google-cpplint-load)
56 ;(add-hook 'c-mode-hook 'my:flymake-google-init)
57 ;(add-hook 'c++-mode-hook 'my:flymake-google-init)
59 ;; start google-c-style with emacs
60 ;(require 'google-c-style)
61 ;(add-hook 'c-mode-hook 'google-set-c-style)
62 ;(add-hook 'c++-mode-hook 'google-make-newline-indent)
66 ;---------------------------------------------------------------------------------------
70 ;; let's define a function which adds semantic as a suggestion backend to auto complete
71 (defun my:add-semantic-to-autocomplete()
72 (add-to-list 'ac-sources 'ac-source-semantic)
74 (add-hook 'c-mode-common-hook 'my:add-semantic-to-autocomplete)
78 ;(ede-cpp-root-project "my project" :file "~/demos/my_program/src/main.cpp"
79 ; :include-path '("/../my_inc"))
80 ;; you can use system-include-path for setting up the system header file locations.
82 ;; turn on automatic reparsing of open buffers in semantic
83 (global-semantic-idle-scheduler-mode 1)
84 (global-semantic-stickyfunc-mode 1)