Tweak flycheck loading process
This commit is contained in:
parent
39d044dcb4
commit
e9f8377b92
|
@ -38,4 +38,4 @@
|
||||||
(spacemacs|add-company-hook puppet-mode))
|
(spacemacs|add-company-hook puppet-mode))
|
||||||
|
|
||||||
(defun puppet/post-init-flycheck ()
|
(defun puppet/post-init-flycheck ()
|
||||||
(spacemacs/add-flycheck-hook 'puppet-mode-hook))
|
(spacemacs/add-flycheck-hook 'puppet-mode))
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
(add-hook 'react-mode-hook #'react/disable-jshint))))
|
(add-hook 'react-mode-hook #'react/disable-jshint))))
|
||||||
|
|
||||||
(defun react/post-init-flycheck ()
|
(defun react/post-init-flycheck ()
|
||||||
(spacemacs/add-flycheck-hook 'react-mode-hook))
|
(spacemacs/add-flycheck-hook 'react-mode))
|
||||||
|
|
||||||
(defun react/post-init-js-doc ()
|
(defun react/post-init-js-doc ()
|
||||||
(add-hook 'react-mode-hook 'spacemacs/js-doc-require)
|
(add-hook 'react-mode-hook 'spacemacs/js-doc-require)
|
||||||
|
|
|
@ -89,8 +89,8 @@
|
||||||
:init (push 'company-c-headers company-backends-c-mode-common))))
|
:init (push 'company-c-headers company-backends-c-mode-common))))
|
||||||
|
|
||||||
(defun c-c++/post-init-flycheck ()
|
(defun c-c++/post-init-flycheck ()
|
||||||
(dolist (hook '(c-mode-hook c++-mode-hook))
|
(dolist (mode '(c-mode c++-mode))
|
||||||
(spacemacs/add-flycheck-hook hook))
|
(spacemacs/add-flycheck-hook mode))
|
||||||
(when c-c++-enable-clang-support
|
(when c-c++-enable-clang-support
|
||||||
(spacemacs/add-to-hooks 'c-c++/load-clang-args '(c-mode-hook c++-mode-hook))))
|
(spacemacs/add-to-hooks 'c-c++/load-clang-args '(c-mode-hook c++-mode-hook))))
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
(when (configuration-layer/layer-usedp 'syntax-checking)
|
(when (configuration-layer/layer-usedp 'syntax-checking)
|
||||||
(defun d/post-init-flycheck ()
|
(defun d/post-init-flycheck ()
|
||||||
(spacemacs/add-flycheck-hook 'd-mode-hook))
|
(spacemacs/add-flycheck-hook 'd-mode))
|
||||||
(defun d/init-flycheck-dmd-dub ()
|
(defun d/init-flycheck-dmd-dub ()
|
||||||
(use-package flycheck-dmd-dub :defer t
|
(use-package flycheck-dmd-dub :defer t
|
||||||
:init (add-hook 'd-mode-hook 'flycheck-dmd-dub-set-include-path))))
|
:init (add-hook 'd-mode-hook 'flycheck-dmd-dub-set-include-path))))
|
||||||
|
|
|
@ -128,7 +128,7 @@
|
||||||
(defun emacs-lisp/post-init-flycheck ()
|
(defun emacs-lisp/post-init-flycheck ()
|
||||||
;; Don't activate flycheck by default in elisp
|
;; Don't activate flycheck by default in elisp
|
||||||
;; because of too much false warnings
|
;; because of too much false warnings
|
||||||
;; (spacemacs/add-flycheck-hook 'emacs-lisp-mode-hook)
|
;; (spacemacs/add-flycheck-hook 'emacs-lisp-mode)
|
||||||
|
|
||||||
;; Make flycheck recognize packages in loadpath
|
;; Make flycheck recognize packages in loadpath
|
||||||
;; i.e (require 'company) will not give an error now
|
;; i.e (require 'company) will not give an error now
|
||||||
|
|
|
@ -41,4 +41,4 @@
|
||||||
(require 'erlang-start)))
|
(require 'erlang-start)))
|
||||||
|
|
||||||
(defun erlang/post-init-flycheck ()
|
(defun erlang/post-init-flycheck ()
|
||||||
(spacemacs/add-flycheck-hook 'erlang-mode-hook))
|
(spacemacs/add-flycheck-hook 'erlang-mode))
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
))
|
))
|
||||||
|
|
||||||
(defun go/post-init-flycheck ()
|
(defun go/post-init-flycheck ()
|
||||||
(spacemacs/add-flycheck-hook 'go-mode-hook))
|
(spacemacs/add-flycheck-hook 'go-mode))
|
||||||
|
|
||||||
(defun go/init-go-mode()
|
(defun go/init-go-mode()
|
||||||
(when (memq window-system '(mac ns x))
|
(when (memq window-system '(mac ns x))
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
(spacemacs/set-leader-keys-for-major-mode 'haskell-mode "hf" 'helm-hoogle))))
|
(spacemacs/set-leader-keys-for-major-mode 'haskell-mode "hf" 'helm-hoogle))))
|
||||||
|
|
||||||
(defun haskell/post-init-flycheck ()
|
(defun haskell/post-init-flycheck ()
|
||||||
(spacemacs/add-flycheck-hook 'haskell-mode-hook))
|
(spacemacs/add-flycheck-hook 'haskell-mode))
|
||||||
|
|
||||||
(when (configuration-layer/layer-usedp 'syntax-checking)
|
(when (configuration-layer/layer-usedp 'syntax-checking)
|
||||||
(defun haskell/init-flycheck-haskell ()
|
(defun haskell/init-flycheck-haskell ()
|
||||||
|
|
|
@ -99,14 +99,14 @@
|
||||||
(add-hook 'web-mode-hook 'turn-on-evil-matchit-mode))
|
(add-hook 'web-mode-hook 'turn-on-evil-matchit-mode))
|
||||||
|
|
||||||
(defun html/post-init-flycheck ()
|
(defun html/post-init-flycheck ()
|
||||||
(dolist (hook '(haml-mode-hook
|
(dolist (mode '(haml-mode
|
||||||
jade-mode-hook
|
jade-mode
|
||||||
less-mode-hook
|
less-mode
|
||||||
sass-mode-hook
|
sass-mode
|
||||||
scss-mode-hook
|
scss-mode
|
||||||
slim-mode-hook
|
slim-mode
|
||||||
web-mode-hook))
|
web-mode))
|
||||||
(spacemacs/add-flycheck-hook hook)))
|
(spacemacs/add-flycheck-hook mode)))
|
||||||
|
|
||||||
(defun html/init-haml-mode ()
|
(defun html/init-haml-mode ()
|
||||||
(use-package haml-mode
|
(use-package haml-mode
|
||||||
|
|
|
@ -57,8 +57,8 @@
|
||||||
(push 'company-tern company-backends-js2-mode))))
|
(push 'company-tern company-backends-js2-mode))))
|
||||||
|
|
||||||
(defun javascript/post-init-flycheck ()
|
(defun javascript/post-init-flycheck ()
|
||||||
(dolist (hook '(coffee-mode-hook js2-mode-hook json-mode-hook))
|
(dolist (mode '(coffee-mode js2-mode json-mode))
|
||||||
(spacemacs/add-flycheck-hook hook)))
|
(spacemacs/add-flycheck-hook mode)))
|
||||||
|
|
||||||
(defun javascript/init-js-doc ()
|
(defun javascript/init-js-doc ()
|
||||||
(use-package js-doc
|
(use-package js-doc
|
||||||
|
|
|
@ -157,7 +157,7 @@
|
||||||
(add-hook 'LaTeX-mode-hook 'evil-matchit-mode))
|
(add-hook 'LaTeX-mode-hook 'evil-matchit-mode))
|
||||||
|
|
||||||
(defun latex/post-init-flycheck ()
|
(defun latex/post-init-flycheck ()
|
||||||
(spacemacs/add-flycheck-hook 'LaTeX-mode-hook))
|
(spacemacs/add-flycheck-hook 'LaTeX-mode))
|
||||||
|
|
||||||
(defun latex/post-init-flyspell ()
|
(defun latex/post-init-flyspell ()
|
||||||
(spell-checking/add-flyspell-hook 'LaTeX-mode-hook))
|
(spell-checking/add-flyspell-hook 'LaTeX-mode-hook))
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
))
|
))
|
||||||
|
|
||||||
(defun lua/post-init-flycheck ()
|
(defun lua/post-init-flycheck ()
|
||||||
(spacemacs/add-flycheck-hook 'lua-mode-hook))
|
(spacemacs/add-flycheck-hook 'lua-mode))
|
||||||
|
|
||||||
(defun lua/init-lua-mode ()
|
(defun lua/init-lua-mode ()
|
||||||
(use-package lua-mode
|
(use-package lua-mode
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
(spacemacs|add-company-hook nim-mode))
|
(spacemacs|add-company-hook nim-mode))
|
||||||
|
|
||||||
(defun nim/post-init-flycheck ()
|
(defun nim/post-init-flycheck ()
|
||||||
(spacemacs/add-flycheck-hook 'nim-mode-hook))
|
(spacemacs/add-flycheck-hook 'nim-mode))
|
||||||
|
|
||||||
(defun nim/init-flycheck-nim ()
|
(defun nim/init-flycheck-nim ()
|
||||||
(use-package flycheck-nim
|
(use-package flycheck-nim
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
(when (configuration-layer/layer-usedp 'syntax-checking)
|
(when (configuration-layer/layer-usedp 'syntax-checking)
|
||||||
(defun ocaml/post-init-flycheck ()
|
(defun ocaml/post-init-flycheck ()
|
||||||
(spacemacs/add-flycheck-hook 'merlin-mode-hook))
|
(spacemacs/add-flycheck-hook 'merlin-mode))
|
||||||
(defun ocaml/init-flycheck-ocaml ()
|
(defun ocaml/init-flycheck-ocaml ()
|
||||||
(use-package flycheck-ocaml
|
(use-package flycheck-ocaml
|
||||||
:if (configuration-layer/package-usedp 'flycheck)
|
:if (configuration-layer/package-usedp 'flycheck)
|
||||||
|
|
|
@ -94,7 +94,7 @@
|
||||||
(add-hook `python-mode-hook `turn-on-evil-matchit-mode))
|
(add-hook `python-mode-hook `turn-on-evil-matchit-mode))
|
||||||
|
|
||||||
(defun python/post-init-flycheck ()
|
(defun python/post-init-flycheck ()
|
||||||
(spacemacs/add-flycheck-hook 'python-mode-hook))
|
(spacemacs/add-flycheck-hook 'python-mode))
|
||||||
|
|
||||||
(when (configuration-layer/layer-usedp 'spacemacs-helm)
|
(when (configuration-layer/layer-usedp 'spacemacs-helm)
|
||||||
(defun python/pre-init-helm-cscope ()
|
(defun python/pre-init-helm-cscope ()
|
||||||
|
|
|
@ -88,8 +88,8 @@
|
||||||
(add-hook hook `turn-on-evil-matchit-mode)))
|
(add-hook hook `turn-on-evil-matchit-mode)))
|
||||||
|
|
||||||
(defun ruby/post-init-flycheck ()
|
(defun ruby/post-init-flycheck ()
|
||||||
(spacemacs/add-flycheck-hook 'ruby-mode-hook)
|
(spacemacs/add-flycheck-hook 'ruby-mode)
|
||||||
(spacemacs/add-flycheck-hook 'enh-ruby-mode-hook))
|
(spacemacs/add-flycheck-hook 'enh-ruby-mode))
|
||||||
|
|
||||||
(defun ruby/post-init-popwin ()
|
(defun ruby/post-init-popwin ()
|
||||||
(push '("*rspec-compilation*" :dedicated t :position bottom :stick t :noselect t :height 0.4)
|
(push '("*rspec-compilation*" :dedicated t :position bottom :stick t :noselect t :height 0.4)
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
(when (configuration-layer/layer-usedp 'syntax-checking)
|
(when (configuration-layer/layer-usedp 'syntax-checking)
|
||||||
(defun rust/post-init-flycheck ()
|
(defun rust/post-init-flycheck ()
|
||||||
(spacemacs/add-flycheck-hook 'rust-mode-hook))
|
(spacemacs/add-flycheck-hook 'rust-mode))
|
||||||
|
|
||||||
(defun rust/init-flycheck-rust ()
|
(defun rust/init-flycheck-rust ()
|
||||||
(use-package flycheck-rust
|
(use-package flycheck-rust
|
||||||
|
|
|
@ -40,6 +40,10 @@ toggled off with ~SPC t s~. You can default this to off by setting the variable
|
||||||
'((syntax-checking :variables syntax-checking-enable-by-default nil)))
|
'((syntax-checking :variables syntax-checking-enable-by-default nil)))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
If you want more fine-grained control, you can configure the variable
|
||||||
|
=flycheck-global-modes= instead. Note that this variable should be manipulated
|
||||||
|
in =dotspacemacs/user-config=.
|
||||||
|
|
||||||
* Key Bindings
|
* Key Bindings
|
||||||
|
|
||||||
| Key Binding | Description |
|
| Key Binding | Description |
|
||||||
|
|
|
@ -9,8 +9,10 @@
|
||||||
;;
|
;;
|
||||||
;;; License: GPLv3
|
;;; License: GPLv3
|
||||||
|
|
||||||
(defun spacemacs/add-flycheck-hook (hook)
|
(defun spacemacs/add-flycheck-hook (mode)
|
||||||
"Add flycheck to the given HOOK, if
|
"Use flycheck in MODE by default, if `syntax-checking-enable-by-default' is
|
||||||
`syntax-checking-enable-by-default' is true."
|
true."
|
||||||
(when syntax-checking-enable-by-default
|
(when (and syntax-checking-enable-by-default
|
||||||
(add-hook hook 'flycheck-mode)))
|
(listp flycheck-global-modes
|
||||||
|
(not (eq 'not (car flycheck-global-modes)))))
|
||||||
|
(push mode flycheck-global-modes)))
|
||||||
|
|
|
@ -18,20 +18,23 @@
|
||||||
|
|
||||||
(defun syntax-checking/init-flycheck ()
|
(defun syntax-checking/init-flycheck ()
|
||||||
(use-package flycheck
|
(use-package flycheck
|
||||||
:defer t
|
|
||||||
:init
|
:init
|
||||||
(progn
|
(progn
|
||||||
(setq flycheck-standard-error-navigation nil)
|
(setq flycheck-standard-error-navigation nil
|
||||||
|
flycheck-global-modes nil)
|
||||||
|
|
||||||
(spacemacs|add-toggle syntax-checking
|
(spacemacs|add-toggle syntax-checking
|
||||||
:status flycheck-mode
|
:status flycheck-mode
|
||||||
:on (flycheck-mode)
|
:on (flycheck-mode)
|
||||||
:off (flycheck-mode -1)
|
:off (flycheck-mode -1)
|
||||||
:documentation "Enable error and syntax checking."
|
:documentation "Enable error and syntax checking."
|
||||||
:evil-leader "ts"))
|
:evil-leader "ts")
|
||||||
:config
|
|
||||||
(progn
|
|
||||||
(spacemacs|diminish flycheck-mode " ⓢ" " s")
|
(spacemacs|diminish flycheck-mode " ⓢ" " s")
|
||||||
|
|
||||||
|
(when syntax-checking-enable-by-default
|
||||||
|
(global-flycheck-mode 1))
|
||||||
|
|
||||||
;; Custom fringe indicator
|
;; Custom fringe indicator
|
||||||
(when (fboundp 'define-fringe-bitmap)
|
(when (fboundp 'define-fringe-bitmap)
|
||||||
(define-fringe-bitmap 'my-flycheck-fringe-indicator
|
(define-fringe-bitmap 'my-flycheck-fringe-indicator
|
||||||
|
|
Loading…
Reference in a new issue