From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arash Esbati Newsgroups: gmane.emacs.bugs Subject: bug#64768: biblatex detection in reftex is too naive, multiple bib files are problematic Date: Mon, 31 Jul 2023 09:40:03 +0200 Message-ID: <861qgoy1f0.fsf@gnu.org> References: <868rb1yxv8.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28433"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 64768@debbugs.gnu.org To: "Philipp G. Haselwarter" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jul 31 09:41:14 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qQNWj-0007CW-TX for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 31 Jul 2023 09:41:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qQNWb-0006vc-UX; Mon, 31 Jul 2023 03:41:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qQNWZ-0006sG-QC for bug-gnu-emacs@gnu.org; Mon, 31 Jul 2023 03:41:04 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qQNWY-0002Ta-6y for bug-gnu-emacs@gnu.org; Mon, 31 Jul 2023 03:41:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qQNWX-0002M8-Pt for bug-gnu-emacs@gnu.org; Mon, 31 Jul 2023 03:41:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Arash Esbati Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 31 Jul 2023 07:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64768 X-GNU-PR-Package: emacs Original-Received: via spool by 64768-submit@debbugs.gnu.org id=B64768.16907892379015 (code B ref 64768); Mon, 31 Jul 2023 07:41:01 +0000 Original-Received: (at 64768) by debbugs.gnu.org; 31 Jul 2023 07:40:37 +0000 Original-Received: from localhost ([127.0.0.1]:51726 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qQNW8-0002LL-VH for submit@debbugs.gnu.org; Mon, 31 Jul 2023 03:40:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53972) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qQNW6-0002L5-Oa for 64768@debbugs.gnu.org; Mon, 31 Jul 2023 03:40:36 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qQNVw-0002Ip-73; Mon, 31 Jul 2023 03:40:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=mSaHyDbY6fp6JFEUWR2g5aw+6O5GQn5j7owjUJPuyEo=; b=T+1EJfeqWWzHKeIQY8mQ l3/21pz+KZfTFNIzO/WR9VxC1BuPRzxq0bv0acVHMF5t8P3ljzKylOhCPl8z7ikS5oWk3B3VW3qke 1TT1eJltCLpqjXD5LV95vxJGgxbqnJ+dOZkkeO9+Ybw+aOBUCxLfOSM4u4UZsoMukJUUTbG+2mV79 dCITLp9pt6t3Xa8iGFi4sMUfAaq2ybbNdD6WhKGIkJAPgvTW0p4QLSv/rcIIzPUPy63ceke1Xwd2I 5k5KN8vxCe2a6kzz119A1ApwRzFm6w6D7eQWaw8UMejd50ZkcGQbQZwRsQQ9S2LQGej84lvA5axxv kctM9IYGCsSZ5w==; Original-Received: from p5b326e8f.dip0.t-ipconnect.de ([91.50.110.143] helo=MUTANT) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qQNVt-0006nI-CK; Mon, 31 Jul 2023 03:40:23 -0400 In-Reply-To: (Philipp G. Haselwarter's message of "Fri, 28 Jul 2023 11:58:32 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:266401 Archived-At: "Philipp G. Haselwarter" writes: > In main.tex, I have the line "\input{mypreamble}", and in > mypreamble.tex, there's a line with "\usepackage{biblatex}". I also > have several "\addbibresource{foo.bib}", "\addbibresource{bar.bib}", > etc, either in main.tex or in mypreamble.tex . I would want reftex to > be aware of the references in foo.bib and bar.bib whenever main.tex is > set as TeX-master, i.e. either while editing main.tex directly or > while editing some-section.tex, where some-section.tex sets TeX-master > to main.tex. Thanks the clarification. \addbibresource is a preamble only command and AFAIU, RefTeX looks for this macro only in the main file; it doesn't go through each \input'ed file in order to find any \addbibresource. I'd suggest you change your setup a little and rename your mypreamble.tex to mypreamble.sty and replace there: \usepackage{biblatex} with \RequirePackage{biblatex} and delete any \addbibresource calls. Now you do this in your main.tex: \usepackage{mypreamble} \addbibresource{foo.bib} \addbibresource{bar.bib} Now the final step is to write a small AUCTeX style file for your mypreamble.sty called mypreamble.el which looks like this: (TeX-add-style-hook "mypreamble" (lambda () (TeX-run-style-hooks "biblatex")) :latex) and save this file in the directory specified in the variable `TeX-style-private' (or adjust it accordingly first). Now restart Emacs and open your main.tex. AUCTeX should load mypreamble.el and biblatex.el subsequently which gets an entry in `TeX-active-styles' and you should be done. Best, Arash