org-babel new language
Asked Answered
L

1

5

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

Lustful answered 1/5, 2012 at 22:47 Comment(0)
L
8

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

Lavernalaverne answered 2/5, 2012 at 17:30 Comment(1)
There's an -f which evaluates a file, so this should work (with foma -f I assume)Lustful

© 2022 - 2024 — McMap. All rights reserved.