Function: consult-isearch-history
consult-isearch-history is an interactive and natively compiled
function defined in consult.el.
Signature
(consult-isearch-history)
Documentation
Read a search string with completion from the Isearch history.
This replaces the current search string if Isearch is active, and starts a new Isearch session otherwise.
Key Bindings
This command is not in any keymaps.
Source Code
;; Defined in /nix/store/6higv2v1wk916v4ynnybyrdkfy2gq44d-emacs-packages-deps/share/emacs/site-lisp/elpa/consult-20261004.957/consult.el
;;;###autoload
(defun consult-isearch-history ()
"Read a search string with completion from the Isearch history.
This replaces the current search string if Isearch is active, and
starts a new Isearch session otherwise."
(interactive)
(consult--forbid-minibuffer)
(let* ((isearch-message-function #'ignore)
(cursor-in-echo-area t) ;; Avoid cursor flickering
(candidates (consult--isearch-history-candidates)))
(unless isearch-mode (isearch-mode t))
(with-isearch-suspended
(consult--read
candidates
:prompt "I-search: "
:category 'consult-isearch-history
:history t ;; disable history
:sort nil
:initial isearch-string
:keymap consult-isearch-history-map
:annotate
(lambda (cand)
(consult--annotate-align
cand
(alist-get (consult--tofu-get cand) consult--isearch-history-narrow)))
:group
(lambda (cand transform)
(if transform
cand
(alist-get (consult--tofu-get cand) consult--isearch-history-narrow)))
:lookup
(lambda (selected candidates &rest _)
(if-let* ((found (member selected candidates)))
(substring (car found) 0 -1)
selected))
:state
(lambda (action cand)
(when cand
(pcase action
('preview
(setq isearch-string cand)
(isearch-update-from-string-properties cand)
(isearch-update))
('return
(setq isearch-new-string cand
isearch-new-message (mapconcat #'isearch-text-char-description cand ""))))))
:narrow
(list :predicate
(lambda (cand) (= (consult--tofu-get cand) consult--narrow))
:keys consult--isearch-history-narrow)))
;; Setting `isearch-regexp' etc only works outside of `with-isearch-suspended'.
(unless (plist-member (text-properties-at 0 isearch-string) 'isearch-regexp-function)
(setq isearch-regexp t
isearch-regexp-function nil))))