[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to use ejacs to eval a file as with command line driven interpr
From: |
Xah Lee |
Subject: |
Re: how to use ejacs to eval a file as with command line driven interpreters |
Date: |
Sun, 11 Jan 2009 08:20:12 -0800 (PST) |
User-agent: |
G2/1.0 |
On Jan 9, 7:09 pm, Kevin Rodgers <kevin.d.rodg...@gmail.com> wrote:
> XahLeewrote:
> > there's Stevey Yegge's javascript interpreter written in elisp.
> >http://code.google.com/p/ejacs/
>
> > by default it runs in emacs as a command line console.
>
> > my question is, is it possible to run ejacs with a file?
>
> > e.g. i have a file x.js, which i can run in shell with spidermonkey
> > like this:
> > js x.js
>
> > i wish to be able to use ejacs to eval a file. Otherwise it wouldn't
> > be useful to me.
>
> http://code.google.com/p/ejacs/wiki/README
>
> There is also a console load() function that takes as an argument the
> path to a JavaScript source file to load and evaluate.
Thanks Kevin. I missed that.
... haven't spend time on this... but “load” is actually just a
function of js, much like “include” in other lang.
i'm hoping to have something like eval-region and eval-buffer for it.
Using the “load” function to implement this might mean a bit of a
hack.
... looking at the source code, looks like js-evaluate in the right
thing to call. Just did this:
(js-evaluate "print(4);")
4
seems it insert result and consol prompt into the current buffer, as
if expecting it is called in a console... a bit more look i found js-
eval-buffer:
// (js-eval-buffer (current-buffer))
print(3);
but got error
let: No catch for tag: js-THROW, throw
Xah
∑ http://xahlee.org/
☄