notes

bib manual

First published: Last updated: 469 words · 20 lines of code

About

bib is a small Emacs package for quickly retrieving bibliographic metadata for books, academic papers, and films. Given only a title (and optionally an author), it searches the relevant public APIs—Crossref, Open Library, OMDb, TMDb, Letterboxd—locates the correct unique identifier (DOI, ISBN, IMDb ID, or Letterboxd slug), and returns a ready-to-use result: a DOI string, an IMDb URL, a Letterboxd slug, or a full BibTeX entry (via zotra).

This is not a full-featured reference manager—just a personal tool that I decided to publish because others might find it useful.

The development repository is on GitHub.

Requirements

  • Emacs 28.1 or later (for json-parse-string and when-let* with bindings).
  • The built-in url, json, dom, and seq libraries (all shipped with Emacs).
  • zotra (optional)—only needed for bib-zotra-add-entry-from-title.

Installation

Manual

Clone this repository somewhere on your load-path and add the following to your init file:

(require 'bib)

With use-package

;; with vc (Emacs 30+)
(use-package bib
  :vc (:url "https://github.com/benthamite/bib"))

;; with elpaca
(use-package bib
  :ensure (:host github :repo "benthamite/bib"))

;; with straight
(use-package bib
  :straight (:host github :repo "benthamite/bib"))

;; with quelpa
(use-package bib
  :quelpa (bib :fetcher github :repo "benthamite/bib"))

Usage

All interactive commands can be invoked via M-x or bound to keys of your choice.

Interactive commands

CommandDescription
bib-search-crossrefSearch Crossref by title/author, select a result, and get its DOI
bib-search-isbnSearch Open Library by title/author/ISBN and get the ISBN (subtitle shown for matching)
bib-search-imdbSearch OMDb by movie title and get the full IMDb URL
bib-search-letterboxdSearch Letterboxd by film title and get the slug or full URL
bib-zotra-add-entry-from-titleCreate a BibTeX entry via zotra, choosing DOI/ISBN/IMDb/Letterboxd

Non-interactive functions

FunctionDescription
bib-fetch-abstract-from-crossrefReturn the abstract for a given DOI via Crossref
bib-fetch-abstract-from-google-booksReturn the description for a given ISBN via Google Books
bib-translate-title-into-englishTranslate a foreign-language film title to English via TMDb
bib-reverse-first-last-nameReverse “Last, First” to “First Last” (handles “&"-separated)

Configuration

API keys

Several commands require API keys for the services they query. Set these variables in your init file or via M-x customize-group RET bib RET:

Note: bib-search-isbn now uses Open Library (free, no key required). The bib-isbndb-key variable is obsolete.

VariableServiceRequired byHow to get a key
bib-omdb-keyOMDbbib-search-imdbomdbapi.com
bib-tmdb-keyTMDbbib-translate-title-into-englishthemoviedb.org

If a key is empty or nil when the corresponding command is invoked, a descriptive error message is shown.

Example:

(setopt bib-omdb-key   "your-omdb-key-here")
(setopt bib-tmdb-key   "your-tmdb-key-here")

General options

VariableTypeDefaultDescription
bib-letterboxd-use-slug-pbooleannilWhen non-nil, bib-search-letterboxd returns the slug by default; when nil, the full URL. A prefix argument inverts the behavior for a single invocation.
bib-letterboxd-user-agentstring"Mozilla/5.0 ..."User-Agent header sent when querying Letterboxd

Example:

;; prefer Letterboxd slugs instead of full URLs
(setopt bib-letterboxd-use-slug-p t)

Troubleshooting

  • “Please set bib-...-key before using this command”: you need to set the relevant API key variable. See the API keys section above.
  • “No results found”: the upstream API returned no matches for your query. Try a different or more specific search term.
  • Letterboxd searches return nothing: the package tries the Letterboxd JSON autocomplete endpoint first, then falls back to DuckDuckGo HTML scraping. Both approaches can fail if the services change their response format. File an issue if this happens.