When creating a capture, org capture will auto insert a link which link to the location where the capture action happens, if the capture template contains "%a".

e.g: I'm in heading A, and using M-x org-capture to create a new heading B, B will contain a link to A.

I found that, the link is an absolute link, e.g: [[A][file:\path\to\file:*A]].

My question is, how to change the style of the auto insert link? I want to use an id like link, e.g: [id:foo].

1 Answer 1


This will use an id-style link when capture action happen in a org heading with ID property.

(add-to-list 'org-link-parameters
    :store test/store-link))
(defun test/store-link ()
  (if (eq major-mode 'org-mode)
    (let ((id (org-entry-get 
                (point) "ID")))
      (when id
          :type "test/store-link"
          :link (concat "id:" id)
          :description id)))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.