7

I create the id of the heading (with org-id-copy function) and somewhere in the file i create link to it: [[id:XXXXXXXXXXXXXXXXXXXXX][name]]. The problem is that the link works only on the computer i created it. When i move the file to another computer, the link stops working, giving the error: No match - create this as new heading? (y/n)

How can i make it work on another computer? Is there any function to scan all ids and make links work again?

4 Answers 4

1

I do not know the answer for your specific question. But alternatively using org-store-link (I bind it to C-c l) to store the link to the heading and then insert the link with org-insert-link (I bind it to C-c C-l) will do what you want, since org-store-link will make a link containing the location of the org file.

If you want to be able to change the heading names freely, then you can add CUSTOM_ID property to the target heading and generate a link to it (for example, [[#my_casutom_id]]). Then you can freely change the heading itself without breaking the link.

6
  • There's one problem with this solution - when my headings change names, the links stop working completely. That's why i want to use org-id-copy. If it only was working on different computers too (i'm syncing my org file with 2 computers).
    – Kossak
    May 10, 2015 at 20:06
  • No, at least by default (?), when using the above key bindings, Org creates a PROPERTY with a hash at the target headline, and then insert a link with the same hash where you wanna put your links.
    – fniessen
    May 10, 2015 at 20:28
  • What property name is added when you use it org-store-link? I have the same keybindings, but for me the functions only copy/paste the name of the heading, not any properties.
    – Kossak
    May 10, 2015 at 22:17
  • 1
    You can add CUSTOM_ID property and generate a link to it as well. Then you can freely change the heading itself without breaking the link.
    – joon
    May 11, 2015 at 3:08
  • @joon this is the solution, i used CUSTOM_ID property and link in the format [[#my_custom_id]] and it works across different computers. Can you post it as an answer so i can mark it as solution? Thank you.
    – Kossak
    May 11, 2015 at 18:35
7

I prefer org-id solution over CUSTOM_ID property.

To have it working across multiple machines you simply need to run org-id-update-id-locations after moving your file to another machine!

1
  • This should be the accepted answer. The CUSTOM_ID approach will fail in certain circumstances, e.g. after archiving. Also the ids are stored in a file specified by the org-id-locations-file variable, and the default is ~/.emacs.d/.org-id-locations, so it's a hidden file.
    – Jason
    Feb 23, 2020 at 15:08
1

The org-id file associations are stored in org-id-locations-file. You should be able to refresh them using org-id-update-id-locations, which will rescan

all agenda files, all associated archives, all open Org files, and all files currently mentioned in org-id-locations.

You can also call it with a list of org-mode files as an argument and it will scan those too.

New contributor
dante is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
0

I was receiving the same error when navigating to a link but fixed it by explicitly loading org-id: (require 'org-id)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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