Function: consult--current-history
consult--current-history is a byte-compiled function defined in
consult.el.
Signature
(consult--current-history)
Documentation
Return the history and index variable relevant to the current buffer.
If the minibuffer is active, the minibuffer history is returned,
otherwise the history corresponding to the mode. There is a
special case for repeat-complex-command, for which the command
history is used.
Source Code
;; Defined in ~/.emacs.d/elpa/consult-20260805.1130/consult.el
;;;;; Command: consult-history
(defun consult--current-history ()
"Return the history and index variable relevant to the current buffer.
If the minibuffer is active, the minibuffer history is returned,
otherwise the history corresponding to the mode. There is a
special case for `repeat-complex-command', for which the command
history is used."
(cond
;; In the minibuffer we use the current minibuffer history,
;; which can be configured by setting `minibuffer-history-variable'.
((minibufferp)
(when (eq minibuffer-history-variable t)
(user-error "Minibuffer history is disabled for `%s'" this-command))
(list (mapcar #'consult--tofu-strip
(if (eq minibuffer-history-variable 'command-history)
;; If pressing "C-x M-:", i.e., `repeat-complex-command',
;; we are instead querying the `command-history' and get a
;; full s-expression. Alternatively you might want to use
;; `consult-complex-command', which can also be bound to
;; "C-x M-:"!
(mapcar #'prin1-to-string command-history)
(symbol-value minibuffer-history-variable)))))
;; Otherwise we use a mode-specific history, see `consult-mode-histories'.
(t (let ((found (seq-find (lambda (h)
(and (derived-mode-p (car h))
(boundp (if (consp (cdr h)) (cadr h) (cdr h)))))
consult-mode-histories)))
(unless found
(user-error "No history configured for `%s', see `consult-mode-histories'"
major-mode))
(cons (symbol-value (cadr found)) (cddr found))))))