diff options
author | Suhail Shergill <suhailshergill@gmail.com> | 2013-03-23 19:26:31 -0400 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2013-03-25 06:09:14 +0100 |
commit | 3b2abfce7be17d6b381806875afa2e21cf16b0f2 (patch) | |
tree | 533d81f27e26137cb06cab8017d124ab766fc7be | |
parent | 3abd5ef70789516481c3ea192c90d3a6ab30b5b1 (diff) | |
download | org-mode-3b2abfce7be17d6b381806875afa2e21cf16b0f2.tar.gz |
bugfix: fix `org-babel-execute-src-block' on remote hosts
* lisp/ob-core.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
-rw-r--r-- | lisp/ob-core.el | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 741beec..a63f77e 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -2641,14 +2641,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." |