From f90c46777a8c7565a1cd34fe4abde62ac2f14d9f Mon Sep 17 00:00:00 2001 From: David Fussner Date: Wed, 13 Sep 2023 10:14:40 +0100 Subject: [PATCH 2/2] Fix xref error when matching in unvisited files * latex.el (LaTeX-common-initialization): * plain-tex.el (plain-TeX-common-initialization): Add calls to TeX-update-style to fix missed matches when xref-find-references searches unvisited files. --- latex.el | 8 +++++++- plain-tex.el | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/latex.el b/latex.el index 548b18a9..d4a5467a 100644 --- a/latex.el +++ b/latex.el @@ -8843,7 +8843,13 @@ function would return non-nil and `(match-string 1)' would return ;; Set LaTeX-specific help messages for error so that it's available ;; in `TeX-help-error'. (setq-local TeX-error-description-list-local - LaTeX-error-description-list)) + LaTeX-error-description-list) + ;; Complete style initialization in buffers which don't visit files + ;; and which are therefore missed by the setting of `find-file-hook' + ;; in `VirTeX-common-initialization'. This is necessary for + ;; `xref-find-references', for example. + (unless buffer-file-truename + (TeX-update-style))) (defun LaTeX-imenu-create-index-function () "Imenu support function for LaTeX." diff --git a/plain-tex.el b/plain-tex.el index 0800b2f3..1e13acc6 100644 --- a/plain-tex.el +++ b/plain-tex.el @@ -244,7 +244,13 @@ of `plain-TeX-mode-hook'." "parindent" "baselineskip" "parskip") - (TeX-run-style-hooks "TEX")) + (TeX-run-style-hooks "TEX") + ;; Complete style initialization in buffers which don't visit files + ;; and which are therefore missed by the setting of `find-file-hook' + ;; in `VirTeX-common-initialization'. This is necessary for + ;; `xref-find-references', for example. + (unless buffer-file-truename + (TeX-update-style))) ;;; Miscellaneous -- 2.35.8