]> git.eshelyaron.com Git - emacs.git/commitdiff
Make bibtex-parse-keys more robust
authorLars Ingebrigtsen <larsi@gnus.org>
Sun, 17 Nov 2019 08:15:20 +0000 (09:15 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 17 Nov 2019 08:15:20 +0000 (09:15 +0100)
* lisp/textmodes/bibtex.el (bibtex-parse-keys): Protect against
bugging out just when starting almost-empty bibtex files
(bug#30112).

lisp/textmodes/bibtex.el

index c29e9631801b97cf828e7e45a1932707bfc39f8e..2d24178f1a753a9f9e352c9ac1f2c1f132f196fe 100644 (file)
@@ -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)