joostkremers/ebib

Ebib-biblio features not loading with use-package

Closed this issue · 4 comments

I am trying to use the ebib with use-package, but I am getting strange load behavior. I have the following lines in my init file:

(use-package ebib
  :general
  (leader-def
    "e" '(nil :which-key "ebib...")
    "ee" '(ebib :which-key "ebib")
    "ei" '(ebib-insert-citation :which-key "insert")))

(use-package biblio
  :general
  (leader-def
    "b" '(nil :which-key "biblio...")
    "bl" '(biblio-lookup :which-key "lookup")))

(use-package ebib-biblio
  :straight nil
  :after (ebib biblio)
  :bind (:map biblio-selection-mode-map
              ("e" . ebib-biblio-selection-import)))

(require 'ebib)
(require 'ebib-biblio)

If I don't use the require statements at the end, the ebib-biblio feature doesn't load properly. Shouldn't the use-package statement already be executing a require statement? Why I'm asking this here is because I have other packages such as org-roam with features provided in other files which I am able to configure just fine with use-package. So is there something unique about ebib which would be causing this behavior?

I am trying to use the ebib with use-package, but I am getting strange load behavior.
[...]
If I don't use the require statements at the end, the ebib-biblio feature doesn't load properly.

What exactly isn't working properly? Do you mean that the command ebib-biblio-import-doi (which ebib-biblio binds to B) isn't available immediately?

The way it works with the suggested setup in the manual is that ebib-biblio is loaded only after Ebib and Biblio are loaded. That means it's not available until you actually run a Biblio query and you've started Ebib. Which means that the command B is likewise not available until you run a Biblio query with M-x biblio-lookup.

I agree that's not ideal... It just never occurred to me before, because I don't use Biblio that much.

To get it to work properly, you would have to define the key binding for B in the use-package call for Ebib, and I would need to add an autoload cookie to ebib-biblio-import-doi. (You can also use use-package to set up an autoload, with the :command keyword.)

Thank you for the clarification.

What exactly isn't working properly? Do you mean that the command ebib-biblio-import-doi (which ebib-biblio binds to B) isn't available immediately?

Yes, this is the issue I'm encountering. I see that this is a loading issue of convenience more than it is of functionality. I think for the time being I will use the :command keyword of use-package.

However, I am actually planning on switching over to setup.el which doesn't have the :command keyword functionality out of the box, so it would be convenient for there to be an autoload cookie to ebib-biblio-import-doi.

Sorry about the delay in response, I am juggling a lot of projects right now.

Thanks for confirming my assumption. I have now added an autoload cookie to ebib-biblio-import-doi. I also removed the key binding for "B" from ebib-biblio.el and added it to the suggested configuration in the manual. I think it makes more sense that way.

Thank you for reporting this issue and no worries that it took a bit longer to follow up. (Happens to me too sometimes...)

Thanks for making that change!