-
-
Save sgrove/c9bdfed77f4da8db108dfb2c188f7baf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;---------------------------------------------------------------------------- | |
;; Reason setup | |
;; Expects reason-cli to be installed: | |
;; npm install -g git://github.com/reasonml/reason-cli.git | |
;;---------------------------------------------------------------------------- | |
(defun chomp-end (str) | |
"Chomp tailing whitespace from STR." | |
(replace-regexp-in-string (rx (* (any " \t\n")) eos) | |
"" | |
str)) | |
(defun real-path (path) | |
"Resolves the actual path for PATH." | |
(chomp-end (shell-command-to-string (concat "realpath " path)))) | |
(let ((support-base-dir (concat (replace-regexp-in-string "refmt\n" "" (shell-command-to-string (concat "realpath " (shell-command-to-string "which refmt")))) "..")) | |
(merlin-base-dir (concat (replace-regexp-in-string "ocamlmerlin\n" "" (shell-command-to-string (concat "realpath " (shell-command-to-string "which ocamlmerlin")))) ".."))) | |
;; Add npm merlin.el to the emacs load path and tell emacs where to find ocamlmerlin | |
(add-to-list 'load-path (concat merlin-base-dir "/share/emacs/site-lisp/")) | |
(setq merlin-command (concat merlin-base-dir "/bin/ocamlmerlin")) | |
;; Add npm reason-mode to the emacs load path and tell emacs where to find refmt | |
(add-to-list 'load-path (concat support-base-dir "/share/emacs/site-lisp")) | |
(setq refmt-command (concat support-base-dir "/bin/refmt"))) | |
(require 'reason-mode) | |
(require 'merlin) | |
(add-hook 'reason-mode-hook (lambda () | |
(add-hook 'before-save-hook 'refmt-before-save) | |
(merlin-mode))) | |
(setq merlin-ac-setup t) | |
(require 'merlin-iedit) | |
(defun evil-custom-merlin-iedit () | |
(interactive) | |
(if iedit-mode (iedit-mode) | |
(merlin-iedit-occurrences))) | |
(define-key merlin-mode-map (kbd "C-c C-e") 'evil-custom-merlin-iedit) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment