Question

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).

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top