General refactor & cleanup, across the board
This commit is contained in:
parent
4ddc5c194b
commit
2d365619cd
35 changed files with 141 additions and 155 deletions
|
@ -28,20 +28,20 @@
|
|||
|
||||
(use-package! utop
|
||||
:when (featurep! :tools eval)
|
||||
:hook (tuareg-mode . +ocaml|init-utop)
|
||||
:hook (tuareg-mode . +ocaml-init-utop-h)
|
||||
:init
|
||||
(set-repl-handler! 'tuareg-mode #'utop)
|
||||
(set-eval-handler! 'tuareg-mode #'utop-eval-region)
|
||||
(defun +ocaml|init-utop ()
|
||||
(defun +ocaml-init-utop-h ()
|
||||
(when (executable-find "utop")
|
||||
(utop-minor-mode)))))
|
||||
|
||||
|
||||
(use-package! merlin
|
||||
:unless (featurep! +lsp)
|
||||
:hook (tuareg-mode . +ocaml|init-merlin)
|
||||
:hook (tuareg-mode . +ocaml-init-merlin-h)
|
||||
:init
|
||||
(defun +ocaml|init-merlin ()
|
||||
(defun +ocaml-init-merlin-h ()
|
||||
"Activate `merlin-mode' if the ocamlmerlin executable exists."
|
||||
(when (executable-find "ocamlmerlin")
|
||||
(merlin-mode)))
|
||||
|
@ -62,9 +62,9 @@
|
|||
|
||||
(use-package! flycheck-ocaml
|
||||
:when (featurep! :tools flycheck)
|
||||
:hook (merlin-mode . +ocaml|init-flycheck)
|
||||
:hook (merlin-mode . +ocaml-init-flycheck-h)
|
||||
:config
|
||||
(defun +ocaml|init-flycheck ()
|
||||
(defun +ocaml-init-flycheck-h ()
|
||||
"Activate `flycheck-ocaml` if the current project possesses a .merlin file."
|
||||
(when (projectile-locate-dominating-file default-directory ".merlin")
|
||||
;; Disable Merlin's own error checking
|
||||
|
@ -90,9 +90,9 @@
|
|||
(use-package! ocp-indent
|
||||
;; must be careful to always defer this, it has autoloads that adds hooks
|
||||
;; which we do not want if the executable can't be found
|
||||
:hook (tuareg-mode . +ocaml|init-ocp-indent)
|
||||
:hook (tuareg-mode . +ocaml-init-ocp-indent-h)
|
||||
:config
|
||||
(defun +ocaml|init-ocp-indent ()
|
||||
(defun +ocaml-init-ocp-indent-h ()
|
||||
"Run `ocp-setup-indent', so long as the ocp-indent binary exists."
|
||||
(when (executable-find "ocp-indent")
|
||||
(ocp-setup-indent))))
|
||||
|
@ -101,12 +101,12 @@
|
|||
(use-package! ocamlformat
|
||||
:when (featurep! :editor format)
|
||||
:commands ocamlformat
|
||||
:hook (tuareg-mode . +ocaml|init-ocamlformat)
|
||||
:hook (tuareg-mode . +ocaml-init-ocamlformat-h)
|
||||
:config
|
||||
(set-formatter! 'ocamlformat #'ocamlformat
|
||||
:modes '(caml-mode tuareg-mode))
|
||||
;; TODO Fix region-based formatting support
|
||||
(defun +ocaml|init-ocamlformat ()
|
||||
(defun +ocaml-init-ocamlformat-h ()
|
||||
(setq +format-with 'ocp-indent)
|
||||
(when (and (executable-find "ocamlformat")
|
||||
(locate-dominating-file default-directory ".ocamlformat"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue