From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: [babel] - Support for Groovy Date: Fri, 19 Mar 2010 15:29:02 -0400 Message-ID: <87eijgrtz5.fsf@stats.ox.ac.uk> References: <211769421003191046x18b4ae74u888c59053462b72c@mail.gmail.com> <87mxy4rvry.fsf@stats.ox.ac.uk> <87ljdop2ek.wl%ucecesf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nshsc-0000ia-Pm for emacs-orgmode@gnu.org; Fri, 19 Mar 2010 15:29:10 -0400 Received: from [140.186.70.92] (port=38805 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nshsb-0000gF-A1 for emacs-orgmode@gnu.org; Fri, 19 Mar 2010 15:29:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NshsZ-0001mi-6f for emacs-orgmode@gnu.org; Fri, 19 Mar 2010 15:29:08 -0400 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:40391) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NshsY-0001mH-Tl for emacs-orgmode@gnu.org; Fri, 19 Mar 2010 15:29:07 -0400 In-Reply-To: <87ljdop2ek.wl%ucecesf@ucl.ac.uk> (Eric S. Fraga's message of "Fri, 19 Mar 2010 18:55:15 +0000") 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: e.fraga@ucl.ac.uk Cc: emacs-orgmode@gnu.org Eric S Fraga writes: > On Fri, 19 Mar 2010 14:50:09 -0400, Dan Davison = wrote: >>=20 >> Nathan Neff writes: >>=20 >> > I'm trying to write an org-babel-groovy.el file, and have read through= the >> > org-babel-template.el and org-babel-template.org files. > > [...] > >> > =C2=A0 (Ex: usage:=C2=A0 groovy blah blah blah) >> > >>=20 >> Hi Nate, >>=20 >> > I suspect that this is because I don't have a major-mode for Groovy in= stalled. >>=20 >> No, that's not the problem. This should be easy to fix... we just need >> to know how to get groovy to read commands from standard input. I.e. how >> do we do the groovy equivalent of this: > > Can you not simply put the commands into a file and then run groovy on > that given that groovy obviously expects a file (see usage above)? I > believe that's what you have done with some of the other babel > languages? It's what I did for my own very clumsy and limited maxima > and octave interfaces... We could, but I had recently settled on a consistent approach using shell-command-on-region across languages. The main thing is that this works straightforwardly with tramp when code is executing on a remote machine, plus we have a consistent way of dealing with stderr and stdout. But then, isn't there something about consistency and hobgoblins and small minds. So yes, if groovy can't take commands on stdin then this seems to work: (defun org-babel-groovy-evaluate (session body &optional result-type) "Evaluate groovy code in BODY" ;; external process evaluation (let ((infile (make-temp-file "org_babel_groovy_input_"))) (save-excursion (with-temp-buffer (with-temp-file infile (insert body)) ;; (message "buffer=3D%s" (buffer-string)) ;; debugging (shell-command (format "groovy %s" infile) (current-buffer)) (buffer-string))))) Nate -- if you haven't then could you sign FSF copyright papers for Emacs, so we can add your module? Eric -- would you your maxima (and jython) code to go in org-babel? (We'd like it) Dan