/pullbib

Let Emacs export your zotero libraries to a .bib file

Primary LanguageEmacs LispGNU General Public License v3.0GPL-3.0

Pullbib - Let Emacs export your zotero libraries to a .bib file

Purpose

Pullbib provides commands to pull your Zotero library to a .bib file, updating its content. Basically, it means you can trigger an export of your Zotero libraries to your .bib files from within Emacs.

For these commands to work, you have to install the BetterBibtex extension in Zotero.

Installation and setup

You will currently have to clone this package with quelpa or straight. Here’s an example:

(use-package pullbib
  :quelpa (pullbib
	     :fetcher github
	     :repo "publicimageltd/pullbib")
  :config
  ;; Obligatory for pullbib to work, see below:
  (setq pullbib-url-map <some-value>))

As you see in the example, for pullbib to work, you must set up a list which maps library URLs to associated bibliography files. Here’s a real world example:

 (setq pullbib-url-map
	'(("http://127.0.0.1:23119/better-bibtex/export/library?/1/library.biblatex" . "~/my-bibfile.bib")))

It makes sense to export to a bibliography file which is also used by other Emacs packages, e.g. bibtex-completion.

To find the correct URL, open Zotero (with BetterBibTex installed) and right-click on the library you want to export. See also https://retorque.re/zotero-better-bibtex/exporting/pull/.

Usage

Just call pullbib-pull, interactively or non-interactively (e.g. in a hook). It will pull all libraries defined in pullbib-url-map.

For testing, you can pass the map explicitly as an argument to pullbib-pull.

Integration with bibtex-actions

If you use bibtex-actions, you can add pullbib-pull as a hook:

(setq bibtex-actions-force-refresh-hook   (list #'pullbib-pull))

With this setup, calling any bibtex-action with prefix argument (C-u) will trigger an export and update the candidates cache.

Changelog

  • Expand filename before passing it to curl
  • Initial commit.