Hi AUCTeX,

The patchset for the new xref backend in tex-mode.el is still pending,
but no matter what the eventual outcome of that I think we still need to
have a complete set of AUCTeX modes included in
`semantic-symref-filepattern-alist'. Without them we just get the
cryptic message about customizing that variable when we try to use
`xref-find-references'. Also, I don't know whether it was decided not to
include the .tex extension where relevant, but this does mean that,
without further intervention, `xref-find-references' won't search .tex
files in any of the modes, even when you are actually searching from,
say, a LaTeX-mode .tex file. This seems suboptimal to me. I attach a
patch for your consideration.

Thanks,

David.

Emacs  : GNU Emacs 30.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version
3.24.31, cairo version 1.16.0)
 of 2024-05-28
Package: 2024-03-17
From 0b78ae5e1e71fc8ec2288d11c3de719ed417816a Mon Sep 17 00:00:00 2001
From: David Fussner <dfuss...@googlemail.com>
Date: Tue, 28 May 2024 17:27:04 +0100
Subject: [PATCH] Populate `semantic-symref-filepattern-alist' for all AUCTeX
 modes.

* context.el:
* latex.el:
* plain-tex.el: Make sure all modes have an entry in the alist, and also
that the ".tex" extension is included where necessary.
---
 context.el   |  7 +++++++
 latex.el     |  3 ++-
 plain-tex.el | 14 ++++++++++++++
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/context.el b/context.el
index 8b0c88ee..0caab223 100644
--- a/context.el
+++ b/context.el
@@ -1861,6 +1861,13 @@ that is, you do _not_ have to cater for this yourself by adding \\\\\\=' or $."
 
 (TeX-abbrev-mode-setup ConTeXt-mode context-mode-abbrev-table)
 
+(defvar semantic-symref-filepattern-alist) ; Silence compiler
+(with-eval-after-load 'semantic/symref/grep
+  ;; This entry is necessary for M-? to work.
+  ;; <URL:https://lists.gnu.org/r/auctex-devel/2023-09/msg00002.html>
+  ;; <URL:https://lists.gnu.org/r/auctex-devel/2023-09/msg00005.html>
+  (push '(ConTeXt-mode "*.[tT]e[xX]") semantic-symref-filepattern-alist))
+
 (defun ConTeXt-mode-common-initialization ()
   "Initialization code that is common for all ConTeXt interfaces."
   (plain-TeX-common-initialization)
diff --git a/latex.el b/latex.el
index d0a9ee6f..ba759291 100644
--- a/latex.el
+++ b/latex.el
@@ -8195,7 +8195,8 @@ This happens when \\left is inserted."
   ;; This entry is necessary for M-? to work.
   ;; <URL:https://lists.gnu.org/r/auctex-devel/2023-09/msg00002.html>
   ;; <URL:https://lists.gnu.org/r/auctex-devel/2023-09/msg00005.html>
-  (push '(LaTeX-mode "*.ltx" "*.sty" "*.cls" "*.clo" "*.bbl" "*.drv" "*.hva")
+  (push '(LaTeX-mode "*.[tT]e[xX]" "*.ltx" "*.sty" "*.cl[so]" "*.bbl"
+                     "*.drv" "*.hva")
         semantic-symref-filepattern-alist))
 
 (declare-function LaTeX-preview-setup "preview")
diff --git a/plain-tex.el b/plain-tex.el
index 2b777869..9bd48eb3 100644
--- a/plain-tex.el
+++ b/plain-tex.el
@@ -118,6 +118,14 @@ plain-TeX file, or any mode derived thereof.  See variable
 
 (TeX-abbrev-mode-setup plain-TeX-mode plain-tex-mode-abbrev-table)
 
+(defvar semantic-symref-filepattern-alist) ; Silence compiler
+(with-eval-after-load 'semantic/symref/grep
+  ;; This entry is necessary for M-? to work.
+  ;; <URL:https://lists.gnu.org/r/auctex-devel/2023-09/msg00002.html>
+  ;; <URL:https://lists.gnu.org/r/auctex-devel/2023-09/msg00005.html>
+  (push '(plain-TeX-mode "*.[tT]e[xX]" "*.ins")
+        semantic-symref-filepattern-alist))
+
 ;; Delete alias predefined in tex-mode.el so that AUCTeX autoload
 ;; takes precedence.
 ;;;###autoload (if (eq (symbol-function 'plain-TeX-mode) 'plain-tex-mode)
@@ -318,6 +326,12 @@ that is, you do _not_ have to cater for this yourself by adding \\\\\\=' or $."
   :type 'hook
   :group 'TeX-misc)
 
+(with-eval-after-load 'semantic/symref/grep
+  ;; This entry is necessary for M-? to work.
+  ;; <URL:https://lists.gnu.org/r/auctex-devel/2023-09/msg00002.html>
+  ;; <URL:https://lists.gnu.org/r/auctex-devel/2023-09/msg00005.html>
+  (push '(AmSTeX-mode "*.[tT]e[xX]") semantic-symref-filepattern-alist))
+
 ;;;###autoload
 (define-derived-mode AmSTeX-mode plain-TeX-mode "AmS-TeX"
   "Major mode in AUCTeX for editing AmSTeX files.
-- 
2.39.4

_______________________________________________
bug-auctex mailing list
bug-auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-auctex
  • bug#71245: ... David Fussner via bug-auctex via Bug reporting list for AUCTeX
    • bug#71... Ikumi Keita
      • bu... David Fussner via bug-auctex via Bug reporting list for AUCTeX
        • ... Ikumi Keita
          • ... David Fussner via bug-auctex via Bug reporting list for AUCTeX
            • ... Ikumi Keita
          • ... Arash Esbati
            • ... David Fussner via bug-auctex via Bug reporting list for AUCTeX

Reply via email to