[ocaml] Revise latest improvement to layer

This commit is contained in:
Maximilian Wolff 2020-08-13 21:45:59 +02:00
parent 350a6ecdb8
commit e50890c490
No known key found for this signature in database
GPG key ID: 2DD07025BFDBD89A

View file

@ -1,6 +1,6 @@
;;; packages.el --- ocaml Layer packages File for Spacemacs ;;; packages.el --- ocaml Layer packages File for Spacemacs
;; ;;
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors ;; Copyright (c) 2012-2020 Sylvain Benner & Contributors
;; ;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com> ;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs ;; URL: https://github.com/syl20bnr/spacemacs
@ -9,24 +9,22 @@
;; ;;
;;; License: GPLv3 ;;; License: GPLv3
(setq ocaml-packages (defconst ocaml-packages
'( '(
;; auto-complete company
company dune
dune flycheck
flycheck (flycheck-ocaml :toggle (configuration-layer/layer-used-p 'syntax-checking))
(flycheck-ocaml :toggle (configuration-layer/layer-used-p 'syntax-checking)) ggtags
ggtags counsel-gtags
counsel-gtags helm-gtags
helm-gtags imenu
imenu merlin
merlin merlin-eldoc
merlin-eldoc ocp-indent
ocp-indent smartparens
smartparens tuareg
tuareg utop))
utop
))
(defun ocaml/post-init-company () (defun ocaml/post-init-company ()
(when (configuration-layer/package-used-p 'merlin) (when (configuration-layer/package-used-p 'merlin)
@ -72,7 +70,6 @@
(defun ocaml/init-flycheck-ocaml () (defun ocaml/init-flycheck-ocaml ()
(use-package flycheck-ocaml (use-package flycheck-ocaml
:if (configuration-layer/package-used-p 'flycheck)
:defer t :defer t
:init :init
(progn (progn
@ -80,13 +77,6 @@
(setq merlin-error-after-save nil) (setq merlin-error-after-save nil)
(flycheck-ocaml-setup))))) (flycheck-ocaml-setup)))))
;; (defun ocaml/setup-flycheck ()
;; (when (and buffer-file-name (locate-dominating-file buffer-file-name ".merlin"))
;; (setq merlin-error-after-save nil)
;; (flycheck-ocaml-setup)))
;; (use-package flycheck-ocaml
;; :hook (merlin-mode . ocaml/setup-flycheck)))
(defun ocaml/post-init-ggtags () (defun ocaml/post-init-ggtags ()
(add-hook 'ocaml-mode-local-vars-hook #'spacemacs/ggtags-mode-enable)) (add-hook 'ocaml-mode-local-vars-hook #'spacemacs/ggtags-mode-enable))
@ -104,6 +94,10 @@
(add-to-list 'spacemacs-jump-handlers-tuareg-mode (add-to-list 'spacemacs-jump-handlers-tuareg-mode
'spacemacs/merlin-locate) 'spacemacs/merlin-locate)
(add-hook 'tuareg-mode-hook 'merlin-mode) (add-hook 'tuareg-mode-hook 'merlin-mode)
;; Actively load merline-iedit
(require 'merlin-iedit)
(spacemacs/set-leader-keys-for-major-mode 'tuareg-mode (spacemacs/set-leader-keys-for-major-mode 'tuareg-mode
"cp" 'merlin-project-check "cp" 'merlin-project-check
"cv" 'merlin-goto-project-file "cv" 'merlin-goto-project-file
@ -119,23 +113,20 @@
"hh" 'merlin-document "hh" 'merlin-document
"ht" 'merlin-type-enclosing "ht" 'merlin-type-enclosing
"hT" 'merlin-type-expr "hT" 'merlin-type-expr
"rd" 'merlin-destruct) "rd" 'merlin-destruct
"re" 'merlin-iedit-occurrences)
(spacemacs/declare-prefix-for-mode 'tuareg-mode "mc" "compile/check") (spacemacs/declare-prefix-for-mode 'tuareg-mode "mc" "compile/check")
(spacemacs/declare-prefix-for-mode 'tuareg-mode "mE" "errors") (spacemacs/declare-prefix-for-mode 'tuareg-mode "mE" "errors")
(spacemacs/declare-prefix-for-mode 'tuareg-mode "mg" "goto") (spacemacs/declare-prefix-for-mode 'tuareg-mode "mg" "goto")
(spacemacs/declare-prefix-for-mode 'tuareg-mode "mh" "help") (spacemacs/declare-prefix-for-mode 'tuareg-mode "mh" "help")
(spacemacs/declare-prefix-for-mode 'tuareg-mode "mr" "refactor")) (spacemacs/declare-prefix-for-mode 'tuareg-mode "mr" "refactor"))))
:config
(require 'merlin-iedit)
(spacemacs/set-leader-keys-for-major-mode 'tuareg-mode
"re" 'merlin-iedit-occurrences)))
(defun ocaml/post-init-imenu () (defun ocaml/post-init-imenu ()
(use-package merlin-imenu (add-hook 'merlin-mode-hook #'merlin-use-merlin-imenu))
:hook (merlin-mode . merlin-use-merlin-imenu)))
(defun ocaml/init-merlin-eldoc () (defun ocaml/init-merlin-eldoc ()
(use-package merlin-eldoc (use-package merlin-eldoc
:defer t
:hook (merlin-mode . merlin-eldoc-setup))) :hook (merlin-mode . merlin-eldoc-setup)))
(defun ocaml/init-ocp-indent () (defun ocaml/init-ocp-indent ()