Subject: Re: bug#56475: 28.1.50; bibtex-parse-entry disregards @string substitutions

From: Ihor Radchenko <[email-masked]>
Date: Sun, 17 Jul 2022 16:34:02 +0800

Roland Winkler <[email-masked]> writes:

> On Tue, Jul 12 2022, Ihor Radchenko wrote:
>> I am wondering why bibtex-string-files is not documented inside the
>> docstring of bibtex-expand-strings. Same for bibtex-expand-strings not
>> being documented in bibtex-parse-entry.
>
> I believe the situation is the other way round: bibtex-files and
> bibtex-string-files are basic user variables for bibtex-mode and have
> been around for 30+ years (much longer than I support bibtex.el).
> bibtex-expand-strings is a small add-on in this context.

I think that the main issue on my side is that I interact with bibtex.el
from API perspective without editing many actual .bib files. So, I was
mostly looking into parser API instead of user customizations.

If you start exploring bibtex.el from bibtex-parse-entry and its
docstring, it is not very easy to figure out that bibtex-string-files
and bibtex-expand-strings need to be set. They are not mentioned in the
docstring other than by common word "extract content" with "extract"
meaning being not very clear.

>> I tried the following simple test:
>>
>> M-: (let ((bibtex-string-files `(,(buffer-file-name)))
>> (bibtex-expand-strings t)) (bibtex-parse-entry))
>>
>> The journal field is still not handled: ("journal" . "jgr")
>
> Try
>
> M-: (let ((bibtex-string-files `(,(buffer-file-name)))
> (bibtex-expand-strings t)) (bibtex-parse-entry t))

Thanks! It works now.

>> Also, note that bibtex-string-files cannot help with situations when
>> the BibTeX buffer does not have an associated file.
>
> When does this happen?  To the best of my knowledge, this has never been
> an issue for users of bibtex.el.

It is more of a hypothetical scenario that might occur in future if Org
tries to support bibliographies provided inside .org files. Such
bibliographies will need to be converted to .bib files transiently and
might not need to be saved on disk.

In any case, it is not a concern you need to worry about now. AFAIU,
bibtex.el depends on .bib buffers having non-nil buffer-file-name in
multiple places.

Best,
Ihor