· August 2012 ·

LiveCode Node.JS Apps

Why should those geeky clojure and lisp types get to have all the fun?

Using js-comint and node you can easily livecode your node code, sending one expression or region at a time to be executed in an Emacs REPL.

For the TLDR, check out http://twitter.com/emacs/status/13134393723 and fix the node command, but it's pretty simple:

First, Install js-comint. Using el-get it's as simple as

el-get-install js-comint</code></pre>

Then, instead of the code in that tweet, add the following to your emacs init file:

(require 'js-comint)
(setq inferior-js-program-command "node") ;; not "node-repl"
;; Use your favorited js mode here:
(add-hook 'js3-mode-hook '(lambda ()
(local-set-key "\C-x\C-e"
(local-set-key "\C-\M-x"
(local-set-key "\C-cb"
(local-set-key "\C-c\C-b"
(local-set-key "\C-cl"

You don't have to, but you can manually start the REPL with M-x run-js

Then you're set. Just open a node file and start coding. As you go, you can send code to the REPL and see how it works.

This is especially useful for working with APIs, less-than-well-documented plugins and other black boxes where you need to poke around a bit to figure out how things work.

Sign in or sign up to add your response.