13

Is it possible to automatically create backlinks to org-mode links? When a link to file B is added to file A, then also a link to file A is added to file B (i.e. the links are symmetrical - going both ways).

A concrete example:

I have two files a.org and b.org.

Inside a.org in heading Links I insert an org-link (with a new function org-link-with-backlink) to the file b.org.

So file a.org looks like this:

* Links
  [[~/org/b.org][b]]

* Heading 1
  lorem ipsum....

I'd like this to happen automatically:

  1. the file b.org is opened (if not open already)

  2. and inside its Links heading a link to a.org is created.

If Links doesn't exist yet, create it by prepending the file and add the link.

If b.org already has a link to a.org in its Links heading then do nothing.

So that b.org looks like this after the operation:

* Links
  [[~/org/a.org][a]]

* Heading X
  foo bar....

If now I inside file c.org add also a link to b.org, then b.org now looks like this:

* Links
  [[~/org/a.org][a]]
  [[~/org/c.org][c]]

* Heading X
  foo bar....

I think some sort of advice around org-link should accomplish this, but unfortunately this is beyond my elisp skills...

Thank you very much!

PS [optional]: I intend to use it in conjunction with org-wiki, to the solution could use the wiki style links as an alternative.

8
2

I just saw this new emacs package org-super-links that allows backlinks creation.

Usage example:

* Section A
  :PROPERTIES:
  :ID:       6a63d1d9-d361-4586-9315-6f7cb98ab2ef
  :END:
  :BACKLINKS:
  [2020-04-12 Sun 11:42] <- [[id:0c924010-a1cb-4f01-b4af-05a33ce588fe][Section B]]
  :END:

* Section B
  :PROPERTIES:
  :ID:       0c924010-a1cb-4f01-b4af-05a33ce588fe
  :END:

  I'm section B and this [[id:6a63d1d9-d361-4586-9315-6f7cb98ab2ef][Section A]] is a 
  link to section A

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.