emacs/old-config/pkgs/tuareg-init.el
2018-04-07 10:54:04 +08:00

29 lines
999 B
EmacsLisp

(defun ocaml-init ()
(setq opam-share
(substring (shell-command-to-string "opam config var share 2> /dev/null") 0 -1))
(add-to-list 'load-path (concat opam-share "/emacs/site-lisp"))
(require 'cl))
(defun ocaml-config ()
(let ((opam (which "opam"))
(ocp-indent (which "ocp-indent")))
(with-eval-after-load 'tuareg-mode
(add-hook 'tuareg-mode-hook 'merlin-mode t)
(add-hook 'caml-mode-hook 'merlin-mode t)
(add-hook 'tuareg-mode-hook 'merlin-mode)
;; (setq merlin-use-auto-complete-mode t)
;; (setq merlin-error-after-save nil))))
;; Enable auto-complete
;;(setq merlin-use-auto-complete-mode 'easy)
;; Use opam switch to lookup ocamlmerlin binary
(setq merlin-command 'opam)
(setq ocp-indent-path ocp-indent))))
(register-mypkg
(list :name "tuareg"
:enabled (and (which "opam")
(which "ocp-indent"))
:packages '(tuareg ocp-indent merlin)
:init #'ocaml-init
:config #'ocaml-config))