Guest User

Untitled

a guest
Feb 17th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. Setup environment variables using opam
  2.  
  3. #+BEGIN_SRC emacs-lisp :tangle no
  4. (dolist (var (car (read-from-string (shell-command-to-string "opam config env --sexp"))))
  5. (setenv (car var) (cadr var)))
  6. #+END_SRC
  7.  
  8. Add opam libs.
  9.  
  10. #+BEGIN_SRC emacs-lisp
  11. (let ((opam-share (ignore-errors (car (process-lines "opam" "config" "var" "share")))))
  12. (when (and opam-share (file-directory-p opam-share))
  13. (add-to-list 'load-path (expand-file-name "emacs/site-lisp" opam-share))
  14. ))
  15. #+END_SRC
  16.  
  17. Install caml, reasonml and tuareg modes.
  18.  
  19. We don't need the tuareg package from the emacs repositories, it
  20. comes from opam.
  21.  
  22. ~caml~ is required because ~caml-types-expr-face~ is used by merlin.
  23.  
  24. #+BEGIN_SRC emacs-lisp
  25. (use-package caml
  26. :ensure t)
  27. (use-package tuareg
  28. :mode ("\\.ml[ily]?$" . tuareg-mode))
  29. (use-package reason-mode
  30. :ensure t)
  31. #+END_SRC
  32.  
  33. Require ocp stuff first because of conflicts between shortcuts.
  34. It is installed from opam, ~ensure~ is not required.
  35.  
  36. #+BEGIN_SRC emacs-lisp
  37. (use-package ocp-indent)
  38. (use-package ocp-index)
  39. #+END_SRC
  40.  
  41. Configure merlin. Magical autocompletion and IDE features.
  42.  
  43. #+BEGIN_SRC emacs-lisp
  44. (use-package merlin
  45. :custom
  46. (merlin-command 'opam)
  47. (merlin-completion-with-doc t)
  48. (company-quickhelp-mode t)
  49. :bind (:map merlin-mode-map
  50. ("M-." . merlin-locate)
  51. ("M-," . merlin-pop-stack)
  52. ("C-c C-o" . merlin-occurrences)
  53. ("C-c C-j" . merlin-jump)
  54. ("C-c i" . merlin-locate-ident)
  55. ("C-c C-e" . merlin-iedit-occurrences)
  56. )
  57. :hook
  58. ;; Start merlin on ml files
  59. (reason-mode . merlin-mode)
  60. (tuareg-mode . merlin-mode)
  61. (caml-mode-hook . merlin-mode)
  62. )
  63. #+END_SRC
  64.  
  65. #+BEGIN_SRC emacs-lisp
  66. (use-package utop
  67. :hook
  68. (tuareg-mode . utop-minor-mode)
  69. (reason-mode . utop-minor-mode)
  70. )
  71. #+END_SRC
Add Comment
Please, Sign In to add comment