Improve C++11 support

This commit is contained in:
Henrik Lissner 2014-10-09 18:35:44 -04:00
parent 8abec3eea3
commit b1f9683d27

View File

@ -4,14 +4,36 @@
c-default-style "linux"
c-tab-always-indent nil)
;; Setting proper includes on OSX
(when is-mac
(setq my/clang-includes
'("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1"
"/usr/local/include"
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include"
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include"
"/usr/include"
"/System/Library/Frameworks"
"/Library/Frameworks"))
(after flycheck (setq flycheck-clang-include-path my/clang-includes))
(after auto-complete
(setq ac-clang-flags (mapcar (lambda (item)(concat "-I" item)) my/clang-includes)))
)
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
(add-hook! 'c-mode-common-hook
(use-package auto-complete-clang)
(use-package auto-complete-c-headers)
(setq ac-sources
'(ac-source-clang
ac-source-c-headers
ac-source-yasnippet
ac-source-words-in-same-mode-buffers))
(c-toggle-electric-state -1)
(c-toggle-auto-newline -1)
;; DEL mapping interferes with smartparens and my.deflate-maybe
(defmap c-mode-map (kbd "DEL") nil)
(c-set-offset 'substatement-open '0) ; brackets should be at same indentation level as the statements they open
@ -20,14 +42,13 @@
(c-set-offset 'brace-list-open '+) ; all "opens" should be indented by the c-indent-level
(c-set-offset 'case-label '+) ; indent case labels by c-indent-level, too
(setq ac-sources
'(ac-source-clang
ac-source-c-headers
ac-source-yasnippet
ac-source-words-in-same-mode-buffers
)))
;; C++11 support on mac
(when (and is-mac (eq major-mode 'c++-mode))
(setq flycheck-clang-language-standard "c++11"
flycheck-clang-standard-library "libc++"
flycheck-c/c++-clang-executable "clang++")))
;; Implement some C++11 Support until cc-mode is updated
;; C++11 syntax support (until cc-mode is updated)
(require 'font-lock)
(defun --copy-face (new-face face)
"Define NEW-FACE from existing FACE."
@ -41,7 +62,6 @@
'font-lock-doc-face)
(--copy-face 'font-lock-doc-string-face ; comment markups
'font-lock-comment-face)
(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)
@ -102,11 +122,3 @@
("\\.vert\\'" . glsl-mode)
("\\.frag\\'" . glsl-mode)
("\\.geom\\'" . glsl-mode)))
(define-minor-mode cocos2d-mode
"Buffer local minor mode for Cocos2D-x"
:init-value nil
:lighter " C2D"
:keymap (make-sparse-keymap))
(associate-minor-mode "[.-]c2d/" cocoa2d-mode)