Fix vanilla sandbox creating too many temp files

On every execution.
This commit is contained in:
Henrik Lissner 2018-07-02 23:32:11 +02:00
parent 9756a0a18c
commit 1530cdbdb6
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -128,9 +128,9 @@ branch and commit."
(defun doom--run-vanilla-sandbox ()
"TODO"
(interactive)
(when (equal (buffer-name) "*doom:vanilla-sandbox*")
(let ((file (make-temp-file "doom-eval-")))
(write-file file)
(let ((contents (buffer-string))
(file (make-temp-file "/tmp/doom-eval-")))
(with-temp-file file (insert contents))
(require 'pp)
(require 'restart-emacs)
(restart-emacs--launch-other-emacs
@ -143,8 +143,7 @@ branch and commit."
package-archives ',package-archives
debug-on-error t))
"-f" "package-initialize"
"-l" file
"--eval" (prin1-to-string `(delete-file ,file)))))))
"--eval" (prin1-to-string `(unwind-protect (load ,file) (delete-file ,file)))))))
;;;###autoload
(defun doom/open-vanilla-sandbox ()