Function: cape-history
cape-history is an autoloaded, interactive and byte-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
Source Code
;; Defined in ~/.emacs.d/elpa/cape-20260804.2303/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)))))