Closed fabcontigiani closed 6 months ago
Decided to add an option for automatic citekey generation since it was simpler than I anticipated, I'm not sure how to indicate the new dependency (bibtex-mode
), maybe it isn't necessary since it's built into Emacs.
I was under the impression that persid-bibtex-from
would insert text into the buffer when called with M-x
. However, after reading #5, it is clear that this is not the case. I still need to do some more testing, but this should be working properly.
Sorry, made a mess trying to rename branches 😅
Thanks for this amazing PR. To answer your first question on lexical vars, I'm not too sure about the reason but it might related to a non existent local variable. I think we can deal with that later.
Hi Nicolas! First, I wanted to thank you for creating this package and for your contributions to the Emacs community in general! Big fan of your work ^^
OpenLibrary was suggested on #4 as an alternative source for retrieving bibliographic entries based on ISBN. Recently I dabbled with one of OpenLibrary's APIs (biblio-openlibrary), and wanted to contribute to this package too, since it may fit better in the workflow I wanna implement with the built-in bibtex-mode and citar.
This PR uses the Book API from OpenLibrary to receive a response in JSON form given a valid ISBN identifier, then parses it extracting the necessary information to create a BibTeX entry of type 'Book' from scratch, due to this previously being done on the server side by
ebooks.de
.I decided to use OpenLibrary's "Legacy" Book API, as indicated on their documentation, seeing that it was possible to receive all needed information in a single query, in contrast, when using other APIs, e.g. the Search API, it was needed to perform an additional query for every author, since only their IDs is received. In addition, OpenLibrary's documentation only mentions the posibility of the Book API being phased out in the future, rather than it being a certainty.
When compiling the package with the proposed changes I get an error, I'm still a noob when it comes to elisp and I'm not sure if and how I've introduced it:
Executing
package-install-file
onpersid.el
gives some more information:If it helps this is how I've installed and configured it in my init file:
~Doing
M-x persid-bibtex-from
and providing a valid ISBN identifier doesn't work, nor does it throw an error for me at the moment, it does nothing really.~ Nevertheless, when evaluating(insert (persid-bibtex-from-isbn "some-valid-isbn"))
the BibTeX entry gets inserted correctly, for example:I get: (might need to add a new line jump or something, not sure)
Notice the absence of a citekey, the creation of the BibTeX entry was done on the server side by ebooks.de previously, thus a citekey was generated there. As it stands now the generated BibTeX lacks this feature, but it allows the built-in
bibtex-mode
to autogenerate one for the user with the available information on the entries by pressingC-c C-c
, if the bibtex major mode is active that is, this has the upside of respecting the user's configuration of the bibtex package making the generation of the citekey customizable, otherwise is up to the user to write one. It may be possible to automatically generate a key using the different tools made available withbibtex.el
but it would add a dependency and complexity, which I'm not sure if it's desirable.Also, I've added biblio-openlibrary to the related works mentioned on the readme, let me know if you feel it doesn't belong there and I'll remove it, no worries.
As I said, I'm still quite new to elisp and all feedback is well received. Cheers!