org-babel: Fix usage of `org-babel-temporary-directory'
* lisp/ob-core.el (org-babel-temp-directory): New macro, returning suitable temporary directory. The macro considers remote `default-directory' and nil values of `org-babel-temporary-directory'. * lisp/ob-gnuplot.el (org-babel-gnuplot-process-vars): * lisp/ob-java.el (org-babel-execute:java): * lisp/ob-processing.el (org-babel-processing-view-sketch): Use the new macro. Reported-by: Christian Köstlin <christian.koestlin@gmail.com>
This commit is contained in:
parent
ba8fbd0cda
commit
f4149681ee
|
@ -3273,6 +3273,15 @@ Emacs shutdown.")
|
|||
,scalar-form
|
||||
,@table-forms))))
|
||||
|
||||
(defmacro org-babel-temp-directory ()
|
||||
"Return temporary directory suitable for `default-directory'."
|
||||
`(if (file-remote-p default-directory)
|
||||
org-babel-remote-temporary-directory
|
||||
(or (and org-babel-temporary-directory
|
||||
(file-exists-p org-babel-temporary-directory)
|
||||
org-babel-temporary-directory)
|
||||
temporary-file-directory)))
|
||||
|
||||
(defun org-babel-temp-file (prefix &optional suffix)
|
||||
"Create a temporary file in the `org-babel-temporary-directory'.
|
||||
Passes PREFIX and SUFFIX directly to `make-temp-file' with the
|
||||
|
|
|
@ -106,7 +106,7 @@ code."
|
|||
(file-remote-p val) ;; check if val is a remote file
|
||||
(file-exists-p val)) ;; call to file-exists-p is slow, maybe remove it
|
||||
(let* ((local-name (concat ;; create a unique filename to avoid multiple downloads
|
||||
org-babel-temporary-directory
|
||||
(org-babel-temp-directory)
|
||||
"/gnuplot/"
|
||||
(file-remote-p val 'host)
|
||||
(org-babel-local-file-name val))))
|
||||
|
|
|
@ -193,7 +193,7 @@ replaced in this string.")
|
|||
(concat
|
||||
(file-remote-p default-directory)
|
||||
org-babel-remote-temporary-directory)
|
||||
org-babel-temporary-directory)
|
||||
(org-babel-temp-directory))
|
||||
default-directory)))
|
||||
;; the dir to write the source file
|
||||
(packagedir (if (and (not run-from-temp) packagename)
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
;; make-temp-file is repeated until no hyphen is in the
|
||||
;; name; also sketch dir name must be the same as the
|
||||
;; basename of the sketch file.
|
||||
(let* ((temporary-file-directory org-babel-temporary-directory)
|
||||
(let* ((temporary-file-directory (org-babel-temp-directory))
|
||||
(sketch-dir
|
||||
(let (sketch-dir-candidate)
|
||||
(while
|
||||
|
|
Loading…
Reference in New Issue