unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* file-remote-p
@ 2004-05-28 19:40 Michael Albinus
  2004-05-28 20:47 ` file-remote-p Stefan Monnier
  2004-05-29 17:02 ` file-remote-p Richard Stallman
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Albinus @ 2004-05-28 19:40 UTC (permalink / raw)


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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: file-remote-p
  2004-05-28 19:40 file-remote-p Michael Albinus
@ 2004-05-28 20:47 ` Stefan Monnier
  2004-05-29 17:02 ` file-remote-p Richard Stallman
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2004-05-28 20:47 UTC (permalink / raw)
  Cc: emacs-devel

> 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.
[...]
> What do people think about?

I obviously completely agree since I pointed out something similar back when
file-remote-p was introduced (although I probably wasn't as clear as you
were: I just intuited that it wouldn't be flexible enough, although I was
thinking of cases like url-handler-mode where file:///foo/bar should be
considered local).


        Stefan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: file-remote-p
  2004-05-28 19:40 file-remote-p Michael Albinus
  2004-05-28 20:47 ` file-remote-p Stefan Monnier
@ 2004-05-29 17:02 ` Richard Stallman
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Stallman @ 2004-05-29 17:02 UTC (permalink / raw)
  Cc: emacs-devel

Since the simple solution I tried does not work, let's use your method
2, which is general and follows the way other operations work.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-05-29 17:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-28 19:40 file-remote-p Michael Albinus
2004-05-28 20:47 ` file-remote-p Stefan Monnier
2004-05-29 17:02 ` file-remote-p Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).