Function: org-roam-link-replace-at-point

org-roam-link-replace-at-point is a byte-compiled function defined in org-roam-node.el.

Signature

(org-roam-link-replace-at-point &optional LINK)

Documentation

Replace "roam:" LINK at point with an "id:" link.

Source Code

;; Defined in ~/.emacs.d/elpa/org-roam-20260224.1637/org-roam-node.el
(defun org-roam-link-replace-at-point (&optional link)
  "Replace \"roam:\" LINK at point with an \"id:\" link."
  (save-excursion
    (save-match-data
      (let* ((link (or link (org-element-context)))
             (type (org-element-property :type link))
             (path (org-element-property :path link))
             (desc (and (org-element-property :contents-begin link)
                        (org-element-property :contents-end link)
                        (buffer-substring-no-properties
                         (org-element-property :contents-begin link)
                         (org-element-property :contents-end link))))
             node)
        (goto-char (org-element-property :begin link))
        (when (and (org-in-regexp org-link-any-re 1)
                   (string-equal type org-roam-link-type)
                   (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))))))))