Function: minibuffer-choose-completion

minibuffer-choose-completion is an interactive and byte-compiled function defined in minibuffer.el.gz.

Signature

(minibuffer-choose-completion &optional NO-EXIT NO-QUIT)

Documentation

Run choose-completion from the minibuffer in its completions window.

With prefix argument NO-EXIT, insert the completion at point to the minibuffer, but don't exit the minibuffer. When the prefix argument is not provided, then whether to exit the minibuffer depends on the value of completion-no-auto-exit. If NO-QUIT is non-nil, insert the completion at point to the minibuffer, but don't quit the completions window.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/minibuffer.el.gz
(defun minibuffer-choose-completion (&optional no-exit no-quit)
  "Run `choose-completion' from the minibuffer in its completions window.
With prefix argument NO-EXIT, insert the completion at point to the
minibuffer, but don't exit the minibuffer.  When the prefix argument
is not provided, then whether to exit the minibuffer depends on the value
of `completion-no-auto-exit'.
If NO-QUIT is non-nil, insert the completion at point to the
minibuffer, but don't quit the completions window."
  (interactive "P")
  ;; Backported fix for bug#62700
  (let* ((md (completion--field-metadata (minibuffer--completion-prompt-end)))
         (base-suffix
          (if (eq (alist-get 'category (cdr md)) 'file)
              (buffer-substring
               (save-excursion (or (search-forward "/" nil t) (point-max)))
               (point-max))
            "")))
    (with-minibuffer-completions-window
      (let ((completion-use-base-affixes t)
            (completion-base-affixes (list (car completion-base-affixes) base-suffix)))
        (choose-completion nil no-exit no-quit)))))