From 89dfaef38b6caa3027f20f96a551dc8f194ac533 Mon Sep 17 00:00:00 2001 From: Liam Hupfer Date: Tue, 1 Jul 2025 00:11:51 -0500 Subject: [PATCH] Fix link replacement optimization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We are searching for a string literal for speed, so don’t treat it as a regexp. Fixes: fc8638759b9d ("feat: Limit link replacement scope") Fixes: #2529 --- org-roam-node.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/org-roam-node.el b/org-roam-node.el index 3b2adb9..14cac4e 100644 --- a/org-roam-node.el +++ b/org-roam-node.el @@ -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 ()