mirror of https://github.com/Chizi123/.emacs.d.git

Joel Grunbaum
2021-12-10 8dba697a2c9e3b5c9f0fcb45e155adb6243ad609
Help flycheck find project root
1 files modified
20 ■■■■■ changed files
config.org 20 ●●●●● patch | view | raw | blame | history
config.org
@@ -960,7 +960,8 @@
** Language specific configs
*** C/C++
**** Flycheck clang
**** Flycheck
***** Flycheck clang
Add the clang backend for linting.
#+BEGIN_SRC emacs-lisp
  (use-package flycheck-clang-analyzer
@@ -971,6 +972,23 @@
      (require 'flycheck-clang-analyzer)
       (flycheck-clang-analyzer-setup)))
#+END_SRC
***** Flycheck project root
Flycheck tends to fail finding the project root, giving errors about missing files.
This should remove them.
#+BEGIN_SRC emacs-lisp
  (defun setup-flycheck-project-path ()
    (let ((root (ignore-errors (projectile-project-root))))
      (when root
        (add-to-list
         (make-variable-buffer-local 'flycheck-clang-include-path)
         root)
        (add-to-list
         (make-variable-buffer-local 'flycheck-gcc-include-path)
         root))))
  (add-hook 'c-mode-hook 'setup-flycheck-project-path)
  (add-hook 'c++-mode-hook 'setup-flycheck-project-path)
#+END_SRC
**** COMMENT Company
Add header completion as well as Irony, which uses clang for suggestions.