[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

more BibTeX/Biblatex stuff

From: Emanuel Berg
Subject: more BibTeX/Biblatex stuff
Date: Fri, 18 Sep 2020 03:44:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

;;; -*- lexical-binding: t -*-
;;; this file:
;;; For this to work, Biblatex entries must be
;;; written like below (without Lisp and quotation
;;; marks, of course). See code for details.
;;; Try it:
;;;   (find-book (format "%s%s" "978-1-59582-214-" "7"))

(when nil
  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))
                    (insert "\n\n") )
                  (pop-to-buffer bfr) ))
            (error "No such book: %s" isbn) ))))

underground experts united

reply via email to

[Prev in Thread] Current Thread [Next in Thread]