meedstrom / org-node

A notetaking system like Roam using Emacs Org-mode
GNU General Public License v3.0
136 stars 5 forks source link

outsourcing to org-capture seems to mean that org-node doesn't index new captures #15

Closed emacsomancer closed 2 months ago

emacsomancer commented 4 months ago

I have set (setq org-node-creation-fn #'org-capture), but org-node then doesn't seem to know about new nodes created by captures.

emacsomancer commented 4 months ago

In general, I seem to have to force org-node to update as so:

  (defun bms/org-node-refresh ()
    (interactive)
    (org-node-files)
    (org-node-reset))
meedstrom commented 4 months ago

Thanks for the report, I think it should work now!

emacsomancer commented 4 months ago

I still have to run my =bms/org-node-refresh= function it seems, in order to get org-node to have all of my nodes.

meedstrom commented 4 months ago

Hm.

I assume the capture is resulting in a new file-level node?

It is not enough to just save the buffer? Because after-save-hook triggers org-node-cache-rescan-file, so something may be wrong in that function, but I'm more inclined to think it's not being triggered somehow.

emacsomancer commented 4 months ago

Yes, capture are resulting in new file-level nodes, and now org-node seems to see them as well.

But I find that I still have to run bms/org-node-refresh on every Emacs restart in order for org-node to see my org-roam nodes.

meedstrom commented 4 months ago

Oh, that's good news.

But regarding the restart thing: I'll guess what you're observing is that the tables are empty until the first-time scan completes. Which is asynchronous. Does it work if you just wait a bit?

~I now pushed a change to make org-node-find wait synchronously if org-nodes is empty.~

meedstrom commented 4 months ago

Actually I think it was already designed to wait synchronously. Something else must be wrong.

emacsomancer commented 4 months ago

It's possible (likely) it's something in my config. But I'm not sure what.

I did earlier have a function which messed with org-id-files, because I'm using org-caldav and I don't want it to search through all nodes (because it takes too long), so I'd reset the value of org-id-files (because it uses this). But I've changed that and I can't find anything else in my config which messes with org-id-files.

[edit: waiting for 10 minutes on restart doesn't seem to do anything; I still need to manually trigger it.]

meedstrom commented 2 months ago

I expect this to be fixed by now, if nothing else because the init as well as every reset will call (org-node-files) without memoization.