* bug#33810: 26.1.50; bibtex initializes some global vars after opening a file
@ 2018-12-20 9:01 Konstantin Reich
2019-07-09 23:29 ` Lars Ingebrigtsen
0 siblings, 1 reply; 2+ messages in thread
From: Konstantin Reich @ 2018-12-20 9:01 UTC (permalink / raw)
To: 33810
Hey, i am using emacs 26.1.50
When i ran the following code in just started emacs -Q
(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")
Also everything works if I add (bibtex-set-dialect) after (bibtex-mode). In (https://emacs.stackexchange.com/questions/46691/package-initialization/46693#46693) I was told that it is some kind of bug due to bibtex initializes some global vars only after opening a file.
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#33810: 26.1.50; bibtex initializes some global vars after opening a file
2018-12-20 9:01 bug#33810: 26.1.50; bibtex initializes some global vars after opening a file Konstantin Reich
@ 2019-07-09 23:29 ` Lars Ingebrigtsen
0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2019-07-09 23:29 UTC (permalink / raw)
To: Konstantin Reich; +Cc: 33810
Konstantin Reich <reich-cv@yandex.ru> writes:
> Hey, i am using emacs 26.1.50
>
> When i ran the following code in just started emacs -Q
> (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()
After poking around in the bibtex code, I think this just isn't
supported. All the variables are like this:
(defvar bibtex-entry-maybe-empty-head nil
"Regexp matching the header line of a BibTeX entry (possibly without key).
Initialized by `bibtex-set-dialect'.")
And the dialect won't be set until you load a file, so I don't think
this is a bug.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-07-09 23:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-20 9:01 bug#33810: 26.1.50; bibtex initializes some global vars after opening a file Konstantin Reich
2019-07-09 23:29 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).