consult: refactor

This commit is contained in:
Brian Leung 2022-07-10 20:04:42 -07:00
parent 67cc57761a
commit be67109e8c
No known key found for this signature in database
GPG Key ID: 2D86D6A94C8BB3B1
1 changed files with 4 additions and 4 deletions

View File

@ -79,14 +79,14 @@ as defined in `evil-collection-consult--evil-mark-ring'."
(let* ((candidates)
(current-buf (current-buffer)))
(save-excursion
(dolist (marker (or markers (evil-collection-consult--evil-mark-ring)))
(let ((pos (marker-position (cdr marker)))
(buf (marker-buffer (cdr marker))))
(pcase-dolist (`(,char . ,marker) (or markers (evil-collection-consult--evil-mark-ring)))
(let ((pos (marker-position marker))
(buf (marker-buffer marker)))
(when (and (eq buf current-buf)
(consult--in-range-p pos))
(goto-char pos)
(push (consult--location-candidate
(format "%s: %s" (char-to-string (car marker)) (consult--line-with-cursor (cdr marker))) (cdr marker)
(format "%s: %s" (char-to-string char) (consult--line-with-cursor marker)) marker
(line-number-at-pos pos consult-line-numbers-widen))
candidates)))))
(nreverse (delete-dups candidates))))