Links with Org-IDs are not showing up in backlinks

If I use org-roam with org-ids, all backlinks to headings do not show up (it works fine without using ord-id ). I’ve added this to my .emacs:

(setq org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id)

If, however, I use org-roam-insert to link to the file with the headings, all links with org-ids also show up in the backlinks. It appears that somehow the database is not updated. Is there anything I can do to fix this behaviour? For reasons of long-term preservability I am strongly preferring the use of org-ids. Thank a lot.

I have no problem with showing backlink using org-id type of link.

#+TITLE: testing example A
#+CREATED:       [2020-11-06 Fri 14:30]
#+LAST_MODIFIED: [2020-11-06 Fri 14:33]

* headline 1
  :PROPERTIES:
  :ID:       uuid-a
  :END:

* headline 2
  :PROPERTIES:
  :ID:       uuid-b
  :END:

In another file B like this:

#+TITLE: testing example B
#+CREATED:       [2020-11-06 Fri 14:32]
#+LAST_MODIFIED: [2020-11-06 Fri 14:33]

I link a [[id:uuid-b][file]]

If I am in file A, I can see a backlink pointing to file B.

Thanks for the reply. If the backlinks with org-id show up, they work fine for me as well. My issue is that the database is somehow not updated when I use org-store-link and org-id is active. For what it is worth, I even did a org-roam-db-clear & org-roam-db-built-cache and they would still not show up in the backlinks. Only if I use org-roam-insert to the file which contains the headline, the database is finally updated and they show up. They remain there even if I remove the link afterwards - so that is a workaround, but still not a good solution.

Offtopic: how do you create the #+created: & #+last_modified ?

I am not sure how you manipulate org-mode file exactly.

On my side, if I:

  1. (org-id-copy) under an org entry
  2. mark any string in any org-roam note
  3. link this string with id:UUID
  4. save file

Then, if I go back to the file that has a entry being linked. I now
can see the back link without any delay.


The time stamp is stolen from Leo Vivier https://github.com/zaeph/.emacs.d/blob/4548c34d1965f4732d5df1f56134dc36b58f6577/init.el#L2822-L2875

My bad. I missed the crucial part, action no. 4. Without saving it could not work. Great way to start here :slight_smile:

I’ve added this to my .emacs to avoid the issue:

(defun save-after-link-store ()
  (interactive)
  (call-interactively 'org-store-link)
  (save-buffer))
(global-set-key (kbd "C-c l") 'save-after-link-store)

(define-key org-mode-map (kbd "C-c C-l") nil)
(defun save-after-insert-link ()
  (interactive)
  (call-interactively 'org-insert-link)
  (save-buffer))
(global-set-key (kbd "C-c C-l") 'save-after-insert-link)

It works great, so far.

ps Thanks also for the link to the time stamp code. I haven’t figured out how to get that to work but that is something for another day.