diff mbox series

[bug#45575] gnu: Update ocaml-merlin

Message ID 8735zl4jsa.fsf_-_@asu.edu
State Accepted
Headers show
Series [bug#45575] gnu: Update ocaml-merlin | expand

Checks

Context Check Description
cbaines/submitting builds success
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

John Soo Dec. 31, 2020, 11:50 p.m. UTC
Hi Julien,

Julien Lepiller <julien@lepiller.eu> writes:

> thanks for the patches! I have pushed a series of patches from
> Pukkamustard a few days ago that already add ocaml-merlin for the
> latest OCaml compiler. Could you rebase your patches on master and
> check if any of your patches is still relevant?

Oops!  I have too many unmerged patches and rebasing is getting to be a
chore.  ocaml-merlin on master looks good to me.  The only thing I would
like to see is the emacs-merlin package.  Having emacs-merlin as a
package is nice because it takes advantage of the guix autoload
machinery.

Here's a rebased patch. I understand if it needs more thought.

Thanks a lot!

- John
diff mbox series

Patch

From f9b6926c9e15780aab978dabc7fd6f65365200cb 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     | 19 ++++++++++++++-----
 2 files changed, 52 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 2f8bc1c7f2..b49106dfa3 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -137,6 +137,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)
@@ -668,6 +669,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")
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 2df16e7cd2..71a3a870e6 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -3951,22 +3951,31 @@  format}.  @code{craml} is released as a single binary (called @code{craml}).")
         (base32
          "0i2nwkdh6cfzmnsdsr8aw86vs8j1k5jkjzrs61b9384wnffdbbmj"))))
     (build-system dune-build-system)
-    (arguments '(#:package "merlin"
-                 #:test-target "tests"))
+    (arguments
+     `(#:package "merlin"
+       #: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")))))))
     (inputs
      `(("ocaml-yojson" ,ocaml-yojson)
        ("ocaml-csexp" ,ocaml-csexp)
        ("ocaml-result" ,ocaml-result)))
     (native-inputs
-     `(("ocaml-dot-merlin-reader" ,ocaml-dot-merlin-reader) ; required for tests
-       ("ocaml-mdx" ,ocaml-mdx)
+     `(("ocaml-mdx" ,ocaml-mdx)
        ("jq" ,jq)))
+    (propagated-inputs
+     `(("ocaml-dot-merlin-reader" ,ocaml-dot-merlin-reader)))
     (home-page "https://ocaml.github.io/merlin/")
     (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)))
 
 ;; ocaml-merlin 3.4.2 can not be built with old version of dune used in
-- 
2.29.2