GNU bug report logs - #33810
26.1.50; bibtex initializes some global vars after opening a file

Previous Next

Package: emacs;

Reported by: Konstantin Reich <reich-cv <at> yandex.ru>

Date: Thu, 20 Dec 2018 09:02:02 UTC

Severity: normal

Tags: notabug

Found in version 26.1.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 33810 in the body.
You can then email your comments to 33810 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#33810; Package emacs. (Thu, 20 Dec 2018 09:02:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Konstantin Reich <reich-cv <at> yandex.ru>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 20 Dec 2018 09:02:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Konstantin Reich <reich-cv <at> yandex.ru>
To: bug-gnu-emacs <bug-gnu-emacs <at> gnu.org>
Subject: 26.1.50; bibtex initializes some global vars after opening a file
Date: Thu, 20 Dec 2018 12:01:23 +0300
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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#33810; Package emacs. (Tue, 09 Jul 2019 23:30:03 GMT) Full text and rfc822 format available.

Message #8 received at 33810 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Konstantin Reich <reich-cv <at> yandex.ru>
Cc: 33810 <at> debbugs.gnu.org
Subject: Re: bug#33810: 26.1.50;
 bibtex initializes some global vars after opening a file
Date: Wed, 10 Jul 2019 01:29:13 +0200
Konstantin Reich <reich-cv <at> 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




Added tag(s) notabug. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 09 Jul 2019 23:30:04 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 33810 <at> debbugs.gnu.org and Konstantin Reich <reich-cv <at> yandex.ru> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 09 Jul 2019 23:30:04 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 07 Aug 2019 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 264 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.