I use org-id to automatically create ID.

For instance in an org mode file: File_A.org

* File_A section

I type C-c l that create an id

* File_A section
  :PROPERTIES:
  :ID:       21588817-03d2-4000-8d37-43649499eff6
  :END:

Then I want to include File_A section in another file, File_B.org,

(in File_B.org)

#+INCLUDE: ".file_A.org::#21588817-03d2-4000-8d37-43649499eff6"

However, this does not work (C-c ' does not follow the link).

To make it works I have to manually add a redundant "CUSTOM_ID" property.

* File_A section
  :PROPERTIES:
  :ID:       21588817-03d2-4000-8d37-43649499eff6
  :CUSTOM_ID: 21588817-03d2-4000-8d37-43649499eff6
  :END:

I am confused by the role of :ID: and :CUSTOM_ID:...

Why on one side Org-Mode's #+INCLUDE:s follow :CUSTOM_ID: (official doc) and on the other side, org-id's links (C-c l and C-c C-l) use :ID: (official org-mode/org-id.el file)?

Ideally I do not want to have a redundant and manually added:CUSTOM_ID: every time I use #+INCLUDE:. My question: is there a clean way to #+INCLUDE: a section using :ID: and not :CUSTOM_ID:?

  • 1
    Sounds like a bug to me (probably on the include side). – NickD Nov 23 at 20:34

Forget about ID, used to generate unique identifiers (likely to be used by downstream libraries, not users), and use CUSTOM_ID.

To insert it, forget about C-c l and use C-c C-x p to set a property. You can then select CUSTOM_ID. You can also include a heading directly by it's name:

#+INCLUDE: file.org::*File_A section

When giving your headings CUSTOM_IDs, prefer names that make sense for you, so that you can make sense of the heading in the includer file.

  • Thanks for your answer. I understand your point, however I like :ID: because I think that they are more robust (org-id keeps a ID database). For instance if I rename File_A.org to something_else.org my links will always work (Emacs scan the agenda files). This is not the case if my links explicitly use the file name (CUSTOM_ID case). – Picaud Vincent Nov 27 at 8:36

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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