comparison lisp/files.el @ 81934:7a3210e699fe

* files.el (file-remote-p): Introduce optional parameter IDENTIFICATION.
author Michael Albinus <michael.albinus@gmx.de>
date Tue, 17 Jul 2007 21:07:49 +0000
parents cd3e38bb3dc7
children 761ac74a9c02 a1be62cbd32a
comparison
equal deleted inserted replaced
81933:a5a2ef19d358 81934:7a3210e699fe
725 (list (completing-read "Load library: " 725 (list (completing-read "Load library: "
726 'locate-file-completion 726 'locate-file-completion
727 (cons load-path (get-load-suffixes))))) 727 (cons load-path (get-load-suffixes)))))
728 (load library)) 728 (load library))
729 729
730 (defun file-remote-p (file &optional connected) 730 (defun file-remote-p (file &optional identification connected)
731 "Test whether FILE specifies a location on a remote system. 731 "Test whether FILE specifies a location on a remote system.
732 Return an identification of the system if the location is indeed 732 Return an identification of the system if the location is indeed
733 remote. The identification of the system may comprise a method 733 remote. The identification of the system may comprise a method
734 to access the system and its hostname, amongst other things. 734 to access the system and its hostname, amongst other things.
735 735
736 For example, the filename \"/user@host:/foo\" specifies a location 736 For example, the filename \"/user@host:/foo\" specifies a location
737 on the system \"/user@host:\". 737 on the system \"/user@host:\".
738 738
739 IDENTIFICATION specifies which part of the identification shall
740 be returned as string. IDENTIFICATION can be the symbol
741 `method', `user' or `host'; any other value is handled like nil
742 and means to return the complete identification string.
743
739 If CONNECTED is non-nil, the function returns an identification only 744 If CONNECTED is non-nil, the function returns an identification only
740 if FILE is located on a remote system, and a connection is established 745 if FILE is located on a remote system, and a connection is established
741 to that remote system. 746 to that remote system.
742 747
743 `file-remote-p' will never open a connection on its own." 748 `file-remote-p' will never open a connection on its own."
744 (let ((handler (find-file-name-handler file 'file-remote-p))) 749 (let ((handler (find-file-name-handler file 'file-remote-p)))
745 (if handler 750 (if handler
746 (funcall handler 'file-remote-p file connected) 751 (funcall handler 'file-remote-p file identification connected)
747 nil))) 752 nil)))
748 753
749 (defun file-local-copy (file) 754 (defun file-local-copy (file)
750 "Copy the file FILE into a temporary file on this machine. 755 "Copy the file FILE into a temporary file on this machine.
751 Returns the name of the local copy, or nil, if FILE is directly 756 Returns the name of the local copy, or nil, if FILE is directly