[PATCH] bugfix: fix `org-babel-execute-src-block' on remote hosts

  • Download Gist
0001-bugfix-fix-org-babel-execute-src-block-on-remote-hos.diff
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
From 7037a45f3504a8d95019bd2b496a919081e85331 Mon Sep 17 00:00:00 2001
From: Suhail Shergill <suhailshergill@gmail.com>
Date: Sat, 23 Mar 2013 19:26:31 -0400
Subject: [PATCH] bugfix: fix `org-babel-execute-src-block' on remote hosts
 
* lisp/ob.el (org-babel-temp-file): For remote hosts, modify the prefix
and leave `temporary-file-directory' unchanged.
 
The reason setting `temporary-file-directory' doesn't work here is
because `make-temp-file' recursively calls itself (indirectly).
Modifying `temporary-file-directly', affects the recursive calls as well,
which results in a "No such file file or directory" error.
 
The fix is to leave `temporary-file-directory' unaltered, for remote
hosts, and instead modifying the 'prefix' argument to `make-temp-file'
appropriately.
 
TINYCHANGE
---
lisp/ob.el | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
 
diff --git a/lisp/ob.el b/lisp/ob.el
index 7245714..1493355 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -2547,14 +2547,17 @@ Emacs shutdown."))
Passes PREFIX and SUFFIX directly to `make-temp-file' with the
value of `temporary-file-directory' temporarily set to the value
of `org-babel-temporary-directory'."
- (let ((temporary-file-directory
- (if (file-remote-p default-directory)
- (concat (file-remote-p default-directory) "/tmp")
+ (if (file-remote-p default-directory)
+ (let ((prefix
+ (concat (file-remote-p default-directory)
+ (expand-file-name prefix temporary-file-directory))))
+ (make-temp-file prefix nil suffix))
+ (let ((temporary-file-directory
(or (and (boundp 'org-babel-temporary-directory)
(file-exists-p org-babel-temporary-directory)
org-babel-temporary-directory)
- temporary-file-directory))))
- (make-temp-file prefix nil suffix)))
+ temporary-file-directory)))
+ (make-temp-file prefix nil suffix))))
(defun org-babel-remove-temporary-directory ()
"Remove `org-babel-temporary-directory' on Emacs shutdown."
--
1.7.10.4

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.