Skip to content

Commit

Permalink
fix: use nconc instead of cl-sort due to performance
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyinz committed Oct 2, 2024
1 parent 0ea6d89 commit a8ee75b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions rg-result.el
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ This function is called from `compilation-filter-hook'."
t t)
(push (cons (copy-marker (match-beginning 0))
(length (match-string 0)))
rg-match-positions)
temp-positions)
(cl-incf rg-hit-count))
(rg-format-line-and-column-numbers beg end)

Expand All @@ -484,12 +484,10 @@ This function is called from `compilation-filter-hook'."
(while (re-search-forward "\033\\[[0-9;]*[0mK]" end 1)
(replace-match "" t t))

(setq rg-match-positions
(cl-sort rg-match-positions
(lambda(x y)
(< (marker-position x) (marker-position y)))
:key #'car))
(goto-char beg)

(setq rg-match-positions (nconc rg-match-positions (nreverse temp-positions)))

(run-hooks 'rg-filter-hook)))))

;; The regexp and filter functions below were taken from ag.el
Expand Down

0 comments on commit a8ee75b

Please sign in to comment.