bib manual
Table of contents
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-stringandwhen-let*with bindings). - The built-in
url,json,dom, andseqlibraries (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
| Command | Description |
|---|---|
bib-search-crossref | Search Crossref by title/author, select a result, and get its DOI |
bib-search-isbn | Search Open Library by title/author/ISBN and get the ISBN (subtitle shown for matching) |
bib-search-imdb | Search OMDb by movie title and get the full IMDb URL |
bib-search-letterboxd | Search Letterboxd by film title and get the slug or full URL |
bib-zotra-add-entry-from-title | Create a BibTeX entry via zotra, choosing DOI/ISBN/IMDb/Letterboxd |
Non-interactive functions
| Function | Description |
|---|---|
bib-fetch-abstract-from-crossref | Return the abstract for a given DOI via Crossref |
bib-fetch-abstract-from-google-books | Return the description for a given ISBN via Google Books |
bib-translate-title-into-english | Translate a foreign-language film title to English via TMDb |
bib-reverse-first-last-name | Reverse “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.
| Variable | Service | Required by | How to get a key |
|---|---|---|---|
bib-omdb-key | OMDb | bib-search-imdb | omdbapi.com |
bib-tmdb-key | TMDb | bib-translate-title-into-english | themoviedb.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
| Variable | Type | Default | Description |
|---|---|---|---|
bib-letterboxd-use-slug-p | boolean | nil | When 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-agent | string | "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-...-keybefore 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.