[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] [BABEL] help adding a language, please?
From: |
Eric Schulte |
Subject: |
Re: [Orgmode] [BABEL] help adding a language, please? |
Date: |
Thu, 22 Jul 2010 15:30:59 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Hi,
address@hidden writes:
> Hi guys,
>
> Org-mode newbie, here. I'd like to add newlisp to the list
> of languages that babel supports.
That's fantastic.
> I got ob-template.el and replaced all occurrences of "template" with
> "newlisp."
>
> When I try to execute a code block, it fails, looking for
> "inf-newlisp." That's "inferior-mode," right? Can I work
> around that somehow? There is a newlisp mode available
> here:
> http://github.com/may/newlisp-mode
> I'm running Org-mode 7.01.
>
This depends if you'd rather execute newlisp code blocks in a "session"
(i.e. in an inferior newlisp buffer, which would require newlisp-mode),
or if you'd rather evaluate newlisp externally. Most languages support
both types of evaluation, but I'd recommend starting with a single
execution mode (whichever will be simpler to implement), and then
incrementally adding functionality.
I just installed newlisp locally, it looks like a nice language, I may
start using this as I've been looking for a light-weight lisp/scheme for
small scripting tasks.
I just put together the following, which works for me as a simple
evaluation function -- note this takes the "external evaluation" path.
--8<---------------cut here---------------start------------->8---
(defun org-babel-execute:newlisp (body params)
(let ((tmp-file (make-temp-file "org-babel-newlisp")))
(with-temp-file tmp-file
(insert
(format "(println (begin\n%s\n))\n(exit)" body)))
(prog1 (org-babel-eval (format "newlisp -f %s" tmp-file) "")
(delete-file tmp-file))))
--8<---------------cut here---------------end--------------->8---
Note, this doesn't make use of *any* of Babels header argument
functionality, but it could serve as a place to start.
>
> Org-mode is great! I sure hope you guys are tolerant of
> stupid questions, because I've got a bunch of them.
> :-)
Please don't be shy about asking questions, we can be a very
understanding bunch.
Happy Hacking -- Eric