org-roam / org-roam-bibtex

Org Roam integration with bibliography management software
GNU General Public License v3.0
571 stars 47 forks source link

Initialize org-notes-cache lazily on demand #158

Closed cdlm closed 3 years ago

cdlm commented 3 years ago

I've been having problems properly loading org-roam-bibtex and org-ref; one symptom is that orb-find-note-file was being called before orb-notes-cache was initialized, and it seems like a lazy initialization would make orb-find-note-file more robust.

cdlm commented 3 years ago

For context, because I have to admit I'm pretty confused regarding which package depends on which…

The symptom is that I have a cite link in an org-roam note which is not recognized until I've run bibtex-completion-candidates or orb-make-notes-cache manually. The link is not colorized and there's a !!! no ref found !!!

I've found hints that helm-bibtex triggers that initialization by calling bibtex-completion-candidates… but I'd like to avoid helm altogether, as I'm currently trying selectrum.

myshevchuk commented 3 years ago

Hi, thanks a lot. This issue has already been reported in #159. Check also my comment there. I personally did not experience it, but your PR makes the things more robust.

It was my bad. The orb-notes-cache commit was introduced recently as a quick fix for another issue. When I have more time, I'll explore the internals of bibtex-completion to find a more appropriate solution.

cdlm commented 3 years ago

👍🏻

The orb-notes-cache commit was introduced recently

yeah I saw that, it's one of the reasons I sent the PR even though I don't think I have a good feeling for code quality in ELisp yet