Unique unique identifier in org-mode emacs files
I have multiple .org files and I would like to be able to create links between them using an ID. I use DOIs as unique identifiers. I can link inside the file using properties:
* Paper 1
:PROPERTIES:
:CUSTOM_ID: 10.1088/0953-8984/23/21/213001
:END:
* Paper 2
:PROPERTIES:
:CUSTOM_ID: 10.1038/nphys2935
See also [[#10.1088/0953-8984/23/21/213001]]
Is there a way to make custom_id global so I can refer to it from another file?
I think the org-id is what I need to go further, but I found the documentation a little confusing. I tried to add the following lines to my.emacs
;; Use global IDs
(require 'org-id)
(setq org-id-link-to-org-use-id use-existing)
;; Update ID file .org-id-locations on startup
(org-id-update-id-locations)
but the file .emacs.d/.org-id-locations
only has nil
.
Looks like globals will not be auto-generated ( Assign IDs to each record in Org mode ). I tried (with cursor on title) use M-x org-id-get-create
, but it doesn't do anything.
EDIT: (Based on helpful comment)
For one session, I can store and create links using M-x org-store-link
, while header ( Paper 1
in my example above). Then I can use M-x org-insert-link
and enter an id to insert the link. The link looks like [[id:10.1088/0953-8984/23/21/213001][Paper 1]]
. But I ran into two problems: (1) I would like the IDs to be saved automatically. (2) Links do not work when I close and reopen the file.
EDIT: Related question:
source to share
So, here is the solution I came up with.
-
In my configuration,
.emacs
I kept the same settings as in my question:(require 'org-id) (setq org-id-link-to-org-use-id use-existing) ;; Update ID file on startup (org-id-update-id-locations)
-
The files must be part of the contributor list (or added to the list of additional files using
org-id-extra-files
( See documentationorg-id
)) -
Use
ID
insteadCUSTOM_ID
in boxPROPERTIES
:* Paper 1 :PROPERTIES: :ID: 10.1088/0953-8984/23/21/213001 :END:
-
Each ID has to be created (if necessary, in my case I already have it) and the link added to the ID file (the links are stored in
.emacs.d/.org-id-locations
). This is done withorg-id-get-create
: with the cursor on the title, call it withM-x org-id-get-create
-
Link to the identifier using
[[id:10.1088/0953-8984/23/21/213001][Paper 1]]
.
I need to think a little about when I want the ID to be created; I can automate the process by binding the ID store to another function I will do for all headers.
source to share