Emacs run-javascript?
Asked Answered
G

4

15

Is there such a thing as a javascript equivalent to run-python et al available for Emacs 23 or later? I'd like to run a JS REPL from within Emacs with the standard load-definition/load-file bindings.

Goddard answered 25/2, 2012 at 2:26 Comment(1)
Can you give an example JavaScript you'd like to run? What operating system?Atiana
C
6

Yes. Check out js-comint.el, which is easily installable via Marmalade or MELPA.

As @phils mentions, MozRepl is also worth a look.

Ceruse answered 25/2, 2012 at 9:11 Comment(0)
P
9

Oh, this is cool. (Thanks for the question!)

I've just learned about MozRepl -- a Mozilla/Firefox extension -- via this answer to a related question, and Emacs support for MozRepl is already available.

  1. Install the browser extension and the Emacs library
  2. Start MozRepl from the browser using the Tools -> MozRepl menu
  3. M-x run-mozilla RET

See also http://www.emacswiki.org/emacs/MozRepl

Paulin answered 25/2, 2012 at 7:40 Comment(0)
C
6

Yes. Check out js-comint.el, which is easily installable via Marmalade or MELPA.

As @phils mentions, MozRepl is also worth a look.

Ceruse answered 25/2, 2012 at 9:11 Comment(0)
G
5

There's a project called skewer-mode that I've been using for this lately. For the lispers, it's basically SLIME with a browser instead of a Lisp system on the other end. It's available from MELPA and includes only Emacs libraries. Meaning, all you need to use it is Emacs and a browser.

Goddard answered 4/12, 2013 at 17:23 Comment(0)
S
2

There's also a WSH-based Javascript REPL. Really easy to run on any emacs on Windows.

http://www.emacswiki.org/emacs/JavascriptShell

  • Start a Javascript "shell" in an emacs buffer. Type in Javascript and see it run.
  • It allows you to define a profile, to load one or more JS modules with every shell you run. So if you want to fiddle around with json2.js, you can load it into the shell by default. You can also load in array extensions, string extensions, or whatever utility package you have.
  • Includes simple command completion. If I type in var str = "This is a string"; then try to complete (via the TAB character) on str., I will get a list of all the string extension methods. The same thing works for any other type of object, even custom objects you define.
  • Depends on Cscript.exe, so nothing to install beyond the .el file. Obviously this means it runs on Windows only.

It's also in the Marmalade repo - http://marmalade-repo.org/packages/jsshell

Survive answered 28/3, 2012 at 8:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.