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 as far as possible using the minibuffer history.

Like minibuffer-complete but completes using the history of minibuffer inputs for the prompting command, instead of the default completion table.

View in manual

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 as far as possible using the minibuffer history.
Like `minibuffer-complete' but completes using the history of minibuffer
inputs for the prompting command, 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?
    (let ((completion-in-region-mode-predicate
           (lambda () (minibuffer--completions-visible))))
      (completion-in-region
       (minibuffer--completion-prompt-end) (point-max)
       (completion-table-with-metadata
        completions '((display-sort-function . identity)
                      (cycle-sort-function . identity)))))))