Skip to content

Instantly share code, notes, and snippets.

@cbilson
Last active February 6, 2018 17:25
Show Gist options
  • Save cbilson/54a873393095b1260a543b744803a506 to your computer and use it in GitHub Desktop.
Save cbilson/54a873393095b1260a543b744803a506 to your computer and use it in GitHub Desktop.
;;; ob-scriptcs.el --- org-babel functions for scriptcs evaluation
;; Authors: Chris Bilson
;; Keywords: literate programming, reproducible research
;; Homepage: http://orgmode.org
;;; Commentary:
;; Org-Babel support for evaluating scriptcs source code.
;;; Code:
(require 'ob)
(require 'ob-core)
(eval-when-compile (require 'cl))
(defvar org-babel-tangle-lang-exts)
(add-to-list 'org-babel-tangle-lang-exts '("scriptcs" . "csx"))
(defvar org-babel-scriptcs-command "scriptcs"
"ScriptCS command to run.")
(defvar org-babel-default-header-args:scriptcs '())
(defun org-babel-expand-body:scriptcs (body params) body)
(defun org-babel-execute:scriptcs (body params)
"Execute a block of Scriptcs code with Babel.
This function is called by `org-babel-execute-src-block'."
(let* ((in-file (org-babel-temp-file "scriptcs-" ".csx"))
(cmdline (or (cdr (assq :cmdline params)) ""))
(cmd (or (cdr (assq :cmd params)) org-babel-scriptcs-command)))
(with-temp-file in-file
(insert (org-babel-expand-body:scriptcs body params)))
(message "cmd: %s" cmd)
(message "cmdline: %s" cmdline)
(message "in-file: %s" in-file)
(message "body: %s" (org-babel-expand-body:scriptcs body params))
(org-babel-eval
(concat cmd " " cmdline
" -ScriptName " (org-babel-process-file-name in-file)) "")))
(provide 'ob-scriptcs)
;;; ob-scriptcs.el ends here
Console.Out.WriteLine("ohai");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment