When i ran the following code in just started emacs
(with-temp-buffer
(insert "@article{aaaa,
author = {AAA},
title = {BBBB}
}")
(bibtex-mode)
(bibtex-autokey-get-field "title"))
I get the following error:
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
looking-at(nil)
bibtex-valid-entry(t)
bibtex-end-of-entry()
bibtex-text-in-field("title" t)
bibtex-autokey-get-field("title")
(progn (insert "@article{aaaa,\n author = {AAA},\n title = {BBBB}\n }") (bibtex-mode) (bibtex-autokey-get-field "title"))
(unwind-protect (progn (insert "@article{aaaa,\n author = {AAA},\n title = {BBBB}\n }") (bibtex-mode) (bibtex-autokey-get-field "title")) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))
(save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert "@article{aaaa,\n author = {AAA},\n title = {BBBB}\n }") (bibtex-mode) (bibtex-autokey-get-field "title")) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))
(let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert "@article{aaaa,\n author = {AAA},\n title = {BBBB}\n }") (bibtex-mode) (bibtex-autokey-get-field "title")) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))
eval((let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert "@article{aaaa,\n author = {AAA},\n title = {BBBB}\n }") (bibtex-mode) (bibtex-autokey-get-field "title")) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))) nil)
elisp--eval-last-sexp(t)
eval-last-sexp(t)
eval-print-last-sexp(nil)
funcall-interactively(eval-print-last-sexp nil)
call-interactively(eval-print-last-sexp nil nil)
command-execute(eval-print-last-sexp)
After i open any bibtex file the above code works as expected. (I get "BBBB")
If it is important i initialize the bibtex with the following:
(use-package bibtex
:mode ("\\.bib" . bibtex-mode)
)
Could you help me to find the problem