Org-Roam doesn’t find some of my nodes.
The nodes that are not found are nodes that exist in a subdirectory in my Org-Roam-Directory, and the subdirectory is not tracked by the git repository for the org-roam-directory.
Taking the subdirectory filepath out of gitignore makes the org-roam nodes visible again (after running org-roam-db-sync).
What did you expect to happen?
My understanding was that org-roam searches recursively within org-roam-directory, and I was unfamiliar with .gitignore modifying this behaviour. Unsure if this is an org-roam thing or a doom thing.
Steps to reproduce
- Put your org-roam-directory under git version control.
- In org-roam-directory, create a subdirectory that you then will exclude from the git repository by adding the subdirectory filepath to the git repository .gitignore.
- Put some Org-Roam nodes into this subdirectory.
- Attempt to search for a node that exists in this subdirectory.
Loading data dump...
(setq org-roam-list-files-commands '(find fd fdfind rg)))
How I figured this out
I appreciate it when people explain how they debug issues so I can do it myself next time, so here goes. You can see where functions are bound with
M-x where-is (including
where-is itself!); most of these tools are bound to sane keybindings, which expedites the process once you’re comfortable. Feel free to follow along.
I assumed you were using
org-roam-node-find when you said “attempt to search for a node”. It’s always good to use exact symbol names in reproduction steps.
helpful-callable) to see if it was ignoring things from the database at runtime. Nothing seemed relevant, so I assumed the node wasn’t making it into the database at all.
org-roam-db-sync to see how it ignored input. It looks it uses
org-roam-list-files to get files. Calling
helpful-callable while the point (cursor) is on a function will default the input to the function at point, so let’s inspect that. It actually just wraps the internal
org--roam-list-files. We need to go deeper!
Here, it looks like org-roam uses external shell commands if defined. Let’s inspect
Hmm, it looks like the original value defaults to
find, but the current value defaults to
fd. Let’s see if the Doom module is to blame.
:lang org will take you to the Org module README.
The README is in your Emacs directory alongside the module code, so let’s
find-file and visit
contrib/roam2.el. Then I
fd, and voilà, it looks like
+roam2 indeed makes this change, for speed. You could also just search the entire Doom source if you weren’t familiar with the module structure with
The simple fix is to reorder the executables in your private config. If you really wanted to use
fd, you could redefine
org-roam--list-files-fd (how I found this is left as an exercise to the reader ) or even submit a PR to make the behavior across executables consistent upstream. I’ve added this to my backlog, but anyone is free to beat me to it. I won’t get to it for at least a week.
hey Liam, thanks so much for the response, I haven’t had a chance to go through all your help in how you were able to debug it yet, but I intend to.
The solution you suggested worked great,
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.