lang/ocaml: always initialize merlin, but wait for a .merlin file for flycheck

Signed-off-by: Edwin Török <edwin@etorok.net>
This commit is contained in:
Edwin Török 2018-10-16 23:30:47 +01:00
parent 3d6b30675c
commit 50b324b683

View file

@ -21,10 +21,8 @@
:defer t :defer t
:init :init
(defun +ocaml|init-merlin () (defun +ocaml|init-merlin ()
"Activate `merlin-mode' if the ocamlmerlin executable exists and the "Activate `merlin-mode' if the ocamlmerlin executable exists."
current project possesses a .merlin file." (when (executable-find "ocamlmerlin")
(when (and (projectile-locate-dominating-file default-directory ".merlin")
(executable-find "ocamlmerlin"))
(merlin-mode))) (merlin-mode)))
(add-hook 'tuareg-mode-hook #'+ocaml|init-merlin) (add-hook 'tuareg-mode-hook #'+ocaml|init-merlin)
@ -44,12 +42,15 @@ current project possesses a .merlin file."
(def-package! flycheck-ocaml (def-package! flycheck-ocaml
:when (featurep! :feature syntax-checker) :when (featurep! :feature syntax-checker)
:after merlin :init
:config (defun +ocaml|init-flycheck ()
;; Disable Merlin's own error checking "Activate `flycheck-ocaml` if the current project possesses a .merlin file."
(setq merlin-error-after-save nil) (when (projectile-locate-dominating-file default-directory ".merlin")
;; Enable Flycheck checker ;; Disable Merlin's own error checking
(flycheck-ocaml-setup)) (setq merlin-error-after-save nil)
;; Enable Flycheck checker
(flycheck-ocaml-setup)))
(add-hook 'merlin-mode-hook #'+ocaml|init-flycheck))
(def-package! utop (def-package! utop