Function: embark-target-top-minibuffer-candidate
embark-target-top-minibuffer-candidate is a byte-compiled function
defined in embark.el.
Signature
(embark-target-top-minibuffer-candidate)
Documentation
Target the top completion candidate in the minibuffer.
Return the category metadatum as the type of the target.
This target finder is meant for the default completion UI and
completion UI highly compatible with it, like Icomplete.
Many completion UIs can still work with Embark but will need
their own target finder. See for example
embark--vertico-selected.
Source Code
;; Defined in ~/.emacs.d/elpa/embark-20260610.302/embark.el
(defun embark-target-top-minibuffer-candidate ()
"Target the top completion candidate in the minibuffer.
Return the category metadatum as the type of the target.
This target finder is meant for the default completion UI and
completion UI highly compatible with it, like Icomplete.
Many completion UIs can still work with Embark but will need
their own target finder. See for example
`embark--vertico-selected'."
(when (and (minibufferp) minibuffer-completion-table)
(pcase-let* ((`(,category . ,candidates) (embark-minibuffer-candidates))
(contents (minibuffer-contents))
(top (if (test-completion contents
minibuffer-completion-table
minibuffer-completion-predicate)
contents
(let ((completions (completion-all-sorted-completions)))
(if (null completions)
contents
(concat
(substring contents
0 (or (cdr (last completions)) 0))
(car completions)))))))
(cons category (or (car (member top candidates)) top)))))