js-comint.el is a comint mode for emacs which allows you to run a compatible javascript repl such as Spidermonkey or Rhino inside of emacs. At first blush this may seem a little useless, but when paired with Steve Yegge's js2-mode it becomes a useful way of testing non-html-centric javascript code while editing it.

For example, put js-comint.el in your load-path, and then add the following lines to your .emacs:

(require 'js-comint)
(setq inferior-js-program-command "/usr/bin/java org.mozilla.javascript.tools.shell.Main")
(add-hook 'js2-mode-hook '(lambda () 
			    (local-set-key "\C-x\C-e" 'js-send-last-sexp)
			    (local-set-key "\C-\M-x" 'js-send-last-sexp-and-go)
			    (local-set-key "\C-cb" 'js-send-buffer)
			    (local-set-key "\C-c\C-b" 'js-send-buffer-and-go)
			    (local-set-key "\C-cl" 'js-load-file-and-go)
You can then try out any piece of javascript code in a javascript interpreter by simply typing C-x C-e at the end of the sexp. js-comint will use js2-mode to find the last sexp, run Rhino, and load the sexp it just found into the interpreter. This, it turns out, is extremely useful, particularly when you're writing non-domish, algorithmic javascript.

The latest version of js-comint.el can be downloaded here.
Related projects
If the js-comint.el isn't enough to convince you to try it out by itself, consider checking out js-test.el which is a companion piece of elisp which sits above js-comint.el and, when used in conjunction with a pure javascript unit testing library, can run tests from your emacs javascript buffer.
Hosting generously provided by: SourceForge.net Logo