Function: minibuffer-complete-history

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

Signature

(minibuffer-complete-history)

Documentation

Complete the minibuffer history as far as possible.

Like minibuffer-complete but completes on the history items instead of the default completion table.

Probably introduced at or before Emacs version 29.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/minibuffer.el.gz
(defun minibuffer-complete-history ()
  "Complete the minibuffer history as far as possible.
Like `minibuffer-complete' but completes on the history items
instead of the default completion table."
  (interactive)
  (let* ((history (symbol-value minibuffer-history-variable))
         (completions
          (if (listp history)
              ;; Support e.g. `C-x ESC ESC TAB' as
              ;; a replacement of `list-command-history'
              (mapcar (lambda (h)
                        (if (stringp h) h (format "%S" h)))
                      history)
            (user-error "No history available"))))
    ;; FIXME: Can we make it work for CRM?
    (completion-in-region
     (minibuffer--completion-prompt-end) (point-max)
     (lambda (string pred action)
       (if (eq action 'metadata)
           '(metadata (display-sort-function . identity)
                      (cycle-sort-function . identity))
         (complete-with-action action completions string pred))))))