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: Sun, 22 Jun 2025 14:52:44 +0200
On Sat, 2025-06-21 at 22:05 +0200, Tim Ruffing wrote:
> I haven't investigated the root cause for this, but let me know
> if you can reproduce it now. 

Update: 
If you have the "%%% TeX-master: "main.tex" line, what will open and
keep open the main.tex buffer when opening chapter.tex is *not* AUCTeX
but the built-in latexenc.el. This is what debug-on-entry find-file-
noselect tells me, and you can confirm it by setting
  (setq latexenc-dont-use-TeX-master-flag nil),
and just to make sure, also
  (setq latexenc-dont-use-tex-guess-main-file-flag nil).

And this makes exactly the bug. So another reproducer is:

config:
(setq latexenc-dont-use-TeX-master-flag nil)  ; this is new
(setq latexenc-dont-use-tex-guess-main-file-flag nil)  ; why not 
(setq reftex-initialize-temporary-buffers nil) ; default
(setq reftex-keep-temporary-buffers 1)  ;  default

chapter.tex:

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

main.tex:

\documentclass{standalone}
\usepackage{biblatex}
\addbibresource{1.bib}
\addbibresource{2.bib}
\begin{document}
\input{chapter.tex}
\end{document}

However, you're still right. AUCTeX will *also* open main.tex when it's
initialized in chapter.tex. And in particular, even with the above
reproducer, i.e., even with latexenc-dont-use-TeX-master-flag set to
nil, "biblatex" will be in (TeX-style-list) when called in chapter.tex.
That means that AUCTeX correctly figures out the main file and parses
it (but it won't keep the main.tex buffer open unlike latexenc). 

What happens then is what I described in my initial email. reftex will
open main.tex as a temp buffer in fundamental mode, and so on...   

The thing is: As I said above, chapter.tex already knows that biblatex
is used (because "biblatex" is in the list returned by (TeX-style-list)
when called in chapter.tex). But the real issue is that this
information will simply not be used when the main.tex buffer is checked
in fundamental mode. 

And I believe that this analysis now really shows that either the call
to (TeX-style-list) should be performed in the buffer in which (reftex-
get-bibfile-list) is called (instead of calling it separately in each
searched buffer). Or simpler, as I've initially suggested, just never
stop after the first occurrence of a bibliography command, and the
problem will just disappear entirely. 




This bug report was last modified 29 days ago.

Previous Next


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