unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Biblatex inconsistent (?) @book and @periodical, DWIM ISBN/ISSN check and insert
@ 2020-09-13  3:40 Emanuel Berg via Emacs development discussions.
  0 siblings, 0 replies; only message in thread
From: Emanuel Berg via Emacs development discussions. @ 2020-09-13  3:40 UTC (permalink / raw)
  To: emacs-devel; +Cc: help-gnu-emacs

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




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-13  3:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-13  3:40 Biblatex inconsistent (?) @book and @periodical, DWIM ISBN/ISSN check and insert Emanuel Berg via Emacs development discussions.

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).