ORB always prompting for template capture, even if the node already exists

Hi all, I posed this on the org-roam-bibtex GitHub, but I thought I might also ask for help here. I use a combination of helm-bibtex, org-roam, and org-roam-bibtex for my ZK system.

On Emacs startup, ORB seems to not be active, despite having org-roam-bibtex-mode on: if I go into helm-bibtex and select “Edit notes,” then helm-bibtex will either (a) correctly navigate to the appropriate note if the note exists or (b) incorrectly try to make a helm-bibtex note (i.e., without org-capture template) if the note does not exist.

However, if I either manually restart org-roam-bibtex-mode (i.e., turn it off and on)—or if I invoke a function that requires org-roam-bibtex-mode (e.g., orb-insert-link), then helm-bibtex will try to use an org-capture template every time, regardless of whether the note is already created or not. I can work around this by just capturing a blank template whenever I navigate between notes, but this can be a bit cumbersome.

I imagine this has something to do with how these packages are loaded. I use Emacs 28.2 run as a daemon and I’ve seen similar oddities before. But I can’t really figure this one out and would really appreciate some help. My code (minus my keybindings) is below:

(use-package org-roam
  :custom
  (org-roam-directory (file-truename "~/Documents/Homework/Zettelkasten/Nodes"))
  (org-roam-completion-everywhere t)
  (org-roam-capture-templates
    `(("r" "Reference" plain
      (file "~/Documents/Homework/Zettelkasten/Templates/reference.org")
       :target (file "Reference/${citekey}.org")
       :unnarrowed t)
      ("b" "Blank Reference Workaround" plain
      (file "~/Documents/Homework/Zettelkasten/Templates/blank.org")
       :target (file "Reference/${citekey}.org")
       :unnarrowed t)))
  :config
  (setq org-roam-mode-sections
        '((org-roam-backlinks-section :unique t)
          org-roam-reflinks-section))
  (org-roam-db-autosync-mode))

(use-package org-roam-bibtex
  :after org-roam helm-bibtex
  :config
  (setq orb-preformat-keywords '("citekey" "author-or-editor-abbrev" "author-or-editor" "date" "title" "url" "keywords" "file")
        orb-process-file-keyword t
        orb-attached-file-extensions '("pdf")
        orb-insert-interface 'helm-bibtex
        orb-insert-link-description 'citekey
        orb-file-field-extensions '("pdf" "epub"))
  (org-roam-bibtex-mode 1))

Thank you in advance!

In case anyone else is having this problem, I managed to figure this out with help on the org-roam-bibtex GitHub.

The problem is that I was not using org-ref, while ORB defaults to org-ref-v2-style citations. Notes were therefore not being registered in the org-roam database, and the capture prompt for a new note was asked every time.

A way to get around this without using org-ref is to use org-cite-style citations, which comes built-in with org:

(use-package org-roam-bibtex
  :after org-roam
  :config
  (setq orb-preformat-keywords '("citekey" "author-or-editor-abbrev" "author-or-editor" "date" "title" "url" "keywords" "file")
        orb-process-file-keyword t
        orb-attached-file-extensions '("pdf")
        orb-insert-interface 'helm-bibtex
        orb-insert-link-description 'citekey
        orb-roam-ref-format 'org-cite
        orb-file-field-extensions '("pdf" "epub")))

(org-roam-bibtex-mode +1)

So everything works now. Thanks again for your help!

1 Like