admin管理员组

文章数量:1193728

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.

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.

Share Improve this question asked Feb 25, 2012 at 2:26 InaimathiInaimathi 14.1k11 gold badges53 silver badges95 bronze badges 1
  • Can you give an example JavaScript you'd like to run? What operating system? – Brigand Commented Feb 25, 2012 at 2:55
Add a comment  | 

4 Answers 4

Reset to default 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

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

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

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.

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

本文标签: Emacs runjavascriptStack Overflow