@@ -140,6 +140,7 @@ (define-module (gnu packages emacs-xyz)
#:use-module (guix download)
#:use-module (guix bzr-download)
#:use-module (guix gexp)
+ #:use-module (guix i18n)
#:use-module (guix git-download)
#:use-module (guix hg-download)
#:use-module (guix build-system gnu)
@@ -240,6 +241,8 @@ (define-module (gnu packages emacs-xyz)
#:use-module (gnu packages photo)
#:use-module (gnu packages uml)
#:use-module (gnu packages finance)
+ #:use-module (gnu packages ocaml)
+ #:use-module (gnu packages erlang)
#:use-module (guix utils)
#:use-module (srfi srfi-1)
#:use-module (ice-9 match))
@@ -27152,6 +27155,89 @@ (define-public emacs-eval-in-repl
@end itemize")
(license license:expat)))
+(define (repl->lang s)
+ (cond
+ ((string= s "ielm") "Emacs Lisp")
+ ((string= s "cider") "Clojure")
+ ((string= s "slime") "Common Lisp")
+ ((string= s "sly") "Common Lisp")
+ ((string= s "geiser") "Racket/Scheme")
+ ((string= s "sml") "Standard ML")
+ ((string= s "iex") "Elixir")
+ ((string= s "ocaml") "OCaml")
+ (else (string-capitalize s))))
+
+(define (repl->inputs s)
+ (cond
+ ((string= s "cider") '("emacs-cider"))
+ ((string= s "slime") '("emacs-slime"))
+ ((string= s "sly") '("emacs-sly"))
+ ((string= s "geiser") '("emacs-geiser"))
+ ((string= s "racket") '("emacs-racket-mode"))
+ ((string= s "hy") '("emacs-hy-mode"))
+ ((string= s "ruby") '("emacs-inf-ruby"))
+ ((string= s "sml") '("emacs-sml-mode"))
+ ((string= s "ocaml") '("emacs-tuareg"))
+ ((string= s "javascript") '("emacs-js2-mode" "emacs-js-comint"))
+ ((string= s "iex") '("emacs-elixir-mode" "emacs-alchemist"))
+ ((string= s "erlang") '("emacs-erlang"))
+ ((string= s "elm") '("emacs-elm-mode"))
+ ((string= s "lua") '("emacs-lua-mode"))
+ (else '())))
+
+(define (make-emacs-eval-in-repl repl)
+ (let* ((lang (repl->lang repl))
+ (inputs (repl->inputs repl)))
+ (package
+ (name (string-append "emacs-eval-in-repl-" repl))
+ (version "0.9.7")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/kaz-yos/eval-in-repl")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1mrssbl0wyc6iij8zk1y3h9bd3rv53nnrxsij7fn67l1m4z0clyn"))))
+ (build-system emacs-build-system)
+ (arguments
+ `(#:include (list ,(string-append "eval-in-repl-" repl "\\.el"))))
+ (propagated-inputs (append (list emacs-eval-in-repl)
+ (map specification->package+output inputs)))
+ (home-page "https://github.com/kaz-yos/eval-in-repl")
+ (synopsis "Consistent evaluation interface for Emacs Lisp REPLs for emacs")
+ (description (G_ (string-append "\
+This package provides a consistent ESS-like evaluation interface for
+" lang " REPLs. Emacs Speaks Statistics (ESS) package has a nice function
+called @code{ess-eval-region-or-line-and-step}, which is assigned to
+C-RET. This function sends a line or a selected region to the corresponding
+shell (R, Julia, Stata, etc) visibly. It also start up a shell if there is
+none.")))
+ (license license:expat))))
+
+(define-public emacs-eval-in-repl-ielm (make-emacs-eval-in-repl "ielm"))
+(define-public emacs-eval-in-repl-cider (make-emacs-eval-in-repl "cider"))
+(define-public emacs-eval-in-repl-slime (make-emacs-eval-in-repl "slime"))
+(define-public emacs-eval-in-repl-sly (make-emacs-eval-in-repl "sly"))
+(define-public emacs-eval-in-repl-geiser (make-emacs-eval-in-repl "geiser"))
+(define-public emacs-eval-in-repl-racket (make-emacs-eval-in-repl "racket"))
+(define-public emacs-eval-in-repl-scheme (make-emacs-eval-in-repl "scheme"))
+(define-public emacs-eval-in-repl-hy (make-emacs-eval-in-repl "hy"))
+(define-public emacs-eval-in-repl-python (make-emacs-eval-in-repl "python"))
+(define-public emacs-eval-in-repl-ruby (make-emacs-eval-in-repl "ruby"))
+(define-public emacs-eval-in-repl-sml (make-emacs-eval-in-repl "sml"))
+(define-public emacs-eval-in-repl-ocaml (make-emacs-eval-in-repl "ocaml"))
+(define-public emacs-eval-in-repl-prolog (make-emacs-eval-in-repl "prolog"))
+(define-public emacs-eval-in-repl-shell (make-emacs-eval-in-repl "shell"))
+(define-public emacs-eval-in-repl-iex (make-emacs-eval-in-repl "iex"))
+(define-public emacs-eval-in-repl-erlang (make-emacs-eval-in-repl "erlang"))
+(define-public emacs-eval-in-repl-elm (make-emacs-eval-in-repl "elm"))
+(define-public emacs-eval-in-repl-lua (make-emacs-eval-in-repl "lua"))
+(define-public emacs-eval-in-repl-javascript
+ (make-emacs-eval-in-repl "javascript"))
+
+
(define-public emacs-eval-sexp-fu-el
(package
(name "emacs-eval-sexp-fu-el")