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

From: Arash Esbati <[email-masked]>
Date: Wed, 05 Jun 2024 13:31:30 +0200

Бабушкин Максим Владимирович <[email-masked]> writes:

> Emacs has a built-in function 'find-file-at-point' (or 'ffap'), which
> works great with the standard latex-mode. For example, putting cursor
> on the argument of the command
> \input{~/Downloads/myfile.tex}
> and calling 'M-x find-file-at-point' causes visiting the file under
> the cursor. It works similarly with the \usepackage command.
>
> The AUCTeX package comes with LaTeX-mode which does not support this
> functionality. But it seems that the older versions of AUCTeX did.

Thanks for raising this issue.  I don't use `ffap', but the issue is
that AUCTeX has changed the mode names.  Following your code, the
following change should fix the issue, right?  Can you give it a try?  I
can propose it for Emacs.

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/ffap.el b/lisp/ffap.el
index b2b681b7c44..f6d663a778b 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -753,6 +753,8 @@ ffap-alist
     ("\\.[fF]\\'" . ffap-fortran-mode)
     (tex-mode . ffap-tex-mode)         ; search ffap-tex-path
     (latex-mode . ffap-latex-mode)     ; similar
+    (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
@@ -1065,6 +1067,9 @@ ffap-string-at-point-mode-alist
     ;; (La)TeX: don't allow braces
     (latex-mode "--:\\\\$+<>@-Z_[:alpha:]~*?" "<@" "@>;.,!:")
     (tex-mode "--:\\\\$+<>@-Z_[:alpha:]~*?" "<@" "@>;.,!:")
+    ;; AUCTeX v14 counterparts:
+    (LaTeX-mode "--:\\\\$+<>@-Z_[:alpha:]~*?" "<@" "@>;.,!:")
+    (TeX-mode "--:\\\\$+<>@-Z_[:alpha:]~*?" "<@" "@>;.,!:")
     ;; XML: don't allow angle brackets
     (xml-mode "--:\\\\${}+@-Z_[:alpha:]~*?#" "{<@" "@>;.,!:}")
     (nxml-mode "--:\\\\${}+@-Z_[:alpha:]~*?#" "{<@" "@>;.,!:}")
--8<---------------cut here---------------end--------------->8---

Best, Arash