Function: consult-register--action
consult-register--action is a byte-compiled function defined in
consult-register.el.
Signature
(consult-register--action ACTION-LIST)
Documentation
Read register key and execute action from ACTION-LIST.
This function is derived from register-read-with-preview.
Source Code
;; Defined in ~/.emacs.d/elpa/consult-20260805.1130/consult-register.el
(defun consult-register--action (action-list)
"Read register key and execute action from ACTION-LIST.
This function is derived from `register-read-with-preview'."
(let* ((buffer "*Register Preview*")
(prefix (car action-list))
(action-list (cdr action-list))
(action (car (nth 0 action-list)))
(preview
(lambda ()
(unless (get-buffer-window buffer)
(register-preview buffer 'show-empty)
(when-let* ((win (get-buffer-window buffer)))
(with-selected-window win
(let ((inhibit-read-only t))
(goto-char (point-max))
(insert
(propertize (concat prefix ": ") 'face 'consult-help)
(mapconcat
(lambda (x)
(concat (propertize (format "M-%c" (car x)) 'face 'consult-key)
" " (propertize (cadr x) 'face 'consult-help)))
action-list " "))
(fit-window-to-buffer)))))))
(timer (when (numberp register-preview-delay)
(run-at-time register-preview-delay nil preview)))
(help-chars (seq-remove #'get-register (cons help-char help-event-list)))
key reg)
(unwind-protect
(while (not reg)
(while (memq (setq key
(read-key (propertize (caddr (assq action action-list))
'face 'minibuffer-prompt)))
help-chars)
(funcall preview))
(setq key (if (and (eql key ?\e) (characterp last-input-event))
;; in terminal Emacs M-letter is read as two keys, ESC and the letter,
;; use what would have been read in graphical Emacs
(logior #x8000000 last-input-event)
last-input-event))
(cond
((or (eq ?\C-g key)
(eq 'escape key)
(eq ?\C-\[ key))
(keyboard-quit))
((and (numberp key) (assq (logxor #x8000000 key) action-list))
(setq action (logxor #x8000000 key)))
((characterp key)
(setq reg key))
(t (user-error "Non-character input"))))
(when (timerp timer)
(cancel-timer timer))
(let ((w (get-buffer-window buffer)))
(when (window-live-p w)
(delete-window w)))
(when (get-buffer buffer)
(kill-buffer buffer)))
(when reg
(funcall (cadddr (assq action action-list)) reg))))