Function: consult--mark-candidates
consult--mark-candidates is a byte-compiled function defined in
consult.el.
Signature
(consult--mark-candidates MARKERS)
Documentation
Return list of candidates strings for MARKERS.
Source Code
;; Defined in ~/.emacs.d/elpa/consult-20260805.1130/consult.el
;;;;; Command: consult-mark
(defun consult--mark-candidates (markers)
"Return list of candidates strings for MARKERS."
(consult--forbid-minibuffer)
(let* ((candidates)
(width (length (number-to-string (line-number-at-pos
(point-max)
consult-line-numbers-widen))))
(fmt (format #("%%%dd %%s%%s" 0 6 (face consult-line-number-prefix)) width)))
(save-excursion
(dolist (marker markers)
(when-let* ((pos (marker-position marker))
((and (eq (marker-buffer marker) (current-buffer))
(consult--in-range-p pos))))
(goto-char pos)
;; `line-number-at-pos' is a very slow function, which should be
;; replaced everywhere. However in this case the slow
;; line-number-at-pos does not hurt much, since the mark ring is
;; usually small since it is limited by `mark-ring-max'.
(let* ((line (line-number-at-pos pos consult-line-numbers-widen))
(cand (format fmt line (consult--line-with-mark marker) (consult--tofu-encode marker))))
(put-text-property 0 width 'consult-strip t cand)
(put-text-property 0 (length cand) 'consult-location (cons marker line) cand)
(push cand candidates)))))
(unless candidates
(user-error "No marks"))
(nreverse (delete-dups candidates))))