Function: minibuffer-complete-and-exit

minibuffer-complete-and-exit is an interactive and byte-compiled function defined in minibuffer.el.gz.

Signature

(minibuffer-complete-and-exit &optional NO-EXIT)

Documentation

Exit if the minibuffer contains a valid completion.

Otherwise, try to complete the minibuffer contents. If completion leads to a valid completion, a repetition of this command will exit.

If a completion candidate is selected in the *Completions* buffer, it will be inserted in the minibuffer first. If NO-EXIT is non-nil, don't actually exit the minibuffer, just insert the selected completion if any.

If minibuffer-completion-confirm is confirm, do not try to
 complete; instead, ask for confirmation and accept any input if
 confirmed.
If minibuffer-completion-confirm is confirm-after-completion,
 do not try to complete; instead, ask for confirmation if the
 preceding minibuffer command was a member of
 minibuffer-confirm-exit-commands, and accept the input
 otherwise.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/minibuffer.el.gz
(defun minibuffer-complete-and-exit (&optional no-exit)
  "Exit if the minibuffer contains a valid completion.
Otherwise, try to complete the minibuffer contents.  If
completion leads to a valid completion, a repetition of this
command will exit.

If a completion candidate is selected in the *Completions* buffer, it
will be inserted in the minibuffer first.  If NO-EXIT is non-nil, don't
actually exit the minibuffer, just insert the selected completion if
any.

If `minibuffer-completion-confirm' is `confirm', do not try to
 complete; instead, ask for confirmation and accept any input if
 confirmed.
If `minibuffer-completion-confirm' is `confirm-after-completion',
 do not try to complete; instead, ask for confirmation if the
 preceding minibuffer command was a member of
 `minibuffer-confirm-exit-commands', and accept the input
 otherwise."
  (interactive "P")
  (when (completion--selected-candidate)
    (minibuffer-choose-completion t t))
  (unless no-exit
    (completion-complete-and-exit (minibuffer--completion-prompt-end) (point-max)
                                  #'exit-minibuffer)))