GNU bug report logs - #78925
31.0.50; ffap's filename prompt problem in remote files

Previous Next

Package: emacs;

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

Date: Mon, 30 Jun 2025 09:55: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 #20 received at 78925 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Liu Hui <liuhui1610 <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 78925 <at> debbugs.gnu.org
Subject: Re: bug#78925: 31.0.50; ffap's filename prompt problem in remote
 files, [PATCH] Add option 'ffap-prefer-remote-file' (bug#78925)
Date: Mon, 07 Jul 2025 19:17:21 +0200
Liu Hui <liuhui1610 <at> gmail.com> writes:

Hi,

> The attached patch adds an option 'ffap-prefer-remote-file', which
> defaults to nil. A non-nil value means ffap always finds remote files
> for absolute filenames in remote case, instead of finding local files
> first.

Thank you for the patch. I don't use ffap myself, so just some comments
from cursory review.

> +---
> +*** New user option 'ffap-prefer-remote-file'.
> +If non-nil, ffap always finds remote files in buffers with remote
> +'default-directory'.  If nil, ffap finds local files first for absolute
> +filenames in above buffers.  The default is nil.

Please spell it out FFAP.

> -(defun ffap-file-exists-string (file &optional nomodify)
> +(defun ffap-file-exists-string (file &optional nomodify remote-host)

A remote file name is not only the host. There are also, at least, a
method and a user. Please call this argument remote-prefix or alike.

> +     ((or (not file)			; quietly reject nil
> +	  (zerop (length file)))	; and also ""
> +      nil)

aka ((zerop (length file)) nil)

> +     ((and remote-host                  ; prepend remote host to file
> +           (file-name-absolute-p file)
> +           (setq file (concat remote-host file))
> +           nil))

What, if file is already remote? Shouldn't the check be

--8<---------------cut here---------------start------------->8---
     ((and remote-host                  ; prepend remote host to file
           (file-name-absolute-p file)
           (not (file-name-remote-p file))
           (setq file (concat remote-host file))
           nil))
--8<---------------cut here---------------end--------------->8---

>  (require 'cl-lib)
>  (require 'ert)
> +(require 'tramp)
>  (require 'ert-x)
>  (require 'ffap)

Why Tramp? I guess it isn't needed.

> +  (let* ((ffap-prefer-remote-file t)
> +         (default-directory
> +          (expand-file-name ert-remote-temporary-file-directory))
> +         (test-file (expand-file-name "ffap-test" default-directory)))

I would use (make-temp-file "ffap-test")

Best regards, Michael.




This bug report was last modified 5 days ago.

Previous Next


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