[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
file-remote-p
From: |
Michael Albinus |
Subject: |
file-remote-p |
Date: |
Fri, 28 May 2004 21:40:56 +0200 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux) |
Hello,
file-remote-p checks for a file name handler of the argument, and
returns the value of the property file-remote-p of that handler.
That doesn't work in some cases.
(file-remote-p "/ssh:localhost:/file.gz") returns nil, because the
first file name handler which is found is jka-compr-handler.
(file-remote-p "/ssh:local") also returns nil, because the handler in
question is tramp-completion-file-name-handler, lacking the
file-remote-p property as well.
There are (at least) 2 ways to solve the problem:
1. file-remote-p loops looking for a file name handler. If the handler
which is returned doesn't have the file-remote-p property, that
handler is inhibited, and the next handler is requested. Either
until a handler with file-remote-p property is found, or no other
handler is found.
2. file-remote-p is implemented in the respective file name handlers
just returning t (tramp-file-name-handler; ange-ftp-hook-function
isn't active in file-name-handler-alist any longer). If other file
name handlers are passed for file-remote-p, they do inhibit
themselves, and apply the operation, again.
I tend to prefer alternative 2. An implementation of file-remote-p in
Tramp (and maybe other packages I don't know) would be simple. The
patch in files.el would look like this:
--- files.el 27 May 2004 20:23:31 -0000 1.697
+++ files.el 28 May 2004 19:34:42 -0000
@@ -642,9 +642,10 @@
(defun file-remote-p (file)
"Test whether FILE specifies a location on a remote system."
- (let ((handler (find-file-name-handler file 'file-local-copy)))
+ (let ((handler (find-file-name-handler file 'file-remote-p)))
(if handler
- (get handler 'file-remote-p))))
+ (funcall handler 'file-remote-p file)
+ nil)))
(defun file-local-copy (file)
"Copy the file FILE into a temporary file on this machine.
What do people think about?
Best regards, Michael.
- file-remote-p,
Michael Albinus <=