cosmetic: removing commented debugging code; shortening some lines
This commit is contained in:
parent
3c932ad603
commit
a06c910f37
|
@ -121,12 +121,11 @@ last statement in BODY."
|
||||||
(case result-type
|
(case result-type
|
||||||
(output
|
(output
|
||||||
(with-temp-file in-tmp-file (insert body))
|
(with-temp-file in-tmp-file (insert body))
|
||||||
;; (message "R --slave --no-save < '%s' > '%s'" in-tmp-file out-tmp-file)
|
(shell-command-to-string (format "R --slave --no-save < '%s' > '%s'"
|
||||||
(shell-command-to-string (format "R --slave --no-save < '%s' > '%s'" in-tmp-file out-tmp-file)))
|
in-tmp-file out-tmp-file)))
|
||||||
(value
|
(value
|
||||||
(with-temp-file in-tmp-file
|
(with-temp-file in-tmp-file
|
||||||
(insert (format org-babel-R-wrapper-method body out-tmp-file)))
|
(insert (format org-babel-R-wrapper-method body out-tmp-file)))
|
||||||
;; (message "R --no-save < '%s'" in-tmp-file)
|
|
||||||
(shell-command (format "R --no-save < '%s'" in-tmp-file))))
|
(shell-command (format "R --no-save < '%s'" in-tmp-file))))
|
||||||
(with-temp-buffer (insert-file-contents out-tmp-file) (buffer-string)))
|
(with-temp-buffer (insert-file-contents out-tmp-file) (buffer-string)))
|
||||||
;; comint session evaluation
|
;; comint session evaluation
|
||||||
|
@ -135,13 +134,18 @@ last statement in BODY."
|
||||||
(last-value-eval
|
(last-value-eval
|
||||||
(format "write.table(.Last.value, file=\"%s\", sep=\"\\t\", na=\"nil\",row.names=FALSE, col.names=FALSE, quote=FALSE)"
|
(format "write.table(.Last.value, file=\"%s\", sep=\"\\t\", na=\"nil\",row.names=FALSE, col.names=FALSE, quote=FALSE)"
|
||||||
tmp-file))
|
tmp-file))
|
||||||
(full-body (mapconcat #'org-babel-chomp (list body last-value-eval org-babel-R-eoe-indicator) "\n"))
|
(full-body (mapconcat #'org-babel-chomp
|
||||||
|
(list body last-value-eval org-babel-R-eoe-indicator) "\n"))
|
||||||
(raw (org-babel-comint-with-output buffer org-babel-R-eoe-output nil
|
(raw (org-babel-comint-with-output buffer org-babel-R-eoe-output nil
|
||||||
(insert full-body) (inferior-ess-send-input)))
|
(insert full-body) (inferior-ess-send-input)))
|
||||||
(results (let ((broke nil))
|
(results
|
||||||
(delete nil (mapcar (lambda (el)
|
(let ((broke nil))
|
||||||
|
(delete
|
||||||
|
nil
|
||||||
|
(mapcar (lambda (el)
|
||||||
(if (or broke
|
(if (or broke
|
||||||
(and (string-match (regexp-quote org-babel-R-eoe-output) el) (setq broke t)))
|
(and (string-match (regexp-quote org-babel-R-eoe-output)
|
||||||
|
el) (setq broke t)))
|
||||||
nil
|
nil
|
||||||
(if (= (length el) 0)
|
(if (= (length el) 0)
|
||||||
nil
|
nil
|
||||||
|
@ -151,7 +155,8 @@ last statement in BODY."
|
||||||
(mapcar #'org-babel-trim raw))))))
|
(mapcar #'org-babel-trim raw))))))
|
||||||
(case result-type
|
(case result-type
|
||||||
(output (org-babel-trim (mapconcat #'identity results "\n")))
|
(output (org-babel-trim (mapconcat #'identity results "\n")))
|
||||||
(value (org-babel-trim (with-temp-buffer (insert-file-contents tmp-file) (buffer-string))))
|
(value (org-babel-trim
|
||||||
|
(with-temp-buffer (insert-file-contents tmp-file) (buffer-string))))
|
||||||
(t (reverse results)))))))
|
(t (reverse results)))))))
|
||||||
|
|
||||||
(provide 'org-babel-R)
|
(provide 'org-babel-R)
|
||||||
|
|
Loading…
Reference in New Issue