Function: registry-insert

registry-insert is a byte-compiled function defined in registry.el.gz.

Signature

(registry-insert ARG &rest ARGS)

Implementations

(registry-insert (DB registry-db) KEY ENTRY) in `registry.el'.

Insert ENTRY under KEY into the registry-db DB. Updates the secondary ('tracked') indices as well. Errors out if the key exists already.

Source Code

;; Defined in /usr/src/emacs/lisp/registry.el.gz
(cl-defmethod registry-insert ((db registry-db) key entry)
  "Insert ENTRY under KEY into the registry-db DB.
Updates the secondary ('tracked') indices as well.
Errors out if the key exists already."
  (cl-assert (not (gethash key (oref db data))) nil
             "Key already exists in database")
  (cl-assert (not (registry-full db)) nil
             "registry max-size limit reached")

  ;; store the entry
  (puthash key entry (oref db data))

  ;; store the secondary indices
  (dolist (tr (oref db tracked))
    ;; for every value in the entry under that key...
    (dolist (val (cdr-safe (assq tr entry)))
      (let* ((value-keys (registry-lookup-secondary-value db tr val)))
	(cl-pushnew key value-keys :test 'equal)
	(registry-lookup-secondary-value db tr val value-keys))))
  entry)