diff mbox series

[bug#57737,4/6] gnu: Add emacs-eval-in-repl packages.

Message ID 20220913134708.18554-4-ngraves@ngraves.fr
State Accepted
Headers show
Series [bug#57737,1/6] gnu: Add emacs-eval-in-repl. | expand

Checks

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

Commit Message

Nicolas Graves Sept. 13, 2022, 1:47 p.m. UTC
* gnu/packages/emacs-xyz.scm
  (emacs-eval-in-repl): New variable.
  (emacs-eval-in-repl-ielm): New variable.
  (emacs-eval-in-repl-cider): New variable.
  (emacs-eval-in-repl-slime): New variable.
  (emacs-eval-in-repl-geiser): New variable.
  (emacs-eval-in-repl-racket): New variable.
  (emacs-eval-in-repl-scheme): New variable.
  (emacs-eval-in-repl-hy): New variable.
  (emacs-eval-in-repl-python): New variable.
  (emacs-eval-in-repl-ruby): New variable.
  (emacs-eval-in-repl-sml): New variable.
  (emacs-eval-in-repl-ocaml): New variable.
  (emacs-eval-in-repl-prolog): New variable.
  (emacs-eval-in-repl-javascript): New variable.
  (emacs-eval-in-repl-shell): New variable.
  (emacs-eval-in-repl-iex): New variable.
  (emacs-eval-in-repl-erlang): New variable.
  (emacs-eval-in-repl-elm): New variable.
---
 gnu/packages/emacs-xyz.scm | 77 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)

Comments

M Sept. 13, 2022, 5:20 p.m. UTC | #1
On 13-09-2022 15:47, Nicolas Graves via Guix-patches via wrote:
> +      (description (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."))

As-is, this is not translatable. Proposal: use 'format' and 'G_'.

Greetings,
Maxime
\( Sept. 13, 2022, 5:22 p.m. UTC | #2
On Tue Sep 13, 2022 at 6:20 PM BST, Maxime Devos wrote:
> As-is, this is not translatable. Proposal: use 'format' and 'G_'.

Isn't this a package, which usually isn't translated anyway?

    -- (
Liliana Marie Prikler Sept. 13, 2022, 7:51 p.m. UTC | #3
Am Dienstag, dem 13.09.2022 um 18:22 +0100 schrieb (:
> On Tue Sep 13, 2022 at 6:20 PM BST, Maxime Devos wrote:
> > As-is, this is not translatable. Proposal: use 'format' and 'G_'.
> 
> Isn't this a package, which usually isn't translated anyway?
Package descriptions are marked as translatable, we're just running
short on translators :)

Also bikeshedding time: I think "make-emacs-eval-in-repl" or "emacs-
eval-in-repl-for-language" are more understandable names than "pack-
eval-in-repl".

Cheers
diff mbox series

Patch

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 9dfb2cfdb7..d7b79d30b8 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -27110,6 +27110,83 @@  (define-public emacs-eval-in-repl
 @item eval-in-repl-elm        for Elm
 @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 "geiser") "Racket/Scheme")
+     ((string= s "sml") "Standard ML")
+     ((string= s "iex") "Elixir")
+     ((string= s "ocaml") "OCaml")
+     (else (string-capitalize s))))
+
+(define (lang->inputs s)
+    (cond
+     ((string= s "Clojure") (list emacs-cider))
+     ((string= s "Common Lisp") (list emacs-slime))
+     ((string= s "Racket/Scheme") (list emacs-geiser))
+     ((string= s "Racket") (list emacs-racket-mode))
+     ((string= s "Hy") (list emacs-hy-mode))
+     ((string= s "Ruby") (list emacs-inf-ruby))
+     ((string= s "Standard ML") (list emacs-sml-mode))
+     ((string= s "OCaml") (list emacs-tuareg))
+     ((string= s "Javascript") (list emacs-js2-mode emacs-js-comint))
+     ((string= s "Elixir") (list emacs-elixir-mode emacs-alchemist))
+     ((string= s "Erlang") (list emacs-erlang))
+     ((string= s "Elm") (list emacs-elm-mode))
+     (else '())))
+
+(define (pack-eval-in-repl repl)
+  (let* ((lang (repl->lang repl))
+         (inputs (lang->inputs lang)))
+    (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) inputs))
+      (home-page "https://github.com/kaz-yos/eval-in-repl")
+      (synopsis "Consistent evaluation interface for Emacs Lisp REPLs for emacs")
+      (description (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       (pack-eval-in-repl "ielm"))
+(define-public emacs-eval-in-repl-cider      (pack-eval-in-repl "cider"))
+(define-public emacs-eval-in-repl-slime      (pack-eval-in-repl "slime"))
+(define-public emacs-eval-in-repl-geiser     (pack-eval-in-repl "geiser"))
+(define-public emacs-eval-in-repl-racket     (pack-eval-in-repl "racket"))
+(define-public emacs-eval-in-repl-scheme     (pack-eval-in-repl "scheme"))
+(define-public emacs-eval-in-repl-hy         (pack-eval-in-repl "hy"))
+(define-public emacs-eval-in-repl-python     (pack-eval-in-repl "python"))
+(define-public emacs-eval-in-repl-ruby       (pack-eval-in-repl "ruby"))
+(define-public emacs-eval-in-repl-sml        (pack-eval-in-repl "sml"))
+(define-public emacs-eval-in-repl-ocaml      (pack-eval-in-repl "ocaml"))
+(define-public emacs-eval-in-repl-prolog     (pack-eval-in-repl "prolog"))
+(define-public emacs-eval-in-repl-javascript (pack-eval-in-repl "javascript"))
+(define-public emacs-eval-in-repl-shell      (pack-eval-in-repl "shell"))
+(define-public emacs-eval-in-repl-iex        (pack-eval-in-repl "iex"))
+(define-public emacs-eval-in-repl-erlang     (pack-eval-in-repl "erlang"))
+(define-public emacs-eval-in-repl-elm        (pack-eval-in-repl "elm"))
+
 (define-public emacs-eval-sexp-fu-el
   (package
     (name "emacs-eval-sexp-fu-el")