org-persist-gc: GC collections without persist file

* lisp/org-persist.el (org-persist-gc): Do not store collections that
lack persist file.  Such collection may emerge, for example, when
writing fails or gets blocked for some reason (in
`org-persist-before-write-hook' or when associated with encrypted
file).

Reported-by: Gustavo Barros <gusbrs.2016@gmail.com>
Link: https://orgmode.org/list/CAM9ALR_F4gjWxOVh_Eq14NOC9nF6g0Cv1jAKb=p4FjPvjqSkWQ@mail.gmail.com
This commit is contained in:
Ihor Radchenko 2023-05-03 12:53:19 +02:00
parent 5ec364a1ae
commit e11073d17d
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 2 additions and 1 deletions

View File

@ -1210,7 +1210,8 @@ Also, remove containers associated with non-existing files."
(setq expired? t)))
(if expired?
(org-persist--gc-persist-file persist-file)
(push collection new-index)
(when (file-exists-p persist-file)
(push collection new-index))
(dolist (container (plist-get collection :container))
(dolist (associated-file
(org-persist-associated-files:generic