Function: registry-prune

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

Signature

(registry-prune ARG &rest ARGS)

Implementations

((db registry-db) &optional sortfunc) in `registry.el'.

Prune the registry-db object DB.

Attempts to prune the number of entries down to (* :max-size :prune-factor) less than the max-size limit, so pruning doesn't need to happen on every save. Removes only entries without the :precious keys, so it may not be possible to reach the target limit.

Entries to be pruned are first sorted using SORTFUNC. Entries from the front of the list are deleted first.

Returns the number of deleted entries.

Source Code

;; Defined in /usr/src/emacs/lisp/registry.el.gz
(cl-defmethod registry-prune ((db registry-db) &optional sortfunc)
  "Prune the registry-db object DB.

Attempts to prune the number of entries down to \(*
:max-size :prune-factor) less than the max-size limit, so
pruning doesn't need to happen on every save.  Removes only
entries without the :precious keys, so it may not be possible to
reach the target limit.

Entries to be pruned are first sorted using SORTFUNC.  Entries
from the front of the list are deleted first.

Returns the number of deleted entries."
  (let ((size (registry-size db))
	(target-size
	 (floor (- (oref db max-size)
		   (* (oref db max-size)
		      (oref db prune-factor)))))
	candidates)
    (if (registry-full db)
	(progn
	  (setq candidates
		(registry-collect-prune-candidates
		 db (- size target-size) sortfunc))
	  (length (registry-delete db candidates nil)))
      0)))