1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-21 06:55:35 +00:00

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:
Ihor Radchenko 2022-10-09 12:26:37 +08:00
parent ba8fbd0cda
commit f4149681ee
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
4 changed files with 12 additions and 3 deletions

View File

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

View File

@ -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))))

View File

@ -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)

View File

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