aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDrew Adams2011-12-21 19:33:38 +0100
committerMichael Albinus2011-12-21 19:33:38 +0100
commitbace743a4a6760cdb3620b0b50396c73ffd16b52 (patch)
treef4803935ea4a6083b1d47abaef71c44ab2102116
parent5da6dcc815adb1dbcaf0c43141dacdf7aa4b0589 (diff)
downloademacs-bace743a4a6760cdb3620b0b50396c73ffd16b52.tar.gz
emacs-bace743a4a6760cdb3620b0b50396c73ffd16b52.zip
* files.el (file-remote-p): Fix docstring. (Bug#10319)
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/files.el53
2 files changed, 39 insertions, 18 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index cf029ddb03e..2cf35375245 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
12011-12-21 Drew Adams <drew.adams@oracle.com>
2
3 * files.el (file-remote-p): Fix docstring. (Bug#10319)
4
12011-12-21 Jérémy Compostella <jeremy.compostella@gmail.com> 52011-12-21 Jérémy Compostella <jeremy.compostella@gmail.com>
2 6
3 * battery.el (battery-linux-sysfs): Add missing parameters from acpi. 7 * battery.el (battery-linux-sysfs): Add missing parameters from acpi.
diff --git a/lisp/files.el b/lisp/files.el
index 40b6e7d56b4..0f7386511f6 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -917,24 +917,41 @@ See `load-file' for a different interface to `load'."
917 917
918(defun file-remote-p (file &optional identification connected) 918(defun file-remote-p (file &optional identification connected)
919 "Test whether FILE specifies a location on a remote system. 919 "Test whether FILE specifies a location on a remote system.
920Returns nil or a string identifying the remote connection (ideally 920A file is considered remote if accessing it is likely to
921a prefix of FILE). For example, the remote identification for filename 921be slower or less reliable than accessing local files.
922\"/user@host:/foo\" could be \"/user@host:\". 922
923A file is considered \"remote\" if accessing it is likely to be slower or 923`file-remote-p' never opens a new remote connection. It can
924less reliable than accessing local files. 924only reuse a connection that is already open.
925Furthermore, relative file names do not work across remote connections. 925
926 926Return nil or a string identifying the remote connection
927IDENTIFICATION specifies which part of the identification shall 927\(ideally a prefix of FILE). Return nil if FILE is a relative
928be returned as string. IDENTIFICATION can be the symbol 928file name.
929`method', `user', `host' or `localname'; any other value is 929
930handled like nil and means to return the complete identification 930When IDENTIFICATION is nil, the returned string is a complete
931string. 931remote identifier: with components method, user, and host. The
932 932components are those present in FILE, with defaults filled in for
933If CONNECTED is non-nil, the function returns an identification only 933any that are missing.
934if FILE is located on a remote system, and a connection is established 934
935to that remote system. 935IDENTIFICATION can specify which part of the identification to
936 936return. IDENTIFICATION can be the symbol `method', `user',
937`file-remote-p' will never open a connection on its own." 937`host', or `localname'. Any other value is handled like nil and
938means to return the complete identification. The string returned
939for IDENTIFICATION `localname' can differ depending on whether
940there is an existing connection.
941
942If CONNECTED is non-nil, return an identification only if FILE is
943located on a remote system and a connection is established to
944that remote system.
945
946Tip: You can use this expansion of remote identifier components
947 to derive a new remote file name from an existing one. For
948 example, if FILE is \"/sudo::/path/to/file\" then
949
950 \(concat \(file-remote-p FILE) \"/bin/sh\")
951
952 returns a remote file name for file \"/bin/sh\" that has the
953 same remote identifier as FILE but expanded; a name such as
954 \"/sudo:root@myhost:/bin/sh\"."
938 (let ((handler (find-file-name-handler file 'file-remote-p))) 955 (let ((handler (find-file-name-handler file 'file-remote-p)))
939 (if handler 956 (if handler
940 (funcall handler 'file-remote-p file identification connected) 957 (funcall handler 'file-remote-p file identification connected)