From 14377bc2ee93c17ac9ead0669a27b872ad86ab48 Mon Sep 17 00:00:00 2001
From: John Soo <jsoo1@asu.edu>
Date: Thu, 31 Dec 2020 13:34:57 -0800
Subject: [PATCH] gnu: Add emacs-merlin.
* gnu/packages/emacs-xyz.scm (emacs-merlin): New variable.
* gnu/packages/ocaml.scm (ocaml-merlin): [arguments] Remove elisp from output,
[description] Note location of emacs package.
---
gnu/packages/emacs-xyz.scm | 38 ++++++++++++++++++++++++++++++++++++++
gnu/packages/ocaml.scm | 11 +++++++++--
2 files changed, 47 insertions(+), 2 deletions(-)
@@ -135,6 +135,7 @@
#:use-module (gnu packages haskell-apps)
#:use-module (gnu packages ibus)
#:use-module (gnu packages ncurses)
+ #:use-module (gnu packages ocaml)
#:use-module (gnu packages python)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages telephony)
@@ -646,6 +647,43 @@ process, passing on the arguments as command line arguments.")
"Magit-annex adds a few git-annex operations to the Magit interface.")
(license license:gpl3+))))
+(define-public emacs-merlin
+ (package
+ (name "emacs-merlin")
+ (version "3.4.2")
+ (home-page "https://ocaml.github.io/merlin/")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/ocaml/merlin")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0i2nwkdh6cfzmnsdsr8aw86vs8j1k5jkjzrs61b9384wnffdbbmj"))))
+ (build-system emacs-build-system)
+ (propagated-inputs
+ `(("emacs-auto-complete" ,emacs-auto-complete)
+ ("emacs-company" ,emacs-company)
+ ("emacs-iedit" ,emacs-iedit)
+ ("ocaml-merlin" ,ocaml-merlin)))
+ (arguments
+ `(#:tests? #f ; No tests
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'setup-emacs-build
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((merlin (assoc-ref inputs "ocaml-merlin")))
+ (chdir "emacs")
+ (for-each make-file-writable (find-files "." "\\.el$"))
+ (emacs-substitute-variables "merlin.el"
+ ("merlin-command"
+ (string-append merlin "/bin/ocamlmerlin")))))))))
+ (synopsis "Context sensitive completion for OCaml in Emacs")
+ (description "Merlin is an editor service that provides modern IDE
+features for OCaml. This package provides the Emacs support for Merlin.")
+ (license license:expat)))
+
(define-public emacs-minions
(package
(name "emacs-minions")
@@ -4070,12 +4070,19 @@ documentation always stays up-to-date.")
`(("ocaml-dot-merlin-reader" ,ocaml-dot-merlin-reader)))
(arguments
`(#:package "merlin"
- #:test-target "tests"))
+ #:test-target "tests"
+ #:phases
+ ;; FIXME: Make merlin.vim into a separate package.
+ (modify-phases %standard-phases
+ (add-after 'install 'remove-emacs
+ (lambda* (#:key outputs #:allow-other-keys)
+ (delete-file-recursively
+ (string-append (assoc-ref outputs "out") "/share/emacs")))))))
(synopsis "Context sensitive completion for OCaml in Vim and Emacs")
(description "Merlin is an editor service that provides modern IDE
features for OCaml. Emacs and Vim support is provided out-of-the-box.
External contributors added support for Visual Studio Code, Sublime Text and
-Atom.")
+Atom. To install the emacs specific package, use @code{emacs-merlin}.")
(license license:expat)))
(define-public ocaml4.07-merlin
--
2.29.2