diff options
| author | Drew Adams | 2011-12-21 19:33:38 +0100 |
|---|---|---|
| committer | Michael Albinus | 2011-12-21 19:33:38 +0100 |
| commit | bace743a4a6760cdb3620b0b50396c73ffd16b52 (patch) | |
| tree | f4803935ea4a6083b1d47abaef71c44ab2102116 | |
| parent | 5da6dcc815adb1dbcaf0c43141dacdf7aa4b0589 (diff) | |
| download | emacs-bace743a4a6760cdb3620b0b50396c73ffd16b52.tar.gz emacs-bace743a4a6760cdb3620b0b50396c73ffd16b52.zip | |
* files.el (file-remote-p): Fix docstring. (Bug#10319)
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/files.el | 53 |
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 @@ | |||
| 1 | 2011-12-21 Drew Adams <drew.adams@oracle.com> | ||
| 2 | |||
| 3 | * files.el (file-remote-p): Fix docstring. (Bug#10319) | ||
| 4 | |||
| 1 | 2011-12-21 Jérémy Compostella <jeremy.compostella@gmail.com> | 5 | 2011-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. |
| 920 | Returns nil or a string identifying the remote connection (ideally | 920 | A file is considered remote if accessing it is likely to |
| 921 | a prefix of FILE). For example, the remote identification for filename | 921 | be slower or less reliable than accessing local files. |
| 922 | \"/user@host:/foo\" could be \"/user@host:\". | 922 | |
| 923 | A 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 |
| 924 | less reliable than accessing local files. | 924 | only reuse a connection that is already open. |
| 925 | Furthermore, relative file names do not work across remote connections. | 925 | |
| 926 | 926 | Return nil or a string identifying the remote connection | |
| 927 | IDENTIFICATION specifies which part of the identification shall | 927 | \(ideally a prefix of FILE). Return nil if FILE is a relative |
| 928 | be returned as string. IDENTIFICATION can be the symbol | 928 | file name. |
| 929 | `method', `user', `host' or `localname'; any other value is | 929 | |
| 930 | handled like nil and means to return the complete identification | 930 | When IDENTIFICATION is nil, the returned string is a complete |
| 931 | string. | 931 | remote identifier: with components method, user, and host. The |
| 932 | 932 | components are those present in FILE, with defaults filled in for | |
| 933 | If CONNECTED is non-nil, the function returns an identification only | 933 | any that are missing. |
| 934 | if FILE is located on a remote system, and a connection is established | 934 | |
| 935 | to that remote system. | 935 | IDENTIFICATION can specify which part of the identification to |
| 936 | 936 | return. 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 |
| 938 | means to return the complete identification. The string returned | ||
| 939 | for IDENTIFICATION `localname' can differ depending on whether | ||
| 940 | there is an existing connection. | ||
| 941 | |||
| 942 | If CONNECTED is non-nil, return an identification only if FILE is | ||
| 943 | located on a remote system and a connection is established to | ||
| 944 | that remote system. | ||
| 945 | |||
| 946 | Tip: 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) |