emacs-citar / citar

Emacs package to quickly find and act on bibliographic references, and edit org, markdown, and latex academic documents.
GNU General Public License v3.0
479 stars 53 forks source link

Feature request: Integration with Zotra #799

Open mpedramfar opened 10 months ago

mpedramfar commented 10 months ago

I've written a package, Zotra, that adds the missing functionality of Zotero to Emacs by allowing the user to get bibliography entries and attachments from a url or a search identifier (DOI, ISBN, PMID, arXiv ID).

I don't personally use citar, but I thought this might be something you'd find interesting.

In the README file, I've described one possible way to seamlessly integrate bibtex-completion with it so that if zotra is installed, it will offer the option to use it when calling bibtex-completion-add-pdf-to-library and if it's not installed, it will behave as before. (Note that the last 4 lines in the function I've written there is for a separate extra functionality, i.e. to add the path to the newly added file to the bibtex-completion-pdf-field field in the bibtex entry) A similar approach could probably be used here.

bdarcus commented 10 months ago

Thanks for the note.

So let me see if IUC:

The idea here is zotra can be used to add either:

  1. an entry, with metadata populated from the zotero translators
  2. a link to a PDF attachment to an already-existing entry; you're example is this

Is that correct?

On 2, we do have a broader command called citar-add-library-files. I'll need to think about this one a bit more. It might be that adding a hook here would be useful, but am not sure.

I think 1 is pretty much the same as using biblio with the embark-become example, so could just add another example to the wiki (and so, no particular integration code needed):

https://github.com/emacs-citar/citar/wiki/Embark#embark-become

mpedramfar commented 10 months ago

For 1, we have two functions. One is zotra-add-entry-from-search which might be similar to biblio since it populates a bibliographic entry (bibtex/biblatex/CSL json/CSV/etc) using a search identifier (DOI, ISBN, PMID, arXiv ID).

The other is zotra-add-entry-from-url which needs a url to a journal/repo/youtube video/whatever and populates the bibliography entry. I've described in the README how to use org-protocol to get a bookmarklet in the browser that acts similar to Zotero-connector so that you can visit a website in your browser, click on the bookmarklet and an entry will be added to your bibliography file.

I agree that, for this case, probably no particular integration code is needed.

For 2, that's mostly correct. The zotra-get-attachment function can get attachment urls (if there is more that one attachment, it'll either ask the user to choose a single one or return the list of all of them) from either search identifier or the url. The version of bibtex-completion-add-pdf-to-library that I've written in the README is using the url field of the bibtex entry and falls back to asking the user for a url when the bibtex entry doesn't have such a field.

There are also zotra-download-attachment (-from-search/-from-url) functions, but it might be easier to integrate if you use zotra-get-attachment instead

bdarcus commented 10 months ago

I can't predict when or if I'll have time to get this, given other priorities. But PR and/or wiki contribution would certainly be welcome.

FWIW, citar is designed to be pretty flexible in terms of integration with other packages, so much so that it's often better to spin off functionality like this into independent small packages.