(fix)org-roam-link-replace-at-point: preseve match-data (#1766)

It lies in between org-in-regexp and replace-match. In some situations, like
when the link looks like roam:a s'b, it changes the match-data.
This commit is contained in:
Samuel Loury
2021-08-16 15:48:29 +02:00
committed by GitHub
parent 8d4de78fac
commit c51ce08a40

View File

@ -631,7 +631,7 @@ Assumes that the cursor was put where the link is."
(goto-char (org-element-property :begin link))
(when (and (org-in-regexp org-link-any-re 1)
(string-equal type "roam")
(setq node (org-roam-node-from-title-or-alias path)))
(setq node (save-match-data (org-roam-node-from-title-or-alias path))))
(replace-match (org-link-make-string
(concat "id:" (org-roam-node-id node))
(or desc path))))))))