From: Lars Ingebrigtsen Date: Sun, 17 Nov 2019 08:15:20 +0000 (+0100) Subject: Make bibtex-parse-keys more robust X-Git-Tag: emacs-27.0.90~591 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9ac8901b0ae5a6bb75c790832caf4ea9be8df16f;p=emacs.git Make bibtex-parse-keys more robust * lisp/textmodes/bibtex.el (bibtex-parse-keys): Protect against bugging out just when starting almost-empty bibtex files (bug#30112). --- diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index c29e9631801..2d24178f1a7 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el @@ -2915,6 +2915,9 @@ for parsing BibTeX keys. If parsing fails, try to set this variable to nil." (1+ (match-beginning 3)) (1- (match-end 3))))) (unless (assoc key crossref-keys) (push (list key) crossref-keys)))) + ;; We have probably have a non-bibtex file. + ((not (match-beginning bibtex-type-in-head)) + (throw 'userkey nil)) ;; only keys of known entries ((assoc-string (bibtex-type-in-head) bibtex-entry-alist t)