Ver código fonte

babel: wrapped `org-babel-make-remote-file-name' in conditional as `org-babel-maybe-remote-file'

Eric Schulte 15 anos atrás
pai
commit
a705bf5925

+ 2 - 3
contrib/babel/lisp/langs/org-babel-R.el

@@ -155,8 +155,7 @@ 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
-	     (if (file-remote-p default-directory) (org-babel-make-remote-file-name tmp-file) tmp-file))
+	    (org-babel-import-elisp-from-file (org-babel-maybe-remote-file tmp-file))
 	    column-names-p))))
     ;; comint session evaluation
     (org-babel-comint-in-buffer session
@@ -181,7 +180,7 @@ last statement in BODY, as elisp."
         (case result-type
           (value (org-babel-R-process-value-result
 		  (org-babel-import-elisp-from-file
-		   (if (file-remote-p default-directory) (org-babel-make-remote-file-name tmp-file) tmp-file))
+		   (org-babel-maybe-remote-file tmp-file))
 		  column-names-p))
           (output
 	   (flet ((extractor

+ 1 - 2
contrib/babel/lisp/langs/org-babel-python.el

@@ -179,8 +179,7 @@ last statement in BODY, as elisp."
                ;; (message "buffer=%s" (buffer-string)) ;; debugging
                (shell-command-on-region (point-min) (point-max) "python"))
              (let ((raw (with-temp-buffer
-			  (insert-file-contents
-			   (if (file-remote-p default-directory) (org-babel-make-remote-file-name tmp-file) tmp-file))
+			  (insert-file-contents (org-babel-maybe-remote-file tmp-file))
 			  (buffer-string))))
                (if (or (member "code" result-params) (member "pp" result-params))
                    raw

+ 1 - 2
contrib/babel/lisp/langs/org-babel-ruby.el

@@ -176,8 +176,7 @@ last statement in BODY, as elisp."
                ;; (message "buffer=%s" (buffer-string)) ;; debugging
                (shell-command-on-region (point-min) (point-max) "ruby"))
              (let ((raw (with-temp-buffer
-			  (insert-file-contents
-			   (if (file-remote-p default-directory) (org-babel-make-remote-file-name tmp-file) tmp-file))
+			  (insert-file-contents (org-babel-maybe-remote-file tmp-file))
 			  (buffer-string))))
                (if (or (member "code" result-params) (member "pp" result-params))
                    raw

+ 7 - 5
contrib/babel/lisp/org-babel.el

@@ -1103,11 +1103,13 @@ Fixes a bug in `tramp-handle-call-process-region'."
     ;; 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)))
+(defun org-babel-maybe-remote-file (file)
+  (if (file-remote-p default-directory)
+      (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))
+    file))
 
 (provide 'org-babel)
 ;;; org-babel.el ends here