`gf` doesn't work as expected in `latex-mode`

First of all: Thank you for maintaining this awesome project! :slight_smile:

What happened?

In a LaTeX file, I navigate to a line like

\input{some|file}

where | indicates where I place my cursor. I then press gf.

What did you expect to happen?

The file somefile.tex should be opened. Instead, file search is opened with the prompt pre-filled with input{somefile}.

Steps to reproduce

As described above.

System information


Loading data dump...

Does M-x find-file-at-point fare differently? gf falls back to this command anyway, but maybe it’ll produce a different result if called directly.

EDIT: Just tried to but couldn’t reproduce it, unless the FILE (in \input{FILE}) doesn’t exist, relative to the current file.

Thanks for responding!

I have the following structure:

$ pwd
~/gf-test
$ ls
Main.tex  somefile.tex
$ cat Main.tex
\input{somefile}

M-x find-file-at-point (with the cursor on some|file) opens a Find file or URL: prompt with ~/gf-test/ prefilled.

gf opens a Find file or URL: prompt with ~/gf-test/input{somefile} prefilled.