Subject: Re: bug#71376: 14.0.5; find-file-at-point doesn't work in LaTeX-mode

From: Arash Esbati <[email-masked]>
Date: Thu, 06 Jun 2024 22:29:02 +0200

Stefan Monnier <[email-masked]> writes:

> So unless/until `ffap.el` is changed to pay attention to the modes'
> hierarchy rather than just the value of `major-mode`, we should use
> things like `plain-tex-mode`.

Thanks for the clarification.  Revised patch is attached.

Best, Arash
>From cf6a14a51a9302770ffeb0cb0c78ae9de60d025e Mon Sep 17 00:00:00 2001
From: Arash Esbati <[email-masked]>
Date: Wed, 5 Jun 2024 21:37:43 +0200
Subject: [PATCH] Fix names of TeX-related major-modes

* lisp/ffap.el (ffap-alist, ffap-string-at-point-mode-alist): Add
entries for mode names introduced in AUCTeX v14.  Use
`plain-tex-mode' for built-in mode.  (bug#71376)
---
 lisp/ffap.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lisp/ffap.el b/lisp/ffap.el
index b2b681b7c44..9fd753fc0e5 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -751,8 +751,10 @@ ffap-alist
     ("\\.\\([chCH]\\|cc\\|hh\\)\\'" . ffap-c-mode) ; stdio.h
     (fortran-mode . ffap-fortran-mode)
     ("\\.[fF]\\'" . ffap-fortran-mode)
-    (tex-mode . ffap-tex-mode)		; search ffap-tex-path
+    (plain-tex-mode . ffap-tex-mode)    ; search ffap-tex-path
     (latex-mode . ffap-latex-mode)	; similar
+    (plain-TeX-mode . ffap-tex-mode)    ; AUCTeX v14 counterpart
+    (LaTeX-mode . ffap-latex-mode)      ; ditto
     ("\\.\\(tex\\|sty\\|doc\\|cls\\)\\'" . ffap-tex)
     ("\\.bib\\'" . ffap-bib)		; search ffap-bib-path
     ("\\`\\." . ffap-home)		; .emacs, .bashrc, .profile
@@ -1064,7 +1066,10 @@ ffap-string-at-point-mode-alist
     (math-mode ",-:$+<>@-Z_[:lower:]~`" "<" "@>;.,!?`:")
     ;; (La)TeX: don't allow braces
     (latex-mode "--:\\\\$+<>@-Z_[:alpha:]~*?" "<@" "@>;.,!:")
-    (tex-mode "--:\\\\$+<>@-Z_[:alpha:]~*?" "<@" "@>;.,!:")
+    (plain-tex-mode "--:\\\\$+<>@-Z_[:alpha:]~*?" "<@" "@>;.,!:")
+    ;; AUCTeX v14 counterparts:
+    (LaTeX-mode "--:\\\\$+<>@-Z_[:alpha:]~*?" "<@" "@>;.,!:")
+    (plain-TeX-mode "--:\\\\$+<>@-Z_[:alpha:]~*?" "<@" "@>;.,!:")
     ;; XML: don't allow angle brackets
     (xml-mode "--:\\\\${}+@-Z_[:alpha:]~*?#" "{<@" "@>;.,!:}")
     (nxml-mode "--:\\\\${}+@-Z_[:alpha:]~*?#" "{<@" "@>;.,!:}")
-- 
2.45.2