From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: [BABEL] help adding a language, please? Date: Thu, 22 Jul 2010 15:30:59 -0700 Message-ID: <871vavi1xb.fsf@gmail.com> References: <20100722151308.17057f89@bigblessing.tville> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=43056 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oc4If-0000vr-5H for emacs-orgmode@gnu.org; Thu, 22 Jul 2010 18:31:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oc4Id-0000Us-S2 for emacs-orgmode@gnu.org; Thu, 22 Jul 2010 18:31:33 -0400 Received: from mail-pz0-f41.google.com ([209.85.210.41]:58650) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oc4Id-0000Uc-NQ for emacs-orgmode@gnu.org; Thu, 22 Jul 2010 18:31:31 -0400 Received: by pzk33 with SMTP id 33so6509711pzk.0 for ; Thu, 22 Jul 2010 15:31:30 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: scrawler@gmail.com Cc: Org Mode Hi, scrawler@gmail.com 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