Function: org-roam-capture--finalize-insert-link

org-roam-capture--finalize-insert-link is a byte-compiled function defined in org-roam-capture.el.

Signature

(org-roam-capture--finalize-insert-link)

Documentation

Insert a link to ID into the buffer where Org-capture was called.

ID is the Org id of the newly captured content. This function is to be called in the Org-capture finalization process.

Source Code

;; Defined in ~/.emacs.d/elpa/org-roam-20260224.1637/org-roam-capture.el
(defun org-roam-capture--finalize-insert-link ()
  "Insert a link to ID into the buffer where Org-capture was called.
ID is the Org id of the newly captured content.
This function is to be called in the Org-capture finalization process."
  (when-let* ((mkr (org-roam-capture--get :call-location))
              (buf (marker-buffer mkr)))
    (with-current-buffer buf
      (when-let* ((region (org-roam-capture--get :region)))
        (delete-region (car region) (cdr region))
        (set-marker (car region) nil)
        (set-marker (cdr region) nil))
      (let* ((id (org-roam-capture--get :id))
             (description (org-roam-capture--get :link-description))
             (link (org-link-make-string (concat "id:" id)
                                         description)))
        (if (eq (point) (marker-position mkr))
            (insert link)
          (org-with-point-at mkr
            (insert link)))
        (run-hook-with-args 'org-roam-post-node-insert-hook
                            id
                            description)))))