Function: consult--line-fontify
consult--line-fontify is a byte-compiled function defined in
consult.el.
Signature
(consult--line-fontify &optional CURR-LINE)
Documentation
Annotation function to fontify consult-location line and add line number.
CURR-LINE is the current line number.
Source Code
;; Defined in ~/.emacs.d/elpa/consult-20260805.1130/consult.el
(defun consult--line-fontify (&optional curr-line)
"Annotation function to fontify `consult-location' line and add line number.
CURR-LINE is the current line number."
(setq curr-line (or curr-line -1))
(let* ((width (length (number-to-string (line-number-at-pos
(point-max)
consult-line-numbers-widen))))
(before (format #("%%%dd " 0 6 (face consult-line-number-wrapped)) width))
(after (propertize before 'face 'consult-line-number-prefix)))
(lambda (cand)
(pcase-let* ((`(,pos . ,line) (get-text-property 0 'consult-location cand))
(buf (when consult-fontify-preserve
(if (consp pos)
(car pos)
(and (markerp pos) (marker-buffer pos))))))
(when (buffer-live-p buf)
(with-current-buffer buf
(goto-char (if (markerp pos) pos (cdr pos)))
(let ((beg (pos-bol))
(end (pos-eol)))
;; Only apply lazy highlighting if the buffer has not been changed.
(when (string-prefix-p (buffer-substring-no-properties beg end) cand)
(setq cand (copy-sequence cand))
(consult--fontify-region beg end)
(consult--copy-faces beg end cand)))))
(list cand (format (if (< line curr-line) before after) line) "")))))