Function: consult-kmacro--candidates
consult-kmacro--candidates is a byte-compiled function defined in
consult-kmacro.el.
Signature
(consult-kmacro--candidates)
Documentation
Return list of formatted kmacros strings.
Source Code
;; Defined in ~/.emacs.d/elpa/consult-20261004.957/consult-kmacro.el
(defun consult-kmacro--candidates ()
"Return list of formatted kmacros strings."
(thread-last
;; List of macros
(append (and last-kbd-macro (list (kmacro-ring-head))) kmacro-ring)
(mapcar (lambda (x)
(list (kmacro--keys x) (kmacro--counter x) (kmacro--format x) x)))
;; Filter mouse clicks
(seq-remove (lambda (x) (seq-some #'mouse-event-p (car x))))
;; Format macros
(mapcar (pcase-lambda (`(,keys ,counter ,format ,km))
(propertize
(format-kbd-macro keys 1)
'consult--candidate km
'consult-kmacro--annotation
;; If the counter is 0 and the counter format is its default,
;; then there is a good chance that the counter isn't actually
;; being used. This can only be wrong when a user
;; intentionally starts the counter with a negative value and
;; then increments it to 0.
(cond
((not (equal format "%d")) ;; show counter for non-default format
(format " (counter=%d, format=%s) " counter format))
((/= counter 0) ;; show counter if non-zero
(format " (counter=%d)" counter))))))
(delete-dups)))