From 9ac8901b0ae5a6bb75c790832caf4ea9be8df16f Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 17 Nov 2019 09:15:20 +0100 Subject: 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). --- lisp/textmodes/bibtex.el | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lisp/textmodes') 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) -- cgit v1.2.1