diff --git a/contrib/babel/lisp/langs/org-babel-R.el b/contrib/babel/lisp/langs/org-babel-R.el index dd9e4419d..5469023e4 100644 --- a/contrib/babel/lisp/langs/org-babel-R.el +++ b/contrib/babel/lisp/langs/org-babel-R.el @@ -155,7 +155,9 @@ last statement in BODY, as elisp." body tmp-file (if column-names-p "TRUE" "FALSE"))) (shell-command-on-region (point-min) (point-max) "R --no-save" 'replace)) (org-babel-R-process-value-result - (org-babel-import-elisp-from-file out-tmp-file) column-names-p)))) + (org-babel-import-elisp-from-file + (if (file-remote-p default-directory) (org-babel-make-remote-file-name tmp-file) tmp-file)) + column-names-p)))) ;; comint session evaluation (org-babel-comint-in-buffer session (let* ((tmp-file (make-temp-file "org-babel-R")) @@ -178,7 +180,9 @@ last statement in BODY, as elisp." broke results) (case result-type (value (org-babel-R-process-value-result - (org-babel-import-elisp-from-file tmp-file) column-names-p)) + (org-babel-import-elisp-from-file + (if (file-remote-p default-directory) (org-babel-make-remote-file-name tmp-file) tmp-file)) + column-names-p)) (output (flet ((extractor (el) diff --git a/contrib/babel/lisp/langs/org-babel-python.el b/contrib/babel/lisp/langs/org-babel-python.el index aaf58a0a1..52cd78193 100644 --- a/contrib/babel/lisp/langs/org-babel-python.el +++ b/contrib/babel/lisp/langs/org-babel-python.el @@ -178,7 +178,10 @@ last statement in BODY, as elisp." tmp-file)) ;; (message "buffer=%s" (buffer-string)) ;; debugging (shell-command-on-region (point-min) (point-max) "python")) - (let ((raw (with-temp-buffer (insert-file-contents tmp-file) (buffer-string)))) + (let ((raw (with-temp-buffer + (insert-file-contents + (if (file-remote-p default-directory) (org-babel-make-remote-file-name tmp-file) tmp-file)) + (buffer-string)))) (if (or (member "code" result-params) (member "pp" result-params)) raw (org-babel-python-table-or-string raw))))))) diff --git a/contrib/babel/lisp/langs/org-babel-ruby.el b/contrib/babel/lisp/langs/org-babel-ruby.el index 1cac05cb3..fc62d0a99 100644 --- a/contrib/babel/lisp/langs/org-babel-ruby.el +++ b/contrib/babel/lisp/langs/org-babel-ruby.el @@ -175,8 +175,10 @@ last statement in BODY, as elisp." org-babel-ruby-wrapper-method) body tmp-file)) ;; (message "buffer=%s" (buffer-string)) ;; debugging (shell-command-on-region (point-min) (point-max) "ruby")) - (let ((raw (with-temp-buffer (insert-file-contents tmp-file) - (buffer-string)))) + (let ((raw (with-temp-buffer + (insert-file-contents + (if (file-remote-p default-directory) (org-babel-make-remote-file-name tmp-file) tmp-file)) + (buffer-string)))) (if (or (member "code" result-params) (member "pp" result-params)) raw (org-babel-ruby-table-or-string raw))))))) diff --git a/contrib/babel/lisp/org-babel.el b/contrib/babel/lisp/org-babel.el index 9dbed233a..4bc4cdfde 100644 --- a/contrib/babel/lisp/org-babel.el +++ b/contrib/babel/lisp/org-babel.el @@ -1102,5 +1102,12 @@ Fixes a bug in `tramp-handle-call-process-region'." ;; call-process-region-original is the original emacs definition. It ;; is in scope from the let binding in org-babel-execute-src-block (apply call-process-region-original start end program delete buffer display args))) + +(defun org-babel-make-remote-file-name (file) + (let* ((vec (tramp-dissect-file-name default-directory)) + (user (tramp-file-name-user vec)) + (host (tramp-file-name-host vec))) + (concat "/" user (when user "@") host ":" file))) + (provide 'org-babel) ;;; org-babel.el ends here