Function: corfu--affixate
corfu--affixate is a byte-compiled function defined in corfu.el.
Signature
(corfu--affixate CANDS)
Documentation
Annotate CANDS with annotation function.
Implementations
:around (corfu--affixate CANDS (NIL ((&context . corfu-indexed-mode) eql t))) in `corfu-indexed.el'.
Undocumented
(corfu--affixate CANDS) in `corfu.el'.
Undocumented
Source Code
;; Defined in ~/.emacs.d/elpa/corfu-20260813.950/corfu.el
(cl-defgeneric corfu--affixate (cands)
"Annotate CANDS with annotation function."
(let* ((dep (corfu--metadata-get 'company-deprecated))
(mf (let ((completion-extra-properties (nth 4 completion-in-region--data)))
(run-hook-with-args-until-success 'corfu-margin-formatters corfu--metadata))))
(setq cands
(if-let* ((aff (corfu--metadata-get 'affixation-function)))
(funcall aff cands)
(if-let* ((ann (corfu--metadata-get 'annotation-function)))
(cl-loop for cand in cands collect
(let ((suff (or (funcall ann cand) "")))
;; The default completion UI adds the
;; `completions-annotations' face if no other faces are
;; present. We use a custom `corfu-annotations' face to
;; allow further styling which fits better for popups.
(unless (text-property-not-all 0 (length suff) 'face nil suff)
(setq suff (propertize suff 'face 'corfu-annotations)))
(list cand "" suff)))
(cl-loop for cand in cands collect (list cand "" "")))))
(cl-loop for x in cands for (c . _) = x do
(when mf
(setf (cadr x) (funcall mf c)))
(when (and dep (funcall dep c))
(setcar x (setq c (substring c)))
(add-face-text-property 0 (length c) 'corfu-deprecated 'append c)))
(cons mf cands)))