emacs-devel
[Top][All Lists]
Advanced

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

Biblatex inconsistent (?) @book and @periodical, DWIM ISBN/ISSN check an


From: Emanuel Berg
Subject: Biblatex inconsistent (?) @book and @periodical, DWIM ISBN/ISSN check and insert
Date: Sun, 13 Sep 2020 05:40:05 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

I tried to make a DWIM ISBN/ISSN inserter and checker
for BibTeX/Biblatex (?) - no region so no "pure DWIM" in that
sense - anyway run into something wierd, see code and
comments below.

(defun bibtex-insert-autokey-check-isbn ()
  (interactive)
  (let*((ids (list (bibtex-autokey-get-field "issn")
                   (bibtex-autokey-get-field "isbn") ))
        (issn (car  ids))
        (isbn (cadr ids)) )
    (cond ((not (empty-string-p issn)) (issn-verify issn))
          ((not (empty-string-p isbn)) (isbn-verify isbn)) )
    (bibtex-insert-autokey) ))
(defalias 'bibtex-insert-autokey-check-issn #'bibtex-insert-autokey-check-isbn)

(defun bibtex-insert-autokey ()
  (re-search-forward "^}") ; need to get below "title", but why?
                           ;; BTW (bibtex-end-of-entry) DNC for @periodical
  (let ((title (bibtex-autokey-get-title)))
    (bibtex-beginning-of-entry) ; but this works... (@periodical _and_ @book)
    (search-forward "{")
    (insert title)
    (kill-line)
    (insert ",") ))

Try on this:

@periodical{economist,
  editor     = {Zanny Minton Beddoes},
  issn       = {0013-0613},
  issuetitle = {The aliens among us. How viruses shape the world},
  number     = {9208},
  title      = {The Economist},
  volume     = {436},
  year       = {2020}
}

%% 352 pages
@book{kommando-holger-meins,
  author     = {Dan Hansén and Jens Nordqvist},
  isbn       = {978-91-7037-234-6},
  publisher  = {Ordfront},
  title      = {Kommando Holger Meins},
  year       = 2006
}

full source:

  https://dataswamp.org/~incal/emacs-init/my-bibtex.el

relevant:

  https://dataswamp.org/~incal/emacs-init/isbn-verify.el
  https://dataswamp.org/~incal/emacs-init/issn-verify.el

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




reply via email to

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