[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
1 changed files with 26 additions and 35 deletions

View File

@ -1,6 +1,6 @@
;;; 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>
;; URL: https://github.com/syl20bnr/spacemacs
@ -9,24 +9,22 @@
;;
;;; License: GPLv3
(setq ocaml-packages
'(
;; auto-complete
company
dune
flycheck
(flycheck-ocaml :toggle (configuration-layer/layer-used-p 'syntax-checking))
ggtags
counsel-gtags
helm-gtags
imenu
merlin
merlin-eldoc
ocp-indent
smartparens
tuareg
utop
))
(defconst ocaml-packages
'(
company
dune
flycheck
(flycheck-ocaml :toggle (configuration-layer/layer-used-p 'syntax-checking))
ggtags
counsel-gtags
helm-gtags
imenu
merlin
merlin-eldoc
ocp-indent
smartparens
tuareg
utop))
(defun ocaml/post-init-company ()
(when (configuration-layer/package-used-p 'merlin)
@ -72,7 +70,6 @@
(defun ocaml/init-flycheck-ocaml ()
(use-package flycheck-ocaml
:if (configuration-layer/package-used-p 'flycheck)
:defer t
:init
(progn
@ -80,13 +77,6 @@
(setq merlin-error-after-save nil)
(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 ()
(add-hook 'ocaml-mode-local-vars-hook #'spacemacs/ggtags-mode-enable))
@ -104,6 +94,10 @@
(add-to-list 'spacemacs-jump-handlers-tuareg-mode
'spacemacs/merlin-locate)
(add-hook 'tuareg-mode-hook 'merlin-mode)
;; Actively load merline-iedit
(require 'merlin-iedit)
(spacemacs/set-leader-keys-for-major-mode 'tuareg-mode
"cp" 'merlin-project-check
"cv" 'merlin-goto-project-file
@ -119,23 +113,20 @@
"hh" 'merlin-document
"ht" 'merlin-type-enclosing
"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 "mE" "errors")
(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 "mr" "refactor"))
:config
(require 'merlin-iedit)
(spacemacs/set-leader-keys-for-major-mode 'tuareg-mode
"re" 'merlin-iedit-occurrences)))
(spacemacs/declare-prefix-for-mode 'tuareg-mode "mr" "refactor"))))
(defun ocaml/post-init-imenu ()
(use-package merlin-imenu
:hook (merlin-mode . merlin-use-merlin-imenu)))
(add-hook 'merlin-mode-hook #'merlin-use-merlin-imenu))
(defun ocaml/init-merlin-eldoc ()
(use-package merlin-eldoc
:defer t
:hook (merlin-mode . merlin-eldoc-setup)))
(defun ocaml/init-ocp-indent ()