ob-core: Fix nil value of `org-babel-temporary-stable-directory'

* lisp/ob-core.el: Make sure that
`org-babel-temporary-stable-directory' is set to non-nil non-existent
directory.  Non-existent directory is required to avoid clashes when
multiple Emacs processes are running.

Fixes https://yhetil.org/emacs-devel/87sfnfhm6v.fsf@yandex.com
This commit is contained in:
Ihor Radchenko 2022-07-05 21:00:24 +08:00
parent 7135982022
commit bdf7afe20e
No known key found for this signature in database
GPG key ID: 6470762A7DA11D8B

View file

@ -3162,12 +3162,13 @@ Emacs shutdown."))
(or (and (boundp 'org-babel-temporary-stable-directory)
(file-exists-p org-babel-temporary-stable-directory)
org-babel-temporary-stable-directory)
(condition-case nil
(make-directory
(expand-file-name
"babel-stable"
(temporary-file-directory)))
(t nil)))
(let (dir)
(while (or (not dir) (file-exists-p dir))
(setq dir (expand-file-name
(format "babel-stable-%d" (random 1000))
(temporary-file-directory))))
(make-directory dir)
dir))
"Directory to hold temporary files created to execute code blocks.
Used by `org-babel-temp-file'. This directory will be removed on
Emacs shutdown."))