Mercurial > emacs
annotate lisp/net/tramp-fish.el @ 108816:94d1d8a6dcfd
* net/tramp-compat.el (tramp-compat-delete-file): Use
`symbol-value' for backward compatibility.
* net/tramp.el (tramp-handle-make-symbolic-link)
(tramp-handle-load)
(tramp-do-copy-or-rename-file-via-buffer)
(tramp-do-copy-or-rename-file-directly)
(tramp-do-copy-or-rename-file-out-of-band)
(tramp-handle-process-file, tramp-handle-call-process-region)
(tramp-handle-shell-command, tramp-handle-file-local-copy)
(tramp-handle-insert-file-contents, tramp-handle-write-region)
(tramp-delete-temp-file-function): Use `delete-file' instead
of `tramp-compat-delete-file'.
* net/tramp-fish.el (tramp-fish-handle-delete-directory)
(tramp-fish-handle-make-symbolic-link)
(tramp-fish-handle-process-file): Use `delete-file' instead
of `tramp-compat-delete-file'.
* net/tramp-ftp.el (tramp-ftp-file-name-handler): Use
`delete-file' instead of `tramp-compat-delete-file'.
* net/tramp-gvfs.el (tramp-gvfs-handle-delete-file): Rename arg.
(tramp-gvfs-handle-write-region): Use `delete-file' instead of
`tramp-compat-delete-file'.
* net/tramp-imap.el (tramp-imap-do-copy-or-rename-file): Use
`delete-file' instead of `tramp-compat-delete-file'.
* net/tramp-smb.el (tramp-smb-handle-copy-file)
(tramp-smb-handle-file-local-copy, tramp-smb-handle-rename-file)
(tramp-smb-handle-write-region): Use `delete-file' instead of
`tramp-compat-delete-file'.
(tramp-smb-handle-delete-directory): Use 'trash as arg.
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Fri, 28 May 2010 15:28:36 +0200 |
parents | 511da81b16c5 |
children | 280c8ae2476d |
rev | line source |
---|---|
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1 ;;; tramp-fish.el --- Tramp access functions for FISH protocol |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2 |
106815 | 3 ;; Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5 ;; Author: Michael Albinus <michael.albinus@gmx.de> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
6 ;; Keywords: comm, processes |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
7 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
8 ;; This file is part of GNU Emacs. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
9 |
94677
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94403
diff
changeset
|
10 ;; GNU Emacs is free software: you can redistribute it and/or modify |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
11 ;; it under the terms of the GNU General Public License as published by |
94677
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94403
diff
changeset
|
12 ;; the Free Software Foundation, either version 3 of the License, or |
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94403
diff
changeset
|
13 ;; (at your option) any later version. |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
14 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
15 ;; GNU Emacs is distributed in the hope that it will be useful, |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
18 ;; GNU General Public License for more details. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
19 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
20 ;; You should have received a copy of the GNU General Public License |
94677
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94403
diff
changeset
|
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
22 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
23 ;;; Commentary: |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
24 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
25 ;; Access functions for FIles transferred over SHell protocol from Tramp. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
26 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
27 ;; FISH is a protocol developped for the GNU Midnight Commander |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
28 ;; <https://savannah.gnu.org/projects/mc>. A client connects to a |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
29 ;; remote host via ssh (or rsh, shall be configurable), and starts |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
30 ;; there a fish server via the command "start_fish_server". All |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
31 ;; commands from the client have the form "#FISH_COMMAND\n" (always |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
32 ;; one line), followed by equivalent shell commands in case there is |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
33 ;; no fish server running. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
34 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
35 ;; The fish server (or the equivalent shell commands) must return the |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
36 ;; response, which is finished by a line "### xxx <optional text>\n". |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
37 ;; "xxx" stands for 3 digits, representing a return code. Return |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
38 ;; codes "# 000" and "# 001" are reserved for fallback implementation |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
39 ;; with native shell commands; they are not used inside the server. See |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
40 ;; <http://cvs.savannah.gnu.org/viewcvs/mc/vfs/README.fish?root=mc&view=markup> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
41 ;; for details of original specification. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
42 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
43 ;; The GNU Midnight Commander implements the original fish protocol |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
44 ;; version 0.0.2. The KDE Konqueror has its own implementation, which |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
45 ;; can be found at |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
46 ;; <http://websvn.kde.org/branches/KDE/3.5/kdebase/kioslave/fish>. It |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
47 ;; implements an extended protocol version 0.0.3. Additionally, it |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
48 ;; provides a fish server implementation in Perl (which is the only |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
49 ;; implementation I've heard of). The following command reference is |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
50 ;; based on that implementation. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
51 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
52 ;; All commands return either "### 2xx\n" (OK) or "### 5xx <optional text>\n" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
53 ;; (NOK). Return codes are mentioned only if they are different from this. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
54 ;; Spaces in any parameter must be escaped by "\ ". |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
55 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
56 ;; Command/Return Code Comment |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
57 ;; |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
58 ;; #FISH initial connection, not used |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
59 ;; in .fishsrv.pl |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
60 ;; ### 100 transfer fish server missing server, or wrong checksum |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
61 ;; version 0.0.3 only |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
62 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
63 ;; #VER a.b.c <commands requested> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
64 ;; VER x.y.z <commands offered> .fishsrv.pl response is not uptodate |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
65 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
66 ;; #PWD |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
67 ;; /path/to/file |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
68 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
69 ;; #CWD /some/path |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
70 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
71 ;; #COPY /path/a /path/b version 0.0.3 only |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
72 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
73 ;; #RENAME /path/a /path/b |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
74 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
75 ;; #SYMLINK /path/a /path/b |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
76 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
77 ;; #LINK /path/a /path/b |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
78 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
79 ;; #DELE /some/path |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
80 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
81 ;; #MKD /some/path |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
82 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
83 ;; #RMD /some/path |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
84 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
85 ;; #CHOWN user /file/name |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
86 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
87 ;; #CHGRP group /file/name |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
88 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
89 ;; #CHMOD 1234 file |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
90 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
91 ;; #READ <offset> <size> /path/and/filename |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
92 ;; ### 291 successful exit when reading |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
93 ;; ended at eof |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
94 ;; ### 292 successful exit when reading |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
95 ;; did not end at eof |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
96 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
97 ;; #WRITE <offset> <size> /path/and/filename |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
98 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
99 ;; #APPEND <size> /path/and/filename version 0.0.3 only |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
100 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
101 ;; #LIST /directory |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
102 ;; <number of entries> version 0.0.3 only |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
103 ;; ### 100 version 0.0.3 only |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
104 ;; P<unix permissions> <owner>.<group> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
105 ;; S<size> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
106 ;; d<3-letters month name> <day> <year or HH:MM> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
107 ;; D<year> <month> <day> <hour> <minute> <second>[.1234] |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
108 ;; E<major-of-device>,<minor> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
109 ;; :<filename> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
110 ;; L<filename symlink points to> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
111 ;; M<mimetype> version 0.0.3 only |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
112 ;; <blank line to separate items> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
113 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
114 ;; #STAT /file version 0.0.3 only |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
115 ;; like #LIST except for directories |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
116 ;; <number of entries> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
117 ;; ### 100 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
118 ;; P<unix permissions> <owner>.<group> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
119 ;; S<size> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
120 ;; d<3-letters month name> <day> <year or HH:MM> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
121 ;; D<year> <month> <day> <hour> <minute> <second>[.1234] |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
122 ;; E<major-of-device>,<minor> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
123 ;; :<filename> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
124 ;; L<filename symlink points to> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
125 ;; <blank line to separate items> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
126 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
127 ;; #RETR /some/name |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
128 ;; <filesize> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
129 ;; ### 100 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
130 ;; <binary data> exactly filesize bytes |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
131 ;; ### 200 with no preceding newline |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
132 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
133 ;; #STOR <size> /file/name |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
134 ;; ### 100 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
135 ;; <data> exactly size bytes |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
136 ;; ### 001 partial success |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
137 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
138 ;; #EXEC <command> <tmpfile> version 0.0.3 only |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
139 ;; <tmpfile> must not exists. It contains the output of <command>. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
140 ;; It can be retrieved afterwards. Last line is |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
141 ;; ###RESULT: <returncode> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
142 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
143 ;; This implementation is meant as proof of the concept, whether there |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
144 ;; is a better performance compared with the native ssh method. It |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
145 ;; looks like the file information retrieval is slower, especially the |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
146 ;; #LIST command. On the other hand, the file contents transmission |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
147 ;; seems to perform better than other inline methods, because there is |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
148 ;; no need for data encoding/decoding, and it supports the APPEND |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
149 ;; parameter of `write-region'. Transfer of binary data fails due to |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
150 ;; Emacs' process input/output handling. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
151 |
108739
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
152 ;;; Code: |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
153 |
108739
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
154 (eval-when-compile |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
155 ;; Pacify byte-compiler. |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
156 (require 'cl)) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
157 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
158 (require 'tramp) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
159 (require 'tramp-cache) |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
84966
diff
changeset
|
160 (require 'tramp-compat) |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
84966
diff
changeset
|
161 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
162 ;; Define FISH method ... |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
163 (defcustom tramp-fish-method "fish" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
164 "*Method to connect via FISH protocol." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
165 :group 'tramp |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
166 :type 'string) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
167 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
168 ;; ... and add it to the method list. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
169 (add-to-list 'tramp-methods (cons tramp-fish-method nil)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
170 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
171 ;; Add a default for `tramp-default-user-alist'. Default is the local user. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
172 (add-to-list 'tramp-default-user-alist |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
173 `(,tramp-fish-method nil ,(user-login-name))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
174 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
175 ;; Add completion function for FISH method. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
176 (tramp-set-completion-function |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
177 tramp-fish-method tramp-completion-function-alist-ssh) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
178 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
179 (defconst tramp-fish-continue-prompt-regexp "^### 100.*\n" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
180 "FISH return code OK.") |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
181 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
182 ;; It cannot be a defconst, occasionally we bind it locally. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
183 (defvar tramp-fish-ok-prompt-regexp "^### 200\n" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
184 "FISH return code OK.") |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
185 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
186 (defconst tramp-fish-error-prompt-regexp "^### \\(4\\|5\\)[0-9]+.*\n" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
187 "Regexp for possible error strings of FISH servers. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
188 Used instead of analyzing error codes of commands.") |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
189 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
190 (defcustom tramp-fish-start-fish-server-command |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
191 (concat "stty intr \"\" quit \"\" erase \"\" kill \"\" eof \"\" eol \"\" eol2 \"\" swtch \"\" start \"\" stop \"\" susp \"\" rprnt \"\" werase \"\" lnext \"\" flush \"\"; " |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
192 "perl .fishsrv.pl " |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
193 "`grep 'ARGV\\[0\\]' .fishsrv.pl | " |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
194 "sed -e 's/^[^\"]*\"//' -e 's/\"[^\"]*$//'`; " |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
195 "exit") |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
196 "*Command to connect via FISH protocol." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
197 :group 'tramp |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
198 :type 'string) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
199 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
200 ;; New handlers should be added here. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
201 (defconst tramp-fish-file-name-handler-alist |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
202 '( |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
203 ;; `access-file' performed by default handler |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
204 (add-name-to-file . tramp-fish-handle-add-name-to-file) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
205 ;; `byte-compiler-base-file-name' performed by default handler |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
206 (copy-file . tramp-fish-handle-copy-file) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
207 (delete-directory . tramp-fish-handle-delete-directory) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
208 (delete-file . tramp-fish-handle-delete-file) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
209 ;; `diff-latest-backup-file' performed by default handler |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
210 (directory-file-name . tramp-handle-directory-file-name) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
211 (directory-files . tramp-handle-directory-files) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
212 (directory-files-and-attributes . tramp-fish-handle-directory-files-and-attributes) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
213 ;; `dired-call-process' performed by default handler |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
214 ;; `dired-compress-file' performed by default handler |
103530
bd92ac143136
* net/tramp-fish.el (tramp-fish-file-name-handler-alist): Add handler
Michael Albinus <michael.albinus@gmx.de>
parents:
102852
diff
changeset
|
215 (dired-uncache . tramp-handle-dired-uncache) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
216 (expand-file-name . tramp-fish-handle-expand-file-name) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
217 ;; `file-accessible-directory-p' performed by default handler |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
218 (file-attributes . tramp-fish-handle-file-attributes) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
219 (file-directory-p . tramp-fish-handle-file-directory-p) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
220 (file-executable-p . tramp-fish-handle-file-executable-p) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
221 (file-exists-p . tramp-fish-handle-file-exists-p) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
222 (file-local-copy . tramp-fish-handle-file-local-copy) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
223 (file-modes . tramp-handle-file-modes) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
224 (file-name-all-completions . tramp-fish-handle-file-name-all-completions) |
99616
9dfb3eaac831
* net/tramp-fish.el (tramp-fish-file-name-handler-alist): Handle
Michael Albinus <michael.albinus@gmx.de>
parents:
97036
diff
changeset
|
225 (file-name-as-directory . tramp-handle-file-name-as-directory) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
226 (file-name-completion . tramp-handle-file-name-completion) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
227 (file-name-directory . tramp-handle-file-name-directory) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
228 (file-name-nondirectory . tramp-handle-file-name-nondirectory) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
229 ;; `file-name-sans-versions' performed by default handler |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
230 (file-newer-than-file-p . tramp-fish-handle-file-newer-than-file-p) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
231 (file-ownership-preserved-p . ignore) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
232 (file-readable-p . tramp-fish-handle-file-readable-p) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
233 (file-regular-p . tramp-handle-file-regular-p) |
108077
93125d6fab29
Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents:
107820
diff
changeset
|
234 (file-remote-p . tramp-handle-file-remote-p) |
93125d6fab29
Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents:
107820
diff
changeset
|
235 ;; `file-selinux-context' performed by default handler. |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
236 (file-symlink-p . tramp-handle-file-symlink-p) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
237 ;; `file-truename' performed by default handler |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
238 (file-writable-p . tramp-fish-handle-file-writable-p) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
239 (find-backup-file-name . tramp-handle-find-backup-file-name) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
240 ;; `find-file-noselect' performed by default handler |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
241 ;; `get-file-buffer' performed by default handler |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
242 (insert-directory . tramp-fish-handle-insert-directory) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
243 (insert-file-contents . tramp-fish-handle-insert-file-contents) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
244 (load . tramp-handle-load) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
245 (make-directory . tramp-fish-handle-make-directory) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
246 (make-directory-internal . tramp-fish-handle-make-directory-internal) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
247 (make-symbolic-link . tramp-fish-handle-make-symbolic-link) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
248 (rename-file . tramp-fish-handle-rename-file) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
249 (set-file-modes . tramp-fish-handle-set-file-modes) |
108077
93125d6fab29
Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents:
107820
diff
changeset
|
250 ;; `set-file-selinux-context' performed by default handler. |
81938
26330ef1aa46
* net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents:
81769
diff
changeset
|
251 (set-file-times . tramp-fish-handle-set-file-times) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
252 (set-visited-file-modtime . ignore) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
253 (shell-command . tramp-handle-shell-command) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
254 (substitute-in-file-name . tramp-handle-substitute-in-file-name) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
255 (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
256 (vc-registered . ignore) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
257 (verify-visited-file-modtime . ignore) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
258 (write-region . tramp-fish-handle-write-region) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
259 (executable-find . tramp-fish-handle-executable-find) |
81938
26330ef1aa46
* net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents:
81769
diff
changeset
|
260 (start-file-process . ignore) |
26330ef1aa46
* net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents:
81769
diff
changeset
|
261 (process-file . tramp-fish-handle-process-file) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
262 ) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
263 "Alist of handler functions for Tramp FISH method. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
264 Operations not mentioned here will be handled by the default Emacs primitives.") |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
265 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
266 (defun tramp-fish-file-name-p (filename) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
267 "Check if it's a filename for FISH protocol." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
268 (let ((v (tramp-dissect-file-name filename))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
269 (string= (tramp-file-name-method v) tramp-fish-method))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
270 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
271 (defun tramp-fish-file-name-handler (operation &rest args) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
272 "Invoke the FISH related OPERATION. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
273 First arg specifies the OPERATION, second arg is a list of arguments to |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
274 pass to the OPERATION." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
275 (let ((fn (assoc operation tramp-fish-file-name-handler-alist))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
276 (if fn |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
277 (save-match-data (apply (cdr fn) args)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
278 (tramp-run-real-handler operation args)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
279 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
280 (add-to-list 'tramp-foreign-file-name-handler-alist |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
281 (cons 'tramp-fish-file-name-p 'tramp-fish-file-name-handler)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
282 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
283 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
284 ;; File name primitives |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
285 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
286 (defun tramp-fish-handle-add-name-to-file |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
287 (filename newname &optional ok-if-already-exists) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
288 "Like `add-name-to-file' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
289 (unless (tramp-equal-remote filename newname) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
290 (with-parsed-tramp-file-name |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
291 (if (tramp-tramp-file-p filename) filename newname) nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
292 (tramp-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
293 v 'file-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
294 "add-name-to-file: %s" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
295 "only implemented for same method, same user, same host"))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
296 (with-parsed-tramp-file-name filename v1 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
297 (with-parsed-tramp-file-name newname v2 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
298 (when (and (not ok-if-already-exists) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
299 (file-exists-p newname) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
300 (not (numberp ok-if-already-exists)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
301 (y-or-n-p |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
302 (format |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
303 "File %s already exists; make it a new name anyway? " |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
304 newname))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
305 (tramp-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
306 v2 'file-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
307 "add-name-to-file: file %s already exists" newname)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
308 (tramp-flush-file-property v2 v2-localname) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
309 (unless (tramp-fish-send-command-and-check |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
310 v1 (format "#LINK %s %s" v1-localname v2-localname)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
311 (tramp-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
312 v1 'file-error "Error with add-name-to-file %s" newname))))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
313 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
314 (defun tramp-fish-handle-copy-file |
108077
93125d6fab29
Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents:
107820
diff
changeset
|
315 (filename newname &optional ok-if-already-exists keep-date |
93125d6fab29
Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents:
107820
diff
changeset
|
316 preserve-uid-gid preserve-selinux-context) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
317 "Like `copy-file' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
318 (tramp-fish-do-copy-or-rename-file |
85694
21983e7c844a
* net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents:
85067
diff
changeset
|
319 'copy filename newname ok-if-already-exists keep-date preserve-uid-gid)) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
320 |
105352
f92b20f3ef80
* net/tramp-fish.el (tramp-fish-handle-delete-directory): Handle
Michael Albinus <michael.albinus@gmx.de>
parents:
103530
diff
changeset
|
321 (defun tramp-fish-handle-delete-directory (directory &optional recursive) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
322 "Like `delete-directory' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
323 (when (file-exists-p directory) |
105352
f92b20f3ef80
* net/tramp-fish.el (tramp-fish-handle-delete-directory): Handle
Michael Albinus <michael.albinus@gmx.de>
parents:
103530
diff
changeset
|
324 (if recursive |
f92b20f3ef80
* net/tramp-fish.el (tramp-fish-handle-delete-directory): Handle
Michael Albinus <michael.albinus@gmx.de>
parents:
103530
diff
changeset
|
325 (mapc |
f92b20f3ef80
* net/tramp-fish.el (tramp-fish-handle-delete-directory): Handle
Michael Albinus <michael.albinus@gmx.de>
parents:
103530
diff
changeset
|
326 (lambda (file) |
f92b20f3ef80
* net/tramp-fish.el (tramp-fish-handle-delete-directory): Handle
Michael Albinus <michael.albinus@gmx.de>
parents:
103530
diff
changeset
|
327 (if (file-directory-p file) |
105894
ae9f17f9fa46
* net/tramp-compat.el (tramp-compat-copy-directory)
Michael Albinus <michael.albinus@gmx.de>
parents:
105352
diff
changeset
|
328 (tramp-compat-delete-directory file recursive) |
108816
94d1d8a6dcfd
* net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents:
108806
diff
changeset
|
329 (delete-file file))) |
105352
f92b20f3ef80
* net/tramp-fish.el (tramp-fish-handle-delete-directory): Handle
Michael Albinus <michael.albinus@gmx.de>
parents:
103530
diff
changeset
|
330 ;; We do not want to delete "." and "..". |
f92b20f3ef80
* net/tramp-fish.el (tramp-fish-handle-delete-directory): Handle
Michael Albinus <michael.albinus@gmx.de>
parents:
103530
diff
changeset
|
331 (directory-files |
f92b20f3ef80
* net/tramp-fish.el (tramp-fish-handle-delete-directory): Handle
Michael Albinus <michael.albinus@gmx.de>
parents:
103530
diff
changeset
|
332 directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*"))) |
108806
511da81b16c5
Change delete-by-moving-to-trash so Lisp calls explicitly request trashing.
Chong Yidong <cyd@stupidchicken.com>
parents:
108739
diff
changeset
|
333 (with-parsed-tramp-file-name |
108816
94d1d8a6dcfd
* net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents:
108806
diff
changeset
|
334 (directory-file-name (expand-file-name directory)) nil |
94d1d8a6dcfd
* net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents:
108806
diff
changeset
|
335 (tramp-flush-directory-property v localname) |
94d1d8a6dcfd
* net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents:
108806
diff
changeset
|
336 (tramp-fish-send-command-and-check v (format "#RMD %s" localname))))) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
337 |
108806
511da81b16c5
Change delete-by-moving-to-trash so Lisp calls explicitly request trashing.
Chong Yidong <cyd@stupidchicken.com>
parents:
108739
diff
changeset
|
338 (defun tramp-fish-handle-delete-file (filename &optional trash) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
339 "Like `delete-file' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
340 (when (file-exists-p filename) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
341 (with-parsed-tramp-file-name (expand-file-name filename) nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
342 (tramp-flush-file-property v localname) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
343 (tramp-fish-send-command-and-check v (format "#DELE %s" localname))))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
344 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
345 (defun tramp-fish-handle-directory-files-and-attributes |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
346 (directory &optional full match nosort id-format) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
347 "Like `directory-files-and-attributes' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
348 (mapcar |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
349 (lambda (x) |
107820
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
106815
diff
changeset
|
350 (cons x |
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
106815
diff
changeset
|
351 (tramp-compat-file-attributes |
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
106815
diff
changeset
|
352 (if full x (expand-file-name x directory)) |
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
106815
diff
changeset
|
353 id-format))) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
354 (directory-files directory full match nosort))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
355 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
356 (defun tramp-fish-handle-expand-file-name (name &optional dir) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
357 "Like `expand-file-name' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
358 ;; If DIR is not given, use DEFAULT-DIRECTORY or "/". |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
359 (setq dir (or dir default-directory "/")) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
360 ;; Unless NAME is absolute, concat DIR and NAME. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
361 (unless (file-name-absolute-p name) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
362 (setq name (concat (file-name-as-directory dir) name))) |
85694
21983e7c844a
* net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents:
85067
diff
changeset
|
363 ;; If NAME is not a Tramp file, run the real handler, |
84966
fa9dd0b54e54
* net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
364 (if (or (tramp-completion-mode-p) (not (tramp-tramp-file-p name))) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
365 (tramp-drop-volume-letter |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
366 (tramp-run-real-handler 'expand-file-name (list name nil))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
367 ;; Dissect NAME. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
368 (with-parsed-tramp-file-name name nil |
94403
f3fa6258dd50
* net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents:
93079
diff
changeset
|
369 (unless (tramp-run-real-handler 'file-name-absolute-p (list localname)) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
370 (setq localname (concat "~/" localname))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
371 ;; Tilde expansion if necessary. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
372 (when (string-match "\\`\\(~[^/]*\\)\\(.*\\)\\'" localname) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
373 (let ((uname (match-string 1 localname)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
374 (fname (match-string 2 localname))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
375 ;; We cannot apply "~user/", because this is not supported |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
376 ;; by the FISH protocol. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
377 (unless (string-equal uname "~") |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
378 (tramp-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
379 v 'file-error "Tilde expansion not supported for %s" name)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
380 (setq uname |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
381 (with-connection-property v uname |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
382 (tramp-fish-send-command-and-check v "#PWD") |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
383 (with-current-buffer (tramp-get-buffer v) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
384 (goto-char (point-min)) |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
84966
diff
changeset
|
385 (buffer-substring (point) (tramp-compat-line-end-position))))) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
386 (setq localname (concat uname fname)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
387 ;; There might be a double slash, for example when "~/" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
388 ;; expands to "/". Remove this. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
389 (while (string-match "//" localname) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
390 (setq localname (replace-match "/" t t localname))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
391 ;; No tilde characters in file name, do normal |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
392 ;; expand-file-name (this does "/./" and "/../"). We bind |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
393 ;; `directory-sep-char' here for XEmacs on Windows, which |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
394 ;; would otherwise use backslash. `default-directory' is |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
395 ;; bound, because on Windows there would be problems with UNC |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
396 ;; shares or Cygwin mounts. |
93079
4af1d1ce512c
* net/tramp-fish.el (tramp-fish-handle-expand-file-name): Let-bind
Michael Albinus <michael.albinus@gmx.de>
parents:
91487
diff
changeset
|
397 (let ((directory-sep-char ?/) |
4af1d1ce512c
* net/tramp-fish.el (tramp-fish-handle-expand-file-name): Let-bind
Michael Albinus <michael.albinus@gmx.de>
parents:
91487
diff
changeset
|
398 (default-directory (tramp-compat-temporary-file-directory))) |
4af1d1ce512c
* net/tramp-fish.el (tramp-fish-handle-expand-file-name): Let-bind
Michael Albinus <michael.albinus@gmx.de>
parents:
91487
diff
changeset
|
399 (tramp-make-tramp-file-name |
4af1d1ce512c
* net/tramp-fish.el (tramp-fish-handle-expand-file-name): Let-bind
Michael Albinus <michael.albinus@gmx.de>
parents:
91487
diff
changeset
|
400 method user host |
4af1d1ce512c
* net/tramp-fish.el (tramp-fish-handle-expand-file-name): Let-bind
Michael Albinus <michael.albinus@gmx.de>
parents:
91487
diff
changeset
|
401 (tramp-drop-volume-letter |
94403
f3fa6258dd50
* net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents:
93079
diff
changeset
|
402 (tramp-run-real-handler |
f3fa6258dd50
* net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents:
93079
diff
changeset
|
403 'expand-file-name (list localname)))))))) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
404 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
405 (defun tramp-fish-handle-file-attributes (filename &optional id-format) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
406 "Like `file-attributes' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
407 (with-parsed-tramp-file-name (expand-file-name filename) nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
408 (with-file-property v localname (format "file-attributes-%s" id-format) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
409 (cdr (car (tramp-fish-get-file-entries v localname nil)))))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
410 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
411 (defun tramp-fish-handle-file-directory-p (filename) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
412 "Like `file-directory-p' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
413 (let ((attributes (file-attributes filename))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
414 (and attributes |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
415 (or (string-match "d" (nth 8 attributes)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
416 (and (file-symlink-p filename) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
417 (with-parsed-tramp-file-name filename nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
418 (file-directory-p |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
419 (tramp-make-tramp-file-name |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
420 method user host (nth 0 attributes)))))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
421 t))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
422 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
423 (defun tramp-fish-handle-file-exists-p (filename) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
424 "Like `file-exists-p' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
425 (and (file-attributes filename) t)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
426 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
427 (defun tramp-fish-handle-file-executable-p (filename) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
428 "Like `file-executable-p' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
429 (with-parsed-tramp-file-name (expand-file-name filename) nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
430 (with-file-property v localname "file-executable-p" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
431 (when (file-exists-p filename) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
432 (let ((mode-chars (string-to-vector (nth 8 (file-attributes filename)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
433 (home-directory |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
434 (tramp-make-tramp-file-name |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
435 method user host |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
436 (tramp-get-connection-property v "home-directory" nil)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
437 (or (and (char-equal (aref mode-chars 3) ?x) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
438 (equal (nth 2 (file-attributes filename)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
439 (nth 2 (file-attributes home-directory)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
440 (and (char-equal (aref mode-chars 6) ?x) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
441 (equal (nth 3 (file-attributes filename)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
442 (nth 3 (file-attributes home-directory)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
443 (char-equal (aref mode-chars 9) ?x))))))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
444 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
445 (defun tramp-fish-handle-file-readable-p (filename) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
446 "Like `file-readable-p' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
447 (with-parsed-tramp-file-name (expand-file-name filename) nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
448 (with-file-property v localname "file-readable-p" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
449 (when (file-exists-p filename) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
450 (let ((mode-chars (string-to-vector (nth 8 (file-attributes filename)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
451 (home-directory |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
452 (tramp-make-tramp-file-name |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
453 method user host |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
454 (tramp-get-connection-property v "home-directory" nil)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
455 (or (and (char-equal (aref mode-chars 1) ?r) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
456 (equal (nth 2 (file-attributes filename)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
457 (nth 2 (file-attributes home-directory)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
458 (and (char-equal (aref mode-chars 4) ?r) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
459 (equal (nth 3 (file-attributes filename)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
460 (nth 3 (file-attributes home-directory)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
461 (char-equal (aref mode-chars 7) ?r))))))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
462 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
463 (defun tramp-fish-handle-file-writable-p (filename) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
464 "Like `file-writable-p' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
465 (with-parsed-tramp-file-name (expand-file-name filename) nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
466 (with-file-property v localname "file-writable-p" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
467 (if (not (file-exists-p filename)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
468 ;; If file doesn't exist, check if directory is writable. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
469 (and (file-directory-p (file-name-directory filename)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
470 (file-writable-p (file-name-directory filename))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
471 ;; Existing files must be writable. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
472 (let ((mode-chars (string-to-vector (nth 8 (file-attributes filename)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
473 (home-directory |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
474 (tramp-make-tramp-file-name |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
475 method user host |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
476 (tramp-get-connection-property v "home-directory" nil)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
477 (or (and (char-equal (aref mode-chars 2) ?w) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
478 (equal (nth 2 (file-attributes filename)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
479 (nth 2 (file-attributes home-directory)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
480 (and (char-equal (aref mode-chars 5) ?w) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
481 (equal (nth 3 (file-attributes filename)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
482 (nth 3 (file-attributes home-directory)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
483 (char-equal (aref mode-chars 8) ?w))))))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
484 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
485 (defun tramp-fish-handle-file-local-copy (filename) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
486 "Like `file-local-copy' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
487 (with-parsed-tramp-file-name (expand-file-name filename) nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
488 (unless (file-exists-p filename) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
489 (tramp-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
490 v 'file-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
491 "Cannot make local copy of non-existing file `%s'" filename)) |
85041
a42b8750a992
* net/tramp.el (tramp-make-temp-file): Move to tramp-compat.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
85024
diff
changeset
|
492 (let ((tmpfile (tramp-compat-make-temp-file filename))) |
108739
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
493 (with-progress-reporter |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
494 v 3 (format "Fetching %s to tmp file %s" filename tmpfile) |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
495 (when (tramp-fish-retrieve-data v) |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
496 ;; Save file |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
497 (with-current-buffer (tramp-get-buffer v) |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
498 (write-region (point-min) (point-max) tmpfile)) |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
499 tmpfile))))) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
500 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
501 ;; This function should return "foo/" for directories and "bar" for |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
502 ;; files. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
503 (defun tramp-fish-handle-file-name-all-completions (filename directory) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
504 "Like `file-name-all-completions' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
505 (all-completions |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
506 filename |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
507 (with-parsed-tramp-file-name (expand-file-name directory) nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
508 (with-file-property v localname "file-name-all-completions" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
509 (save-match-data |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
510 (let ((entries |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
511 (with-file-property v localname "file-entries" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
512 (tramp-fish-get-file-entries v localname t)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
513 (mapcar |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
514 (lambda (x) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
515 (list |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
516 (if (string-match "d" (nth 9 x)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
517 (file-name-as-directory (nth 0 x)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
518 (nth 0 x)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
519 entries))))))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
520 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
521 (defun tramp-fish-handle-file-newer-than-file-p (file1 file2) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
522 "Like `file-newer-than-file-p' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
523 (cond |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
524 ((not (file-exists-p file1)) nil) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
525 ((not (file-exists-p file2)) t) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
526 (t (tramp-time-less-p (nth 5 (file-attributes file2)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
527 (nth 5 (file-attributes file1)))))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
528 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
529 (defun tramp-fish-handle-insert-directory |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
530 (filename switches &optional wildcard full-directory-p) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
531 "Like `insert-directory' for Tramp files. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
532 WILDCARD and FULL-DIRECTORY-P are not handled." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
533 (setq filename (expand-file-name filename)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
534 (when (file-directory-p filename) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
535 ;; This check is a little bit strange, but in `dired-add-entry' |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
536 ;; this function is called with a non-directory ... |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
537 (setq filename (file-name-as-directory filename))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
538 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
539 (with-parsed-tramp-file-name filename nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
540 (tramp-flush-file-property v localname) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
541 (save-match-data |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
542 (let ((entries |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
543 (with-file-property v localname "file-entries" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
544 (tramp-fish-get-file-entries v localname t)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
545 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
546 ;; Sort entries |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
547 (setq entries |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
548 (sort |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
549 entries |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
550 (lambda (x y) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
551 (if (string-match "t" switches) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
552 ;; Sort by date. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
553 (tramp-time-less-p (nth 6 y) (nth 6 x)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
554 ;; Sort by name. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
555 (string-lessp (nth 0 x) (nth 0 y)))))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
556 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
557 ;; Print entries. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
558 (mapcar |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
559 (lambda (x) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
560 (insert |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
561 (format |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
562 "%10s %3d %-8s %-8s %8s %s %s%s\n" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
563 (nth 9 x) ; mode |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
564 1 ; hardlinks |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
565 (nth 3 x) ; uid |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
566 (nth 4 x) ; gid |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
567 (nth 8 x) ; size |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
568 (format-time-string |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
569 (if (tramp-time-less-p |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
570 (tramp-time-subtract (current-time) (nth 6 x)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
571 tramp-half-a-year) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
572 "%b %e %R" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
573 "%b %e %Y") |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
574 (nth 6 x)) ; date |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
575 (nth 0 x) ; file name |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
576 (if (stringp (nth 1 x)) (format " -> %s" (nth 1 x)) ""))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
577 (forward-line) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
578 (beginning-of-line)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
579 entries))))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
580 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
581 (defun tramp-fish-handle-insert-file-contents |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
582 (filename &optional visit beg end replace) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
583 "Like `insert-file-contents' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
584 (barf-if-buffer-read-only) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
585 (when visit |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
586 (setq buffer-file-name (expand-file-name filename)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
587 (set-visited-file-modtime) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
588 (set-buffer-modified-p nil)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
589 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
590 (with-parsed-tramp-file-name filename nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
591 (if (not (file-exists-p filename)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
592 (tramp-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
593 v 'file-error "File %s not found on remote host" filename) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
594 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
595 (let ((point (point)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
596 size) |
108739
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
597 (with-progress-reporter v 3 (format "Fetching file %s" filename) |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
598 (when (tramp-fish-retrieve-data v) |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
599 ;; Insert file |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
600 (insert |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
601 (with-current-buffer (tramp-get-buffer v) |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
602 (let ((beg (or beg (point-min))) |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
603 (end (min (or end (point-max)) (point-max)))) |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
604 (setq size (- end beg)) |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
605 (buffer-substring beg end)))) |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
606 (goto-char point))) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
607 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
608 (list (expand-file-name filename) size))))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
609 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
610 (defun tramp-fish-handle-make-directory (dir &optional parents) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
611 "Like `make-directory' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
612 (setq dir (directory-file-name (expand-file-name dir))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
613 (unless (file-name-absolute-p dir) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
614 (setq dir (expand-file-name dir default-directory))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
615 (with-parsed-tramp-file-name dir nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
616 (save-match-data |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
617 (let ((ldir (file-name-directory dir))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
618 ;; Make missing directory parts |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
619 (when (and parents (not (file-directory-p ldir))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
620 (make-directory ldir parents)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
621 ;; Just do it |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
622 (when (file-directory-p ldir) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
623 (make-directory-internal dir)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
624 (unless (file-directory-p dir) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
625 (tramp-error v 'file-error "Couldn't make directory %s" dir)))))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
626 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
627 (defun tramp-fish-handle-make-directory-internal (directory) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
628 "Like `make-directory-internal' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
629 (setq directory (directory-file-name (expand-file-name directory))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
630 (unless (file-name-absolute-p directory) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
631 (setq directory (expand-file-name directory default-directory))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
632 (when (file-directory-p (file-name-directory directory)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
633 (with-parsed-tramp-file-name directory nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
634 (save-match-data |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
635 (unless |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
636 (tramp-fish-send-command-and-check v (format "#MKD %s" localname)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
637 (tramp-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
638 v 'file-error "Couldn't make directory %s" directory)))))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
639 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
640 (defun tramp-fish-handle-make-symbolic-link |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
641 (filename linkname &optional ok-if-already-exists) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
642 "Like `make-symbolic-link' for Tramp files. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
643 If LINKNAME is a non-Tramp file, it is used verbatim as the target of |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
644 the symlink. If LINKNAME is a Tramp file, only the localname component is |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
645 used as the target of the symlink. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
646 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
647 If LINKNAME is a Tramp file and the localname component is relative, then |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
648 it is expanded first, before the localname component is taken. Note that |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
649 this can give surprising results if the user/host for the source and |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
650 target of the symlink differ." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
651 (with-parsed-tramp-file-name linkname nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
652 ;; Do the 'confirm if exists' thing. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
653 (when (file-exists-p linkname) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
654 ;; What to do? |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
655 (if (or (null ok-if-already-exists) ; not allowed to exist |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
656 (and (numberp ok-if-already-exists) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
657 (not (yes-or-no-p |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
658 (format |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
659 "File %s already exists; make it a link anyway? " |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
660 localname))))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
661 (tramp-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
662 v 'file-already-exists "File %s already exists" localname) |
108816
94d1d8a6dcfd
* net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents:
108806
diff
changeset
|
663 (delete-file linkname))) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
664 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
665 ;; If FILENAME is a Tramp name, use just the localname component. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
666 (when (tramp-tramp-file-p filename) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
667 (setq filename (tramp-file-name-localname |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
668 (tramp-dissect-file-name (expand-file-name filename))))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
669 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
670 ;; Right, they are on the same host, regardless of user, method, etc. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
671 ;; We now make the link on the remote machine. This will occur as the user |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
672 ;; that FILENAME belongs to. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
673 (unless |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
674 (tramp-fish-send-command-and-check |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
675 v (format "#SYMLINK %s %s" filename localname)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
676 (tramp-error v 'file-error "Error creating symbolic link %s" linkname)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
677 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
678 (defun tramp-fish-handle-rename-file |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
679 (filename newname &optional ok-if-already-exists) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
680 "Like `rename-file' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
681 (tramp-fish-do-copy-or-rename-file |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
682 'rename filename newname ok-if-already-exists t)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
683 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
684 (defun tramp-fish-handle-set-file-modes (filename mode) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
685 "Like `set-file-modes' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
686 (with-parsed-tramp-file-name filename nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
687 (tramp-flush-file-property v localname) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
688 (unless (tramp-fish-send-command-and-check |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
689 v (format "#CHMOD %s %s" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
690 (tramp-decimal-to-octal mode) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
691 (tramp-shell-quote-argument localname))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
692 (tramp-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
693 v 'file-error "Error while changing file's mode %s" filename)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
694 |
81938
26330ef1aa46
* net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents:
81769
diff
changeset
|
695 (defun tramp-fish-handle-set-file-times (filename &optional time) |
26330ef1aa46
* net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents:
81769
diff
changeset
|
696 "Like `set-file-times' for Tramp files." |
26330ef1aa46
* net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents:
81769
diff
changeset
|
697 (with-parsed-tramp-file-name filename nil |
26330ef1aa46
* net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents:
81769
diff
changeset
|
698 (let ((time (if (or (null time) (equal time '(0 0))) (current-time) time))) |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
84966
diff
changeset
|
699 (zerop (process-file |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
84966
diff
changeset
|
700 "touch" nil nil nil "-t" |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
84966
diff
changeset
|
701 (format-time-string "%Y%m%d%H%M.%S" time) |
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
84966
diff
changeset
|
702 (tramp-shell-quote-argument localname)))))) |
81938
26330ef1aa46
* net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents:
81769
diff
changeset
|
703 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
704 (defun tramp-fish-handle-write-region |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
705 (start end filename &optional append visit lockname confirm) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
706 "Like `write-region' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
707 (setq filename (expand-file-name filename)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
708 (with-parsed-tramp-file-name filename nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
709 ;; XEmacs takes a coding system as the seventh argument, not `confirm' |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
710 (when (and (not (featurep 'xemacs)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
711 confirm (file-exists-p filename)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
712 (unless (y-or-n-p (format "File %s exists; overwrite anyway? " |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
713 filename)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
714 (tramp-error v 'file-error "File not overwritten"))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
715 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
716 (tramp-flush-file-property v localname) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
717 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
718 ;; Send command |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
719 (let ((tramp-fish-ok-prompt-regexp |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
720 (concat |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
721 tramp-fish-ok-prompt-regexp "\\|" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
722 tramp-fish-continue-prompt-regexp))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
723 (tramp-fish-send-command |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
724 v (format "%s %d %s\n### 100" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
725 (if append "#APPEND" "#STOR") (- end start) localname))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
726 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
727 ;; Send data, if there are any. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
728 (when (> end start) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
729 (tramp-fish-send-command v (buffer-substring-no-properties start end))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
730 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
731 (when (eq visit t) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
732 (set-visited-file-modtime)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
733 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
734 (defun tramp-fish-handle-executable-find (command) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
735 "Like `executable-find' for Tramp files." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
736 (with-temp-buffer |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
84966
diff
changeset
|
737 (if (zerop (process-file "which" nil t nil command)) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
738 (progn |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
739 (goto-char (point-min)) |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
84966
diff
changeset
|
740 (buffer-substring (point-min) (tramp-compat-line-end-position)))))) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
741 |
81938
26330ef1aa46
* net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents:
81769
diff
changeset
|
742 (defun tramp-fish-handle-process-file |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
743 (program &optional infile destination display &rest args) |
81938
26330ef1aa46
* net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents:
81769
diff
changeset
|
744 "Like `process-file' for Tramp files." |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
745 ;; The implementation is not complete yet. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
746 (when (and (numberp destination) (zerop destination)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
747 (error "Implementation does not handle immediate return")) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
748 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
749 (with-parsed-tramp-file-name default-directory nil |
85067
4636000015c5
* net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents:
85041
diff
changeset
|
750 (let (command input tmpinput output tmpoutput stderr tmpstderr |
4636000015c5
* net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents:
85041
diff
changeset
|
751 outbuf tmpfile ret) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
752 ;; Compute command. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
753 (setq command (mapconcat 'tramp-shell-quote-argument |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
754 (cons program args) " ")) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
755 ;; Determine input. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
756 (if (null infile) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
757 (setq input "/dev/null") |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
758 (setq infile (expand-file-name infile)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
759 (if (tramp-equal-remote default-directory infile) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
760 ;; INFILE is on the same remote host. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
761 (setq input (with-parsed-tramp-file-name infile nil localname)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
762 ;; INFILE must be copied to remote host. |
85067
4636000015c5
* net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents:
85041
diff
changeset
|
763 (setq input (tramp-make-tramp-temp-file v) |
4636000015c5
* net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents:
85041
diff
changeset
|
764 tmpinput (tramp-make-tramp-file-name method user host input)) |
4636000015c5
* net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents:
85041
diff
changeset
|
765 (copy-file infile tmpinput t))) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
766 (when input (setq command (format "%s <%s" command input))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
767 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
768 ;; Determine output. |
85067
4636000015c5
* net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents:
85041
diff
changeset
|
769 (setq output (tramp-make-tramp-temp-file v) |
4636000015c5
* net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents:
85041
diff
changeset
|
770 tmpoutput (tramp-make-tramp-file-name method user host output)) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
771 (cond |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
772 ;; Just a buffer |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
773 ((bufferp destination) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
774 (setq outbuf destination)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
775 ;; A buffer name |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
776 ((stringp destination) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
777 (setq outbuf (get-buffer-create destination))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
778 ;; (REAL-DESTINATION ERROR-DESTINATION) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
779 ((consp destination) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
780 ;; output |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
781 (cond |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
782 ((bufferp (car destination)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
783 (setq outbuf (car destination))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
784 ((stringp (car destination)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
785 (setq outbuf (get-buffer-create (car destination))))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
786 ;; stderr |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
787 (cond |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
788 ((stringp (cadr destination)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
789 (setcar (cdr destination) (expand-file-name (cadr destination))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
790 (if (tramp-equal-remote default-directory (cadr destination)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
791 ;; stderr is on the same remote host. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
792 (setq stderr (with-parsed-tramp-file-name |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
793 (cadr destination) nil localname)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
794 ;; stderr must be copied to remote host. The temporary |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
795 ;; file must be deleted after execution. |
85067
4636000015c5
* net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents:
85041
diff
changeset
|
796 (setq stderr (tramp-make-tramp-temp-file v) |
4636000015c5
* net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents:
85041
diff
changeset
|
797 tmpstderr (tramp-make-tramp-file-name |
4636000015c5
* net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents:
85041
diff
changeset
|
798 method user host stderr)))) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
799 ;; stderr to be discarded |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
800 ((null (cadr destination)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
801 (setq stderr "/dev/null")))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
802 ;; 't |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
803 (destination |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
804 (setq outbuf (current-buffer)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
805 (when stderr (setq command (format "%s 2>%s" command stderr))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
806 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
807 ;; Goto working directory. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
808 (unless |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
809 (tramp-fish-send-command-and-check |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
810 v (format "#CWD %s" (tramp-shell-quote-argument localname))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
811 (tramp-error v 'file-error "No such directory: %s" default-directory)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
812 ;; Send the command. It might not return in time, so we protect it. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
813 (condition-case nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
814 (unwind-protect |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
815 (unless (tramp-fish-send-command-and-check |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
816 v (format |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
817 "#EXEC %s %s" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
818 (tramp-shell-quote-argument command) output)) |
84966
fa9dd0b54e54
* net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
819 (error nil)) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
820 ;; Check return code. |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84985
diff
changeset
|
821 (setq tmpfile |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84985
diff
changeset
|
822 (file-local-copy |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84985
diff
changeset
|
823 (tramp-make-tramp-file-name method user host output))) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
824 (with-temp-buffer |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84985
diff
changeset
|
825 (insert-file-contents tmpfile) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
826 (goto-char (point-max)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
827 (forward-line -1) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
828 (looking-at "^###RESULT: \\([0-9]+\\)") |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
829 (setq ret (string-to-number (match-string 1))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
830 (delete-region (point) (point-max)) |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84985
diff
changeset
|
831 (write-region (point-min) (point-max) tmpfile)) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
832 ;; We should show the output anyway. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
833 (when outbuf |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
84985
diff
changeset
|
834 (with-current-buffer outbuf (insert-file-contents tmpfile)) |
85067
4636000015c5
* net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents:
85041
diff
changeset
|
835 (when display (display-buffer outbuf)))) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
836 ;; When the user did interrupt, we should do it also. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
837 (error (setq ret 1))) |
85067
4636000015c5
* net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents:
85041
diff
changeset
|
838 |
4636000015c5
* net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents:
85041
diff
changeset
|
839 ;; Provide error file. |
4636000015c5
* net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents:
85041
diff
changeset
|
840 (when tmpstderr (rename-file tmpstderr (cadr destination) t)) |
4636000015c5
* net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents:
85041
diff
changeset
|
841 ;; Cleanup. |
108816
94d1d8a6dcfd
* net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents:
108806
diff
changeset
|
842 (when tmpinput (delete-file tmpinput)) |
94d1d8a6dcfd
* net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents:
108806
diff
changeset
|
843 (when tmpoutput (delete-file tmpoutput)) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
844 ;; Return exit status. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
845 ret))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
846 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
847 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
848 ;; Internal file name functions |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
849 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
850 (defun tramp-fish-do-copy-or-rename-file |
85694
21983e7c844a
* net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents:
85067
diff
changeset
|
851 (op filename newname &optional ok-if-already-exists keep-date preserve-uid-gid) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
852 "Copy or rename a remote file. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
853 OP must be `copy' or `rename' and indicates the operation to |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
854 perform. FILENAME specifies the file to copy or rename, NEWNAME |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
855 is the name of the new file (for copy) or the new name of the |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
856 file (for rename). OK-IF-ALREADY-EXISTS means don't barf if |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
857 NEWNAME exists already. KEEP-DATE means to make sure that |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
858 NEWNAME has the same timestamp as FILENAME. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
859 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
860 This function is invoked by `tramp-fish-handle-copy-file' and |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
861 `tramp-fish-handle-rename-file'. It is an error if OP is neither |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
862 of `copy' and `rename'. FILENAME and NEWNAME must be absolute |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
863 file names." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
864 (unless (memq op '(copy rename)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
865 (error "Unknown operation `%s', must be `copy' or `rename'" op)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
866 (let ((t1 (tramp-tramp-file-p filename)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
867 (t2 (tramp-tramp-file-p newname))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
868 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
869 (unless ok-if-already-exists |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
870 (when (and t2 (file-exists-p newname)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
871 (with-parsed-tramp-file-name newname nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
872 (tramp-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
873 v 'file-already-exists "File %s already exists" newname)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
874 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
875 (prog1 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
876 (cond |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
877 ;; Both are Tramp files. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
878 ((and t1 t2) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
879 (cond |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
880 ;; Shortcut: if method, host, user are the same for both |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
881 ;; files, we invoke `cp' or `mv' on the remote host |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
882 ;; directly. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
883 ((tramp-equal-remote filename newname) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
884 (tramp-fish-do-copy-or-rename-file-directly |
85694
21983e7c844a
* net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents:
85067
diff
changeset
|
885 op filename newname keep-date preserve-uid-gid)) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
886 ;; No shortcut was possible. So we copy the |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
887 ;; file first. If the operation was `rename', we go |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
888 ;; back and delete the original file (if the copy was |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
889 ;; successful). The approach is simple-minded: we |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
890 ;; create a new buffer, insert the contents of the |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
891 ;; source file into it, then write out the buffer to |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
892 ;; the target file. The advantage is that it doesn't |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
893 ;; matter which filename handlers are used for the |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
894 ;; source and target file. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
895 (t |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
896 (tramp-do-copy-or-rename-file-via-buffer |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
897 op filename newname keep-date)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
898 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
899 ;; One file is a Tramp file, the other one is local. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
900 ((or t1 t2) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
901 ;; Use the generic method via a Tramp buffer. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
902 (tramp-do-copy-or-rename-file-via-buffer |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
903 op filename newname keep-date)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
904 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
905 (t |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
906 ;; One of them must be a Tramp file. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
907 (error "Tramp implementation says this cannot happen"))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
908 ;; When newname did exist, we have wrong cached values. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
909 (when t2 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
910 (with-parsed-tramp-file-name newname nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
911 (tramp-flush-file-property v localname) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
912 (tramp-flush-file-property v (file-name-directory localname))))))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
913 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
914 (defun tramp-fish-do-copy-or-rename-file-directly |
85694
21983e7c844a
* net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents:
85067
diff
changeset
|
915 (op filename newname keep-date preserve-uid-gid) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
916 "Invokes `COPY' or `RENAME' on the remote system. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
917 OP must be one of `copy' or `rename', indicating `cp' or `mv', |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
918 respectively. VEC specifies the connection. LOCALNAME1 and |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
919 LOCALNAME2 specify the two arguments of `cp' or `mv'. If |
85694
21983e7c844a
* net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents:
85067
diff
changeset
|
920 KEEP-DATE is non-nil, preserve the time stamp when copying. |
21983e7c844a
* net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents:
85067
diff
changeset
|
921 PRESERVE-UID-GID is completely ignored." |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
922 (with-parsed-tramp-file-name filename v1 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
923 (with-parsed-tramp-file-name newname v2 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
924 (tramp-fish-send-command |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
925 v1 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
926 (format "%s %s %s" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
927 (if (eq op 'copy) "#COPY" "#RENAME") |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
928 (tramp-shell-quote-argument v1-localname) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
929 (tramp-shell-quote-argument v2-localname))))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
930 ;; KEEP-DATE handling. |
81938
26330ef1aa46
* net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents:
81769
diff
changeset
|
931 (when (and keep-date (functionp 'set-file-times)) |
84985
f7642749252b
* net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents:
84966
diff
changeset
|
932 (set-file-times newname (nth 5 (file-attributes filename)))) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
933 ;; Set the mode. |
102852
da220e3be804
* net/tramp-fish.el (tramp-fish-do-copy-or-rename-file-directly):
Michael Albinus <michael.albinus@gmx.de>
parents:
100908
diff
changeset
|
934 (set-file-modes newname (tramp-default-file-modes filename))) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
935 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
936 (defun tramp-fish-get-file-entries (vec localname list) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
937 "Read entries returned by FISH server. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
938 When LIST is true, a #LIST command will be sent, including all entries |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
939 of a directory. Otherwise, #STAT is sent for just one entry. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
940 Result is a list of (LOCALNAME LINK COUNT UID GID ATIME MTIME CTIME |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
941 SIZE MODE WEIRD INODE DEVICE)." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
942 (block nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
943 (with-current-buffer (tramp-get-buffer vec) |
81938
26330ef1aa46
* net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents:
81769
diff
changeset
|
944 ;; #LIST does not work properly with trailing "/", at least in |
26330ef1aa46
* net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents:
81769
diff
changeset
|
945 ;; .fishsrv.pl. |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
946 (when (string-match "/$" localname) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
947 (setq localname (concat localname "."))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
948 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
949 (let ((command (format "%s %s" (if list "#LIST" "#STAT") localname)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
950 buffer-read-only num res) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
951 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
952 ;; Send command |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
953 (tramp-fish-send-command vec command) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
954 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
955 ;; Read number of entries |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
956 (goto-char (point-min)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
957 (condition-case nil |
84966
fa9dd0b54e54
* net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
958 (unless (integerp (setq num (read (current-buffer)))) (error nil)) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
959 (error (return nil))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
960 (forward-line) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
961 (delete-region (point-min) (point)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
962 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
963 ;; Read return code |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
964 (goto-char (point-min)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
965 (condition-case nil |
84966
fa9dd0b54e54
* net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
966 (unless (looking-at tramp-fish-continue-prompt-regexp) (error nil)) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
967 (error (return nil))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
968 (forward-line) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
969 (delete-region (point-min) (point)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
970 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
971 ;; Loop the listing |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
972 (dotimes (i num) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
973 (let ((item (tramp-fish-read-file-entry))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
974 ;; Add inode and device. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
975 (add-to-list |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
976 'res (append item |
81938
26330ef1aa46
* net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents:
81769
diff
changeset
|
977 (list (tramp-get-inode vec) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
978 (tramp-get-device vec)))))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
979 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
980 ;; Read return code |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
981 (goto-char (point-min)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
982 (condition-case nil |
84966
fa9dd0b54e54
* net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
983 (unless (looking-at tramp-fish-ok-prompt-regexp) (error nil)) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
984 (error (tramp-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
985 vec 'file-error |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
986 "`%s' does not return a valid Lisp expression: `%s'" |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
987 command (buffer-string)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
988 (forward-line) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
989 (delete-region (point-min) (point)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
990 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
991 res)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
992 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
993 (defun tramp-fish-read-file-entry () |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
994 "Parse entry in output buffer. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
995 Result is the list (LOCALNAME LINK COUNT UID GID ATIME MTIME CTIME |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
996 SIZE MODE WEIRD)." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
997 ;; We are called from `tramp-fish-get-file-entries', which sets the |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
998 ;; current buffer. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
999 (let (buffer-read-only localname link uid gid mtime size mode) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1000 (block nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1001 (while t |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1002 (cond |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1003 ;; P<unix permissions> <owner>.<group> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1004 ((looking-at "^P\\(.+\\)\\s-\\(.+\\)\\.\\(.+\\)$") |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1005 (setq mode (match-string 1)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1006 (setq uid (match-string 2)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1007 (setq gid (match-string 3)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1008 (when (string-match "^d" mode) (setq link t))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1009 ;; S<size> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1010 ((looking-at "^S\\([0-9]+\\)$") |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1011 (setq size (string-to-number (match-string 1)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1012 ;; D<year> <month> <day> <hour> <minute> <second>[.1234] |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1013 ((looking-at |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1014 "^D\\([0-9]+\\)\\s-\\([0-9]+\\)\\s-\\([0-9]+\\)\\s-\\([0-9]+\\)\\s-\\([0-9]+\\)\\s-\\(\\S-+\\)$") |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1015 (setq mtime |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1016 (encode-time |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1017 (string-to-number (match-string 6)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1018 (string-to-number (match-string 5)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1019 (string-to-number (match-string 4)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1020 (string-to-number (match-string 3)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1021 (string-to-number (match-string 2)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1022 (string-to-number (match-string 1))))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1023 ;; d<3-letters month name> <day> <year or HH:MM> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1024 ((looking-at "^d") nil) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1025 ;; E<major-of-device>,<minor> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1026 ((looking-at "^E") nil) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1027 ;; :<filename> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1028 ((looking-at "^:\\(.+\\)$") |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1029 (setq localname (match-string 1))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1030 ;; L<filename symlink points to> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1031 ((looking-at "^L\\(.+\\)$") |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1032 (setq link (match-string 1))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1033 ;; M<mimetype> |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1034 ((looking-at "^M\\(.+\\)$") nil) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1035 ;; last line |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1036 ((looking-at "^$") |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1037 (return))) |
107820
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
106815
diff
changeset
|
1038 ;; Delete line. |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1039 (forward-line) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1040 (delete-region (point-min) (point)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1041 |
107820
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
106815
diff
changeset
|
1042 ;; Delete trailing empty line. |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1043 (forward-line) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1044 (delete-region (point-min) (point)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1045 |
107820
e97568b31550
Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents:
106815
diff
changeset
|
1046 ;; Return entry in `file-attributes' format. |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1047 (list localname link -1 uid gid '(0 0) mtime '(0 0) size mode nil))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1048 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1049 (defun tramp-fish-retrieve-data (vec) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1050 "Reads remote data for FISH protocol. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1051 The data are left in the connection buffer of VEC for further processing. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1052 Returns the size of the data." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1053 (block nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1054 (with-current-buffer (tramp-get-buffer vec) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1055 ;; The retrieved data might be in binary format, without |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1056 ;; trailing newline. Therefore, the OK prompt might not start |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1057 ;; at the beginning of a line. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1058 (let ((tramp-fish-ok-prompt-regexp "### 200\n") |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1059 size) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1060 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1061 ;; Send command |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1062 (tramp-fish-send-command |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1063 vec (format "#RETR %s" (tramp-file-name-localname vec))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1064 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1065 ;; Read filesize |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1066 (goto-char (point-min)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1067 (condition-case nil |
84966
fa9dd0b54e54
* net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
1068 (unless (integerp (setq size (read (current-buffer)))) (error nil)) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1069 (error (return nil))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1070 (forward-line) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1071 (delete-region (point-min) (point)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1072 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1073 ;; Read return code |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1074 (goto-char (point-min)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1075 (condition-case nil |
84966
fa9dd0b54e54
* net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
1076 (unless (looking-at tramp-fish-continue-prompt-regexp) (error nil)) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1077 (error (return nil))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1078 (forward-line) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1079 (delete-region (point-min) (point)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1080 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1081 ;; The received data might contain the OK prompt already, so |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1082 ;; there might be outstanding data. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1083 (while (/= (+ size (length tramp-fish-ok-prompt-regexp)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1084 (- (point-max) (point-min))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1085 (tramp-wait-for-regexp |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1086 (tramp-get-connection-process vec) nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1087 (concat tramp-fish-ok-prompt-regexp "$"))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1088 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1089 ;; Read return code |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1090 (goto-char (+ (point-min) size)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1091 (condition-case nil |
84966
fa9dd0b54e54
* net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
1092 (unless (looking-at tramp-fish-ok-prompt-regexp) (error nil)) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1093 (error (return nil))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1094 (delete-region (+ (point-min) size) (point-max)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1095 size)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1096 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1097 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1098 ;; Connection functions |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1099 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1100 (defun tramp-fish-maybe-open-connection (vec) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1101 "Maybe open a connection VEC. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1102 Does not do anything if a connection is already open, but re-opens the |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1103 connection if a previous connection has died for some reason." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1104 (let ((process-connection-type tramp-process-connection-type) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1105 (p (get-buffer-process (tramp-get-buffer vec)))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1106 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1107 ;; New connection must be opened. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1108 (unless (and p (processp p) (memq (process-status p) '(run open))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1109 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1110 ;; Set variables for computing the prompt for reading password. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1111 (setq tramp-current-method (tramp-file-name-method vec) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1112 tramp-current-user (tramp-file-name-user vec) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1113 tramp-current-host (tramp-file-name-host vec)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1114 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1115 ;; Start new process. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1116 (when (and p (processp p)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1117 (delete-process p)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1118 (setenv "TERM" tramp-terminal-type) |
106470
9e96dbbd314e
Handle prompt rules of ksh in OpenBSD 4.5. Reported by Rapha¸«³l
Michael Albinus <michael.albinus@gmx.de>
parents:
105894
diff
changeset
|
1119 (setenv "PS1" tramp-initial-end-of-output) |
108739
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1120 (with-progress-reporter |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1121 vec 3 |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1122 (format "Opening connection for %s@%s using %s" |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1123 tramp-current-user tramp-current-host tramp-current-method) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1124 |
108739
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1125 (let* ((process-connection-type tramp-process-connection-type) |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1126 (inhibit-eol-conversion nil) |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1127 (coding-system-for-read 'binary) |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1128 (coding-system-for-write 'binary) |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1129 ;; This must be done in order to avoid our file name handler. |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1130 (p (let ((default-directory |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1131 (tramp-compat-temporary-file-directory))) |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1132 (start-process |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1133 (or (tramp-get-connection-property vec "process-name" nil) |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1134 (tramp-buffer-name vec)) |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1135 (tramp-get-connection-buffer vec) |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1136 "ssh" "-l" |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1137 (tramp-file-name-user vec) |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1138 (tramp-file-name-host vec))))) |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1139 (tramp-message |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1140 vec 6 "%s" (mapconcat 'identity (process-command p) " ")) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1141 |
108739
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1142 ;; Check whether process is alive. |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1143 (tramp-set-process-query-on-exit-flag p nil) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1144 |
108739
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1145 (tramp-process-actions p vec tramp-actions-before-shell 60) |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1146 (tramp-fish-send-command vec tramp-fish-start-fish-server-command) |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1147 (tramp-message |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1148 vec 3 |
ae0f7dfcf9c9
* net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents:
108244
diff
changeset
|
1149 "Found remote shell prompt on `%s'" (tramp-file-name-host vec))))))) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1150 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1151 (defun tramp-fish-send-command (vec command) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1152 "Send the COMMAND to connection VEC." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1153 (tramp-fish-maybe-open-connection vec) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1154 (tramp-message vec 6 "%s" command) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1155 (tramp-send-string vec command) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1156 (tramp-wait-for-regexp |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1157 (tramp-get-connection-process vec) nil |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1158 (concat tramp-fish-ok-prompt-regexp "\\|" tramp-fish-error-prompt-regexp))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1159 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1160 (defun tramp-fish-send-command-and-check (vec command) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1161 "Send the COMMAND to connection VEC. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1162 Returns nil if there has been an error message." |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1163 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1164 ;; Send command. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1165 (tramp-fish-send-command vec command) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1166 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1167 ;; Read return code. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1168 (with-current-buffer (tramp-get-buffer vec) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1169 (goto-char (point-min)) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1170 (looking-at tramp-fish-ok-prompt-regexp))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1171 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1172 (provide 'tramp-fish) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1173 ; |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1174 ;;;; TODO: |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1175 ; |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1176 ;; * Evaluate the MIME information with #LIST or #STAT. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1177 ; |
81769 | 1178 |
1179 ;; arch-tag: a66df7df-5f29-42a7-a921-643ceb29db49 | |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1180 ;;;; tramp-fish.el ends here |