;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/bibtex/bibtex-autokey-insert.el (require 'bibtex) (require 'isbn-verify) (require 'issn-verify) (require 'string) (defun bibtex-autokey-insert-check-isbn () (interactive) (let*((isbn-str "isbn") (isbn-10-str "isbn-10") (isbn-13-str "isbn-13") (issn-str "issn") (vals (list (cons issn-str (bibtex-autokey-get-field issn-str)) (cons isbn-str (bibtex-autokey-get-field isbn-str)) (cons isbn-10-str (bibtex-autokey-get-field isbn-10-str)) (cons isbn-13-str (bibtex-autokey-get-field isbn-13-str)) )) (issn (alist-get issn-str vals)) (isbn (alist-get isbn-str vals)) (isbn-10 (alist-get isbn-10-str vals)) (isbn-13 (alist-get isbn-13-str vals)) ) (when (string-data-p issn) (issn-verify issn)) (when (string-data-p isbn) (isbn-verify isbn)) (when (string-data-p isbn-10) (isbn-verify isbn-10)) (when (string-data-p isbn-13) (isbn-verify isbn-13)) (bibtex-autokey-insert) )) (defalias 'bibtex-autokey-insert-check-issn #'bibtex-autokey-insert-check-isbn) (defun bibtex-autokey-insert () (re-search-forward "^}") (let ((title (bibtex-autokey-get-title))) (bibtex-beginning-of-entry) (search-forward "{") (insert title) ) (kill-line) (insert ",") ) (provide 'bibtex-autokey-insert)