cpitclaudel / biblio.el

Browse and import bibliographic references from CrossRef, DBLP, HAL, arXiv, Dissemin, and doi.org from Emacs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

biblio-lookup error

ericdanan opened this issue · comments

Whenever I call the function bibtex-lookup, it fails with the following error message:

run-hook-with-args: Symbol's function definition is void: biblio-hal-backend

It seems that emacs cannot find the function biblio-hal-backend, which is the first element in biblio-init-hook. If I remove it from the hook I get the same error with the next element, biblio-dblp-backend. If I call biblio-hal-lookup or biblio-dblp-lookup directly then everything works.

Since this issue has not been reported before, I guess I must be doing something wrong, but I can't find what... How is emacs supposed to find the functions biblio-****-backend, since they are not autoloaded?

Sorry to bother you with this, and thanks a lot for this package.

Hi @ericdanan,

Whenever I call the function bibtex-lookup, it fails with the following error message:

Do you mean biblio-lookup?

Since this issue has not been reported before, I guess I must be doing something wrong, but I can't find what...

I think it's just that most people load this package aggressively (I do, because I wrote it :). But there is indeed a problem; thanks very much for spotting it! I'll push a fix soon.

Sorry to bother you with this, and thanks a lot for this package.

Thanks for the report!

New build should be out in a few hours; please let me know if it works!

Yes I meant biblio-lookup, sorry.

It works now, thanks! (I don't know if the new MELPA build is out already, I install the package with el-get).

Out of curiosity, what is the advantage of the two-stage mechanism to build the list of backends (first the autoloads to populate biblio-init-hook with the biblio-****-backend functions and then calling these functions to populate biblio-backends with these same functions, if I understand correctly)? Would it be different if instead the defvar for biblio-backends was directly setting the default value to the default list of biblio-****-backend functions?

Great, thanks for testing.

Re advantages: biblio-core and biblio are separate packages, so I can't refer to crossref-lookup etc. from biblio-core. Does this make sense?

You mean that some people may have the file biblio-core.el but not biblio-crossref.el, for instance, and the variable biblio-backends is automatically populated with the list of available backends. Right?

But I still don't understand the need for biblio-init-hook. If in biblio-crossref.el, instead of

;;;###autoload
(add-hook 'biblio-init-hook #'biblio-crossref-backend)

you had

;;;###autoload
(add-to-list 'biblio-backends #'biblio-crossref-backend)

and got rid of biblio-init-hook (and the 'register command in biblio-crossref-backend), would that make any difference?

Anyway, it all works fine, I'm just curious but I don't want to waste too much of your time.

Thanks

You mean that some people may have the file biblio-core.el but not biblio-crossref.el, for instance, and the variable biblio-backends is automatically populated with the list of available backends. Right?

That's right.

[If] you had

;;;###autoload
(add-to-list 'biblio-backends #'biblio-crossref-backend)

and got rid of biblio-init-hook (and the 'register command in biblio-crossref-backend), would that make
any difference?

I'm not sure this would work. Would the variable exist when the autoloads are processed? Using add-hook instead of add-to-list works around this neatly because add-hook doesn't require the hook variable to already be defined.

OK I see the problem, biblio-backends would probably not exist at that point. Thanks a lot for the clarifications.

Exactly :) My pleasure, and thanks for the bug report!