Function: registry-collect-prune-candidates
registry-collect-prune-candidates is a byte-compiled function defined
in registry.el.gz.
Signature
(registry-collect-prune-candidates ARG &rest ARGS)
Implementations
((db registry-db) limit sortfunc) in `registry.el'.
Collect pruning candidates from the registry-db object DB.
Proposes only entries without the :precious keys, and attempts to return LIMIT such candidates. If SORTFUNC is provided, sort entries first and return candidates from beginning of list.
Source Code
;; Defined in /usr/src/emacs/lisp/registry.el.gz
(cl-defmethod registry-collect-prune-candidates ((db registry-db)
limit sortfunc)
"Collect pruning candidates from the registry-db object DB.
Proposes only entries without the :precious keys, and attempts to
return LIMIT such candidates. If SORTFUNC is provided, sort
entries first and return candidates from beginning of list."
(let* ((precious (oref db precious))
(precious-p (lambda (entry-key)
(memq (car-safe entry-key) precious)))
(data (oref db data))
(candidates (cl-loop for k being the hash-keys of data
using (hash-values v)
when (and (listp v)
(cl-notany precious-p v))
collect (cons k v))))
;; We want the full entries for sorting, but should only return a
;; list of entry keys.
(when sortfunc
(setq candidates (sort candidates sortfunc)))
(cl-subseq (mapcar #'car candidates) 0 (min limit (length candidates)))))