Function: consult--grep-position

consult--grep-position is a byte-compiled function defined in consult.el.

Signature

(consult--grep-position CAND &optional FIND-FILE)

Documentation

Return the grep position marker for CAND.

FIND-FILE is the file open function, defaulting to find-file-noselect.

Source Code

;; Defined in ~/.emacs.d/elpa/consult-20260805.1130/consult.el
(defun consult--grep-position (cand &optional find-file)
  "Return the grep position marker for CAND.
FIND-FILE is the file open function, defaulting to `find-file-noselect'."
  (when cand
    (let* ((file-end (next-single-property-change 0 'face cand))
           (line-end (next-single-property-change (1+ file-end) 'face cand))
           (matches (consult--point-placement cand (1+ line-end) 'consult-grep-context))
           (file (substring-no-properties cand 0 file-end))
           (line (string-to-number (substring-no-properties cand (+ 1 file-end) line-end))))
      (when-let* ((pos (consult--marker-from-line-column
                        (funcall (or find-file #'consult--file-action) file)
                        line (or (car matches) 0))))
        (cons pos (cdr matches))))))