GNU bug report logs - #79036
[PATCH] Fix pdb tracking for remote filenames

Previous Next

Package: emacs;

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

Date: Thu, 17 Jul 2025 04:59:01 UTC

Severity: normal

Tags: patch

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

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: liuhui1610 <at> gmail.com, kobarity <at> gmail.com, 79036 <at> debbugs.gnu.org
Subject: Re: bug#79036: [PATCH] Fix pdb tracking for remote filenames
Date: Thu, 17 Jul 2025 18:45:22 +0300
> From: Michael Albinus <michael.albinus <at> gmx.de>
> Cc: liuhui1610 <at> gmail.com,  kobarity <at> gmail.com,  79036 <at> debbugs.gnu.org
> Date: Thu, 17 Jul 2025 17:09:13 +0200
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > I'm missing expand-file-name somewhere (FILE could be not an absolute
> > file name) in the case that FILE is a local file.  Otherwise, yes,
> > thanks.
> 
> I have left it out by intention. expand-file-name has a price on remote
> systems

I meant to call expand-file-name only in the local case.  AFAIU, if
file-remote-p returns non-nil, its argument is already an absolute
file name.  But the alternative:

  (concat (file-remote-p default-directory) file)

will not necessarily produce an absolute file name.

> (defun file-remote-name (file)
>   "Return the remote file name of FILE.
> If FILE is a relative file name, return FILE as it is.
> If FILE is already remote, return FILE as it is.
> If `default-directory' is local, return FILE as it is.
> Otherwise, prepend the remote file name component of `default-directory'
> to FILE."

I would like this to be the equivalent of expand-file-name, so we
could use it instead of expand-file-name when an absolute file name
actually names a remote file.  If we return a relative file name, Lisp
programs will need to call expand-file-name on them, which is not what
we want, IMO.

And I'm not sure I understand what you are trying to say here:

> expand-file-name has a price on remote systems, it should be called
> explicitly by the callee of file-remote-name

(I guess you meant "caller", not "callee".)  If you want to avoid the
price of calling expand-file-name when FILE is already expanded, we
can call expand-file-name only on relative file names and only if
default-directory is local.  Would that solve the problem?




This bug report was last modified 2 days ago.

Previous Next


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