emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: tsd@tsdye.com (Thomas S. Dye)
To: dougie smith <dsv2xm@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: how to evaluate javascript in code blocks
Date: Tue, 01 Jan 2013 19:13:29 -1000	[thread overview]
Message-ID: <m11ue49ngm.fsf@tsdye.com> (raw)
In-Reply-To: <CAGVSr0S2Y01VKeTK0FjSsf7ozm+xUuETebyHd-sgFDzqf4wPdw@mail.gmail.com> (dougie smith's message of "Tue, 1 Jan 2013 14:55:43 -0500")

dougie smith <dsv2xm@gmail.com> writes:
> i have installed nodejs
> not sure what to do next
>
> do i need an 'ob.javascript file?
>
> can't seem to find any docs.

AFAIK, the only documentation is in the file ob-js.el.  Back in 2011,
Eric Schulte welcomed patches to ob-js.el to support sessions with
node.  I don't think there has been any subsequent work on this front.

You'll need something like this in .emacs:

(org-babel-do-load-languages
 'org-babel-load-languages
 '((js . t)))

If you evaluate the following source code block, you can look at
localhost:8888 and see Hello World.  But, emacs is fully engaged until
you press Ctrl-G.

#+begin_src js :tangle hello.js
var http = require("http");

http.createServer(function(request, response) {
  response.writeHead(200, {"Content-Type": "text/plain"});
  response.write("Hello World");
  response.end();
}).listen(8888);
#+end_src

hth,
Tom
-- 
Thomas S. Dye
http://www.tsdye.com

      reply	other threads:[~2013-01-02  5:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-01 19:55 how to evaluate javascript in code blocks dougie smith
2013-01-02  5:13 ` Thomas S. Dye [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m11ue49ngm.fsf@tsdye.com \
    --to=tsd@tsdye.com \
    --cc=dsv2xm@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).