;;; -*- lexical-binding: t -*- ;;; ;;; this file: ;;; https://dataswamp.org/~incal/emacs-init/bibtex-get.el ;;; ;;; also see: ;;; https://dataswamp.org/~incal/emacs-init/my-bibtex.el ;;; ;;; For this to work, Biblatex entries must be written like below ;;; (without Lisp and quotation marks). Try it: ;;; ;;; (find-book (format "%s%s" "978-1-59582-214-" "7")) (when nil " @book{aliens-omnibus-6, author = {Mark Schultz and Doug Wheatly}, isbn = {978-1-59582-214-7}, publisher = {Dark Horse}, title = {Aliens Omnibus 6}, year = 2009 } " ) (require 'cl-lib) (defun find-book (isbn &rest more) (cl-loop for isbn in (cons isbn more) do (goto-char (point-min)) (let ((hit (re-search-forward isbn (point-max) t)) ) (if hit (let*((beg (re-search-backward "^@" (point-min) t)) (end (re-search-forward "^}" (point-max) t)) (bfr (and beg end (get-buffer-create "*books*"))) ) (if (not bfr) (error "DNC: %s or %s" beg end) (kill-ring-save beg end) (with-current-buffer bfr (goto-char (point-max)) (yank) (insert "\n\n") ) (pop-to-buffer bfr) )) (error "No such book: %s" isbn) ))))