Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

org-babel new language

I'd like to run some code through a binary via stdin and paste the output. The language is foma, is there a fast way for that or do I have to write my own definition? I've tried http://sprunge.us/DjOV, but that gives me a if: Wrong type argument: stringp, (:colname-names).

like image 442
Reactormonk Avatar asked May 01 '12 22:05

Reactormonk


1 Answers

If foma could be run an a file (rather than STDIN), then simply evaluating the following function definition should work. This will write body to a temporary file, call foma on that file and return the output (collected from STDOUT).

(defun org-babel-execute:foma (body params)
  "Execute a block of Foma code with org-babel."
  (message "executing Foma source code block")
  (org-babel-eval "foma" body))

If foma insists on taking input through STDIN, then you could replace foma above with something like foma-helper where foma-helper is a shell script holding something like

#!/bin/sh
cat $1|foma

Hope this helps

like image 147
eschulte Avatar answered Oct 20 '22 12:10

eschulte