Fix org-persist-unregister

This commit is contained in:
Ihor Radchenko 2022-01-12 20:34:41 +08:00
parent 703df9310a
commit 1084566322
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 9 additions and 6 deletions

View File

@ -625,17 +625,20 @@ EXPIRY key has no effect when INHERIT is non-nil."
"Unregister CONTAINER in ASSOCIATED to be persistent.
When ASSOCIATED is `all', unregister CONTAINER everywhere."
(unless org-persist--index (org-persist--load-index))
(setq container (org-persist--normalize-container container))
(setq associated (org-persist--normalize-associated associated))
(if (eq associated 'all)
(mapc (lambda (collection)
(when (member container (plist-get collection :container))
(org-persist-unregister container (plist-get collection :associated))))
org-persist--index)
(let ((collection (org-persist--get-collection container associated)))
(let ((collection (org-persist--find-index `(:container ,container :associated ,associated))))
(when collection
(if (= (length (plist-get collection :container)) 1)
(org-persist--remove-from-index collection)
(plist-put collection :container
(remove container (plist-get collection :container)))
(org-persist--add-to-index collection)))))
(org-persist--add-to-index collection))))))
(defun org-persist-read (container &optional associated hash-must-match load?)
"Restore CONTAINER data for ASSOCIATED.