]> git.donarmstrong.com Git - bin.git/commitdiff
add eval_r command
authorDon Armstrong <don@donarmstrong.com>
Sun, 5 Oct 2014 01:54:51 +0000 (18:54 -0700)
committerDon Armstrong <don@donarmstrong.com>
Sun, 5 Oct 2014 01:54:51 +0000 (18:54 -0700)
eval_r [new file with mode: 0755]

diff --git a/eval_r b/eval_r
new file mode 100755 (executable)
index 0000000..ef0ad73
--- /dev/null
+++ b/eval_r
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+TMP="$(mktemp -d)"
+
+trap "rm -f '$TMP'/file; rmdir '$TMP'" EXIT
+
+cat - > "$TMP"/file;
+
+( emacsclient -s R --eval "(with-temp-buffer (insert-file-contents \"$TMP/file\")
+(setq ess-eval-visibly t)
+(setq ess-eval-visibly-p t)
+(setq ess-language \"R\")
+(setq ess-dialect \"R\")
+(ess-eval-region (point-min) (point-max) nil))" >/dev/null 2>&1 & );
+
+trap - EXIT;
+( sleep 2s;
+  rm -f "$TMP/file";
+  rmdir "$TMP";
+) &
+
+