GNU bug report logs - #78841
reftex-get-bibfile-list fails to detect biblatex if there's no buffer for the main file

Previous Next

Package: auctex;

Reported by: Tim Ruffing <dev <at> real-or-random.org>

Date: Thu, 19 Jun 2025 19:29:04 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Tim Ruffing <dev <at> real-or-random.org>
To: Arash Esbati <arash <at> gnu.org>
Cc: 78841 <at> debbugs.gnu.org
Subject: bug#78841: reftex-get-bibfile-list fails to detect biblatex if there's no buffer for the main file
Date: Sat, 21 Jun 2025 22:05:38 +0200
On Sat, 2025-06-21 at 17:42 +0200, Arash Esbati wrote:
> Is this with AUCTeX?  I'm asking because AUCTeX opens the master file
> in
> the background when you visit a subfile.  So your chapter.tex should
> look like this:
> 
> --8<---------------cut here---------------start------------->8---
> Content of chapter.tex
> 
> %%% Local Variables:
> %%% mode: LaTeX
> %%% TeX-master: "main.tex"
> %%% End:
> --8<---------------cut here---------------end--------------->8---
> 

Oh, that's interesting. I didn't use a local variables section, but I
have this in my config instead:

(setq-default TeX-master "main")

And this works, at least in principle. In chapter.tex, (TeX-master-
file) returns "main". And also compilation works properly and uses the
main file.

But this appears to make a difference for reftex-get-bibfile-list! I
get both bib files 1.bib and 2.bib with this chapter.tex as you
suggested:

%%% Local Variables:
%%% mode: LaTeX
%%% TeX-master: "main.tex"
%%% End:

But only 1.bib with this chapter.tex (and still setting TeX-master in
my config).
 
%%% Local Variables:
%%% mode: LaTeX
%%% End:

(When testing, make sure to restart emacs first.)

This shouldn't happen, (setq-default TeX-master "main") is suggested in
the docs, so it should not make a difference whether it's set as a
local variable in the file or as a default in the config.

But okay, this is probably the reason why noone has discovered this
before. I haven't investigated the root cause for this, but let me know
if you can reproduce it now. 

> I think the correct fix is to replace (boundp 'TeX-active-styles)
> with:
> 
> (and (fboundp 'TeX-style-list)
>      (TeX-style-list))
> 

Sure, sounds better, yes. I think that change should be applied in any
case (unless the code is removed entirely).

> > Then reftex-using-biblatex-p will fall back on a "poor-man's check"
> > (according to the comment in the code), which looks for
> > \usepackage{biblatex} using some regex.
> > 
> > I think this logic is broken. Whether biblatex is used or not
> > should
> > not be judged in each file of a multifile document separately.
> > Either
> > the entire document uses biblatex, or it doesn't. As a result,
> > replacing boundp by local-variable-p is only my second best
> > suggestion.
> 
> I'm not sure I follow: `TeX-style-list' returns all active styles for
> the entire document, the test is done on a per file basis, but the
> final
> result goes for the entire document.

Well okay, if AUCTeX is used, then you're right: the result is the same
for all files. But if the poor man's check is used, the regexp is
really checked separately in each file (if I'm not mistaken). One could
argue that this is good enough for a poor man's check. It will work as
long as the bib files are loaded in the same file that contains
\usepackage{biblatex}, which is probably the common case even for
multifile docs. But still, the behavior is a bit erratic. Then, in the
above examples, loading two bib files will work in main.tex but not in
chapter.tex. 

> 
> > My best suggestion is to get rid of reftex-using-biblatex-p
> > entirely,
> > and assume it's always true.
> 
> I'm not convinced yet that this a good idea.  The way around, the
> current code is in place for >25 years now and the number of
> complaints
> were low :-)

Not exactly, the biblatex support has been there only for 12 years. ;)
But yeah, I agree it's still a very long time for code.

Best,
Tim




This bug report was last modified 30 days ago.

Previous Next


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