1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-12-26 10:49:38 +00:00

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
This commit is contained in:
Suhail Shergill 2013-03-23 19:26:31 -04:00 committed by Bastien Guerry
parent 3abd5ef707
commit 3b2abfce7b

View File

@ -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."