org-roam / org-roam-bibtex

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

orb-insert-interface customization issue #189

Closed Wheest closed 2 years ago

Wheest commented 3 years ago

Describe the bug A clear and concise description of what the bug is. I am new to ORB, and am trying to have a non-generic orb-insert-interface. I use Doom, with ivy, so ivy-bibtex seems like a good choice.

I can confirm that ivy-bibtex is a valid and working command in my installation. I just can't use it for ORB.

Following the docs, they say that the variable orb-insert-interface is to be set to the preferred interface.

In my init.el, I add the line (setq orb-insert-interface 'ivy-bibtex), however I find that I am still getting the generic interface.

Is the setq approach the correct one? It is not clear in the docs. If there is another correct way of doing it, can it be shared and added to the docs?

To Reproduce Steps to reproduce the behavior:

  1. Run command orb-insert
  2. Observe generic interface

Expected behavior A clear and concise description of what you expected to happen.

ORB configuration

init.el

(use-package! org-roam-bibtex
  :after org-roam
  :hook (org-roam-mode . org-roam-bibtex-mode)
  :config
  (require 'org-ref)
  (setq orb-insert-interface 'ivy-bibtex)
  )

packages.el

(package! org-roam-bibtex
  :recipe (:host github :repo "org-roam/org-roam-bibtex"))

;; When using org-roam via the `+roam` flag
(unpin! org-roam)

;; When using bibtex-completion via the `biblio` module
(unpin! bibtex-completion helm-bibtex ivy-bibtex)

Environment (please complete the following information):

myshevchuk commented 3 years ago

Hi! Thanks for reporting this. I'm aware of this issue. It happens because you have Ivy-bibtex autoloaded (by Doom) and upon calling orb-insert before the ivy-bibtex library is loaded the interface is not picked up automatically. I will keep this issue open because such a behaviour is clumsy.

Meanwhile, you can call ivy-bibtex before calling orb-insert, once per session is enough. Or put this into your config.el:

(use-package! org-roam-bibtex
  :after org-roam
  :hook (org-roam-mode . org-roam-bibtex-mode)
  :config
  (require 'org-ref)
  (require 'ivy-bibtex)
  (setq orb-insert-interface 'ivy-bibtex))
myshevchuk commented 3 years ago

FYI, this issue will not be fixed in ORB v0.5 you are using. The fix will go into ORB v0.6, which is meant to be used with Org-roam v2, which in turn will supersede Org-roam v1 soon. If you plan to stay with Org-roam v1 for a while, you'll need to stick to (require 'ivy-bibtex) in your config.

Wheest commented 3 years ago

Great, many thanks. The suggested config.el change fixed my issue. I'll leave the issue open as you suggested.

I'll be following upstream fairly closely, so I'll migrate to org-roam v2 when available.

To those like me that were not aware of the upcoming change, see this thread discussing it.

Wheest commented 3 years ago

I'm currently exploring moving to Org-roam v2, however have had some migration issues with ORB.

With the same config as described above, I get the issue:

Warning (:warning): ORB: ivy-bibtex not available; using generic completion.

ivy-bibtex is available and runs independently.

Is there a different ORB config to use ivy-bibtex for org-roam v2? I'm not seeing anything in the updated manual.

myshevchuk commented 3 years ago

Hi, orb-insert-interface should be set through customize, in Doom it can also be set using the setq! macro:

General with use-package:

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

Doom:

(use-package! org-roam-bibtex
  :config
  (setq! orb-insert-interface 'ivy-bibtex))

The reason is that this user option has a custom setter, which loads an additional internal library prior to setting the requested value. You also don't need the (require 'ivy-bibtex) form in your :config section - the setter function takes care of this.

Currently, the manual is not exhaustive. Things will change when ORB hits version 1.0, but I can't promise when this happens.