From: Michael Albinus <michael.albinus@gmx.de>
Date: Tue, 17 Jul 2007 21:07:49 +0000 (+0000)
Subject: * files.el (file-remote-p): Introduce optional parameter
X-Git-Tag: emacs-pretest-23.0.90~11867
X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ac25542d3337e026e6ebc3e39fae741a8147817e;p=emacs.git

* files.el (file-remote-p): Introduce optional parameter
IDENTIFICATION.
---

diff --git a/lisp/files.el b/lisp/files.el
index 849d09b4215..ed76e16b183 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -727,7 +727,7 @@ This is an interface to the function `load'."
 			  (cons load-path (get-load-suffixes)))))
   (load library))
 
-(defun file-remote-p (file &optional connected)
+(defun file-remote-p (file &optional identification connected)
   "Test whether FILE specifies a location on a remote system.
 Return an identification of the system if the location is indeed
 remote.  The identification of the system may comprise a method
@@ -736,6 +736,11 @@ to access the system and its hostname, amongst other things.
 For example, the filename \"/user@host:/foo\" specifies a location
 on the system \"/user@host:\".
 
+IDENTIFICATION specifies which part of the identification shall
+be returned as string.  IDENTIFICATION can be the symbol
+`method', `user' or `host'; any other value is handled like nil
+and means to return the complete identification string.
+
 If CONNECTED is non-nil, the function returns an identification only
 if FILE is located on a remote system, and a connection is established
 to that remote system.
@@ -743,7 +748,7 @@ to that remote system.
 `file-remote-p' will never open a connection on its own."
   (let ((handler (find-file-name-handler file 'file-remote-p)))
     (if handler
-	(funcall handler 'file-remote-p file connected)
+	(funcall handler 'file-remote-p file identification connected)
       nil)))
 
 (defun file-local-copy (file)