Fix link replacement optimization

We are searching for a string literal for speed, so don’t treat it as a
regexp.

Fixes: fc8638759b ("feat: Limit link replacement scope")
Fixes: #2529
This commit is contained in:
Liam Hupfer
2025-07-01 00:11:51 -05:00
parent fc8638759b
commit 89dfaef38b

View File

@ -810,10 +810,9 @@ Assumes that the cursor was put where the link is."
(defun org-roam-link-replace-all ()
"Replace all \"roam:\" links in buffer with \"id:\" links."
(interactive)
(let ((org-roam-link-prefix (concat "[[" org-roam-link-type ":")))
(org-with-point-at 1
(while (re-search-forward org-roam-link-prefix nil t)
(org-roam-link-replace-at-point)))))
(org-with-point-at 1
(while (search-forward (concat "[[" org-roam-link-type ":") nil t)
(org-roam-link-replace-at-point))))
(add-hook 'org-roam-find-file-hook #'org-roam--replace-roam-links-on-save-h)
(defun org-roam--replace-roam-links-on-save-h ()