chipsenkbeil / org-roam.nvim

Port of org-roam to neovim using orgmode
MIT License
113 stars 10 forks source link

Store link not inserting existing files into roam graph #66

Open bchr0n opened 1 week ago

bchr0n commented 1 week ago

Been getting used to org-mode over the past few months and wanted to start dipping my toes into moving over my obsidian notes into org-roam. But I have run into an issue where I can't insert my existing org files into the graph. I tried the store link tip in the Docs but I was never able to get an ID and I assume that a node was never created. I tried both with a precreated properties and title like the docs show and then without but I still never received an ID for the headline. Creating nodes through the insert means still works perfectly fine, just the inserting existing files functionality hasn't been working. Below is screenshots of my config for org-mode and org-roam.

image

chipsenkbeil commented 1 week ago

@bchr0n hey there 😄 To make sure I understand, what you're trying to do is take existing org files that you've already written and are in the codex directory and convert them into nodes?

I'm not sure which document you're referring to about using the store link feature of the orgmode plugin, but at the moment the only way to get existing org files to be counted as nodes (for use in inserting, finding, etc) is to add a unique id following the properties format that roam uses and reload the database.

Since I don't use the store link feature, I read through it a little bit and it looks similar to trying to use org-get-or-create from Emacs, but at the moment that functionality of adding an ID does not parse the document as a roam node or load it into the roam database. But it seems like the store link isn't working like you'd expect by inserting an id, so I'd recommend filing the issue with the nvim-orgmode plugin first to figure out why it isn't adding the ID property. Once that is resolved, you'd want some way to cause that to reload the roam database to parse the file as a node.

bchr0n commented 1 week ago

Hello again, I take that emoji to mean you remember me. Yeah that is correct. For reference I was using this part of the org-roam docs image

How would you recommend adding that ID property then? Is that something I can create and reference myself or do I need the roam database to generate it for me and if so how do I do that? Is store link the only way nvim-orgmode or org-roam can achieve that?

chipsenkbeil commented 1 week ago

Oh, @seflue wrote that as part of https://github.com/chipsenkbeil/org-roam.nvim/pull/55. I've never done that myself. Once the properties with an id is in place, the plugin should ideally detect the file and load it into the database. You can try :RoamUpdate! or :RoamReset once you've written the file with the properties id and it should pick it up.

The tip in the docs mentions that you need to have a headline for the id to show up. Were you trying this with a headline? It's using nvim-orgmode's functionality to generate with that approach.

Sounds like a potential enhancement would be to support a method directly from this plugin that will insert an id into an existing file/headline and update the roam database all in one go.


Is that something I can create and reference myself

You can technically make up any id you want and reference it yourself. As soon as there is an id property, the next time you load neovim it should be parsed as a roam node. You can use the above commands to try to load it with neovim already running.

seflue commented 1 week ago

Exactly, @chipsenkbeil. The improvement is something, which primarily needs to be done in the store-link feature in orgmode, to support plain files. A wrapper in org-roam could update the node database, that would be convenient for headlines too. It's somewhere down my to-do list but I not with priority, because I don't need it often and the workaround mentioned in the docs works for me most of the time.

bchr0n commented 6 days ago

I did do it with a top level (*) headline and no ID was generated. I can provide a video when I get off work but @seflue just out of curiosity are you using any additional orgmode plugins? I am running basic lazyvim with just orgroam and org mode and haven't been able to get it to work.

And @chipsenkbeil so I could create a note with ID:1 and the database would recognize it? And then if I wanted to branch off of it the Roam-Origin would be 1? And once I run :RoamUpdate! I would be able to go back and forth between those two connected nodes?

chipsenkbeil commented 6 days ago

And @chipsenkbeil so I could create a note with ID:1 and the database would recognize it? And then if I wanted to branch off of it the Roam-Origin would be 1? And once I run :RoamUpdate! I would be able to go back and forth between those two connected nodes?

Yes, you can manually create a node with id 1 and use :RoamUpdate! (maybe just :RoamUpdate would work) and it will now exist within the database. Here's a video demonstrating the full flow:

https://github.com/user-attachments/assets/81913dee-09ba-4243-b3e4-2e4f069d933f

seflue commented 6 days ago

I did do it with a top level (*) headline and no ID was generated.

Did you activate the necessary option in or more config? org_id_link_to_org_use_id must be set to true.

I can provide a video when I get off work but @seflue just out of curiosity are you using any additional orgmode plugins? I am running basic lazyvim with just orgroam and org mode and haven't been able to get it to work.

I'm using telescope-orgmode.nvim in addition, but this is not necessary for the workaround. But I recommend it anyway. 👍