0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-08-25 14:02:51 +00:00

* 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 <wtd@pobox.com>
Link: https://orgmode.org/list/alpine.DEB.2.22.394.2212211213480.270543@shell3.miskatonic.org
This commit is contained in:
Ihor Radchenko 2022-12-21 21:38:57 +03:00
parent a8c9f11757
commit e2366ac283
No known key found for this signature in database
GPG key ID: 6470762A7DA11D8B

View file

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