unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* more BibTeX/Biblatex stuff
@ 2020-09-18  1:44 Emanuel Berg via Users list for the GNU Emacs text editor
  2020-09-18  1:57 ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 2+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-09-18  1:44 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: emacs-devel

;;; -*- lexical-binding: t -*-
;;;
;;; this file:
;;;   https://dataswamp.org/~incal/emacs-init/bibtex-get.el
;;;
;;; 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
"
@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) ))))

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-18  1:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-18  1:44 more BibTeX/Biblatex stuff Emanuel Berg via Users list for the GNU Emacs text editor
2020-09-18  1:57 ` Emanuel Berg via Users list for the GNU Emacs text editor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).