Function: corfu-complete

corfu-complete is an interactive and byte-compiled function defined in corfu.el.

Signature

(corfu-complete)

Documentation

Complete current input.

If a candidate is selected, insert it. Otherwise invoke corfu-expand. 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-complete ()
  "Complete current input.
If a candidate is selected, insert it.  Otherwise invoke
`corfu-expand'.  Return non-nil if the input has been expanded."
  (interactive)
  (if (< corfu--index 0)
      (corfu-expand)
    ;; Continue completion with selected candidate.  Exit with status 'finished
    ;; if input is a valid match and no further completion is possible.
    (pcase-let ((`(,_beg ,_end ,table ,pred . ,_) completion-in-region--data)
                (newstr (corfu--insert nil)))
      (and (test-completion newstr table pred)
           (or (not (consp (corfu--try-completion newstr table pred (length newstr))))
               ;; Additionally finish completion if at the end of a boundary,
               ;; even if other longer candidates match, since the user invoked
               ;; `corfu-complete' with an explicitly selected candidate!
               (equal (completion-boundaries newstr table pred "") '(0 . 0)))
           (corfu--done newstr 'finished nil))
      t)))