Function: cape--super-all
cape--super-all is a byte-compiled function defined in cape.el.
Signature
(cape--super-all STR PRED TABLES EXC CACHE)
Documentation
Compute all candidates given STR, PRED, TABLES, EXC and CACHE.
Source Code
;; Defined in ~/.emacs.d/elpa/cape-20260804.2303/cape.el
(defun cape--super-all (str pred tables exc cache)
"Compute all candidates given STR, PRED, TABLES, EXC and CACHE."
(let ((ht (make-hash-table :test #'equal))
(candidates nil))
(cl-loop
for (main table-pred table cand-plist) in tables do
(let* ((pr (if (and table-pred pred)
(lambda (x) (and (funcall table-pred x) (funcall pred x)))
(or table-pred pred)))
(md (completion-metadata "" table pr))
(sort (or (completion-metadata-get md 'display-sort-function)
#'identity))
;; Always compute candidates of the main Capf
;; tables, which come first in the tables
;; list. For the :with Capfs only compute
;; candidates if we've already determined that
;; main candidates are available.
(cands (when (or main (or exc (car cache) candidates))
(funcall sort (all-completions str table pr)))))
;; Handle duplicates with a hash table.
(cl-loop
for cand in-ref cands
for dup = (gethash cand ht t) do
(cond
((eq dup t)
;; Candidate does not yet exist.
(puthash cand cand-plist ht))
((not (equal dup cand-plist))
;; Duplicate candidate. Candidate plist is
;; different, therefore disambiguate the
;; candidates.
(setf cand (propertize cand 'cape--super
(cons cand cand-plist))))))
(when cands (push cands candidates))))
(when (or (car cache) candidates)
(setf candidates (apply #'nconc (nreverse candidates))
(car cache) ht)
candidates)))