/pdf-drop-mode

Get DOI from PDF files dropped onto a Emacs buffer

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

Documentation

pdf-drop-mode is a convenient mode that search for the DOI of any file that is dropped onto a buffer. To do that, the mode searches the DOI using several different methods (whose order can be specified):

  1. Look at the file metadata to check if a DOI is attached using exiftool (whose path can be specified).
  2. Search the content of the file to try to locate a DOI regex on the first page (PDF is transformed into text using the pdftotext utility).
  3. Search again the metadata to try to find the title and query the crossref database to get a corresponding DOI.
  4. Ask the user to enter the title of the file and query the crossref database to try to get a correspondong DOI.

If all methods failed, then the search has failed. When search finishes, a user-defined function is called with the filename and the DOI as arguments.

Installation

(straight-use-package
 '(pdf-drop-mode :type git :host github :repo "rougier/pdf-drop-mode"))

Usage

(require 'pdf-drop-mode)

(defun my/pdf-process (file doi)
  (message "%s : %s" file doi))

(setq pdf-drop-search-hook #'my/pdf-process)
(pdf-drop-mode)

You can then drag and drop a PDF onto the buffer and the DOI should be displayed.