mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-25 13:32:52 +00:00
org-persist-register: Fix MISC argument handling
* lisp/org-persist.el (org-persist-register): Document that MISC must be a plist. (org-persist--get-collection): Throw an error when MISC is not a plist. Fix arglist - MISC is now passed explicitly as a single object. (org-persist--storage-version): Bump version to avoid obsolete malformed containers with improperly included MISC.
This commit is contained in:
parent
40e1c6c050
commit
18577a495b
|
@ -161,7 +161,7 @@
|
|||
(declare-function org-at-heading-p "org" (&optional invisible-not-ok))
|
||||
|
||||
|
||||
(defconst org-persist--storage-version "2.7"
|
||||
(defconst org-persist--storage-version "3.1"
|
||||
"Persistent storage layout version.")
|
||||
|
||||
(defgroup org-persist nil
|
||||
|
@ -431,25 +431,27 @@ Return PLIST."
|
|||
(when key (remhash (cons cont (list :key key)) org-persist--index-hash))))
|
||||
(setq org-persist--index (delq existing org-persist--index)))))
|
||||
|
||||
(defun org-persist--get-collection (container &optional associated &rest misc)
|
||||
(defun org-persist--get-collection (container &optional associated misc)
|
||||
"Return or create collection used to store CONTAINER for ASSOCIATED.
|
||||
When ASSOCIATED is nil, it is a global CONTAINER.
|
||||
ASSOCIATED can also be a (:buffer buffer) or buffer, (:file file-path)
|
||||
or file-path, (:inode inode), (:hash hash), or or (:key key).
|
||||
MISC, if non-nil will be appended to the collection."
|
||||
MISC, if non-nil will be appended to the collection. It must be a plist."
|
||||
(unless (and (listp container) (listp (car container)))
|
||||
(setq container (list container)))
|
||||
(setq associated (org-persist--normalize-associated associated))
|
||||
(unless (equal misc '(nil))
|
||||
(setq associated (append associated misc)))
|
||||
(when (and misc (or (not (listp misc)) (= 1 (% (length misc) 2))))
|
||||
(error "org-persist: Not a plist: %S" misc))
|
||||
(or (org-persist--find-index
|
||||
`( :container ,(org-persist--normalize-container container)
|
||||
:associated ,associated))
|
||||
(org-persist--add-to-index
|
||||
(list :container (org-persist--normalize-container container)
|
||||
:persist-file
|
||||
(replace-regexp-in-string "^.." "\\&/" (org-id-uuid))
|
||||
:associated associated))))
|
||||
(nconc
|
||||
(list :container (org-persist--normalize-container container)
|
||||
:persist-file
|
||||
(replace-regexp-in-string "^.." "\\&/" (org-id-uuid))
|
||||
:associated associated)
|
||||
misc))))
|
||||
|
||||
;;;; Reading container data.
|
||||
|
||||
|
@ -720,7 +722,8 @@ last access, or a function accepting a single argument - collection.
|
|||
EXPIRY key has no effect when INHERIT is non-nil.
|
||||
Optional key WRITE-IMMEDIATELY controls whether to save the container
|
||||
data immediately.
|
||||
MISC will be appended to CONTAINER.
|
||||
MISC will be appended to the collection. It must be alternating :KEY
|
||||
VALUE pairs.
|
||||
When WRITE-IMMEDIATELY is non-nil, the return value will be the same
|
||||
with `org-persist-write'."
|
||||
(unless org-persist--index (org-persist--load-index))
|
||||
|
|
Loading…
Reference in a new issue