Org-roam-bibtex for Org-Roam v2

I downloaded the branch and looked at it after seeing your messages in Doom’s Github. I didn’t try to install it because I didn’t have time to figure out how to do it properly in Doom. I mean Org-mode is so complex and heavily rooted in Doom and the last thing I want to do is to mess up my Org-mode installation, which would basically mean my main work stops until it’s fixed. I’ll need to try it in a separate Emacs instance. How do you install it correctly in Doom?

Hah, I had the same issue, so with a little help from Nicolas, just created this little init file, for use with emacs -Q.

I have a separate Doom Emacs instance for development of ORB v0.6/Org-roam v2. I didn’t want to install the wip-cite-new before I fixed the things with ORB for v2. Now when it’s more or less up, I can install wip-cite-new in that instance and can directly check how it plays with Org-ref and Org-roam v2.

Thanks a lot! So it’s basically for plain Emacs. I actually forgot how to use it :slight_smile:

Yes, but if you use the bibtex-actions, etc. option it’ll install and setup selectrum, etc., so at least the experience is not painful :wink:

I adapted that from the selectrum test scripts that Daniel Mendler recently added.

1 Like

Great, thanks!

Yes this allows me to search references with org-roam-ref-find. It seem that org-roam-bibtex isn’t loading correctly org-ref.

However, if I restart emacs it doesn’t work. The warning persists though.

I will keep using V1 for the moment given my problems to load correctly org-roam-bibtex.

For Org-roam, supporting org-cite shouldn’t be too difficult. Like @mshevchuk says, Org-roam just needs to register the new citation links during db build and updates. Will look at it once org-cite is merged into Org, as far as I can tell right now there’s nothing Org-roam needs to change drastically to support this.

1 Like

Org-roam-bibtex is not supposed to load Org-ref. You can load it together with ORB like in

(use-package! org-roam-bibtex
   ...
   :config
   (require 'org-ref)
  ...)

But you can also do it elsewhere in your config. Not sure why the above is not working. Below is my testing config and I don’t have any issues with Org-ref:

(use-package! org-ref
  :after org
  :commands
  (org-ref-cite-hydra/body
   org-ref-bibtex-hydra/body)
  :config
  (setq org-ref-default-bibliography
        '("/path/to/my/bib")))

(use-package! org-roam-bibtex
  :after org-roam
  :config
  (require 'org-ref)
  (setq org-roam-capture-templates
        '(("d" "default" plain "%?" :if-new
           (file+olp "%<%Y%m%d%H%M%S>-${slug}.org" ("heading 1" "heading 2"))
           :unnarrowed t)
          ("r" "multi-file" plain "%?"
           :if-new
           (file+head "test/${citekey}.org" "#+title: ${title}\n")
           :unnarrowed t)
          ("n" "single-file" plain "%?"
           :if-new
           (file+olp "test/references.org" ("${citekey}"))
           :unnarrowed t))))

(after! org-roam
  (org-roam-bibtex-mode))

Maybe you should also try

(use-package! org-ref
  :after org)  ;; instead of :after org-roam

Also, sometimes purging and rebuilding all the packages in Doom helps to resolve various issues.

I’m now looking at Org-cite more closely and it seems that citations are completely new Org objects (elements) rather than custom links. As such, Org-ref and Org-cite are orthogonal and should not even interfere with one another. Logically, it of course does not make sense to mix the two systems because the citation numbers will be messed on export, but technically there would be no problems. Org-roam can also support both simultaneously without any major effort.

@bruce, could you point me to any resources which describe the syntax of Org-cite citations?

It may not be documented ATM, but this email summarizes current state:

https://lists.gnu.org/archive/html/emacs-orgmode/2021-04/msg00790.html

TBD is a new “sub-style” feature that he since added:

https://lists.gnu.org/archive/html/emacs-orgmode/2021-05/msg00402.html

That may go away, or be modified. I expect that decision soon.

Edit: everything else is solid.

1 Like

Thanks!

I just used the cite-init.el file to run Emacs; I created an Org file such as

#+TITLE: title
#+bibliography: ~/path/to/my/library.bib

This is test citation [cite:@existing-cite-key]

I set org-cite-follow-processor, org-cite-activate-processor to basic and org-cite-export-processor to (natbib). When trying org-open-at-point, I get “No link found” user-error; when trying to export this file, I get Invalid cite export processor definition: (natbib))

Do you have an idea what I might be doing wrong?

Also, when I move the point to the citation
[cite:@existing-cite-key] and evaluate (org-element-context), the output is (paragraph ...), whereas I would expect it to be something like (citation ...)

How do you do that evaluate step?

Here’s a minimal file that works for me:

#+cite_export: natbib

[cite:@key]

Hi everyone. I’ve been using Org-roam v2 and Org-roam Bibtex v0.6 for a while now. I have a couple of issues:

  1. Accidentally, outside of Emacs I renamed an org-roam note linked to a bibliographical reference. So, with helm-bibtex I could not open those notes through Edit-notes any longer. I rechanged the name of the file and now helm-bibtex correctly displays the note unless org-roam-bibtex is on. Is there a way to fix this?
  2. Also, with org-roam-bibtex on, if I want to add a note to a bibliographic reference but then I decide to abort by pressing q, OB throws me a wrong-type-argument error. Any ideas why this happens?

I forgot to mention: evaluating (orb-make-notes-cache) did not help.

If you rename a file outside Emacs, you should run org-roam-db-sync. This is true for any note, not only those created through ORB. After this, evaluate orb-make-notes-cache to update the ORB cache. Another way - simply restart Emacs.