Function: consult--add-history
consult--add-history is a byte-compiled function defined in
consult.el.
Signature
(consult--add-history ASYNC ITEMS)
Documentation
Add ITEMS to the minibuffer future history.
ASYNC must be non-nil for async completion functions.
Source Code
;; Defined in ~/.emacs.d/elpa/consult-20260805.1130/consult.el
(defun consult--add-history (async items)
"Add ITEMS to the minibuffer future history.
ASYNC must be non-nil for async completion functions."
(setq items
(delete-dups
(append
;; Defaults are at the beginning of the future history
(ensure-list minibuffer-default)
;; Custom items
(remove "" (remq nil (ensure-list items)))
;; Add all completions for non-async commands. For async commands
;; this feature is not useful, since if one selects a completion
;; candidate, the async search is restarted using that candidate
;; string. This usually does not yield a desired result since the
;; async input uses a special format, e.g., `#grep#filter'.
(unless async
(all-completions "" minibuffer-completion-table
minibuffer-completion-predicate)))))
;; Prefix all items with the initial input from the async split style.
(when (and async (get-text-property (minibuffer-prompt-end) 'consult--split))
(let* ((beg (minibuffer-prompt-end))
(end (or (text-property-any beg (point-max) 'consult--split nil)
(point-max)))
(pre (buffer-substring beg end)))
(cl-loop for item in-ref items do
(unless (string-prefix-p pre item)
(setf item (concat pre item))))))
items)