GNU bug report logs - #78929
31.0.50; ffap does not find the correct filename in remote projects

Previous Next

Package: emacs;

Reported by: Liu Hui <liuhui1610 <at> gmail.com>

Date: Mon, 30 Jun 2025 14:48:02 UTC

Severity: normal

Found in version 31.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 78929 <at> debbugs.gnu.org (full text, mbox):

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Liu Hui <liuhui1610 <at> gmail.com>, 78929 <at> debbugs.gnu.org
Subject: Re: bug#78929: 31.0.50; ffap does not find the correct filename in
 remote projects
Date: Thu, 03 Jul 2025 14:02:21 -0400
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Liu Hui <liuhui1610 <at> gmail.com>
>> Date: Mon, 30 Jun 2025 22:47:10 +0800
>> 
>> Hi,
>> 
>> The following recipe is extracted from bug#78925:
>> 
>> 1. emacs -Q
>> 2. Open a file in a remote project:
>>    C-x C-f /ssh:server:~/a_git_project/test_file
>> 3. Create a file that exists outside the project in the remote host, e.g.
>>    M-! touch /tmp/abc
>> 4. type the above filename (i.e. /tmp/abc) in test_file, and M-x ffap
>> 
>> ffap prompts /ssh:server:~/a_git_project/tmp/abc, while in Emacs 29
>> prompts /ssh:server:/tmp/abc correctly. This problem seems to be
>> related to commit 1eae0e7edf4.
>
> Spencer, could you please look into this?

Thanks for the report, this is indeed a bug in ffap-in-project.  This
should be fixed by the attached patch, could you please test?

[0001-Fix-ffap-in-project-to-check-file-existence.patch (text/x-patch, inline)]
From 3d6b886fb8d9f30ec72950e969427925299d3c8e Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh <at> janestreet.com>
Date: Thu, 3 Jul 2025 13:59:46 -0400
Subject: [PATCH] Fix ffap-in-project to check file existence

* lisp/ffap.el (ffap-in-project): Check file existence before
returning non-nil. (bug#78929)
---
 lisp/ffap.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/ffap.el b/lisp/ffap.el
index 1c9f0294601..10afcd9514a 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -807,7 +807,9 @@ ffap-completable
 (declare-function project-root "project" (project))
 (defun ffap-in-project (name)
   (when-let* ((project (project-current)))
-    (file-name-concat (project-root project) name)))
+    (ffap-file-exists-string
+     (file-name-concat (project-root project) name)
+     'nomodify)))
 
 (defun ffap-home (name) (ffap-locate-file name t '("~")))
 
-- 
2.39.3


This bug report was last modified 11 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.