I'm not sure the best way to phrase this question, but hopefully my examples will make clear what's going on.
I have some code where I want to insert the contents of a bibtex file in a temporary buffer and move through the entries one at a time, grabbing the entry using bibtex-parse-entry
for later use. However, whenever I run the code on a bibtex file that I haven't visited during this emacs session, bibtex-parse-entry
returns a (wrong-type-argument stringp nil)
error.
Once I visit the file, even if I then close the buffer, the code runs without any issues. And if I remove the bibtex-parse-entry
call, bibtex-kill-entry
has the same issue.
Here's the elisp code I'm using:
(with-temp-buffer
(insert-file-contents "~/test.bib")
(goto-char (point-min))
(bibtex-mode)
(while (not (eobp))
(let* ((entry (bibtex-parse-entry t)))
(message "i'm here"))
(bibtex-kill-entry)
(bibtex-beginning-of-entry)
)
)
and a dummy .bib file:
@Article{test,
author = {joe shmo},
title = {lorem ipsum},
journal = {something},
year = {1990},
}
With these you should be able to reproduce my error.
I have no idea what's going on, so I'd greatly appreciate any help!