浏览代码

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
Ihor Radchenko 2 年之前
父节点
当前提交
bdf7afe20e
共有 1 个文件被更改,包括 7 次插入6 次删除
  1. 7 6
      lisp/ob-core.el

+ 7 - 6
lisp/ob-core.el

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