Running Doom Emacs 2.0.9 on Emacs 27.1.

In an org file, I have:

* First heading
  :ID:       89f7215b-60b1-45c8-8262-b0e10db18f4c
* Second heading

I got that ID by using org-id-store-link function.

Now, I want to insert a link to that heading. So, I did org-insert-link and it displayed various options. I was looking forward to some kind of auto-completion --- I start typing Firs.. and it suggests the correct link.

But that does not seem to be happening.

How do I get that behavior?


You need to enable ID links by customizing the option org-id-link-to-org-use-id. The doc string of the variable says:

Non-nil means storing a link to an Org file will use entry IDs.

The variable can have the following values:


 Create an ID if needed to make a link to the current entry.


 If ‘org-store-link’ is called directly (interactively, as a user
 command), do create an ID to support the link.  But when doing the
 job for capture, only use the ID if it already exists.  The
 purpose of this setting is to avoid proliferation of unwanted
 IDs, just because you happen to be in an Org file when you
 call ‘org-capture’ that automatically and preemptively creates a
 link.  If you do want to get an ID link in a capture template to
 an entry not having an ID, create it first by explicitly creating
 a link to it, using ‘C-c l’ first.


 Like create-if-interactive, but do not create an ID if there is
 a CUSTOM_ID property defined in the entry.


 Use existing ID, do not create one.


Never use an ID to make a link, instead link using a text search for
 the headline text.

I'd start by setting it to use-existing and go from there.

  • Thanks. I did set up the variable as suggested. (setq org-id-link-to-org-use-id 'use-existing). Now when I try to create link org-insert-link, it shows me various options like doom-repo, wolfram, wikipedia, etc. In this list of 35 items, there is an option for id and another option for org. Selecting org, I can create a link to an org file. But how do I create a link to a heading? Do I need to use any other commands?
    – deshmukh
    Apr 1 at 2:31
  • With the option on, you should be able to org-store-link (suggested binding: C-c l) on a heading with an ID property and then org-insert-link (suggested binding: C-c C-l) to insert such a link.
    – NickD
    Apr 1 at 3:24
  • 1
    Thanks. With org-store-link it works even without the ID property set. So, why does one go the extra mile to create an ID? By the way, this led me to reading the manual about links and that led me to discover a couple of very powerful things. :)
    – deshmukh
    Apr 1 at 8:16
  • Basically IDs are (spposed to be) unique, so the link desitnation is unambiguous.
    – NickD
    Apr 1 at 15:10

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.