summaryrefslogtreecommitdiff
path: root/settings/setup-flycheck.el
diff options
context:
space:
mode:
authorbenj <benj@rse8.com>2018-12-21 16:45:46 -0800
committerbenj <benj@rse8.com>2018-12-22 18:44:41 -0800
commit261b42ddf1b4b965092ef7f2e106bf8f8cbb93da (patch)
tree0474dd5abca3cd5e4135a62b3550d911e76cc40b /settings/setup-flycheck.el
parent9def383a41abf5f4f8a63505482cbe2dfdcc10ec (diff)
downloademacs-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
Diffstat (limited to 'settings/setup-flycheck.el')
-rw-r--r--settings/setup-flycheck.el13
1 files changed, 13 insertions, 0 deletions
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)