Org-roam-bibtex error "orb-insert-link: Symbol’s function definition is void: orb-helm-insert"

when I call orb-insert-link from a org-roam buffer, I get the following error:

orb-insert-link: Symbol’s function definition is void: orb-helm-insert

Please let me know if there is anything I can do to troubleshoot the issue.

This is the init.el limited to the relevant packages:

(use-package helm
  :ensure t
  :init
  (setq helm-split-window-default-side 'other)
  (helm-mode 1))

(use-package bibtex-completion
  :ensure t)

(use-package helm-bibtex
    :ensure t
    :custom
    (reftex-default-bibliography '("/Users/cfusco/Nextcloud/work/zettelkasten/bibliography/zotero.bib"))
    (bibtex-completion-pdf-field "file")
    (bibtex-completion-bibliography "/Users/cfusco/Nextcloud/work/zettelkasten/bibliography/zotero.bib")
    (bibtex-completion-library-path "/Users/cfusco/Nextcloud/zotero/storage")
    (bibtex-completion-notes-path "/Users/cfusco/Nextcloud/work/zettelkasten")
    (org-ref-get-pdf-filename-function
      '(lambda (key) (car (bibtex-completion-find-pdf key))))
    :hook
    (Tex . (lambda () (define-key Tex-mode-map "\C-ch" 'helm-bibtex))))

(use-package org-ref
    :ensure t
    :init
    (require 'org-id)
    (require 'org-ref-wos)
    (require 'org-ref-scopus)
    (require 'org-ref-pubmed)
    :custom
    (org-ref-pdf-directory "/Users/cfusco/Nextcloud/zotero/storage") 
    (org-ref-bibliography-notes "/Users/cfusco/Nextcloud/work/zettelkasten/notes.org")
    (org-ref-default-bibliography '("/Users/cfusco/Nextcloud/work/zettelkasten/bibliography/zotero.bib"))
    (bibtex-completion-pdf-open-function 'org-open-file)
    )
(use-package org-roam
  :quelpa (:upgrade t)
  :after org
  :ensure t
  :init
  (setq org-roam-v2-ack t)
  ;; for org-roam-buffer-toggle
  (add-to-list 'display-buffer-alist
               '("\\*org-roam\\*"
                 (display-buffer-in-direction)
                 (direction . right)
                 (window-width . 0.33)
                 (window-height . fit-window-to-buffer)))
  :custom
  (org-roam-directory (file-truename
                       "/Users/cfusco/Nextcloud/work/zettelkasten")) ;; file-truename handle eventual symbolic links
  (org-roam-completion-everywhere t)
  (org-roam-dailies-directory "daily/")
  (setq org-roam-dailies-capture-templates
        '(("d" "default" entry
           "* %?"
           :target (file+head "%<%Y-%m-%d>.org"
                              "#+title: %<%Y-%m-%d>\n"))))
  :hook
  (org-roam-mode . (lambda () (text-scale-adjust 1))) ;; increase the size of the side panel text
  (org-load . org-roam-db-autosync-mode) ;; starts org-roam major mode with org, org-roam-setup is an alias
  :config
  (org-roam-bibtex-mode +1)   ;; starts org-roam-bibtex-mode to make Helm-bibtex use Org-roam
  (require 'org-roam-protocol)
  (defun org-roam-jump-to-index ()
    "Stub of recreating org-roam-jump-to-index from V1"
    (interactive)
    (let
        ((org-roam-index
          "/Users/cfusco/Nextcloud/work/zettelkasten/index.org"))
      (find-file org-roam-index)))
  :bind 
  (("C-c n l" . org-roam-buffer-toggle)
   ("C-c n f" . org-roam-node-find)
   ("C-c n g" . org-roam-graph)
   ("C-c n i" . org-roam-node-insert)
   ("C-c n c" . org-roam-capture)
   ("C-c n x" . org-roam-jump-to-index)
   ;; Dailies
   ("C-c n j" . org-roam-dailies-capture-today)))

(use-package org-roam-bibtex
  :quelpa (:upgrade t)
  :ensure t
  :requires bibtex-completion
  :after (org-roam)
  :bind (:map org-mode-map
              (("C-c n a" . orb-note-actions)
               ("C-c n k" . orb-insert-link)))
  :config
  (require 'org-ref) ; optional: if Org Ref is not loaded anywhere else, load it here
  (setq orb-note-actions-frontend 'helm)
  (setq orb-insert-interface 'helm-bibtex)
  (setq orb-autokey-format "%a%y")
  (setq orb-preformat-keywords
        '("citekey" "title" "url" "author-or-editor" "keywords" "file")
        orb-process-file-keyword t
        orb-file-field-extensions '("pdf"))
  (setq org-roam-capture-templates
        '(("d" "default" plain
           "%?"
           :target (file+head "${slug}.org"
                              "#+title: ${title}\n")
           :immediate-finish t
           :unnarrowed t)
          ("r" "reference" plain
           "%?"
           :target
           (file+head "${citekey}.org"
                      "#+TITLE: ${author-or-editor-abbrev} (${date}) ${title}.\n#+ROAM_REF: ${ref}\n#FILETAGS: \"bibliography\"\n#+STARTUP: content\n\n")
           :unnarrowed t)
          ("n" "bibliography reference + noter" plain  
           (file "/Users/cfusco/Nextcloud/work/zettelkasten/templates/orb-capture-template.org") ;;; exclusive for ORB-Capture, not org-roam capture
           :target
           (file+head "${citekey}.org"
                      "#+TITLE: ${title}\n#+ROAM_REF: ${ref}\n#+FILETAGS: \"bibliography\"\n#+STARTUP: content\n")
           :unnarrowed t)
          )))

when I comment this out, I get the generic interface and everything works as expected.

EDIT: should I report it as a bug in the github repo?

I would check the loading sequence before doing so.

Simply M-x load-library and load helm-bibtex, and try the same command.

:hook defers loading of helm-bibtex and it is not linked to ORB, so I guess you never load helm-bibtex before ORB.

If this is the case, you can add :command to helm-bibtex with orb-helm-insert; this way, helm-bibtex loads just when you call orb-helm-insert.

1 Like

@wiliya orb-insert-interface has a custom setter, that this simple setq will not work. This option should be set with Customize or using the :custom keyword in use-package:

(use-package org-roam-bibtex
  ...
 :custom (orb-insert-interface 'helm-bibtex)
  ...)

This is not clearly articulated in the README nor in the variable description. You can comment on it here: orb-insert-interface customization issue · Issue #189 · org-roam/org-roam-bibtex · GitHub. It’ll be a reminder for me to update the docs.

2 Likes

unfortunately orb-helm-insert is not defined, neither by adding to use-package the :custom section as suggested by @mshevchuk , nor by loading helm-bibtex with load-library as suggested by @nobiot .

As a newbie, is there some trick I could use to log all the events and try to debug this problem?

@wilya sorry, my bad. I thought I’d already fixed it. Anyway, it is now fixed in the latest commit. Please update ORB and restart Emacs. It may take a couple of hours until the changes reach MELPA though. You’ll be able to use the :custom keyword as described above.

1 Like

Are you kidding? You are doing a fantastic work! Now it works, perfectly! Thank you so much.

Question, I also set in :custom orb-note-actions-frontend and it seems to work; is this all right:

        :custom
        (orb-insert-interface 'helm-bibtex)
        (orb-note-actions-frontend 'helm)

or should assigne helm to orb-note-frontend with setq?

Thank you!

Technically, only one of those must be set with Customize, the other one can be set with setq. In fact, you can do (require 'orb-helm) and then set both with setq (this is basically what the custom setter does). For the sake of logical consistency I’d suggest to set both as you did it above or whatever you prefer.

1 Like