Skip to content

Commit

Permalink
Merge pull request #454 from joostkremers/parsebib-rdp
Browse files Browse the repository at this point in the history
Avoid infinite loop when parsing a .bib file.
  • Loading branch information
tmalsburg authored Nov 15, 2024
2 parents 6e75c71 + 0c49950 commit 3c75c2c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions bibtex-completion.el
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,8 @@ for string replacement."
if (string= (downcase entry-type) "string")
collect (let ((entry (parsebib-read-string ht)))
(puthash (car entry) (cdr entry) ht)
entry))))
entry)
else do (forward-line 1))))
(-filter (lambda (x) x) strings)))

(defun bibtex-completion-update-strings-ht (ht strings)
Expand Down Expand Up @@ -684,7 +685,7 @@ If HT-STRINGS is provided it is assumed to be a hash table."
bibtex-completion-additional-search-fields))
for entry-type = (parsebib-find-next-item)
while entry-type
unless (member-ignore-case entry-type '("preamble" "string" "comment"))
if (not (member-ignore-case entry-type '("preamble" "string" "comment")))
collect (let* ((entry (parsebib-read-entry nil ht-strings))
(fields (append
(list (if (assoc-string "author" entry 'case-fold)
Expand All @@ -696,7 +697,8 @@ If HT-STRINGS is provided it is assumed to be a hash table."
fields)))
(-map (lambda (it)
(cons (downcase (car it)) (cdr it)))
(bibtex-completion-prepare-entry entry fields)))))
(bibtex-completion-prepare-entry entry fields)))
else do (forward-line 1)))

(defun bibtex-completion-get-entry (entry-key)
"Given a BibTeX key this function scans all bibliographies listed in `bibtex-completion-bibliography' and returns an alist of the record with that key.
Expand Down

0 comments on commit 3c75c2c

Please sign in to comment.