Validate/fix all backlinks
meedstrom opened this issue · 4 comments
Hi, I didn't get this info from the readme, but is it possible to scan all files in a directory to fix outdated backlinks?
I mainly use org-roam, but it's slow with thousands of nodes. Thinking about rewriting its org-roam-db-update-file
, I understood that a major performance challenge is figuring out which subtree to which a backlink belongs, so it's a great idea to "cache" backlinks as org-super-links does!
I'm just concerned about the info staying up to date. Or what if you inherit an org-roam directory, already full of ID-links, but you never used org-super-links so none of them have a :BACKLINKS:
property?
If you use org-id for links, which is strongly recommended, then you shouldn't need to worry about them getting out of sync. If something changes though org-id does provide org-id-update-id-locations
. So basically org-super-links does not manage any of it itself and leaves it to standard org-mode/emacs machinery.
There is no current way to bulk add backlinks properties automatically either. There is the org-super-links-convert-link-to-super function that will get you part of the way there by handling a single link, but nothing in bulk at the moment.
Hopefully that answers your questions.
I understand, and indeed bulk-adding is one of my two concerns. The other is, what happens when you remove a link? I assume the backlink must be removed manually by the user?
In the time since I filed this issue, I made the following package, which does try to offer org-super-links integration: https://github.com/meedstrom/org-node?tab=readme-ov-file#backlink-solution-2-printed-inside-the-file
I could try to reuse my experience with my in-house :BACKLINKS: property, and come up with a similar bulk-adder for org-super-links drawers if you want. But I am not sure about the best way to automate cleanup, since it seems org-super-links offers a lot of customization, with timestamped backlinks etc.
Ah, I see there exists a command org-super-links-delete-link
! Never mind my second concern.
A bulk adder would be great. It's something I've always wanted to work on but just haven't made the time.
You may also find this interesting https://github.com/toshism/org-super-links/wiki/Tips#create-a-new-target-and-auto-link-to-it if you like the org-roam style capture stuff. It's not exactly the same but could easily be adapted to function similarly. You just need to create a capture template that creates a new file or whatever.