Minimal setup for helm-bibtex, org-roam v2, org-roam-bibtex

I know that there are several posts in this community about this specific question, but I can’t make it work.

I want to point that org-roam v2 is working for me, and I am able to insert nodes, etc. (I am having a little trouble with the new movement to the extensions folder, but I am not using dailies a lot, so, not my big problem right now).

I used to have a workflow that incorporated Zotero, org-noter, org-ref, helm-bibtex, org-roam etc. And everything was working.

Today, I wanted to take some notes regarding a book, and org-roam is not using the appropriate template (is using the default from helm-bibtex). I already removed org-noter (I am not using it anyway a lot), but I don’t know how to get the correct template here.

My configuration is the following:


 (use-package helm-bibtex
  (setq bibtex-completion-bibliography bib-files-directory
        bibtex-completion-library-path pdf-files-directory
        bibtex-completion-pdf-field "File"
        bibtex-completion-notes-path bib-notes-directory)

  ;; Símbolos usados para indicar que tiene PDF y notas
  (setq bibtex-completion-pdf-symbol "⌘")
  (setq bibtex-completion-notes-symbol "✎")
  (setq bibtex-completion-additional-search-fields '(journal booktitle))

  (setq bibtex-completion-notes-extension ".org")
  (setq bibtex-completion-pdf-extension '(".pdf" ".djvu" ".txt"))

  ;; Para abrir URL/DOIs
  (setq bibtex-completion-browser-function
        (lambda (url _) (start-process "firefox" "*firefox*" "firefox" url)))

   "Open annotated PDF (if present)" 'helm-bibtex-open-annotated-pdf
   helm-source-bibtex 1)

  (("C-x C-b" . helm-bibtex)
   ("<menu>" . helm-bibtex)
   :map helm-command-map
   ("b" . helm-bibtex)))


(use-package org-ref
  :after (org bibtex)
  (setq org-ref-default-bibliography bib-files-directory)
  (setq org-ref-completion-library 'org-ref-helm-cite)
  (setq org-ref-get-pdf-filename-function 'org-ref-get-pdf-filename-helm-bibtex)
  (setq org-ref-default-citation-link "citep"))


(use-package org-roam
  (setq org-roam-v2-ack t)
  (require 'org-roam-protocol)
  (org-roam-directory "~/research/notas")
  (org-roam-dailies-directory "~/org/daily")
  (org-roam-db-location "~/.cache/emacs/org-roam.db")
  (org-roam-completion-everywhere t)
  (org-roam-db-gc-threshold most-positive-fixnum)
  (org-id-link-to-org-use-id t)
  :bind (("C-c n l" . org-roam-buffer-toggle)
         ("C-c n f" . org-roam-node-find)
         ("C-c n i" . org-roam-node-insert)
         ("C-c n r" . org-roam-ref-find)
         ("C-c n c" . org-roam-capture)
         ("C-c n j" . org-roam-dailies-capture-today)
         :map org-mode-map
         ("C-M-i"    . completion-at-point))
  (setq org-roam-capture-templates
        '(("d" "default" plain
           :if-new (file+head "${slug}.org"
                              "#+title: ${title}\n#+date: %U\n")
           :immediate-finish t
           :unnarrowed t)
          ("p" "project" plain
           "* Objetivos\n\n* Tasks\n\n** TODO Agregar tareas iniciales\n\n* Fechas importantes\n\n"
           :if-new (file+head "${slug}.org"
                              "#+title: ${title}\n#+date: %U\n#+filetags: Projects")
           :immediate-finish t
           :unnarrowed t)
          ("P" "Nota privada" plain
           :if-new (file+head "${slug}.org.gpg"
                              "#+title: ${title}\n#+date: %U\n")
           :unnarrowed t)
          ("r" "bibliography reference" plain
           (file "~/.config/emacs/org-templates/")
           (file+head "references/${citekey}.org" "#+title: ${title}\n#+date: %U\n")
           :unnarrowed t)))
  (setq org-roam-dailies-capture-templates
        '(("d" "default" entry
           "* %?"
           :if-new (file+head "%<%Y-%m-%d-%H%M%S>.org"
                              "#+title: %<%Y-%m-%d-%H%M%S>\n")))))


(use-package org-roam-bibtex
  :after (org-roam)
  :bind (:map org-mode-map ("C-c n b" . orb-note-actions))
  ;(require 'org-ref)
  (setq orb-note-actions-interface 'hydra)
  (setq orb-preformat-keywords
        '("citekey" "title" "url" "author-or-editor" "keywords" "file" "date")
        orb-process-file-keyword t
        orb-insert-interface 'helm-bibtex 
        orb-file-field-extensions '("pdf")))

My (attempt) of workflow is:

Open helm-bibtex, press Tab to get the extended actions, press f9 to get the Edit notes and the thing that happen is that I get a buffer with

#+TITLE: name of the reference  ...

This template comes from helm-bibtex no org-roam, So, what I am doing wrong?

Thanks in advance

1 Like

Hi, org-roam-bibtex-mode should be on to make Helm-bibtex use Org-roam. If it’s off then Helm-bibtex will use its own note-taking facility. You can call this command interactively after Emacs startup or add (org-roam-bibtex-mode +1) somewhere in your config.

In Org-roam v1, org-roam-bibtex-mode was usually called upon startup through org-roam-mode-hook as soon as Org-roam was loaded. The corresponding line was nevertheless required in the config as in :hook (org-roam-mode . org-roam-bibtex-mode). In Org-roam v2, org-roam-mode is not longer a minor mode, so doing so makes little sense. Instead, one can put (org-roam-bibtex-mode +1) in the :config section of use-package org-roam:

(use-package org-roam
  (setq org-roam-v2-ack t)
  (org-roam-bibtex-mode +1)

Thank you @mshevchuk , Following your advice I added that line but I am getting this error:

(void-variable bibtex-completion-find-note-functions)

Any idea? It is weird, because it is defined in helm-bibtex

Forget it, if I C-h v it is not defined … except in the org-roam-bibtex.el file

This should not be the case @Nanounanue. That variable is defined in bibtex-completion.el and org-roam-bibtex.el explicitly requires this library, so it should be already loaded when you call (org-roam-bibtex-mode +1) no matter what. Maybe some stale .elc files? Try to reinstall Org-roam-bibtex and Helm-bibtex/Bibtex-completion.

Thank you! I will try it, and will report back