Function: corfu-reset

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

Signature

(corfu-reset)

Documentation

Reset Corfu completion.

This command can be executed multiple times by hammering the ESC key. If a candidate is selected, unselect the candidate. Otherwise reset the input. If there hasn't been any input, then quit.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/corfu-20260813.950/corfu.el
(defun corfu-reset ()
  "Reset Corfu completion.
This command can be executed multiple times by hammering the ESC key.  If a
candidate is selected, unselect the candidate.  Otherwise reset the input.  If
there hasn't been any input, then quit."
  (interactive)
  (if (/= corfu--index corfu--preselect)
      (progn
        (corfu--goto -1)
        (setq this-command #'corfu-first))
    ;; Cancel all changes and start new change group.
    (pcase-let* ((`(,beg ,end . ,_) completion-in-region--data)
                 (str (buffer-substring-no-properties beg end)))
      (cancel-change-group corfu--change-group)
      (goto-char end)
      (activate-change-group (setq corfu--change-group (prepare-change-group)))
      ;; Quit when resetting, when input did not change.
      (when (equal str (buffer-substring-no-properties beg end))
        (corfu-quit)))))