GNU bug report logs - #10319
24.0.92; doc string of `file-remote-p'

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Sun, 18 Dec 2011 02:20:01 UTC

Severity: minor

Found in version 24.0.92

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

Full log


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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 10319 <at> debbugs.gnu.org
Subject: Re: bug#10319: 24.0.92; doc string of `file-remote-p'
Date: Tue, 20 Dec 2011 18:02:57 +0100
"Drew Adams" <drew.adams <at> oracle.com> writes:

> Are you saying that nil is always returned for a relative file name?  If so,
> let's just say that: "Return nil if FILE is a relative file name".  (No need to
> say that you must or should use an absolute name.)

Thinking about (and testing a little bit) it seems like this: for
relative file names it always returns nil, indeed. This is because it
does not apply `expand-file-name'. Your proposed sentence looks OK.

>> When IDENTIFICATION is nil, the returned string is everything 
>> until the last ":" (with expanded default method, default user,
>> default host).
>> 
>> (file-remote-p "/sudo::/") => "/sudo:root <at> localhost:"
>> (file-remote-p "/localhost:/") => "/scpc:localhost:"
>
> Fine. Let's say that (it's not obvious, IMHO).
>
>  When IDENTIFICATION is nil, the returned string is a complete
>  remote identifier: with components method, user, and host.
>  The components are those present in FILE, with defaults filled
>  in for any that are missing.

OK.

>> What I have tried to explain is a common technique for creation of new
>> remote filenames, derived from an existing one. Let's say you have a
>> variable `file' containing the remote filename "/sudo::/path/to/file",
>> and you want to create a new remote filename for the file 
>> "/bin/sh". You apply then (concat (file-remote-p file) "/bin/sh")
>
> That's a useful tip about another way to _use_ the function, and also not so
> obvious.  Let's say that too.
>
>   Tip: You can use this expansion of remote identifier components
>   to derive a new remote name from an existing one.  For example,
>   if FILE is "/sudo::/path/to/file" then 
>   (concat (file-remote-p FILE) "/bin/sh") returns a remote
>   name for file "/bin/sh" that has the same remote identifier as
>   FILE but expanded; a name such as "/sudo:myhost.org:/bin/sh".

OK as well. Minor change: the result for the sudo case ought to be
"/sudo:root <at> myhost:/bin/sh". "root" is the default user name for "sudo",
and "myhost" instead of "myhost.org" because the default host name in
this case is the value of `system-name'.

> HTH.

Thanks, and best regards, Michael.




This bug report was last modified 13 years and 214 days ago.

Previous Next


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