RefTeX bibliography entries not updating without Emacs restart (Emacs 30.1 regression?)
- Dominant language
- Emacs Lisp
- Stars
- 22.7k
- Forks
- 3.1k
- Avg merge
- 10h 46m
- Merged PRs (30d)
- 4
Description
### I confirm that...
- [x] I searched the issue tracker and found no similar issues.
- [x] I searched the [documentation](https://docs.doomemacs.org), [FAQ](https://docs.doomemacs.org/-/faq), [discussion board](https://doomemacs.org/discuss), and [Google](https://google.com) for solutions to my issue.
- [x] I read [the debugging guide](https://doomemacs.org/d/how2debug) and researched the issue to the best of my ability.
- [x] My issue can be observed on the latest available commit of Doom.
- [x] My issue can be observed on a stable release of Emacs (i.e. doesn't end in `.50`, `.60`, or `.90`–`.99`)
### Describe your issue
As of recently, adding new entries to BibTeX files no longer makes them available in RefTeX citation selection (C-c [) without completely restarting Emacs. This is a regression from long-standing working behavior.
Environment:
- Emacs version: 30.1
- Doom version:
GNU Emacs v30.1 nil
Doom core v3.0.0-pre HEAD -> master ead254e15 2025-11-04 22:18:26 -0500
Doom modules v25.10.0-pre HEAD -> master ead254e15 2025-11-04 22:18:26 -0500
- OS: Ubuntu 24.04
- Relevant modules: latex (with default configuration)
Steps to Reproduce:
0. Create a "clean" doom:
```bash
# Create a test directory
mkdir -p ~/doom-test
cd ~/doom-test
# Clone Doom (or use your existing Doom installation)
# but with a separate config directory
mkdir .doom.d
# Create minimal init.el
cat > .doom.d/init.el <<'EOF'
(doom! :lang
latex)
EOF
# Create minimal config.el
cat > .doom.d/config.el <<'EOF'
;; Minimal config - nothing else
EOF
# Create minimal packages.el
touch .doom.d/packages.el
# Launch Emacs with this config
DOOMDIR=~/doom-test/.doom.d emacs
```
1. Create a minimal LaTeX document test.tex:
```latex
\documentclass{article}
\usepackage{natbib}
\begin{document}
Test citation: \cite{entry1}
\bibliography{test}
\end{document}
```
2. Create a minimal BibTeX file test.bib:
```bibtex
@article{entry1,
author = {Smith, John},
title = {First Entry},
journal = {Test Journal},
year = {2024}
}
```
3. Open test.tex in Emacs/Doom
4. Run C-c [ - you'll see entry1 in the citation list
5. Without closing Emacs, add a new entry to test.bib:
```bibtex
@article{entry2,
author = {Doe, Jane},
title = {Second Entry},
journal = {Test Journal},
year = {2024}
}
```
6. Save test.bib
7. In test.tex, run C-c [ again
Expected Behavior:
Both entry1 and entry2 should appear in the citation list.
Actual Behavior:
Only entry1 appears. entry2 doesn't show up until Emacs is completely restarted.
Root Cause:
AUCTeX stores parsed bibliography data in .auctex-auto/*.el cache files. When these files are loaded, they populate LaTeX-auto-bibitem with the parsed entries, but the style hook mechanism that should transfer this data to LaTeX-bibitem-list (which RefTeX actually reads) appears to be broken.
Evidence:
M-: (length LaTeX-auto-bibitem) RET ; Returns correct count (e.g., 2)
M-: (length (LaTeX-bibitem-list)) RET ; Returns 0 or stale count
Workaround:
Add this to config.el:
```elisp
(after! reftex
(defun refresh-reftex-bib ()
"Reload bibliography cache by manually transferring entries."
(interactive)
(let ((bibfiles (reftex-get-bibfile-list)))
(dolist (bibfile bibfiles)
(let ((cache-file (concat (file-name-directory bibfile) ".auctex-auto/"
(file-name-sans-extension (file-name-nondirectory bibfile)) ".el")))
(when (file-exists-p cache-file)
(load-file cache-file)
(when (boundp 'LaTeX-auto-bibitem)
(apply #'LaTeX-add-bibitems LaTeX-auto-bibitem))))))
(message "Bibliography reloaded")))
```
Then run M-x refresh-reftex-bib after adding new bib entries.
Additional Notes:
- This worked correctly for many years until recently.
- Setting TeX-auto-save to nil does not fix the issue
- The cache files in .auctex-auto/ contain the correct data; the problem is in transferring it to the active list
- May be an Emacs 30.1 compatibility issue or a recent AUCTeX update
Related:
Potentially related to changes in how Emacs 30.1 handles style hooks or dynamic variable scoping.
### Steps to reproduce
see "describe your issue", above
### System information
https://pastebin.com/csnnsV3M
Contributor guide
Assessment
This issue has not been assessed yet.