From 9b598b1d72d69e79a53fbc3bcde122193013c948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B6r=C3=B6k=20Edwin?= Date: Sat, 18 Apr 2015 19:26:24 +0300 Subject: [PATCH] ocaml: flycheck support if syntax-checking configuration layer is turned on in .spacemacs --- contrib/lang/ocaml/packages.el | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/contrib/lang/ocaml/packages.el b/contrib/lang/ocaml/packages.el index b718f4a2b..e0e992206 100644 --- a/contrib/lang/ocaml/packages.el +++ b/contrib/lang/ocaml/packages.el @@ -17,8 +17,8 @@ utop ocp-indent company -;; flycheck -;; flycheck-ocaml + flycheck + flycheck-ocaml ;; package ocamls go here )) @@ -69,14 +69,22 @@ (when (configuration-layer/layer-usedp 'auto-completion) ;; Hook company to merlin-mode (defun ocaml/post-init-company () - (spacemacs|add-company-hook merlin-mode))) + (spacemacs|add-company-hook merlin-mode) + )) -;; (defun ocaml/init-flycheck-ocaml () -;; (progn -;; (setq merlin-error-after-save nil) -;; (flycheck-ocaml-setup) -;; ) -;; ) +(when (configuration-layer/layer-usedp 'syntax-checking) + (defun ocaml/init-flycheck-ocaml () + (use-package flycheck-ocaml + :if (configuration-layer/package-usedp 'flycheck) + :defer t + :init + (add-hook 'merlin-mode-hook 'flycheck-mode) + (with-eval-after-load 'merlin + ;; Disable Merlin's own error checking + (setq merlin-error-after-save nil) + ;; Enable Flycheck checker + (flycheck-ocaml-setup)) + ))) ;; For each package, define a function ocaml/init- ;;