Function: cape-history
cape-history is an interactive and natively compiled function defined
in cape.el.
Signature
(cape-history &optional INTERACTIVE)
Documentation
Complete from Eshell, Comint or minibuffer history.
See also consult-history for a more flexible variant based on
completing-read. If INTERACTIVE is nil the function acts like a Capf.
Key Bindings
cape-prefix-map h
Source Code
;; Defined in /nix/store/nxaggkd0bn9kr2xfg9hyw77q51q20r8y-emacs-packages-deps/share/emacs/site-lisp/elpa/cape-20260927.2347/cape.el
;;;###autoload
(defun cape-history (&optional interactive)
"Complete from Eshell, Comint or minibuffer history.
See also `consult-history' for a more flexible variant based on
`completing-read'. If INTERACTIVE is nil the function acts like a Capf."
(interactive (list t))
(if interactive
(cape-interactive #'cape-history)
(let (history bol)
(cond
((derived-mode-p 'eshell-mode)
(setq history eshell-history-ring
bol (static-if (< emacs-major-version 30)
(save-excursion (eshell-bol) (point))
(line-beginning-position))))
((derived-mode-p 'comint-mode)
(setq history comint-input-ring
bol (comint-line-beginning-position)))
((and (minibufferp) (not (eq minibuffer-history-variable t)))
(setq history (symbol-value minibuffer-history-variable)
bol (line-beginning-position))))
(when (ring-p history)
(setq history (ring-elements history)))
(when history
`(,bol ,(point) ,history ,@cape--history-properties)))))