Function: consult--setup-keymap
consult--setup-keymap is a byte-compiled function defined in
consult.el.
Signature
(consult--setup-keymap KEYMAP ASYNC NARROW PREVIEW-KEY)
Documentation
Setup minibuffer keymap.
KEYMAP is a command-specific keymap. ASYNC must be non-nil for async completion functions. NARROW is the narrowing configuration. PREVIEW-KEY are the preview keys.
Source Code
;; Defined in ~/.emacs.d/elpa/consult-20260805.1130/consult.el
(defun consult--setup-keymap (keymap async narrow preview-key)
"Setup minibuffer keymap.
KEYMAP is a command-specific keymap.
ASYNC must be non-nil for async completion functions.
NARROW is the narrowing configuration.
PREVIEW-KEY are the preview keys."
(let ((old-map (current-local-map))
(map (make-sparse-keymap)))
;; Add narrow keys
(when narrow
(consult--narrow-setup narrow map))
;; Preview trigger keys
(when (and (consp preview-key) (memq :keys preview-key))
(setq preview-key (plist-get preview-key :keys)))
(setq preview-key (mapcar #'car (consult--preview-key-normalize preview-key)))
(when preview-key
(dolist (key preview-key)
(unless (or (eq key 'any) (lookup-key old-map key))
(define-key map key #'ignore))))
;; Put the keymap together
(use-local-map
(make-composed-keymap
(delq nil (list keymap
(and async consult-async-map)
(and narrow consult-narrow-map)
map))
old-map))))