Function: embark-collect--format-entries
embark-collect--format-entries is a byte-compiled function defined in
embark.el.
Signature
(embark-collect--format-entries CANDIDATES GROUPER)
Documentation
Format CANDIDATES for tabulated-list-mode grouped by GROUPER.
The GROUPER is either nil or a function like the group-function
completion metadatum, that is, a function of two arguments, the
first of which is a candidate and the second controls what is
computed: if nil, the title of the group the candidate belongs
to, and if non-nil, a rewriting of the candidate (useful to
simplify the candidate so it doesn't repeat the group title, for
example).
Source Code
;; Defined in ~/.emacs.d/elpa/embark-20260610.302/embark.el
(defun embark-collect--format-entries (candidates grouper)
"Format CANDIDATES for `tabulated-list-mode' grouped by GROUPER.
The GROUPER is either nil or a function like the `group-function'
completion metadatum, that is, a function of two arguments, the
first of which is a candidate and the second controls what is
computed: if nil, the title of the group the candidate belongs
to, and if non-nil, a rewriting of the candidate (useful to
simplify the candidate so it doesn't repeat the group title, for
example)."
(let ((max-width 0)
(transform
(if grouper (lambda (cand) (funcall grouper cand t)) #'identity)))
(setq
tabulated-list-entries
(mapcan
(lambda (group)
(let ((multiline (seq-some (lambda (x) (string-match-p "\n" (car x)))
candidates)))
(cons
`(nil [(,(concat (propertize embark-collect--outline-string
'invisible t)
(format embark-collect-group-format (car group)))
type embark-collect-group)
("" skip t)])
(mapcar
(pcase-lambda (`(,cand ,prefix ,annotation))
(let* ((display (embark--display-string (funcall transform cand)))
(length (length annotation))
(faces (text-property-not-all
0 length 'face nil annotation)))
(setq max-width (max max-width (+ (string-width prefix)
(string-width display))))
(when faces
(add-face-text-property 0 length 'default t annotation))
`(,cand
[(,(propertize
(if multiline (concat display embark--hline) display)
'line-prefix prefix)
type embark-collect-entry)
(,annotation
skip t
,@(unless faces
'(face embark-collect-annotation)))])))
(cdr group)))))
(if grouper
(seq-group-by (lambda (item) (funcall grouper (car item) nil))
candidates)
(list (cons "" candidates)))))
(if (null grouper)
(pop tabulated-list-entries)
(setq-local outline-regexp embark-collect--outline-string)
(outline-minor-mode))
(setq tabulated-list-format
`[("Candidate" ,max-width t) ("Annotation" 0 t)])))