Function: corfu-expand
corfu-expand is an interactive and byte-compiled function defined in
corfu.el.
Signature
(corfu-expand)
Documentation
Expands the common prefix of all candidates.
If the currently selected candidate is previewed, invoke
corfu-complete instead. Expansion relies on the completion
styles via completion-try-completion. Return non-nil if the
input has been expanded.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/corfu-20260813.950/corfu.el
(defun corfu-expand ()
"Expands the common prefix of all candidates.
If the currently selected candidate is previewed, invoke
`corfu-complete' instead. Expansion relies on the completion
styles via `completion-try-completion'. Return non-nil if the
input has been expanded."
(interactive)
(if (corfu--preview-current-p)
(corfu-complete)
(pcase-let* ((`(,beg ,end ,table ,pred . ,_) completion-in-region--data)
(pt (max 0 (- (point) beg)))
(str (buffer-substring-no-properties beg end)))
(pcase (corfu--try-completion str table pred pt)
('t
(goto-char end)
(corfu--done str 'finished corfu--candidates)
t)
((and `(,newstr . ,newpt) (guard (not (and (= pt newpt) (equal newstr str)))))
(corfu--replace beg end newstr)
(goto-char (+ beg newpt))
;; Exit with status 'finished if input is a valid match
;; and no further completion is possible.
(and (test-completion newstr table pred)
(not (consp (corfu--try-completion newstr table pred newpt)))
(corfu--done newstr 'finished corfu--candidates))
t)))))