branch: externals-release/org commit e2366ac2830d073392fd9aae3b79ecdd87353bc9 Author: Ihor Radchenko <yanta...@posteo.net> Commit: Ihor Radchenko <yanta...@posteo.net>
* lisp/org-persist.el: Do not litter /tmp when native compiling Remove the directory created by `make-temp-file' when Emacs is called with -Q command line argument. Only use the return value as the directory to be created when something is actually stored by org-persist while running Emacs. Reported-by: William Denton <w...@pobox.com> Link: https://orgmode.org/list/alpine.deb.2.22.394.2212211213480.270...@shell3.miskatonic.org --- lisp/org-persist.el | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 6ccf357784..80ecd85886 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -978,13 +978,17 @@ Also, remove containers associated with non-existing files." (add-hook 'kill-emacs-hook #'org-persist-gc))) ;; Point to temp directory when `org-persist--disable-when-emacs-Q' is set. -(if (and org-persist--disable-when-emacs-Q - ;; FIXME: This is relying on undocumented fact that - ;; Emacs sets `user-init-file' to nil when loaded with - ;; "-Q" argument. - (not user-init-file)) - (setq org-persist-directory - (make-temp-file "org-persist-" 'dir))) +(when (and org-persist--disable-when-emacs-Q + ;; FIXME: This is relying on undocumented fact that + ;; Emacs sets `user-init-file' to nil when loaded with + ;; "-Q" argument. + (not user-init-file)) + (setq org-persist-directory + (make-temp-file "org-persist-" 'dir)) + ;; We don't need the temp directory to exist. + ;; `org-persist-write-all' will refrain from creating and writing to the dir if + ;; none exists yet. + (delete-directory org-persist-directory)) (add-hook 'after-init-hook #'org-persist-load-all)