diff options
| author | benj <benj@rse8.com> | 2018-12-21 16:45:46 -0800 |
|---|---|---|
| committer | benj <benj@rse8.com> | 2018-12-22 18:44:41 -0800 |
| commit | 261b42ddf1b4b965092ef7f2e106bf8f8cbb93da (patch) | |
| tree | 0474dd5abca3cd5e4135a62b3550d911e76cc40b | |
| parent | 9def383a41abf5f4f8a63505482cbe2dfdcc10ec (diff) | |
| download | emacs-261b42ddf1b4b965092ef7f2e106bf8f8cbb93da.tar emacs-261b42ddf1b4b965092ef7f2e106bf8f8cbb93da.tar.gz emacs-261b42ddf1b4b965092ef7f2e106bf8f8cbb93da.tar.bz2 emacs-261b42ddf1b4b965092ef7f2e106bf8f8cbb93da.tar.lz emacs-261b42ddf1b4b965092ef7f2e106bf8f8cbb93da.tar.xz emacs-261b42ddf1b4b965092ef7f2e106bf8f8cbb93da.tar.zst emacs-261b42ddf1b4b965092ef7f2e106bf8f8cbb93da.zip | |
added flycheck-clangcheck support; notes for larger c++ builds
| -rw-r--r-- | settings/setup-c++-mode.el | 7 | ||||
| -rw-r--r-- | settings/setup-company-mode.el | 9 | ||||
| -rw-r--r-- | settings/setup-flycheck.el | 13 | ||||
| l--------- | templates/snippets/c++-mode/doxycomments | 1 |
4 files changed, 28 insertions, 2 deletions
diff --git a/settings/setup-c++-mode.el b/settings/setup-c++-mode.el index 820c057..28d8698 100644 --- a/settings/setup-c++-mode.el +++ b/settings/setup-c++-mode.el @@ -5,7 +5,12 @@ '(;; add some keywords ("\\<\\(nullptr\\)\\>" . font-lock-keyword-face))))) -(add-hook 'c++-mode-hook 'rtags-start-process-unless-running) +(defun arg-list-indent () + "Indent arglist properly when overflowing." + (c-set-offset 'arglist-intro '+)) + +(add-hook 'c++-mode-hook 'arg-list-indent) +;;(add-hook 'c++-mode-hook 'rtags-start-process-unless-running) (setq c-basic-offset 2) (setq c-default-style "gnu") diff --git a/settings/setup-company-mode.el b/settings/setup-company-mode.el index 9c5a843..311496c 100644 --- a/settings/setup-company-mode.el +++ b/settings/setup-company-mode.el @@ -5,10 +5,17 @@ ;; basic company mode configs ;;; Code: +(require 'company) + +;; When working with a larger project, until a parser is written +;; for compile_commands.json DB, you can add the headers to +;; .dir-locals.el as follows: +;; (company-clang-arguments . ("-I/path/to/include")) -(add-hook 'after-init-hook 'global-company-mode) (setq company-idle-delay 0.1) +(setq company-clang-executable "/usr/bin/clang++") +(add-hook 'after-init-hook 'global-company-mode) (provide 'setup-company-mode) ;;; setup-company-mode.el ends here diff --git a/settings/setup-flycheck.el b/settings/setup-flycheck.el index db93a0e..63fca3f 100644 --- a/settings/setup-flycheck.el +++ b/settings/setup-flycheck.el @@ -1,5 +1,17 @@ (require 'flycheck) (require 'flycheck-pos-tip) +(require 'flycheck-clangcheck) + +;; When using flycheck in a larger c++ project with a variety of headers +;; across a variety of dirs, add the following to your .dir-locals.el +;; (flycheck-clang-dbname . "/abs/path/to/build/compile_commands.json") + +(defun setup-custom-clang-checker () + (flycheck-set-checker-executable 'c/c++-clangcheck "/usr/bin/clang-check") + (flycheck-select-checker 'c/c++-clangcheck)) + +(add-hook 'c-mode-hook #'setup-custom-clang-checker) +(add-hook 'c++-mode-hook #'setup-custom-clang-checker) (global-flycheck-mode 1) @@ -8,5 +20,6 @@ '(flycheck-display-errors-function #'flycheck-pos-tip-error-messages))) (global-set-key (kbd "<f2>") 'flyspell-auto-correct-previous-word) +(setq flycheck-clangcheck-analyze t) (provide 'setup-flycheck) diff --git a/templates/snippets/c++-mode/doxycomments b/templates/snippets/c++-mode/doxycomments new file mode 120000 index 0000000..62fd598 --- /dev/null +++ b/templates/snippets/c++-mode/doxycomments @@ -0,0 +1 @@ +../doxygen/doxycomments
\ No newline at end of file |
