Frequently when I do a basic search (e.g. calling
org-roam-node-find), I can’t find any of my nodes except all my dailies show up. I haven’t figured out what triggers this; it doesn’t seem to happen when I’m actively using it, but if I leave things alone for a bit and then come back to Emacs this often happens. The only thing I’ve found to fix it is manually call
org-roam-db-sync. But this also takes an extremely long time (at least 10-20 seconds).
My config uses Spacemacs and the only relevant line is that I have set
(add-hook 'org-mode-hook 'org-roam-db-autosync-mode)
I checked the modes and
org-roam-db-autosync-mode does appear to be on whenever I’m in an org file.
TL;DR: I’m suffering from the following two issues, which might be unrelated. Any ideas why?
- My nodes are constantly un-indexed and I have to manually sync the database frequently.
org-roam-db-sync takes an extremely long time which also blocks Emacs.
Remove org-roam-db-autosync-mode from org-mode-hook. It is not meant to be there.
org-roam-db-autosync-mode is a global mode and meant to be enabled once in your Emacs session. It updates the whole org-roam-db when you enable it to sync all the updates to the files to db. Org-mode-hook is called every time you visit a org file. So, effectively, I think you are updating the whole db for each org file.
Spacemacs has a layer for org-roam, if I recall correctly. So perhaps you can follow its documentation to set it up correctly. If you have a reason not to use the layer, README of Org-roam has a sample configuration with use-package.
For issue 1, you need to save the buffer. That is when Org-roam updates the file the current buffer is visiting into the db. Since this process updates only one entry, it should not take too long (it should be a fraction of a second). If this is not happening, your Org-roam is not set up properly.
For issue 2, how many files do you have in your db? The current community experience seems to be that updating the whole db might start to feel slow around 10,000 nodes. I have about 300 and feel instantaneous.
Thanks for the fast response!
org-roam-db-autosync-mode is a global mode and meant to be enabled once in your Emacs session
Thanks, this was not obvious to me and seems to be the root of my issues.
Unfortunately the Spacemacs layer for org-roam doesn’t seem to call this by default, and I’m having issues getting it to call
org-roam-db-autosync-mode properly. For anyone who has the same problems, this seems to be the most relevant issue: org-roam-setup cause race condition with user config file · Issue #15724 · syl20bnr/spacemacs · GitHub
I guess for now I’ll just manually call the function when I start Emacs…
I’m actually thinking of moving to Doom because of various issues I’ve had with Spacemacs. Do you happen to know of any collection of resources for setting up configuration of only org-roam? That’s the only thing I use Emacs for essentially.
I am afraid I don’t. But there is an installation example in README of org-roamGitHub repo. Doom has a module(? layer?) for Org-roam (use v2, which is the current). So that’s a starting point.
Org-roam GitHub repo has a wiki; some might be useful for Doom but I can’t confirm.
Other than that, perhaps you can search in this forum. There has been many interactions with Doom users here. Others might want to jump in to give you more help.
If this is the case (like me), I’d go without Spacemacs or Doom; just a plain Emacs with a few config would do.
This is the guide I created for such case. It’s aimed for Windows users but the config would work for Mac or Linux. I’d need to update content now that 29.1 is released and a few things have changed. I’d now recommend Vertico instead of Selectrum.