From 7037a45f3504a8d95019bd2b496a919081e85331 Mon Sep 17 00:00:00 2001 From: Suhail Shergill 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