Mercurial > emacs
annotate lisp/net/tramp.el @ 47640:d5e4a276998c
*** empty log message ***
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 27 Sep 2002 00:47:25 +0000 |
parents | 9d26bf959510 |
children | 9597eaa105a1 |
rev | line source |
---|---|
47205
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
1 ;;; tramp.el --- Transparent Remote Access, Multiple Protocol -*- coding: iso-8859-1; -*- |
45861 | 2 |
3 ;; Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. | |
4 | |
5 ;; Author: Kai.Grossjohann@CS.Uni-Dortmund.DE | |
6 ;; Keywords: comm, processes | |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
24 | |
25 ;;; Commentary: | |
26 | |
27 ;; This package provides remote file editing, similar to ange-ftp. | |
28 ;; The difference is that ange-ftp uses FTP to transfer files between | |
29 ;; the local and the remote host, whereas tramp.el uses a combination | |
30 ;; of rsh and rcp or other work-alike programs, such as ssh/scp. | |
31 ;; | |
32 ;; For more detailed instructions, please see the info file, which is | |
33 ;; included in the file `tramp.tar.gz' mentioned below. | |
34 ;; | |
35 ;; Notes: | |
36 ;; ----- | |
37 ;; | |
38 ;; This package only works for Emacs 20 and higher, and for XEmacs 21 | |
39 ;; and higher. (XEmacs 20 is missing the `with-timeout' macro. Emacs | |
40 ;; 19 is reported to have other problems. For XEmacs 21, you need the | |
41 ;; package `fsf-compat' for the `with-timeout' macro.) | |
42 ;; | |
43 ;; This version might not work with pre-Emacs 21 VC unless VC is | |
44 ;; loaded before tramp.el. Could you please test this and tell me about | |
45 ;; the result? Thanks. | |
46 ;; | |
47 ;; Also see the todo list at the bottom of this file. | |
48 ;; | |
49 ;; The current version of tramp.el can be retrieved from the following | |
50 ;; URL: ftp://ls6-ftp.cs.uni-dortmund.de/pub/src/emacs/tramp.tar.gz | |
51 ;; For your convenience, the *.el file is available separately from | |
52 ;; the same directory. | |
53 ;; | |
54 ;; There's a mailing list for this, as well. Its name is: | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
55 ;; tramp-devel@mail.freesoftware.fsf.org |
45861 | 56 ;; Send a mail with `help' in the subject (!) to the administration |
57 ;; address for instructions on joining the list. The administration | |
58 ;; address is: | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
59 ;; tramp-devel-request@mail.freesoftware.fsf.org |
45861 | 60 ;; You can also use the Web to subscribe, under the following URL: |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
61 ;; http://mail.freesoftware.fsf.org/mailman/listinfo/tramp-devel |
45861 | 62 ;; |
63 ;; For the adventurous, the current development sources are available | |
64 ;; via CVS. You can find instructions about this at the following URL: | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
65 ;; http://savannah.gnu.org/projects/tramp/ |
45861 | 66 ;; Click on "CVS" in the navigation bar near the top. |
67 ;; | |
68 ;; Don't forget to put on your asbestos longjohns, first! | |
69 | |
70 ;;; Code: | |
71 | |
46790 | 72 ;; In the Tramp CVS repository, the version numer is auto-frobbed from |
73 ;; the Makefile, so you should edit the top-level Makefile to change | |
74 ;; the version number. | |
47578
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
75 (defconst tramp-version "2.0.22" |
45861 | 76 "This version of tramp.") |
46752 | 77 |
45861 | 78 (defconst tramp-bug-report-address "tramp-devel@mail.freesoftware.fsf.org" |
79 "Email address to send bug reports to.") | |
80 | |
81 (require 'timer) | |
82 (require 'format-spec) ;from Gnus 5.8, also in tar ball | |
47205
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
83 ;; The explicit check is not necessary in Emacs, which provides the |
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
84 ;; feature even if implemented in C, but it appears to be necessary |
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
85 ;; in XEmacs. |
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
86 (unless (and (fboundp 'base64-encode-region) |
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
87 (fboundp 'base64-decode-region)) |
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
88 (require 'base64)) ;for the mimencode methods |
45861 | 89 (require 'shell) |
90 (require 'advice) | |
91 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
92 (autoload 'tramp-uuencode-region "tramp-uu" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
93 "Implementation of `uuencode' in Lisp.") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
94 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
95 (unless (fboundp 'uudecode-decode-region) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
96 (autoload 'uudecode-decode-region "uudecode")) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
97 |
45861 | 98 ;; ;; It does not work to load EFS after loading TRAMP. |
99 ;; (when (fboundp 'efs-file-handler-function) | |
100 ;; (require 'efs)) | |
101 | |
102 (eval-when-compile | |
103 (require 'cl) | |
104 (require 'custom) | |
105 ;; Emacs 19.34 compatibility hack -- is this needed? | |
106 (or (>= emacs-major-version 20) | |
107 (load "cl-seq"))) | |
108 | |
109 (unless (boundp 'custom-print-functions) | |
110 (defvar custom-print-functions nil)) ; not autoloaded before Emacs 20.4 | |
111 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
112 ;; XEmacs is distributed with few Lisp packages. Further packages are |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
113 ;; installed using EFS. If we use a unified filename format, then |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
114 ;; Tramp is required in addition to EFS. (But why can't Tramp just |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
115 ;; disable EFS when Tramp is loaded? Then XEmacs can ship with EFS |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
116 ;; just like before.) Another reason for using a separate filename |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
117 ;; syntax on XEmacs is that EFS hooks into XEmacs in many places, but |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
118 ;; Tramp only knows how to deal with `file-name-handler-alist', not |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
119 ;; the other places. |
47584
9d26bf959510
(tramp-unified-filenames): Autoload it.
Juanma Barranquero <lekktu@gmail.com>
parents:
47578
diff
changeset
|
120 ;;;###autoload |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
121 (defvar tramp-unified-filenames (not (featurep 'xemacs)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
122 "Non-nil means to use unified Ange-FTP/Tramp filename syntax. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
123 Nil means to use a separate filename syntax for Tramp.") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
124 |
45861 | 125 ;;; User Customizable Internal Variables: |
126 | |
127 (defgroup tramp nil | |
128 "Edit remote files with a combination of rsh and rcp or similar programs." | |
129 :group 'files) | |
130 | |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
131 (defcustom tramp-verbose 9 |
45861 | 132 "*Verbosity level for tramp.el. 0 means be silent, 10 is most verbose." |
133 :group 'tramp | |
134 :type 'integer) | |
135 | |
136 (defcustom tramp-debug-buffer nil | |
137 "*Whether to send all commands and responses to a debug buffer." | |
138 :group 'tramp | |
139 :type 'boolean) | |
140 | |
141 (defcustom tramp-auto-save-directory nil | |
142 "*Put auto-save files in this directory, if set. | |
143 The idea is to use a local directory so that auto-saving is faster." | |
144 :group 'tramp | |
145 :type '(choice (const nil) | |
146 string)) | |
147 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
148 (defcustom tramp-encoding-shell |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
149 (if (memq system-type '(windows-nt)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
150 (getenv "COMSPEC") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
151 "/bin/sh") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
152 "*Use this program for encoding and decoding commands on the local host. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
153 This shell is used to execute the encoding and decoding command on the |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
154 local host, so if you want to use `~' in those commands, you should |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
155 choose a shell here which groks tilde expansion. `/bin/sh' normally |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
156 does not understand tilde expansion. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
157 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
158 For encoding and deocding, commands like the following are executed: |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
159 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
160 /bin/sh -c COMMAND < INPUT > OUTPUT |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
161 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
162 This variable can be used to change the \"/bin/sh\" part. See the |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
163 variable `tramp-encoding-command-switch' for the \"-c\" part. Also, see the |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
164 variable `tramp-encoding-reads-stdin' to specify whether the commands read |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
165 standard input or a file. |
45861 | 166 |
167 Note that this variable is not used for remote commands. There are | |
168 mechanisms in tramp.el which automatically determine the right shell to | |
169 use for the remote host." | |
170 :group 'tramp | |
171 :type '(file :must-match t)) | |
172 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
173 (defcustom tramp-encoding-command-switch |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
174 (if (string-match "cmd\\.exe" tramp-encoding-shell) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
175 "/c" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
176 "-c") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
177 "*Use this switch together with `tramp-encoding-shell' for local commands. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
178 See the variable `tramp-encoding-shell' for more information." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
179 :group 'tramp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
180 :type 'string) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
181 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
182 (defcustom tramp-encoding-reads-stdin t |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
183 "*If non-nil, encoding commands read from standard input. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
184 If nil, the filename is the last argument. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
185 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
186 Note that the commands always must write to standard output." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
187 :group 'tramp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
188 :type 'boolean) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
189 |
46584
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
190 (defcustom tramp-multi-sh-program |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
191 tramp-encoding-shell |
46584
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
192 "*Use this program for bootstrapping multi-hop connections. |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
193 This variable is similar to `tramp-encoding-shell', but it is only used |
46584
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
194 when initializing a multi-hop connection. Therefore, the set of |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
195 commands sent to this shell is quite restricted, and if you are |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
196 careful it works to use CMD.EXE under Windows (instead of a Bourne-ish |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
197 shell which does not normally exist on Windows anyway). |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
198 |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
199 To use multi-hop methods from Windows, you also need suitable entries |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
200 in `tramp-multi-connection-function-alist' for the first hop. |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
201 |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
202 This variable defaults to the value of `tramp-encoding-shell'." |
46584
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
203 :group 'tramp |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
204 :type '(file :must-match t)) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
205 |
45861 | 206 ;; CCC I have changed all occurrences of comint-quote-filename with |
207 ;; tramp-shell-quote-argument, except in tramp-handle-expand-many-files. | |
208 ;; There, comint-quote-filename was removed altogether. If it turns | |
209 ;; out to be necessary there, something will need to be done. | |
210 ;;-(defcustom tramp-file-name-quote-list | |
211 ;;- '(?] ?[ ?\| ?& ?< ?> ?\( ?\) ?\; ?\ ?\* ?\? ?\! ?\" ?\' ?\` ?# ?\@ ?\+ ) | |
212 ;;- "*Protect these characters from the remote shell. | |
213 ;;-Any character in this list is quoted (preceded with a backslash) | |
214 ;;-because it means something special to the shell. This takes effect | |
215 ;;-when sending file and directory names to the remote shell. | |
216 ;;- | |
217 ;;-See `comint-file-name-quote-list' for details." | |
218 ;;- :group 'tramp | |
219 ;;- :type '(repeat character)) | |
220 | |
221 (defcustom tramp-methods | |
222 '( ("rcp" (tramp-connection-function tramp-open-connection-rsh) | |
223 (tramp-rsh-program "rsh") | |
224 (tramp-rcp-program "rcp") | |
225 (tramp-remote-sh "/bin/sh") | |
226 (tramp-rsh-args nil) | |
227 (tramp-rcp-args nil) | |
228 (tramp-rcp-keep-date-arg "-p") | |
229 (tramp-su-program nil) | |
230 (tramp-su-args nil) | |
231 (tramp-telnet-program nil) | |
232 (tramp-telnet-args nil)) | |
233 ("scp" (tramp-connection-function tramp-open-connection-rsh) | |
234 (tramp-rsh-program "ssh") | |
235 (tramp-rcp-program "scp") | |
236 (tramp-remote-sh "/bin/sh") | |
237 (tramp-rsh-args ("-e" "none")) | |
238 (tramp-rcp-args nil) | |
239 (tramp-rcp-keep-date-arg "-p") | |
240 (tramp-su-program nil) | |
241 (tramp-su-args nil) | |
242 (tramp-telnet-program nil) | |
243 (tramp-telnet-args nil)) | |
244 ("scp1" (tramp-connection-function tramp-open-connection-rsh) | |
46584
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
245 (tramp-rsh-program "ssh") |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
246 (tramp-rcp-program "scp") |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
247 (tramp-remote-sh "/bin/sh") |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
248 (tramp-rsh-args ("-1" "-e" "none")) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
249 (tramp-rcp-args ("-1")) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
250 (tramp-rcp-keep-date-arg "-p") |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
251 (tramp-su-program nil) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
252 (tramp-su-args nil) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
253 (tramp-telnet-program nil) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
254 (tramp-telnet-args nil)) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
255 ("scp2" (tramp-connection-function tramp-open-connection-rsh) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
256 (tramp-rsh-program "ssh") |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
257 (tramp-rcp-program "scp") |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
258 (tramp-remote-sh "/bin/sh") |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
259 (tramp-rsh-args ("-2" "-e" "none")) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
260 (tramp-rcp-args ("-2")) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
261 (tramp-rcp-keep-date-arg "-p") |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
262 (tramp-su-program nil) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
263 (tramp-su-args nil) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
264 (tramp-telnet-program nil) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
265 (tramp-telnet-args nil)) |
46752 | 266 ("scp1-old" |
267 (tramp-connection-function tramp-open-connection-rsh) | |
45861 | 268 (tramp-rsh-program "ssh1") |
269 (tramp-rcp-program "scp1") | |
270 (tramp-remote-sh "/bin/sh") | |
271 (tramp-rsh-args ("-e" "none")) | |
272 (tramp-rcp-args nil) | |
273 (tramp-rcp-keep-date-arg "-p") | |
274 (tramp-su-program nil) | |
275 (tramp-su-args nil) | |
276 (tramp-telnet-program nil) | |
277 (tramp-telnet-args nil)) | |
46752 | 278 ("scp2-old" |
279 (tramp-connection-function tramp-open-connection-rsh) | |
45861 | 280 (tramp-rsh-program "ssh2") |
281 (tramp-rcp-program "scp2") | |
282 (tramp-remote-sh "/bin/sh") | |
283 (tramp-rsh-args ("-e" "none")) | |
284 (tramp-rcp-args nil) | |
285 (tramp-rcp-keep-date-arg "-p") | |
286 (tramp-su-program nil) | |
287 (tramp-su-args nil) | |
288 (tramp-telnet-program nil) | |
289 (tramp-telnet-args nil)) | |
290 ("rsync" (tramp-connection-function tramp-open-connection-rsh) | |
291 (tramp-rsh-program "ssh") | |
292 (tramp-rcp-program "rsync") | |
293 (tramp-remote-sh "/bin/sh") | |
294 (tramp-rsh-args ("-e" "none")) | |
295 (tramp-rcp-args ("-e" "ssh")) | |
296 (tramp-rcp-keep-date-arg "-t") | |
297 (tramp-su-program nil) | |
298 (tramp-su-args nil) | |
299 (tramp-telnet-program nil) | |
300 (tramp-telnet-args nil)) | |
46752 | 301 ("rsh" (tramp-connection-function tramp-open-connection-rsh) |
45861 | 302 (tramp-rsh-program "rsh") |
303 (tramp-rcp-program nil) | |
304 (tramp-remote-sh "/bin/sh") | |
305 (tramp-rsh-args nil) | |
306 (tramp-rcp-args nil) | |
307 (tramp-rcp-keep-date-arg nil) | |
308 (tramp-su-program nil) | |
309 (tramp-su-args nil) | |
46584
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
310 (tramp-telnet-program nil) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
311 (tramp-telnet-args nil)) |
46752 | 312 ("ssh" (tramp-connection-function tramp-open-connection-rsh) |
45861 | 313 (tramp-rsh-program "ssh") |
314 (tramp-rcp-program nil) | |
315 (tramp-remote-sh "/bin/sh") | |
316 (tramp-rsh-args ("-e" "none")) | |
317 (tramp-rcp-args nil) | |
318 (tramp-rcp-keep-date-arg nil) | |
319 (tramp-su-program nil) | |
320 (tramp-su-args nil) | |
46752 | 321 (tramp-telnet-program nil) |
322 (tramp-telnet-args nil)) | |
323 ("ssh1" (tramp-connection-function tramp-open-connection-rsh) | |
46584
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
324 (tramp-rsh-program "ssh") |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
325 (tramp-rcp-program nil) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
326 (tramp-remote-sh "/bin/sh") |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
327 (tramp-rsh-args ("-1" "-e" "none")) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
328 (tramp-rcp-args ("-1")) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
329 (tramp-rcp-keep-date-arg nil) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
330 (tramp-su-program nil) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
331 (tramp-su-args nil) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
332 (tramp-telnet-program nil) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
333 (tramp-telnet-args nil)) |
46752 | 334 ("ssh2" (tramp-connection-function tramp-open-connection-rsh) |
46584
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
335 (tramp-rsh-program "ssh") |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
336 (tramp-rcp-program nil) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
337 (tramp-remote-sh "/bin/sh") |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
338 (tramp-rsh-args ("-2" "-e" "none")) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
339 (tramp-rcp-args ("-2")) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
340 (tramp-rcp-keep-date-arg nil) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
341 (tramp-su-program nil) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
342 (tramp-su-args nil) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
343 (tramp-telnet-program nil) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
344 (tramp-telnet-args nil)) |
46752 | 345 ("ssh1-old" |
346 (tramp-connection-function tramp-open-connection-rsh) | |
45861 | 347 (tramp-rsh-program "ssh1") |
348 (tramp-rcp-program nil) | |
349 (tramp-remote-sh "/bin/sh") | |
350 (tramp-rsh-args ("-e" "none")) | |
351 (tramp-rcp-args nil) | |
352 (tramp-rcp-keep-date-arg nil) | |
353 (tramp-su-program nil) | |
354 (tramp-su-args nil) | |
355 (tramp-telnet-program nil) | |
356 (tramp-telnet-args nil)) | |
46752 | 357 ("ssh2-old" |
358 (tramp-connection-function tramp-open-connection-rsh) | |
45861 | 359 (tramp-rsh-program "ssh2") |
360 (tramp-rcp-program nil) | |
361 (tramp-remote-sh "/bin/sh") | |
362 (tramp-rsh-args ("-e" "none")) | |
363 (tramp-rcp-args nil) | |
364 (tramp-rcp-keep-date-arg nil) | |
365 (tramp-su-program nil) | |
366 (tramp-su-args nil) | |
46752 | 367 (tramp-telnet-program nil) |
368 (tramp-telnet-args nil)) | |
369 ("telnet" | |
370 (tramp-connection-function tramp-open-connection-telnet) | |
45861 | 371 (tramp-rsh-program nil) |
372 (tramp-rcp-program nil) | |
373 (tramp-remote-sh "/bin/sh") | |
374 (tramp-rsh-args nil) | |
375 (tramp-rcp-args nil) | |
376 (tramp-rcp-keep-date-arg nil) | |
377 (tramp-su-program nil) | |
378 (tramp-su-args nil) | |
379 (tramp-telnet-program "telnet") | |
380 (tramp-telnet-args nil)) | |
46752 | 381 ("su" (tramp-connection-function tramp-open-connection-su) |
45861 | 382 (tramp-rsh-program nil) |
383 (tramp-rcp-program nil) | |
384 (tramp-remote-sh "/bin/sh") | |
385 (tramp-rsh-args nil) | |
386 (tramp-rcp-args nil) | |
387 (tramp-rcp-keep-date-arg nil) | |
388 (tramp-su-program "su") | |
389 (tramp-su-args ("-" "%u")) | |
390 (tramp-telnet-program nil) | |
391 (tramp-telnet-args nil)) | |
46752 | 392 ("sudo" (tramp-connection-function tramp-open-connection-su) |
45861 | 393 (tramp-rsh-program nil) |
394 (tramp-rcp-program nil) | |
395 (tramp-remote-sh "/bin/sh") | |
396 (tramp-rsh-args nil) | |
397 (tramp-rcp-args nil) | |
398 (tramp-rcp-keep-date-arg nil) | |
399 (tramp-su-program "sudo") | |
400 (tramp-su-args ("-u" "%u" "-s")) | |
401 (tramp-telnet-program nil) | |
402 (tramp-telnet-args nil)) | |
403 ("multi" (tramp-connection-function tramp-open-connection-multi) | |
404 (tramp-rsh-program nil) | |
405 (tramp-rcp-program nil) | |
406 (tramp-remote-sh "/bin/sh") | |
407 (tramp-rsh-args nil) | |
408 (tramp-rcp-args nil) | |
409 (tramp-rcp-keep-date-arg nil) | |
410 (tramp-su-program nil) | |
411 (tramp-su-args nil) | |
412 (tramp-telnet-program nil) | |
413 (tramp-telnet-args nil)) | |
414 ("scpx" (tramp-connection-function tramp-open-connection-rsh) | |
415 (tramp-rsh-program "ssh") | |
416 (tramp-rcp-program "scp") | |
417 (tramp-remote-sh "/bin/sh") | |
418 (tramp-rsh-args ("-e" "none" "-t" "-t" "/bin/sh")) | |
419 (tramp-rcp-args nil) | |
420 (tramp-rcp-keep-date-arg "-p") | |
421 (tramp-telnet-program nil) | |
422 (tramp-telnet-args nil)) | |
46752 | 423 ("sshx" (tramp-connection-function tramp-open-connection-rsh) |
45861 | 424 (tramp-rsh-program "ssh") |
425 (tramp-rcp-program nil) | |
426 (tramp-remote-sh "/bin/sh") | |
427 (tramp-rsh-args ("-e" "none" "-t" "-t" "/bin/sh")) | |
428 (tramp-rcp-args nil) | |
429 (tramp-rcp-keep-date-arg nil) | |
430 (tramp-su-program nil) | |
431 (tramp-su-args nil) | |
432 (tramp-telnet-program nil) | |
433 (tramp-telnet-args nil)) | |
46752 | 434 ("krlogin" |
45861 | 435 (tramp-connection-function tramp-open-connection-rsh) |
436 (tramp-rsh-program "krlogin") | |
437 (tramp-rcp-program nil) | |
438 (tramp-remote-sh "/bin/sh") | |
439 (tramp-rsh-args ("-x")) | |
440 (tramp-rcp-args nil) | |
441 (tramp-rcp-keep-date-arg nil) | |
442 (tramp-su-program nil) | |
443 (tramp-su-args nil) | |
444 (tramp-telnet-program nil) | |
445 (tramp-telnet-args nil)) | |
46752 | 446 ("plink" |
45861 | 447 (tramp-connection-function tramp-open-connection-rsh) |
448 (tramp-rsh-program "plink") | |
449 (tramp-rcp-program nil) | |
450 (tramp-remote-sh "/bin/sh") | |
451 (tramp-rsh-args ("-ssh")) ;optionally add "-v" | |
452 (tramp-rcp-args nil) | |
453 (tramp-rcp-keep-date-arg nil) | |
454 (tramp-su-program nil) | |
455 (tramp-su-args nil) | |
456 (tramp-telnet-program nil) | |
457 (tramp-telnet-args nil)) | |
458 ("pscp" | |
459 (tramp-connection-function tramp-open-connection-rsh) | |
460 (tramp-rsh-program "plink") | |
461 (tramp-rcp-program "pscp") | |
462 (tramp-remote-sh "/bin/sh") | |
463 (tramp-rsh-args ("-ssh")) | |
464 (tramp-rcp-args nil) | |
465 (tramp-rcp-keep-date-arg "-p") | |
466 (tramp-su-program nil) | |
467 (tramp-su-args nil) | |
468 (tramp-telnet-program nil) | |
469 (tramp-telnet-args nil)) | |
470 ("fcp" | |
471 (tramp-connection-function tramp-open-connection-rsh) | |
472 (tramp-rsh-program "fsh") | |
473 (tramp-rcp-program "fcp") | |
474 (tramp-remote-sh "/bin/sh -i") | |
475 (tramp-rsh-args ("sh" "-i")) | |
476 (tramp-rcp-args nil) | |
477 (tramp-rcp-keep-date-arg "-p") | |
478 (tramp-su-program nil) | |
479 (tramp-su-args nil) | |
480 (tramp-telnet-program nil) | |
481 (tramp-telnet-args nil)) | |
482 ) | |
483 "*Alist of methods for remote files. | |
484 This is a list of entries of the form (NAME PARAM1 PARAM2 ...). | |
485 Each NAME stands for a remote access method. Each PARAM is a | |
486 pair of the form (KEY VALUE). The following KEYs are defined: | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
487 * `tramp-connection-function' |
45861 | 488 This specifies the function to use to connect to the remote host. |
489 Currently, `tramp-open-connection-rsh', `tramp-open-connection-telnet' | |
490 and `tramp-open-connection-su' are defined. See the documentation | |
491 of these functions for more details. | |
492 * `tramp-remote-sh' | |
493 This specifies the Bourne shell to use on the remote host. This | |
494 MUST be a Bourne-like shell. It is normally not necessary to set | |
495 this to any value other than \"/bin/sh\": tramp wants to use a shell | |
496 which groks tilde expansion, but it can search for it. Also note | |
497 that \"/bin/sh\" exists on all Unixen, this might not be true for | |
498 the value that you decide to use. You Have Been Warned. | |
499 * `tramp-rsh-program' | |
500 This specifies the name of the program to use for rsh; this might be | |
501 the full path to rsh or the name of a workalike program. | |
502 * `tramp-rsh-args' | |
503 This specifies the list of arguments to pass to the above | |
504 mentioned program. Please note that this is a list of arguments, | |
505 that is, normally you don't want to put \"-a -b\" or \"-f foo\" | |
506 here. Instead, you want two list elements, one for \"-a\" and one | |
507 for \"-b\", or one for \"-f\" and one for \"foo\". | |
508 * `tramp-rcp-program' | |
509 This specifies the name of the program to use for rcp; this might be | |
510 the full path to rcp or the name of a workalike program. | |
511 * `tramp-rcp-args' | |
512 This specifies the list of parameters to pass to the above mentioned | |
513 program, the hints for `tramp-rsh-args' also apply here. | |
514 * `tramp-rcp-keep-date-arg' | |
515 This specifies the parameter to use for `rcp' when the timestamp | |
516 of the original file should be kept. For `rcp', use `-p', for | |
517 `rsync', use `-t'. | |
518 * `tramp-su-program' | |
519 This specifies the name of the program to use for `su'. | |
520 * `tramp-su-args' | |
521 This specifies the list of arguments to pass to `su'. | |
522 \"%u\" is replaced by the user name, use \"%%\" for a literal | |
523 percent character. | |
524 * `tramp-telnet-program' | |
525 Specifies the telnet program to use when using | |
526 `tramp-open-connection-telnet' to log in. | |
527 * `tramp-telnet-args' | |
528 Specifies list of arguments to pass to `telnet'. The hints for | |
529 `tramp-rsh-args' also apply here. | |
530 | |
531 What does all this mean? Well, you should specify `tramp-rsh-program', | |
532 `tramp-telnet-program' or `tramp-su-program' for all methods; this program | |
533 is used to log in to the remote site. Then, there are two ways to | |
534 actually transfer the files between the local and the remote side. | |
535 One way is using an additional rcp-like program. If you want to do | |
536 this, set `tramp-rcp-program' in the method. | |
537 | |
538 Another possibility for file transfer is inline transfer, i.e. the | |
539 file is passed through the same buffer used by `tramp-rsh-program'. In | |
540 this case, the file contents need to be protected since the | |
541 `tramp-rsh-program' might use escape codes or the connection might not | |
542 be eight-bit clean. Therefore, file contents are encoded for transit. | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
543 See the variable `tramp-coding-commands' for details. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
544 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
545 So, to summarize: if the method is an out-of-band method, then you |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
546 must specify `tramp-rcp-program' and `tramp-rcp-args'. If it is an |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
547 inline method, then these two parameters should be nil. Every method, |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
548 inline or out of band, must specify `tramp-connection-function' plus |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
549 the associated arguments (for example, the telnet program if you chose |
45861 | 550 `tramp-open-connection-telnet'). |
551 | |
552 Notes: | |
553 | |
554 When using `tramp-open-connection-su' the phrase `open connection to a | |
555 remote host' sounds strange, but it is used nevertheless, for | |
556 consistency. No connection is opened to a remote host, but `su' is | |
557 started on the local host. You are not allowed to specify a remote | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
558 host other than `localhost' or the name of the local host." |
45861 | 559 :group 'tramp |
560 :type '(repeat | |
561 (cons string | |
562 (set (list (const tramp-connection-function) function) | |
563 (list (const tramp-rsh-program) | |
564 (choice (const nil) string)) | |
565 (list (const tramp-rcp-program) | |
566 (choice (const nil) string)) | |
567 (list (const tramp-remote-sh) | |
568 (choice (const nil) string)) | |
569 (list (const tramp-rsh-args) (repeat string)) | |
570 (list (const tramp-rcp-args) (repeat string)) | |
571 (list (const tramp-rcp-keep-date-arg) | |
572 (choice (const nil) string)) | |
573 (list (const tramp-su-program) | |
574 (choice (const nil) string)) | |
575 (list (const tramp-su-args) (repeat string)) | |
576 (list (const tramp-encoding-command) | |
577 (choice (const nil) string)) | |
578 (list (const tramp-decoding-command) | |
579 (choice (const nil) string)) | |
580 (list (const tramp-encoding-function) | |
581 (choice (const nil) function)) | |
582 (list (const tramp-decoding-function) | |
583 (choice (const nil) function)) | |
584 (list (const tramp-telnet-program) | |
585 (choice (const nil) string)) | |
586 (list (const tramp-telnet-args) (repeat string)))))) | |
587 | |
588 (defcustom tramp-multi-methods '("multi" "multiu") | |
589 "*List of multi-hop methods. | |
590 Each entry in this list should be a method name as mentioned in the | |
591 variable `tramp-methods'." | |
592 :group 'tramp | |
593 :type '(repeat string)) | |
594 | |
595 (defcustom tramp-multi-connection-function-alist | |
596 '(("telnet" tramp-multi-connect-telnet "telnet %h%n") | |
597 ("rsh" tramp-multi-connect-rlogin "rsh %h -l %u%n") | |
598 ("ssh" tramp-multi-connect-rlogin "ssh %h -l %u%n") | |
599 ("su" tramp-multi-connect-su "su - %u%n") | |
600 ("sudo" tramp-multi-connect-su "sudo -u %u -s%n")) | |
601 "*List of connection functions for multi-hop methods. | |
602 Each list item is a list of three items (METHOD FUNCTION COMMAND), | |
603 where METHOD is the name as used in the file name, FUNCTION is the | |
604 function to be executed, and COMMAND is the shell command used for | |
605 connecting. | |
606 | |
607 COMMAND may contain percent escapes. `%u' will be replaced with the | |
608 user name, `%h' will be replaced with the host name, and `%n' will be | |
609 replaced with an end-of-line character, as specified in the variable | |
610 `tramp-rsh-end-of-line'. Use `%%' for a literal percent character. | |
611 Note that the interpretation of the percent escapes also depends on | |
612 the FUNCTION. For example, the `%u' escape is forbidden with the | |
613 function `tramp-multi-connect-telnet'. See the documentation of the | |
614 various functions for details." | |
615 :group 'tramp | |
616 :type '(repeat (list string function string))) | |
617 | |
46790 | 618 (defcustom tramp-default-method "ssh" |
45861 | 619 "*Default method to use for transferring files. |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
620 See `tramp-methods' for possibilities. |
46306
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
621 Also see `tramp-default-method-alist'. |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
622 |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
623 Emacs uses a unified filename syntax for Tramp and Ange-FTP. |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
624 For backward compatibility, the default value of this variable |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
625 is \"ftp\" on Emacs. But XEmacs uses a separate filename syntax |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
626 for Tramp and EFS, so there the default method is \"sm\"." |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
627 :group 'tramp |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
628 :type 'string) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
629 |
46306
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
630 (defcustom tramp-default-method-alist |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
631 (when tramp-unified-filenames |
46306
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
632 '(("\\`ftp\\." "" "ftp") |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
633 ("" "\\`\\(anonymous\\|ftp\\)\\'" "ftp"))) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
634 "*Default method to use for specific user/host pairs. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
635 This is an alist of items (HOST USER METHOD). The first matching item |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
636 specifies the method to use for a file name which does not specify a |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
637 method. HOST and USER are regular expressions or nil, which is |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
638 interpreted as a regular expression which always matches. If no entry |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
639 matches, the variable `tramp-default-method' takes effect. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
640 |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
641 If the file name does not specify the user, lookup is done using the |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
642 empty string for the user name. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
643 |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
644 See `tramp-methods' for a list of possibilities for METHOD." |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
645 :group 'tramp |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
646 :type '(repeat (list (regexp :tag "Host regexp") |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
647 (regexp :tag "User regexp") |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
648 (string :tag "Method")))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
649 |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
650 (defcustom tramp-ftp-method "ftp" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
651 "*When this method name is used, forward all calls to Ange-FTP." |
45861 | 652 :group 'tramp |
653 :type 'string) | |
654 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
655 ;; Default values for non-Unices seeked |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
656 (defconst tramp-completion-function-alist-rsh |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
657 (unless (memq system-type '(windows-nt)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
658 '((tramp-parse-rhosts "/etc/hosts.equiv") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
659 (tramp-parse-rhosts "~/.rhosts"))) |
47578
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
660 "Default list of (FUNCTION FILE) pairs to be examined for rsh methods." |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
661 ) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
662 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
663 ;; Default values for non-Unices seeked |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
664 (defconst tramp-completion-function-alist-ssh |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
665 (unless (memq system-type '(windows-nt)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
666 '((tramp-parse-rhosts "/etc/hosts.equiv") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
667 (tramp-parse-rhosts "/etc/shosts.equiv") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
668 (tramp-parse-shosts "/etc/ssh_known_hosts") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
669 (tramp-parse-rhosts "~/.rhosts") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
670 (tramp-parse-rhosts "~/.shosts") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
671 (tramp-parse-shosts "~/.ssh/known_hosts"))) |
47578
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
672 "Default list of (FUNCTION FILE) pairs to be examined for ssh methods." |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
673 ) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
674 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
675 ;; Default values for non-Unices seeked |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
676 (defconst tramp-completion-function-alist-telnet |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
677 (unless (memq system-type '(windows-nt)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
678 '((tramp-parse-hosts "/etc/hosts"))) |
47578
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
679 "Default list of (FUNCTION FILE) pairs to be examined for telnet methods." |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
680 ) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
681 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
682 ;; Default values for non-Unices seeked |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
683 (defconst tramp-completion-function-alist-su |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
684 (unless (memq system-type '(windows-nt)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
685 '((tramp-parse-passwd "/etc/passwd"))) |
47578
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
686 "Default list of (FUNCTION FILE) pairs to be examined for su methods." |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
687 ) |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
688 |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
689 ;; Default values for non-Unices seeked |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
690 (defconst tramp-completion-function-alist-ftp |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
691 (unless (memq system-type '(windows-nt)) |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
692 '((tramp-parse-netrc "~/.netrc"))) |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
693 "Default list of (FUNCTION FILE) pairs to be examined for ftp methods." |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
694 ) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
695 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
696 (defcustom tramp-completion-function-alist |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
697 (list (cons "rcp" tramp-completion-function-alist-rsh) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
698 (cons "scp" tramp-completion-function-alist-ssh) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
699 (cons "scp1" tramp-completion-function-alist-ssh) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
700 (cons "scp2" tramp-completion-function-alist-ssh) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
701 (cons "scp1-old" tramp-completion-function-alist-ssh) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
702 (cons "scp2-old" tramp-completion-function-alist-ssh) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
703 (cons "rsync" tramp-completion-function-alist-rsh) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
704 (cons "rsh" tramp-completion-function-alist-rsh) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
705 (cons "ssh" tramp-completion-function-alist-ssh) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
706 (cons "ssh1" tramp-completion-function-alist-ssh) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
707 (cons "ssh2" tramp-completion-function-alist-ssh) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
708 (cons "ssh1-old" tramp-completion-function-alist-ssh) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
709 (cons "ssh2-old" tramp-completion-function-alist-ssh) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
710 (cons "telnet" tramp-completion-function-alist-telnet) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
711 (cons "su" tramp-completion-function-alist-su) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
712 (cons "sudo" tramp-completion-function-alist-su) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
713 (cons "multi" nil) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
714 (cons "scpx" tramp-completion-function-alist-ssh) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
715 (cons "sshx" tramp-completion-function-alist-ssh) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
716 (cons "krlogin" tramp-completion-function-alist-rsh) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
717 (cons "plink" tramp-completion-function-alist-ssh) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
718 (cons "pscp" tramp-completion-function-alist-ssh) |
47578
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
719 (cons "ftp" tramp-completion-function-alist-ftp) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
720 (cons "fcp" nil) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
721 ) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
722 "*Alist of methods for remote files. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
723 This is a list of entries of the form (NAME PAIR1 PAIR2 ...). |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
724 Each NAME stands for a remote access method. Each PAIR is of the form |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
725 \(FUNCTION FILE). FUNCTION is responsible to extract user names and host |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
726 names from FILE for completion. The following predefined FUNCTIONs exists: |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
727 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
728 * `tramp-parse-rhosts' for \".rhosts\" like files, |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
729 * `tramp-parse-shosts' for \"ssh_known_hosts\" like files, |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
730 * `tramp-parse-hosts' for \"/etc/hosts\" like files, and |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
731 * `tramp-parse-passwd' for \"/etc/passwd\" like files. |
47578
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
732 * `tramp-parse-netrc ' for \".netrc\" like files. |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
733 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
734 FUNCTION can also see a customer defined function. For more details see |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
735 the info pages." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
736 :group 'tramp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
737 :type '(repeat |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
738 (cons string |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
739 (choice (const nil) (repeat (list function file)))))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
740 |
45861 | 741 (defcustom tramp-rsh-end-of-line "\n" |
742 "*String used for end of line in rsh connections. | |
743 I don't think this ever needs to be changed, so please tell me about it | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
744 if you need to change this. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
745 Also see `tramp-password-end-of-line'." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
746 :group 'tramp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
747 :type 'string) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
748 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
749 (defcustom tramp-password-end-of-line tramp-rsh-end-of-line |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
750 "*String used for end of line after sending a password. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
751 It seems that people using plink under Windows need to send |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
752 \"\\r\\n\" (carriage-return, then newline) after a password, but just |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
753 \"\\n\" after all other lines. This variable can be used for the |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
754 password, see `tramp-rsh-end-of-line' for the other cases. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
755 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
756 The default value is to use the same value as `tramp-rsh-end-of-line'." |
45861 | 757 :group 'tramp |
758 :type 'string) | |
759 | |
760 (defcustom tramp-remote-path | |
761 '("/bin" "/usr/bin" "/usr/sbin" "/usr/local/bin" "/usr/ccs/bin" | |
762 "/local/bin" "/local/freeware/bin" "/local/gnu/bin" | |
763 "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin") | |
764 "*List of directories to search for executables on remote host. | |
765 Please notify me about other semi-standard directories to include here. | |
766 | |
767 You can use `~' in this list, but when searching for a shell which groks | |
768 tilde expansion, all directory names starting with `~' will be ignored." | |
769 :group 'tramp | |
770 :type '(repeat string)) | |
771 | |
772 (defcustom tramp-login-prompt-regexp | |
46752 | 773 ".*ogin: *" |
45861 | 774 "*Regexp matching login-like prompts. |
46752 | 775 The regexp should match at end of buffer." |
45861 | 776 :group 'tramp |
777 :type 'regexp) | |
778 | |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
779 (defcustom tramp-shell-prompt-pattern |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
780 "^[^#$%>\n]*[#$%>] *" |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
781 "Regexp to match prompts from remote shell. |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
782 Normally, Tramp expects you to configure `shell-prompt-pattern' |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
783 correctly, but sometimes it happens that you are connecting to a |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
784 remote host which sends a different kind of shell prompt. Therefore, |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
785 Tramp recognizes things matched by `shell-prompt-pattern' as prompt, |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
786 and also things matched by this variable. The default value of this |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
787 variable is the same as the default value of `shell-prompt-pattern', |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
788 which should work well in many cases." |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
789 :group 'tramp |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
790 :type 'regexp) |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
791 |
45861 | 792 (defcustom tramp-password-prompt-regexp |
46752 | 793 "^.*\\([pP]assword\\|passphrase.*\\):\^@? *" |
45861 | 794 "*Regexp matching password-like prompts. |
46752 | 795 The regexp should match at end of buffer. |
45861 | 796 |
797 The `sudo' program appears to insert a `^@' character into the prompt." | |
798 :group 'tramp | |
799 :type 'regexp) | |
800 | |
801 (defcustom tramp-wrong-passwd-regexp | |
46790 | 802 (concat "^.*" |
803 ;; These strings should be on the last line | |
804 (regexp-opt '("Permission denied." | |
805 "Login incorrect" | |
806 "Login Incorrect" | |
807 "Connection refused" | |
808 "Connection closed" | |
809 "Sorry, try again." | |
810 "Name or service not known" | |
811 "Host key verification failed.") t) | |
812 ".*" | |
813 "\\|" | |
814 "^.*\\(" | |
815 ;; Here comes a list of regexes, separated by \\| | |
816 "Received signal [0-9]+" | |
817 "\\).*") | |
45861 | 818 "*Regexp matching a `login failed' message. |
46752 | 819 The regexp should match at end of buffer." |
820 :group 'tramp | |
821 :type 'regexp) | |
822 | |
823 (defcustom tramp-yesno-prompt-regexp | |
46992
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
824 (concat |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
825 (regexp-opt '("Are you sure you want to continue connecting (yes/no)?") t) |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
826 "\\s-*") |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
827 "Regular expression matching all yes/no queries which need to be confirmed. |
46752 | 828 The confirmation should be done with yes or no. |
46992
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
829 The regexp should match at end of buffer. |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
830 See also `tramp-yn-prompt-regexp'." |
45861 | 831 :group 'tramp |
832 :type 'regexp) | |
833 | |
46992
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
834 (defcustom tramp-yn-prompt-regexp |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
835 (concat (regexp-opt '("Store key in cache? (y/n)") t) |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
836 "\\s-*") |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
837 "Regular expression matching all y/n queries which need to be confirmed. |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
838 The confirmation should be done with y or n. |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
839 The regexp should match at end of buffer. |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
840 See also `tramp-yesno-prompt-regexp'." |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
841 :group 'tramp |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
842 :type 'regexp) |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
843 |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
844 |
45861 | 845 (defcustom tramp-temp-name-prefix "tramp." |
846 "*Prefix to use for temporary files. | |
847 If this is a relative file name (such as \"tramp.\"), it is considered | |
848 relative to the directory name returned by the function | |
849 `tramp-temporary-file-directory' (which see). It may also be an | |
850 absolute file name; don't forget to include a prefix for the filename | |
851 part, though." | |
852 :group 'tramp | |
853 :type 'string) | |
854 | |
855 (defcustom tramp-discard-garbage nil | |
856 "*If non-nil, try to discard garbage sent by remote shell. | |
857 Some shells send such garbage upon connection setup." | |
858 :group 'tramp | |
859 :type 'boolean) | |
860 | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
861 (defcustom tramp-sh-extra-args '(("/bash\\'" . "--norc")) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
862 "*Alist specifying extra arguments to pass to the remote shell. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
863 Entries are (REGEXP . ARGS) where REGEXP is a regular expression |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
864 matching the shell file name and ARGS is a string specifying the |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
865 arguments. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
866 |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
867 This variable is only used when Tramp needs to start up another shell |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
868 for tilde expansion. The extra arguments should typically prevent the |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
869 shell from reading its init file." |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
870 :group 'tramp |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
871 :type '(alist :key-type string :value-type string)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
872 |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
873 (defcustom tramp-prefix-format |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
874 (if tramp-unified-filenames "/" "/[") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
875 "*String matching the very beginning of tramp file names. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
876 Used in `tramp-make-tramp-file-name' and `tramp-make-tramp-multi-file-name'." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
877 :group 'tramp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
878 :type 'string) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
879 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
880 (defcustom tramp-prefix-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
881 (concat "^" (regexp-quote tramp-prefix-format)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
882 "*Regexp matching the very beginning of tramp file names. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
883 Should always start with \"^\". Derived from `tramp-prefix-format'." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
884 :group 'tramp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
885 :type 'regexp) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
886 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
887 (defcustom tramp-method-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
888 "[a-zA-Z_0-9-]+" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
889 "*Regexp matching methods identifiers." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
890 :group 'tramp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
891 :type 'regexp) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
892 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
893 ;; It is a little bit annoying that in XEmacs case this delimeter is different |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
894 ;; for single-hop and multi-hop cases. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
895 (defcustom tramp-postfix-single-method-format |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
896 (if tramp-unified-filenames ":" "/") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
897 "*String matching delimeter between method and user or host names. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
898 Applicable for single-hop methods. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
899 Used in `tramp-make-tramp-file-name'." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
900 :group 'tramp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
901 :type 'string) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
902 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
903 (defcustom tramp-postfix-single-method-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
904 (regexp-quote tramp-postfix-single-method-format) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
905 "*Regexp matching delimeter between method and user or host names. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
906 Applicable for single-hop methods. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
907 Derived from `tramp-postfix-single-method-format'." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
908 :group 'tramp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
909 :type 'regexp) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
910 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
911 (defcustom tramp-postfix-multi-method-format |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
912 ":" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
913 "*String matching delimeter between method and user or host names. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
914 Applicable for multi-hop methods. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
915 Used in `tramp-make-tramp-multi-file-name'." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
916 :group 'tramp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
917 :type 'string) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
918 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
919 (defcustom tramp-postfix-multi-method-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
920 (regexp-quote tramp-postfix-multi-method-format) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
921 "*Regexp matching delimeter between method and user or host names. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
922 Applicable for multi-hop methods. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
923 Derived from `tramp-postfix-multi-method-format'." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
924 :group 'tramp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
925 :type 'regexp) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
926 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
927 (defcustom tramp-postfix-multi-hop-format |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
928 (if tramp-unified-filenames ":" "/") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
929 "*String matching delimeter between path and next method. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
930 Applicable for multi-hop methods. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
931 Used in `tramp-make-tramp-multi-file-name'." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
932 :group 'tramp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
933 :type 'string) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
934 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
935 (defcustom tramp-postfix-multi-hop-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
936 (regexp-quote tramp-postfix-multi-hop-format) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
937 "*Regexp matching delimeter between path and next method. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
938 Applicable for multi-hop methods. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
939 Derived from `tramp-postfix-multi-hop-format'." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
940 :group 'tramp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
941 :type 'regexp) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
942 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
943 (defcustom tramp-user-regexp |
47578
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
944 "[^:@/ \t]*" |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
945 "*Regexp matching user names." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
946 :group 'tramp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
947 :type 'regexp) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
948 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
949 (defcustom tramp-postfix-user-format |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
950 "@" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
951 "*String matching delimeter between user and host names. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
952 Used in `tramp-make-tramp-file-name' and `tramp-make-tramp-multi-file-name'." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
953 :group 'tramp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
954 :type 'string) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
955 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
956 (defcustom tramp-postfix-user-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
957 (regexp-quote tramp-postfix-user-format) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
958 "*Regexp matching delimeter between user and host names. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
959 Derived from `tramp-postfix-user-format'." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
960 :group 'tramp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
961 :type 'regexp) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
962 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
963 (defcustom tramp-host-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
964 "[a-zA-Z0-9_.-]*" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
965 "*Regexp matching host names." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
966 :group 'tramp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
967 :type 'regexp) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
968 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
969 (defcustom tramp-postfix-host-format |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
970 (if tramp-unified-filenames ":" "]") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
971 "*String matching delimeter between host names and paths. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
972 Used in `tramp-make-tramp-file-name' and `tramp-make-tramp-multi-file-name'." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
973 :group 'tramp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
974 :type 'string) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
975 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
976 (defcustom tramp-postfix-host-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
977 (regexp-quote tramp-postfix-host-format) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
978 "*Regexp matching delimeter between host names and paths. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
979 Derived from `tramp-postfix-host-format'." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
980 :group 'tramp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
981 :type 'regexp) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
982 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
983 (defcustom tramp-path-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
984 ".*$" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
985 "*Regexp matching paths." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
986 :group 'tramp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
987 :type 'regexp) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
988 |
45861 | 989 ;; File name format. |
990 | |
46306
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
991 (defcustom tramp-file-name-structure |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
992 (list |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
993 (concat |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
994 tramp-prefix-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
995 "\\(" "\\(" tramp-method-regexp "\\)" tramp-postfix-single-method-regexp "\\)?" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
996 "\\(" "\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp "\\)?" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
997 "\\(" tramp-host-regexp "\\)" tramp-postfix-host-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
998 "\\(" tramp-path-regexp "\\)") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
999 2 4 5 6) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1000 |
45861 | 1001 "*List of five elements (REGEXP METHOD USER HOST FILE), detailing \ |
1002 the tramp file name structure. | |
1003 | |
1004 The first element REGEXP is a regular expression matching a tramp file | |
1005 name. The regex should contain parentheses around the method name, | |
1006 the user name, the host name, and the file name parts. | |
1007 | |
1008 The second element METHOD is a number, saying which pair of | |
1009 parentheses matches the method name. The third element USER is | |
1010 similar, but for the user name. The fourth element HOST is similar, | |
1011 but for the host name. The fifth element FILE is for the file name. | |
1012 These numbers are passed directly to `match-string', which see. That | |
1013 means the opening parentheses are counted to identify the pair. | |
1014 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1015 See also `tramp-file-name-regexp'." |
45861 | 1016 :group 'tramp |
1017 :type '(list (regexp :tag "File name regexp") | |
1018 (integer :tag "Paren pair for method name") | |
1019 (integer :tag "Paren pair for user name ") | |
1020 (integer :tag "Paren pair for host name ") | |
1021 (integer :tag "Paren pair for file name "))) | |
1022 | |
1023 ;;;###autoload | |
46306
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1024 (defconst tramp-file-name-regexp-unified |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1025 "\\`/[^/:]+:" |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1026 "Value for `tramp-file-name-regexp' for unified remoting. |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1027 Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1028 Tramp. See `tramp-file-name-structure-unified' for more explanations.") |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1029 |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1030 ;;;###autoload |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1031 (defconst tramp-file-name-regexp-separate |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1032 "\\`/\\[.*\\]" |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1033 "Value for `tramp-file-name-regexp' for separate remoting. |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1034 XEmacs uses a separate filename syntax for Tramp and EFS. |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1035 See `tramp-file-name-structure-separate' for more explanations.") |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1036 |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1037 ;;;###autoload |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1038 (defcustom tramp-file-name-regexp |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1039 (if tramp-unified-filenames |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1040 tramp-file-name-regexp-unified |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1041 tramp-file-name-regexp-separate) |
45861 | 1042 "*Regular expression matching file names handled by tramp. |
1043 This regexp should match tramp file names but no other file names. | |
1044 \(When tramp.el is loaded, this regular expression is prepended to | |
1045 `file-name-handler-alist', and that is searched sequentially. Thus, | |
1046 if the tramp entry appears rather early in the `file-name-handler-alist' | |
1047 and is a bit too general, then some files might be considered tramp | |
1048 files which are not really tramp files. | |
1049 | |
1050 Please note that the entry in `file-name-handler-alist' is made when | |
1051 this file (tramp.el) is loaded. This means that this variable must be set | |
1052 before loading tramp.el. Alternatively, `file-name-handler-alist' can be | |
1053 updated after changing this variable. | |
1054 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1055 Also see `tramp-file-name-structure'." |
45861 | 1056 :group 'tramp |
1057 :type 'regexp) | |
1058 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1059 ;;;###autoload |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1060 (defconst tramp-completion-file-name-regexp-unified |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1061 "^/[^/]*$" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1062 "Value for `tramp-completion-file-name-regexp' for unified remoting. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1063 Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1064 Tramp. See `tramp-file-name-structure-unified' for more explanations.") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1065 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1066 ;;;###autoload |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1067 (defconst tramp-completion-file-name-regexp-separate |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1068 "^/\\([[][^]]*\\)?$" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1069 "Value for `tramp-completion-file-name-regexp' for separate remoting. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1070 XEmacs uses a separate filename syntax for Tramp and EFS. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1071 See `tramp-file-name-structure-separate' for more explanations.") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1072 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1073 ;;;###autoload |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1074 (defcustom tramp-completion-file-name-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1075 (if tramp-unified-filenames |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1076 tramp-completion-file-name-regexp-unified |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1077 tramp-completion-file-name-regexp-separate) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1078 "*Regular expression matching file names handled by tramp completion. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1079 This regexp should match partial tramp file names only. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1080 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1081 Please note that the entry in `file-name-handler-alist' is made when |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1082 this file (tramp.el) is loaded. This means that this variable must be set |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1083 before loading tramp.el. Alternatively, `file-name-handler-alist' can be |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1084 updated after changing this variable. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1085 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1086 Also see `tramp-file-name-structure'." |
45861 | 1087 :group 'tramp |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1088 :type 'regexp) |
46306
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1089 |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1090 (defcustom tramp-multi-file-name-structure |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1091 (list |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1092 (concat |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1093 tramp-prefix-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1094 "\\(" "\\(" tramp-method-regexp "\\)" "\\)?" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1095 "\\(" "\\(" tramp-postfix-multi-hop-regexp "%s" "\\)+" "\\)?" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1096 tramp-postfix-host-regexp "\\(" tramp-path-regexp "\\)") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1097 2 3 -1) |
45861 | 1098 "*Describes the file name structure of `multi' files. |
1099 Multi files allow you to contact a remote host in several hops. | |
1100 This is a list of four elements (REGEXP METHOD HOP PATH). | |
1101 | |
1102 The first element, REGEXP, gives a regular expression to match against | |
1103 the file name. In this regular expression, `%s' is replaced with the | |
1104 value of `tramp-multi-file-name-hop-structure'. (Note: in order to | |
1105 allow multiple hops, you normally want to use something like | |
1106 \"\\\\(\\\\(%s\\\\)+\\\\)\" in the regular expression. The outer pair | |
1107 of parentheses is used for the HOP element, see below.) | |
1108 | |
1109 All remaining elements are numbers. METHOD gives the number of the | |
1110 paren pair which matches the method name. HOP gives the number of the | |
1111 paren pair which matches the hop sequence. PATH gives the number of | |
1112 the paren pair which matches the path name on the remote host. | |
1113 | |
1114 PATH can also be negative, which means to count from the end. Ie, a | |
1115 value of -1 means the last paren pair. | |
1116 | |
1117 I think it would be good if the regexp matches the whole of the | |
1118 string, but I haven't actually tried what happens if it doesn't..." | |
1119 :group 'tramp | |
1120 :type '(list (regexp :tag "File name regexp") | |
1121 (integer :tag "Paren pair for method name") | |
1122 (integer :tag "Paren pair for hops") | |
1123 (integer :tag "Paren pair to match path"))) | |
1124 | |
46306
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1125 (defcustom tramp-multi-file-name-hop-structure |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1126 (list |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1127 (concat |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1128 "\\(" tramp-method-regexp "\\)" tramp-postfix-multi-method-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1129 "\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1130 "\\(" tramp-host-regexp "\\)") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1131 1 2 3) |
45861 | 1132 "*Describes the structure of a hop in multi files. |
1133 This is a list of four elements (REGEXP METHOD USER HOST). First | |
1134 element REGEXP is used to match against the hop. Pair number METHOD | |
1135 matches the method of one hop, pair number USER matches the user of | |
1136 one hop, pair number HOST matches the host of one hop. | |
1137 | |
1138 This regular expression should match exactly all of one hop." | |
1139 :group 'tramp | |
1140 :type '(list (regexp :tag "Hop regexp") | |
1141 (integer :tag "Paren pair for method name") | |
1142 (integer :tag "Paren pair for user name") | |
1143 (integer :tag "Paren pair for host name"))) | |
1144 | |
1145 (defcustom tramp-make-multi-tramp-file-format | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1146 (list |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1147 (concat tramp-prefix-format "%m") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1148 (concat tramp-postfix-multi-hop-format |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1149 "%m" tramp-postfix-multi-method-format |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1150 "%u" tramp-postfix-user-format |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1151 "%h") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1152 (concat tramp-postfix-host-format "%p")) |
45861 | 1153 "*Describes how to construct a `multi' file name. |
1154 This is a list of three elements PREFIX, HOP and PATH. | |
1155 | |
1156 The first element PREFIX says how to construct the prefix, the second | |
1157 element HOP specifies what each hop looks like, and the final element | |
1158 PATH says how to construct the path name. | |
1159 | |
1160 In PREFIX, `%%' means `%' and `%m' means the method name. | |
1161 | |
1162 In HOP, `%%' means `%' and `%m', `%u', `%h' mean the hop method, hop | |
1163 user and hop host, respectively. | |
1164 | |
1165 In PATH, `%%' means `%' and `%p' means the path name. | |
1166 | |
1167 The resulting file name always contains one copy of PREFIX and one | |
1168 copy of PATH, but there is one copy of HOP for each hop in the file | |
1169 name. | |
1170 | |
1171 Note: the current implementation requires the prefix to contain the | |
1172 method name, followed by all the hops, and the path name must come | |
1173 last." | |
1174 :group 'tramp | |
1175 :type '(list string string string)) | |
1176 | |
1177 (defcustom tramp-terminal-type "dumb" | |
1178 "*Value of TERM environment variable for logging in to remote host. | |
1179 Because Tramp wants to parse the output of the remote shell, it is easily | |
1180 confused by ANSI color escape sequences and suchlike. Often, shell init | |
1181 files conditionalize this setup based on the TERM environment variable." | |
1182 :group 'tramp | |
1183 :type 'string) | |
1184 | |
1185 (defcustom tramp-completion-without-shell-p nil | |
1186 "*If nil, use shell wildcards for completion, else rely on Lisp only. | |
1187 Using shell wildcards for completions has the advantage that it can be | |
1188 fast even in large directories, but completion is always | |
1189 case-sensitive. Relying on Lisp only means that case-insensitive | |
1190 completion is possible (subject to the variable `completion-ignore-case'), | |
1191 but it might be slow on large directories." | |
1192 :group 'tramp | |
1193 :type 'boolean) | |
1194 | |
46752 | 1195 (defcustom tramp-actions-before-shell |
1196 '((tramp-password-prompt-regexp tramp-action-password) | |
1197 (tramp-login-prompt-regexp tramp-action-login) | |
1198 (shell-prompt-pattern tramp-action-succeed) | |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
1199 (tramp-shell-prompt-pattern tramp-action-succeed) |
46752 | 1200 (tramp-wrong-passwd-regexp tramp-action-permission-denied) |
46992
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
1201 (tramp-yesno-prompt-regexp tramp-action-yesno) |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
1202 (tramp-yn-prompt-regexp tramp-action-yn)) |
46752 | 1203 "List of pattern/action pairs. |
1204 Whenever a pattern matches, the corresponding action is performed. | |
1205 Each item looks like (PATTERN ACTION). | |
1206 | |
1207 The PATTERN should be a symbol, a variable. The value of this | |
1208 variable gives the regular expression to search for. Note that the | |
1209 regexp must match at the end of the buffer, \"\\'\" is implicitly | |
1210 appended to it. | |
1211 | |
1212 The ACTION should also be a symbol, but a function. When the | |
1213 corresponding PATTERN matches, the ACTION function is called." | |
1214 :group 'tramp | |
1215 :type '(repeat (list variable function))) | |
1216 | |
1217 (defcustom tramp-multi-actions | |
1218 '((tramp-password-prompt-regexp tramp-multi-action-password) | |
1219 (tramp-login-prompt-regexp tramp-multi-action-login) | |
1220 (shell-prompt-pattern tramp-multi-action-succeed) | |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
1221 (tramp-shell-prompt-pattern tramp-multi-action-succeed) |
46752 | 1222 (tramp-wrong-passwd-regexp tramp-multi-action-permission-denied)) |
1223 "List of pattern/action pairs. | |
1224 This list is used for each hop in multi-hop connections. | |
1225 See `tramp-actions-before-shell' for more info." | |
1226 :group 'tramp | |
1227 :type '(repeat (list variable function))) | |
1228 | |
45861 | 1229 ;;; Internal Variables: |
1230 | |
1231 (defvar tramp-buffer-file-attributes nil | |
1232 "Holds the `ls -ild' output for the current buffer. | |
1233 This variable is local to each buffer. It is not used if the remote | |
1234 machine groks Perl. If it is used, it's used as an emulation for | |
1235 the visited file modtime.") | |
1236 (make-variable-buffer-local 'tramp-buffer-file-attributes) | |
1237 | |
1238 (defvar tramp-end-of-output "/////" | |
1239 "String used to recognize end of output.") | |
1240 | |
1241 (defvar tramp-connection-function nil | |
1242 "This internal variable holds a parameter for `tramp-methods'. | |
1243 In the connection buffer, this variable has the value of the like-named | |
1244 method parameter, as specified in `tramp-methods' (which see).") | |
1245 | |
1246 (defvar tramp-remote-sh nil | |
1247 "This internal variable holds a parameter for `tramp-methods'. | |
1248 In the connection buffer, this variable has the value of the like-named | |
1249 method parameter, as specified in `tramp-methods' (which see).") | |
1250 | |
1251 (defvar tramp-rsh-program nil | |
1252 "This internal variable holds a parameter for `tramp-methods'. | |
1253 In the connection buffer, this variable has the value of the like-named | |
1254 method parameter, as specified in `tramp-methods' (which see).") | |
1255 | |
1256 (defvar tramp-rsh-args nil | |
1257 "This internal variable holds a parameter for `tramp-methods'. | |
1258 In the connection buffer, this variable has the value of the like-named | |
1259 method parameter, as specified in `tramp-methods' (which see).") | |
1260 | |
1261 (defvar tramp-rcp-program nil | |
1262 "This internal variable holds a parameter for `tramp-methods'. | |
1263 In the connection buffer, this variable has the value of the like-named | |
1264 method parameter, as specified in `tramp-methods' (which see).") | |
1265 | |
1266 (defvar tramp-rcp-args nil | |
1267 "This internal variable holds a parameter for `tramp-methods'. | |
1268 In the connection buffer, this variable has the value of the like-named | |
1269 method parameter, as specified in `tramp-methods' (which see).") | |
1270 | |
1271 (defvar tramp-rcp-keep-date-arg nil | |
1272 "This internal variable holds a parameter for `tramp-methods'. | |
1273 In the connection buffer, this variable has the value of the like-named | |
1274 method parameter, as specified in `tramp-methods' (which see).") | |
1275 | |
1276 (defvar tramp-encoding-command nil | |
1277 "This internal variable holds a parameter for `tramp-methods'. | |
1278 In the connection buffer, this variable has the value of the like-named | |
1279 method parameter, as specified in `tramp-methods' (which see).") | |
1280 | |
1281 (defvar tramp-decoding-command nil | |
1282 "This internal variable holds a parameter for `tramp-methods'. | |
1283 In the connection buffer, this variable has the value of the like-named | |
1284 method parameter, as specified in `tramp-methods' (which see).") | |
1285 | |
1286 (defvar tramp-encoding-function nil | |
1287 "This internal variable holds a parameter for `tramp-methods'. | |
1288 In the connection buffer, this variable has the value of the like-named | |
1289 method parameter, as specified in `tramp-methods' (which see).") | |
1290 | |
1291 (defvar tramp-decoding-function nil | |
1292 "This internal variable holds a parameter for `tramp-methods'. | |
1293 In the connection buffer, this variable has the value of the like-named | |
1294 method parameter, as specified in `tramp-methods' (which see).") | |
1295 | |
1296 (defvar tramp-telnet-program nil | |
1297 "This internal variable holds a parameter for `tramp-methods'. | |
1298 In the connection buffer, this variable has the value of the like-named | |
1299 method parameter, as specified in `tramp-methods' (which see).") | |
1300 | |
1301 (defvar tramp-telnet-args nil | |
1302 "This internal variable holds a parameter for `tramp-methods'. | |
1303 In the connection buffer, this variable has the value of the like-named | |
1304 method parameter, as specified in `tramp-methods' (which see).") | |
1305 | |
46790 | 1306 (defvar tramp-su-program nil |
1307 "This internal variable holds a parameter for `tramp-methods'. | |
1308 In the connection buffer, this variable has the value of the like-named | |
1309 method parameter, as specified in `tramp-methods' (which see).") | |
1310 | |
45861 | 1311 ;; CCC `local in each buffer'? |
1312 (defvar tramp-ls-command nil | |
1313 "This command is used to get a long listing with numeric user and group ids. | |
1314 This variable is automatically made buffer-local to each rsh process buffer | |
1315 upon opening the connection.") | |
1316 | |
1317 (defvar tramp-current-multi-method nil | |
1318 "Name of `multi' connection method for this *tramp* buffer, or nil if not multi. | |
1319 This variable is automatically made buffer-local to each rsh process buffer | |
1320 upon opening the connection.") | |
1321 | |
1322 (defvar tramp-current-method nil | |
1323 "Connection method for this *tramp* buffer. | |
1324 This variable is automatically made buffer-local to each rsh process buffer | |
1325 upon opening the connection.") | |
1326 | |
1327 (defvar tramp-current-user nil | |
1328 "Remote login name for this *tramp* buffer. | |
1329 This variable is automatically made buffer-local to each rsh process buffer | |
1330 upon opening the connection.") | |
1331 | |
1332 (defvar tramp-current-host nil | |
1333 "Remote host for this *tramp* buffer. | |
1334 This variable is automatically made buffer-local to each rsh process buffer | |
1335 upon opening the connection.") | |
1336 | |
1337 (defvar tramp-test-groks-nt nil | |
1338 "Whether the `test' command groks the `-nt' switch. | |
1339 \(`test A -nt B' tests if file A is newer than file B.) | |
1340 This variable is automatically made buffer-local to each rsh process buffer | |
1341 upon opening the connection.") | |
1342 | |
1343 (defvar tramp-file-exists-command nil | |
1344 "Command to use for checking if a file exists. | |
1345 This variable is automatically made buffer-local to each rsh process buffer | |
1346 upon opening the connection.") | |
1347 | |
46802
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
1348 (defconst tramp-uudecode "\ |
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
1349 tramp_uudecode () { |
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
1350 \(echo begin 600 /tmp/tramp.$$; tail +2) | uudecode |
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
1351 cat /tmp/tramp.$$ |
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
1352 rm -f /tmp/tramp.$$ |
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
1353 }" |
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
1354 "Shell function to implement `uudecode' to standard output. |
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
1355 Many systems support `uudecode -o -' for this or `uudecode -p', but |
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
1356 some systems don't, and for them we have this shell function.") |
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
1357 |
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
1358 ;; Perl script to implement `file-attributes' in a Lisp `read'able |
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
1359 ;; output. If you are hacking on this, note that you get *no* output |
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
1360 ;; unless this spits out a complete line, including the '\n' at the |
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
1361 ;; end. |
46808
cf225aed7a75
Version 2.0.11 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46802
diff
changeset
|
1362 (defconst tramp-perl-file-attributes "\ |
cf225aed7a75
Version 2.0.11 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46802
diff
changeset
|
1363 $f = $ARGV[0]; |
45861 | 1364 @s = lstat($f); |
1365 if (($s[2] & 0170000) == 0120000) { $l = readlink($f); $l = \"\\\"$l\\\"\"; } | |
1366 elsif (($s[2] & 0170000) == 040000) { $l = \"t\"; } | |
1367 else { $l = \"nil\" }; | |
46808
cf225aed7a75
Version 2.0.11 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46802
diff
changeset
|
1368 printf(\"(%s %u %d %d (%u %u) (%u %u) (%u %u) %u %u t (%u . %u) (%u %u))\\n\", |
45861 | 1369 $l, $s[3], $s[4], $s[5], $s[8] >> 16 & 0xffff, $s[8] & 0xffff, |
1370 $s[9] >> 16 & 0xffff, $s[9] & 0xffff, $s[10] >> 16 & 0xffff, $s[10] & 0xffff, | |
1371 $s[7], $s[2], $s[1] >> 16 & 0xffff, $s[1] & 0xffff, $s[0] >> 16 & 0xffff, $s[0] & 0xffff);" | |
1372 "Perl script to produce output suitable for use with `file-attributes' | |
1373 on the remote file system.") | |
1374 | |
46752 | 1375 ;; ;; These two use uu encoding. |
1376 ;; (defvar tramp-perl-encode "%s -e'\ | |
1377 ;; print qq(begin 644 xxx\n); | |
1378 ;; my $s = q(); | |
1379 ;; my $res = q(); | |
1380 ;; while (read(STDIN, $s, 45)) { | |
1381 ;; print pack(q(u), $s); | |
1382 ;; } | |
1383 ;; print qq(`\n); | |
1384 ;; print qq(end\n); | |
1385 ;; '" | |
1386 ;; "Perl program to use for encoding a file. | |
1387 ;; Escape sequence %s is replaced with name of Perl binary.") | |
1388 | |
1389 ;; (defvar tramp-perl-decode "%s -ne ' | |
1390 ;; print unpack q(u), $_; | |
1391 ;; '" | |
1392 ;; "Perl program to use for decoding a file. | |
1393 ;; Escape sequence %s is replaced with name of Perl binary.") | |
1394 | |
1395 ;; These two use base64 encoding. | |
46790 | 1396 (defvar tramp-perl-encode-with-module |
1397 "perl -MMIME::Base64 -0777 -ne 'print encode_base64($_)'" | |
1398 "Perl program to use for encoding a file. | |
1399 Escape sequence %s is replaced with name of Perl binary. | |
46801
3fafc6fca8a8
Version 2.0.9 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46799
diff
changeset
|
1400 This string is passed to `format', so percent characters need to be doubled. |
46790 | 1401 This implementation requires the MIME::Base64 Perl module to be installed |
1402 on the remote host.") | |
1403 | |
1404 (defvar tramp-perl-decode-with-module | |
1405 "perl -MMIME::Base64 -0777 -ne 'print decode_base64($_)'" | |
1406 "Perl program to use for decoding a file. | |
1407 Escape sequence %s is replaced with name of Perl binary. | |
46801
3fafc6fca8a8
Version 2.0.9 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46799
diff
changeset
|
1408 This string is passed to `format', so percent characters need to be doubled. |
46790 | 1409 This implementation requires the MIME::Base64 Perl module to be installed |
1410 on the remote host.") | |
1411 | |
46752 | 1412 (defvar tramp-perl-encode |
46790 | 1413 "%s -e ' |
1414 # This script contributed by Juanma Barranquero <lektu@terra.es>. | |
1415 # Copyright (C) 2002 Free Software Foundation, Inc. | |
1416 use strict; | |
1417 | |
46795 | 1418 my %%trans = do { |
46790 | 1419 my $i = 0; |
1420 map {(substr(unpack(q(B8), chr $i++), 2, 6), $_)} | |
1421 split //, q(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/); | |
1422 }; | |
1423 | |
46797 | 1424 binmode(\\*STDIN); |
46790 | 1425 |
1426 # We read in chunks of 54 bytes, to generate output lines | |
1427 # of 72 chars (plus end of line) | |
46797 | 1428 $/ = \\54; |
46790 | 1429 |
1430 while (my $data = <STDIN>) { | |
1431 my $pad = q(); | |
1432 | |
1433 # Only for the last chunk, and only if did not fill the last three-byte packet | |
1434 if (eof) { | |
46795 | 1435 my $mod = length($data) %% 3; |
46790 | 1436 $pad = q(=) x (3 - $mod) if $mod; |
1437 } | |
1438 | |
1439 # Not the fastest method, but it is simple: unpack to binary string, split | |
1440 # by groups of 6 bits and convert back from binary to byte; then map into | |
1441 # the translation table | |
1442 print | |
1443 join q(), | |
1444 map($trans{$_}, | |
1445 (substr(unpack(q(B*), $data) . q(00000), 0, 432) =~ /....../g)), | |
1446 $pad, | |
46797 | 1447 qq(\\n); |
46790 | 1448 } |
1449 '" | |
46752 | 1450 "Perl program to use for encoding a file. |
46795 | 1451 Escape sequence %s is replaced with name of Perl binary. |
46799
c9fab7d532d1
(tramp-perl-encode, tramp-perl-decode): Doc fix.
Andreas Schwab <schwab@suse.de>
parents:
46797
diff
changeset
|
1452 This string is passed to `format', so percent characters need to be doubled.") |
46752 | 1453 |
1454 (defvar tramp-perl-decode | |
46790 | 1455 "%s -e ' |
1456 # This script contributed by Juanma Barranquero <lektu@terra.es>. | |
1457 # Copyright (C) 2002 Free Software Foundation, Inc. | |
1458 use strict; | |
1459 | |
46795 | 1460 my %%trans = do { |
46790 | 1461 my $i = 0; |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1462 map {($_, substr(unpack(q(B8), chr $i++), 2, 6))} |
46790 | 1463 split //, q(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/) |
1464 }; | |
1465 | |
46795 | 1466 my %%bytes = map {(unpack(q(B8), chr $_), chr $_)} 0 .. 255; |
46790 | 1467 |
46797 | 1468 binmode(\\*STDOUT); |
46790 | 1469 |
1470 # We are going to accumulate into $pending to accept any line length | |
1471 # (we do not check they are <= 76 chars as the RFC says) | |
1472 my $pending = q(); | |
1473 | |
1474 while (my $data = <STDIN>) { | |
1475 chomp $data; | |
1476 | |
1477 # If we find one or two =, we have reached the end and | |
1478 # any following data is to be discarded | |
1479 my $finished = $data =~ s/(==?).*/$1/; | |
1480 $pending .= $data; | |
1481 | |
1482 my $len = length($pending); | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1483 my $chunk = substr($pending, 0, $len & ~3); |
46790 | 1484 |
1485 # Easy method: translate from chars to (pregenerated) six-bit packets, join, | |
1486 # split in 8-bit chunks and convert back to char. | |
1487 print join q(), | |
1488 map $bytes{$_}, | |
1489 ((join q(), map {$trans{$_} || q()} split //, $chunk) =~ /......../g); | |
1490 | |
1491 last if $finished; | |
1492 } | |
1493 '" | |
46752 | 1494 "Perl program to use for decoding a file. |
46795 | 1495 Escape sequence %s is replaced with name of Perl binary. |
46799
c9fab7d532d1
(tramp-perl-encode, tramp-perl-decode): Doc fix.
Andreas Schwab <schwab@suse.de>
parents:
46797
diff
changeset
|
1496 This string is passed to `format', so percent characters need to be doubled.") |
45861 | 1497 |
1498 ; These values conform to `file-attributes' from XEmacs 21.2. | |
1499 ; GNU Emacs and other tools not checked. | |
1500 (defconst tramp-file-mode-type-map '((0 . "-") ; Normal file (SVID-v2 and XPG2) | |
1501 (1 . "p") ; fifo | |
1502 (2 . "c") ; character device | |
1503 (3 . "m") ; multiplexed character device (v7) | |
1504 (4 . "d") ; directory | |
1505 (5 . "?") ; Named special file (XENIX) | |
1506 (6 . "b") ; block device | |
1507 (7 . "?") ; multiplexed block device (v7) | |
1508 (8 . "-") ; regular file | |
1509 (9 . "n") ; network special file (HP-UX) | |
1510 (10 . "l") ; symlink | |
1511 (11 . "?") ; ACL shadow inode (Solaris, not userspace) | |
1512 (12 . "s") ; socket | |
1513 (13 . "D") ; door special (Solaris) | |
1514 (14 . "w")) ; whiteout (BSD) | |
1515 "A list of file types returned from the `stat' system call. | |
1516 This is used to map a mode number to a permission string.") | |
1517 | |
1518 (defvar tramp-dos-coding-system | |
1519 (if (and (fboundp 'coding-system-p) | |
1520 (funcall 'coding-system-p '(dos))) | |
1521 'dos | |
1522 'undecided-dos) | |
1523 "Some Emacsen know the `dos' coding system, others need `undecided-dos'.") | |
1524 | |
46752 | 1525 (defvar tramp-last-cmd-time nil |
1526 "Internal Tramp variable recording the time when the last cmd was sent. | |
1527 This variable is buffer-local in every buffer.") | |
1528 (make-variable-buffer-local 'tramp-last-cmd-time) | |
45861 | 1529 |
47205
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
1530 ;; This variable does not have the right value in XEmacs. What should |
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
1531 ;; I use instead of find-operation-coding-system in XEmacs? |
46992
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
1532 (defvar tramp-feature-write-region-fix |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1533 (when (fboundp 'find-operation-coding-system) |
47205
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
1534 (let ((file-coding-system-alist '(("test" emacs-mule)))) |
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
1535 (find-operation-coding-system 'write-region 0 0 "" nil "test"))) |
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
1536 "Internal variable to say if `write-region' chooses the right coding. |
46992
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
1537 Older versions of Emacs chose the coding system for `write-region' based |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
1538 on the FILENAME argument, even if VISIT was a string.") |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
1539 |
45861 | 1540 ;; New handlers should be added here. The following operations can be |
1541 ;; handled using the normal primitives: file-name-as-directory, | |
1542 ;; file-name-directory, file-name-nondirectory, | |
1543 ;; file-name-sans-versions, get-file-buffer. | |
1544 (defconst tramp-file-name-handler-alist | |
1545 '( | |
1546 (load . tramp-handle-load) | |
1547 (make-symbolic-link . tramp-handle-make-symbolic-link) | |
1548 (file-name-directory . tramp-handle-file-name-directory) | |
1549 (file-name-nondirectory . tramp-handle-file-name-nondirectory) | |
1550 (file-truename . tramp-handle-file-truename) | |
1551 (file-exists-p . tramp-handle-file-exists-p) | |
1552 (file-directory-p . tramp-handle-file-directory-p) | |
1553 (file-executable-p . tramp-handle-file-executable-p) | |
1554 (file-accessible-directory-p . tramp-handle-file-accessible-directory-p) | |
1555 (file-readable-p . tramp-handle-file-readable-p) | |
1556 (file-regular-p . tramp-handle-file-regular-p) | |
1557 (file-symlink-p . tramp-handle-file-symlink-p) | |
1558 (file-writable-p . tramp-handle-file-writable-p) | |
1559 (file-ownership-preserved-p . tramp-handle-file-ownership-preserved-p) | |
1560 (file-newer-than-file-p . tramp-handle-file-newer-than-file-p) | |
1561 (file-attributes . tramp-handle-file-attributes) | |
1562 (file-modes . tramp-handle-file-modes) | |
1563 (file-directory-files . tramp-handle-file-directory-files) | |
1564 (directory-files . tramp-handle-directory-files) | |
1565 (file-name-all-completions . tramp-handle-file-name-all-completions) | |
1566 (file-name-completion . tramp-handle-file-name-completion) | |
1567 (add-name-to-file . tramp-handle-add-name-to-file) | |
1568 (copy-file . tramp-handle-copy-file) | |
1569 (rename-file . tramp-handle-rename-file) | |
1570 (set-file-modes . tramp-handle-set-file-modes) | |
1571 (make-directory . tramp-handle-make-directory) | |
1572 (delete-directory . tramp-handle-delete-directory) | |
1573 (delete-file . tramp-handle-delete-file) | |
1574 (directory-file-name . tramp-handle-directory-file-name) | |
1575 (shell-command . tramp-handle-shell-command) | |
1576 (insert-directory . tramp-handle-insert-directory) | |
1577 (expand-file-name . tramp-handle-expand-file-name) | |
1578 (file-local-copy . tramp-handle-file-local-copy) | |
1579 (insert-file-contents . tramp-handle-insert-file-contents) | |
1580 (write-region . tramp-handle-write-region) | |
1581 (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory) | |
1582 (dired-call-process . tramp-handle-dired-call-process) | |
1583 (dired-recursive-delete-directory | |
1584 . tramp-handle-dired-recursive-delete-directory) | |
1585 (set-visited-file-modtime . tramp-handle-set-visited-file-modtime) | |
1586 (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)) | |
1587 "Alist of handler functions. | |
1588 Operations not mentioned here will be handled by the normal Emacs functions.") | |
1589 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1590 ;; Handlers for partial tramp file names. For GNU Emacs just |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1591 ;; `file-name-all-completions' is needed. The other ones are necessary |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1592 ;; for XEmacs. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1593 (defconst tramp-completion-file-name-handler-alist |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1594 '( |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1595 (file-name-directory . tramp-completion-handle-file-name-directory) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1596 (file-name-nondirectory . tramp-completion-handle-file-name-nondirectory) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1597 (file-exists-p . tramp-completion-handle-file-exists-p) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1598 (file-name-all-completions . tramp-completion-handle-file-name-all-completions) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1599 (file-name-completion . tramp-completion-handle-file-name-completion) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1600 (expand-file-name . tramp-completion-handle-expand-file-name)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1601 "Alist of completion handler functions. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1602 Used for file names matching `tramp-file-name-regexp'. Operations not |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1603 mentioned here will be handled by `tramp-file-name-handler-alist' or the |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1604 normal Emacs functions.") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1605 |
45861 | 1606 ;;; Internal functions which must come first. |
1607 | |
1608 (defsubst tramp-message (level fmt-string &rest args) | |
1609 "Emit a message depending on verbosity level. | |
1610 First arg LEVEL says to be quiet if `tramp-verbose' is less than LEVEL. The | |
1611 message is emitted only if `tramp-verbose' is greater than or equal to LEVEL. | |
1612 Calls function `message' with FMT-STRING as control string and the remaining | |
1613 ARGS to actually emit the message (if applicable). | |
1614 | |
1615 This function expects to be called from the tramp buffer only!" | |
1616 (when (<= level tramp-verbose) | |
1617 (apply #'message (concat "tramp: " fmt-string) args) | |
1618 (when tramp-debug-buffer | |
1619 (save-excursion | |
1620 (set-buffer | |
1621 (tramp-get-debug-buffer | |
1622 tramp-current-multi-method tramp-current-method | |
1623 tramp-current-user tramp-current-host)) | |
1624 (goto-char (point-max)) | |
1625 (tramp-insert-with-face | |
1626 'italic | |
1627 (concat "# " (apply #'format fmt-string args) "\n")))))) | |
1628 | |
1629 (defun tramp-message-for-buffer | |
1630 (multi-method method user host level fmt-string &rest args) | |
1631 "Like `tramp-message' but temporarily switches to the tramp buffer. | |
1632 First three args METHOD, USER, and HOST identify the tramp buffer to use, | |
1633 remaining args passed to `tramp-message'." | |
1634 (save-excursion | |
1635 (set-buffer (tramp-get-buffer multi-method method user host)) | |
1636 (apply 'tramp-message level fmt-string args))) | |
1637 | |
1638 (defsubst tramp-line-end-position nil | |
1639 "Return point at end of line. | |
1640 Calls `line-end-position' or `point-at-eol' if defined, else | |
1641 own implementation." | |
1642 (cond | |
1643 ((fboundp 'line-end-position) (funcall 'line-end-position)) | |
1644 ((fboundp 'point-at-eol) (funcall 'point-at-eol)) | |
1645 (t (save-excursion (end-of-line) (point))))) | |
1646 | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1647 (defmacro with-parsed-tramp-file-name (filename var &rest body) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1648 "Parse a Tramp filename and make components available in the body. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1649 |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1650 First arg FILENAME is evaluated and dissected into its components. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1651 Second arg VAR is a symbol. It is used as a variable name to hold |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1652 the filename structure. It is also used as a prefix for the variables |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1653 holding the components. For example, if VAR is the symbol `foo', then |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1654 `foo' will be bound to the whole structure, `foo-multi-method' will |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1655 be bound to the multi-method component, and so on for `foo-method', |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1656 `foo-user', `foo-host', `foo-path'. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1657 |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1658 Remaining args are Lisp expressions to be evaluated (inside an implicit |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1659 `progn'). |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1660 |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1661 If VAR is nil, then we bind `v' to the structure and `multi-method', |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1662 `method', `user', `host', `path' to the components." |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1663 `(let* ((,(or var 'v) (tramp-dissect-file-name ,filename)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1664 (,(if var (intern (concat (symbol-name var) "-multi-method")) 'multi-method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1665 (tramp-file-name-multi-method ,(or var 'v))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1666 (,(if var (intern (concat (symbol-name var) "-method")) 'method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1667 (tramp-file-name-method ,(or var 'v))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1668 (,(if var (intern (concat (symbol-name var) "-user")) 'user) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1669 (tramp-file-name-user ,(or var 'v))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1670 (,(if var (intern (concat (symbol-name var) "-host")) 'host) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1671 (tramp-file-name-host ,(or var 'v))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1672 (,(if var (intern (concat (symbol-name var) "-path")) 'path) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1673 (tramp-file-name-path ,(or var 'v)))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1674 ,@body)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1675 |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1676 (put 'with-parsed-tramp-file-name 'lisp-indent-function 2) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1677 |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1678 ;;; Config Manipulation Functions: |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1679 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1680 (defun tramp-set-completion-function (method function-list) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1681 "Sets the list of completion functions for METHOD. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1682 FUNCTION-LIST is a list of entries of the form (FUNCTION FILE). |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1683 The FUNCTION is intended to parse FILE according its syntax. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1684 It might be a predefined FUNCTION, or a user defined FUNCTION. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1685 Predefined FUNCTIONs are `tramp-parse-rhosts', `tramp-parse-shosts', |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1686 `tramp-parse-hosts', and `tramp-parse-passwd'. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1687 Example: |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1688 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1689 (tramp-set-completion-function |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1690 \"ssh\" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1691 '((tramp-parse-shosts \"/etc/ssh_known_hosts\") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1692 (tramp-parse-shosts \"~/.ssh/known_hosts\")))" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1693 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1694 (let ((v (cdr (assoc method tramp-completion-function-alist)))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1695 (when v (setcdr v function-list)))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1696 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1697 (defun tramp-get-completion-function (method) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1698 "Returns list of completion functions for METHOD. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1699 For definition of that list see `tramp-set-completion-function'." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1700 (cdr (assoc method tramp-completion-function-alist))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
1701 |
45861 | 1702 ;;; File Name Handler Functions: |
1703 | |
1704 (defun tramp-handle-make-symbolic-link | |
1705 (filename linkname &optional ok-if-already-exists) | |
1706 "Like `make-symbolic-link' for tramp files. | |
46307
a2d047d50fb9
(tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46306
diff
changeset
|
1707 If LINKNAME is a non-Tramp file, it is used verbatim as the target of |
a2d047d50fb9
(tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46306
diff
changeset
|
1708 the symlink. If LINKNAME is a Tramp file, only the path component is |
a2d047d50fb9
(tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46306
diff
changeset
|
1709 used as the target of the symlink. |
a2d047d50fb9
(tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46306
diff
changeset
|
1710 |
a2d047d50fb9
(tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46306
diff
changeset
|
1711 If LINKNAME is a Tramp file and the path component is relative, then |
a2d047d50fb9
(tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46306
diff
changeset
|
1712 it is expanded first, before the path component is taken. Note that |
a2d047d50fb9
(tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46306
diff
changeset
|
1713 this can give surprising results if the user/host for the source and |
a2d047d50fb9
(tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46306
diff
changeset
|
1714 target of the symlink differ." |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1715 (with-parsed-tramp-file-name linkname l |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1716 (when (tramp-ange-ftp-file-name-p l-multi-method l-method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1717 (tramp-invoke-ange-ftp 'make-symbolic-link |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1718 filename linkname ok-if-already-exists)) |
46048
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
1719 (let ((ln (tramp-get-remote-ln l-multi-method l-method l-user l-host)) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1720 (cwd (file-name-directory l-path))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1721 (unless ln |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1722 (signal 'file-error |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1723 (list "Making a symbolic link." |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1724 "ln(1) does not exist on the remote host."))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1725 |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1726 ;; Do the 'confirm if exists' thing. |
46307
a2d047d50fb9
(tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46306
diff
changeset
|
1727 (when (file-exists-p linkname) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1728 ;; What to do? |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1729 (if (or (null ok-if-already-exists) ; not allowed to exist |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1730 (and (numberp ok-if-already-exists) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1731 (not (yes-or-no-p |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1732 (format |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1733 "File %s already exists; make it a link anyway? " |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1734 l-path))))) |
46307
a2d047d50fb9
(tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46306
diff
changeset
|
1735 (signal 'file-already-exists (list "File already exists" l-path)) |
a2d047d50fb9
(tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46306
diff
changeset
|
1736 (delete-file linkname))) |
a2d047d50fb9
(tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46306
diff
changeset
|
1737 |
a2d047d50fb9
(tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46306
diff
changeset
|
1738 ;; If FILENAME is a Tramp name, use just the path component. |
a2d047d50fb9
(tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46306
diff
changeset
|
1739 (when (tramp-tramp-file-p filename) |
a2d047d50fb9
(tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46306
diff
changeset
|
1740 (setq filename (tramp-file-name-path |
a2d047d50fb9
(tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46306
diff
changeset
|
1741 (tramp-dissect-file-name |
a2d047d50fb9
(tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46306
diff
changeset
|
1742 (expand-file-name filename))))) |
45861 | 1743 |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1744 ;; Right, they are on the same host, regardless of user, method, etc. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1745 ;; We now make the link on the remote machine. This will occur as the user |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1746 ;; that FILENAME belongs to. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1747 (zerop |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1748 (tramp-send-command-and-check |
46048
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
1749 l-multi-method l-method l-user l-host |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1750 (format "cd %s && %s -sf %s %s" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1751 cwd ln |
46307
a2d047d50fb9
(tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46306
diff
changeset
|
1752 filename |
a2d047d50fb9
(tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46306
diff
changeset
|
1753 l-path) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1754 t))))) |
45861 | 1755 |
1756 | |
1757 (defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix) | |
1758 "Like `load' for tramp files. Not implemented!" | |
1759 (unless (file-name-absolute-p file) | |
1760 (error "Tramp cannot `load' files without absolute path name")) | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1761 (with-parsed-tramp-file-name file nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1762 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1763 (tramp-invoke-ange-ftp 'load |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1764 file noerror nomessage nosuffix must-suffix)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1765 (unless nosuffix |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1766 (cond ((file-exists-p (concat file ".elc")) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1767 (setq file (concat file ".elc"))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1768 ((file-exists-p (concat file ".el")) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1769 (setq file (concat file ".el"))))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1770 (when must-suffix |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1771 ;; The first condition is always true for absolute file names. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1772 ;; Included for safety's sake. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1773 (unless (or (file-name-directory file) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1774 (string-match "\\.elc?\\'" file)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1775 (error "File `%s' does not include a `.el' or `.elc' suffix" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1776 file))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1777 (unless noerror |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1778 (when (not (file-exists-p file)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1779 (error "Cannot load nonexistant file `%s'" file))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1780 (if (not (file-exists-p file)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1781 nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1782 (unless nomessage |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1783 (message "Loading %s..." file)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1784 (let ((local-copy (file-local-copy file))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1785 ;; MUST-SUFFIX doesn't exist on XEmacs, so let it default to nil. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1786 (load local-copy noerror t t) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1787 (delete-file local-copy)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1788 (unless nomessage |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1789 (message "Loading %s...done" file)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1790 t))) |
45861 | 1791 |
1792 ;; Path manipulation functions that grok TRAMP paths... | |
1793 (defun tramp-handle-file-name-directory (file) | |
1794 "Like `file-name-directory' but aware of TRAMP files." | |
1795 ;; everything except the last filename thing is the directory | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1796 (with-parsed-tramp-file-name file nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1797 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1798 (tramp-invoke-ange-ftp 'file-name-directory file)) |
46306
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1799 ;; For the following condition, two possibilities should be tried: |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1800 ;; (1) (string= path "") |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1801 ;; (2) (or (string= path "") (string= path "/")) |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1802 ;; The second variant fails when completing a "/" directory on |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1803 ;; the remote host, that is a filename which looks like |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1804 ;; "/user@host:/". But maybe wildcards fail with the first variant. |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1805 ;; We should do some investigation. |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
1806 (if (string= path "") |
45861 | 1807 ;; For a filename like "/[foo]", we return "/". The `else' |
1808 ;; case would return "/[foo]" unchanged. But if we do that, | |
1809 ;; then `file-expand-wildcards' ceases to work. It's not | |
1810 ;; quite clear to me what's the intuition that tells that this | |
1811 ;; behavior is the right behavior, but oh, well. | |
1812 "/" | |
1813 ;; run the command on the path portion only | |
1814 ;; CCC: This should take into account the remote machine type, no? | |
1815 ;; --daniel <daniel@danann.net> | |
1816 (tramp-make-tramp-file-name multi-method method user host | |
1817 ;; This will not recurse... | |
1818 (or (file-name-directory path) ""))))) | |
1819 | |
1820 (defun tramp-handle-file-name-nondirectory (file) | |
1821 "Like `file-name-nondirectory' but aware of TRAMP files." | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1822 (with-parsed-tramp-file-name file nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1823 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1824 (tramp-invoke-ange-ftp 'file-name-nondirectory file)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1825 (file-name-nondirectory path))) |
45861 | 1826 |
1827 (defun tramp-handle-file-truename (filename &optional counter prev-dirs) | |
1828 "Like `file-truename' for tramp files." | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1829 (with-parsed-tramp-file-name filename nil |
46790 | 1830 ;; Ange-FTP does not support truename processing, but for |
1831 ;; convenience we pretend it did and forward the call to Ange-FTP | |
1832 ;; anyway. Ange-FTP then just invokes `identity'. | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1833 (when (tramp-ange-ftp-file-name-p multi-method method) |
46790 | 1834 (tramp-invoke-ange-ftp 'file-truename filename)) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1835 (let* ((steps (tramp-split-string path "/")) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1836 (pathdir (let ((directory-sep-char ?/)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1837 (file-name-as-directory path))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1838 (is-dir (string= path pathdir)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1839 (thisstep nil) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1840 (numchase 0) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1841 ;; Don't make the following value larger than necessary. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1842 ;; People expect an error message in a timely fashion when |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1843 ;; something is wrong; otherwise they might think that Emacs |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1844 ;; is hung. Of course, correctness has to come first. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1845 (numchase-limit 20) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1846 (result nil) ;result steps in reverse order |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1847 (curstri "") |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1848 symlink-target) |
45861 | 1849 (tramp-message-for-buffer |
1850 multi-method method user host | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1851 10 "Finding true name for `%s'" filename) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1852 (while (and steps (< numchase numchase-limit)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1853 (setq thisstep (pop steps)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1854 (tramp-message-for-buffer |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1855 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1856 10 "Check %s" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1857 (mapconcat 'identity |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1858 (append '("") (reverse result) (list thisstep)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1859 "/")) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1860 (setq symlink-target |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1861 (nth 0 (tramp-handle-file-attributes |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1862 (tramp-make-tramp-file-name |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1863 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1864 (mapconcat 'identity |
46790 | 1865 (append '("") |
1866 (reverse result) | |
1867 (list thisstep)) | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1868 "/"))))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1869 (cond ((string= "." thisstep) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1870 (tramp-message-for-buffer multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1871 10 "Ignoring step `.'")) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1872 ((string= ".." thisstep) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1873 (tramp-message-for-buffer multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1874 10 "Processing step `..'") |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1875 (pop result)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1876 ((stringp symlink-target) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1877 ;; It's a symlink, follow it. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1878 (tramp-message-for-buffer |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1879 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1880 10 "Follow symlink to %s" symlink-target) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1881 (setq numchase (1+ numchase)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1882 (when (file-name-absolute-p symlink-target) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1883 (setq result nil)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1884 (setq steps |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1885 (append (tramp-split-string symlink-target "/") steps))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1886 (t |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1887 ;; It's a file. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1888 (setq result (cons thisstep result))))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1889 (when (>= numchase numchase-limit) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1890 (error "Maximum number (%d) of symlinks exceeded" numchase-limit)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1891 (setq result (reverse result)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1892 (tramp-message-for-buffer |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1893 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1894 10 "True name of `%s' is `%s'" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1895 filename (mapconcat 'identity (cons "" result) "/")) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1896 (tramp-make-tramp-file-name |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1897 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1898 (concat (mapconcat 'identity (cons "" result) "/") |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1899 (if is-dir "/" "")))))) |
45861 | 1900 |
1901 ;; Basic functions. | |
1902 | |
1903 (defun tramp-handle-file-exists-p (filename) | |
1904 "Like `file-exists-p' for tramp files." | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1905 (with-parsed-tramp-file-name filename nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1906 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1907 (tramp-invoke-ange-ftp 'file-exists-p filename)) |
45861 | 1908 (save-excursion |
1909 (zerop (tramp-send-command-and-check | |
1910 multi-method method user host | |
1911 (format | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1912 (tramp-get-file-exists-command multi-method method user host) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
1913 (tramp-shell-quote-argument path))))))) |
45861 | 1914 |
1915 ;; CCC: This should check for an error condition and signal failure | |
1916 ;; when something goes wrong. | |
1917 ;; Daniel Pittman <daniel@danann.net> | |
1918 (defun tramp-handle-file-attributes (filename &optional nonnumeric) | |
1919 "Like `file-attributes' for tramp files. | |
1920 Optional argument NONNUMERIC means return user and group name | |
1921 rather than as numbers." | |
46752 | 1922 (let (result) |
1923 (with-parsed-tramp-file-name filename nil | |
1924 (when (tramp-ange-ftp-file-name-p multi-method method) | |
1925 (tramp-invoke-ange-ftp 'file-attributes filename)) | |
1926 (when (tramp-handle-file-exists-p filename) | |
1927 ;; file exists, find out stuff | |
1928 (save-excursion | |
45861 | 1929 (if (tramp-get-remote-perl multi-method method user host) |
46752 | 1930 (setq result |
1931 (tramp-handle-file-attributes-with-perl | |
1932 multi-method method user host path nonnumeric)) | |
1933 (setq result | |
1934 (tramp-handle-file-attributes-with-ls | |
1935 multi-method method user host path nonnumeric)))))) | |
1936 result)) | |
45861 | 1937 |
1938 | |
1939 (defun tramp-handle-file-attributes-with-ls | |
1940 (multi-method method user host path &optional nonnumeric) | |
1941 "Implement `file-attributes' for tramp files using the ls(1) command." | |
1942 (let (symlinkp dirp | |
1943 res-inode res-filemodes res-numlinks | |
1944 res-uid res-gid res-size res-symlink-target) | |
46752 | 1945 (tramp-message-for-buffer multi-method method user host 10 |
1946 "file attributes with ls: %s" | |
1947 (tramp-make-tramp-file-name | |
1948 multi-method method user host path)) | |
45861 | 1949 (tramp-send-command |
1950 multi-method method user host | |
1951 (format "%s %s %s" | |
1952 (tramp-get-ls-command multi-method method user host) | |
1953 (if nonnumeric "-ild" "-ildn") | |
1954 (tramp-shell-quote-argument path))) | |
1955 (tramp-wait-for-output) | |
1956 ;; parse `ls -l' output ... | |
1957 ;; ... inode | |
1958 (setq res-inode | |
1959 (condition-case err | |
1960 (read (current-buffer)) | |
1961 (invalid-read-syntax | |
1962 (when (and (equal (cadr err) | |
1963 "Integer constant overflow in reader") | |
1964 (string-match | |
1965 "^[0-9]+\\([0-9][0-9][0-9][0-9][0-9]\\)\\'" | |
1966 (caddr err))) | |
1967 (let* ((big (read (substring (caddr err) 0 | |
1968 (match-beginning 1)))) | |
1969 (small (read (match-string 1 (caddr err)))) | |
1970 (twiddle (/ small 65536))) | |
1971 (cons (+ big twiddle) | |
1972 (- small (* twiddle 65536)))))))) | |
1973 ;; ... file mode flags | |
1974 (setq res-filemodes (symbol-name (read (current-buffer)))) | |
1975 ;; ... number links | |
1976 (setq res-numlinks (read (current-buffer))) | |
1977 ;; ... uid and gid | |
1978 (setq res-uid (read (current-buffer))) | |
1979 (setq res-gid (read (current-buffer))) | |
1980 (unless nonnumeric | |
1981 (unless (numberp res-uid) (setq res-uid -1)) | |
1982 (unless (numberp res-gid) (setq res-gid -1))) | |
1983 ;; ... size | |
1984 (setq res-size (read (current-buffer))) | |
1985 ;; From the file modes, figure out other stuff. | |
1986 (setq symlinkp (eq ?l (aref res-filemodes 0))) | |
1987 (setq dirp (eq ?d (aref res-filemodes 0))) | |
1988 ;; if symlink, find out file name pointed to | |
1989 (when symlinkp | |
1990 (search-forward "-> ") | |
1991 (setq res-symlink-target | |
1992 (buffer-substring (point) | |
1993 (tramp-line-end-position)))) | |
1994 ;; return data gathered | |
1995 (list | |
1996 ;; 0. t for directory, string (name linked to) for symbolic | |
1997 ;; link, or nil. | |
1998 (or dirp res-symlink-target nil) | |
1999 ;; 1. Number of links to file. | |
2000 res-numlinks | |
2001 ;; 2. File uid. | |
2002 res-uid | |
2003 ;; 3. File gid. | |
2004 res-gid | |
2005 ;; 4. Last access time, as a list of two integers. First | |
2006 ;; integer has high-order 16 bits of time, second has low 16 | |
2007 ;; bits. | |
2008 ;; 5. Last modification time, likewise. | |
2009 ;; 6. Last status change time, likewise. | |
2010 '(0 0) '(0 0) '(0 0) ;CCC how to find out? | |
2011 ;; 7. Size in bytes (-1, if number is out of range). | |
2012 res-size | |
2013 ;; 8. File modes, as a string of ten letters or dashes as in ls -l. | |
2014 res-filemodes | |
2015 ;; 9. t iff file's gid would change if file were deleted and | |
2016 ;; recreated. | |
2017 nil ;hm? | |
2018 ;; 10. inode number. | |
2019 res-inode | |
2020 ;; 11. Device number. | |
2021 -1 ;hm? | |
2022 ))) | |
2023 | |
2024 (defun tramp-handle-file-attributes-with-perl | |
2025 (multi-method method user host path &optional nonnumeric) | |
2026 "Implement `file-attributes' for tramp files using a Perl script. | |
2027 | |
2028 The Perl command is sent to the remote machine when the connection | |
2029 is initially created and is kept cached by the remote shell." | |
46752 | 2030 (tramp-message-for-buffer multi-method method user host 10 |
2031 "file attributes with perl: %s" | |
2032 (tramp-make-tramp-file-name | |
2033 multi-method method user host path)) | |
45861 | 2034 (tramp-send-command |
2035 multi-method method user host | |
2036 (format "tramp_file_attributes %s" | |
2037 (tramp-shell-quote-argument path))) | |
2038 (tramp-wait-for-output) | |
2039 (let ((result (read (current-buffer)))) | |
2040 (setcar (nthcdr 8 result) | |
2041 (tramp-file-mode-from-int (nth 8 result))) | |
2042 result)) | |
2043 | |
2044 (defun tramp-handle-set-visited-file-modtime (&optional time-list) | |
2045 "Like `set-visited-file-modtime' for tramp files." | |
2046 (unless (buffer-file-name) | |
2047 (error "Can't set-visited-file-modtime: buffer `%s' not visiting a file" | |
2048 (buffer-name))) | |
2049 (when time-list | |
2050 (tramp-run-real-handler 'set-visited-file-modtime (list time-list))) | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2051 (let ((f (buffer-file-name)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2052 (coding-system-used nil)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2053 (with-parsed-tramp-file-name f nil |
46790 | 2054 ;; This operation is not handled by Ange-FTP! Compare this |
2055 ;; behavior with `file-truename' which Ange-FTP does not really | |
2056 ;; handle, either, but at least it pretends to. I wonder if | |
2057 ;; Ange-FTP should also pretend to grok | |
2058 ;; `set-visited-file-modtime', for consistency? | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2059 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2060 (throw 'tramp-forward-to-ange-ftp |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2061 (tramp-run-real-handler 'set-visited-file-modtime |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2062 (list time-list)))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2063 (let* ((attr (file-attributes f)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2064 (modtime (nth 5 attr))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2065 ;; We use '(0 0) as a don't-know value. See also |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2066 ;; `tramp-handle-file-attributes-with-ls'. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2067 (when (boundp 'last-coding-system-used) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2068 (setq coding-system-used last-coding-system-used)) |
45861 | 2069 (if (not (equal modtime '(0 0))) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2070 (tramp-run-real-handler 'set-visited-file-modtime (list modtime)) |
45861 | 2071 (save-excursion |
2072 (tramp-send-command | |
2073 multi-method method user host | |
2074 (format "%s -ild %s" | |
2075 (tramp-get-ls-command multi-method method user host) | |
2076 (tramp-shell-quote-argument path))) | |
2077 (tramp-wait-for-output) | |
2078 (setq attr (buffer-substring (point) | |
2079 (progn (end-of-line) (point))))) | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2080 (setq tramp-buffer-file-attributes attr)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2081 (when (boundp 'last-coding-system-used) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2082 (setq last-coding-system-used coding-system-used)) |
45861 | 2083 nil)))) |
2084 | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2085 ;; CCC continue here |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2086 |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2087 ;; This function makes the same assumption as |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2088 ;; `tramp-handle-set-visited-file-modtime'. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2089 (defun tramp-handle-verify-visited-file-modtime (buf) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2090 "Like `verify-visited-file-modtime' for tramp files." |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2091 (with-current-buffer buf |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2092 (let ((f (buffer-file-name))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2093 (with-parsed-tramp-file-name f nil |
46048
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
2094 (when (tramp-ange-ftp-file-name-p multi-method method) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2095 ;; This one requires a hack since the file name is not passed |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2096 ;; on the arg list. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2097 (let ((buffer-file-name (tramp-make-ange-ftp-file-name |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2098 user host path))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2099 (tramp-invoke-ange-ftp 'verify-visited-file-modtime buf))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2100 (let* ((attr (file-attributes f)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2101 (modtime (nth 5 attr))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2102 (cond ((and attr (not (equal modtime '(0 0)))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2103 ;; Why does `file-attributes' return a list (HIGH |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2104 ;; LOW), but `visited-file-modtime' returns a cons |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2105 ;; (HIGH . LOW)? |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2106 (let ((mt (visited-file-modtime))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2107 (< (abs (tramp-time-diff |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2108 modtime (list (car mt) (cdr mt)))) 2))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2109 (attr |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2110 (save-excursion |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2111 (tramp-send-command |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2112 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2113 (format "%s -ild %s" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2114 (tramp-get-ls-command multi-method method |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2115 user host) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2116 (tramp-shell-quote-argument path))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2117 (tramp-wait-for-output) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2118 (setq attr (buffer-substring |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2119 (point) (progn (end-of-line) (point))))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2120 (equal tramp-buffer-file-attributes attr)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2121 ;; If file does not exist, say it is not modified. |
46048
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
2122 (t nil))))))) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2123 |
45861 | 2124 (defadvice clear-visited-file-modtime (after tramp activate) |
2125 "Set `tramp-buffer-file-attributes' back to nil. | |
2126 Tramp uses this variable as an emulation for the actual modtime of the file, | |
2127 if the remote host can't provide the modtime." | |
2128 (setq tramp-buffer-file-attributes nil)) | |
2129 | |
2130 (defun tramp-handle-set-file-modes (filename mode) | |
2131 "Like `set-file-modes' for tramp files." | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2132 (with-parsed-tramp-file-name filename nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2133 (when (tramp-ange-ftp-file-name-p multi-method method) |
47205
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
2134 (tramp-invoke-ange-ftp 'set-file-modes mode filename)) |
45861 | 2135 (save-excursion |
2136 (unless (zerop (tramp-send-command-and-check | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2137 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2138 (format "chmod %s %s" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2139 (tramp-decimal-to-octal mode) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2140 (tramp-shell-quote-argument path)))) |
45861 | 2141 (signal 'file-error |
2142 (list "Doing chmod" | |
2143 ;; FIXME: extract the proper text from chmod's stderr. | |
2144 "error while changing file's mode" | |
2145 filename)))))) | |
2146 | |
2147 ;; Simple functions using the `test' command. | |
2148 | |
2149 (defun tramp-handle-file-executable-p (filename) | |
2150 "Like `file-executable-p' for tramp files." | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2151 (with-parsed-tramp-file-name filename nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2152 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2153 (tramp-invoke-ange-ftp 'file-executable-p filename)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2154 (zerop (tramp-run-test "-x" filename)))) |
45861 | 2155 |
2156 (defun tramp-handle-file-readable-p (filename) | |
2157 "Like `file-readable-p' for tramp files." | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2158 (with-parsed-tramp-file-name filename nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2159 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2160 (tramp-invoke-ange-ftp 'file-readable-p filename)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2161 (zerop (tramp-run-test "-r" filename)))) |
45861 | 2162 |
2163 (defun tramp-handle-file-accessible-directory-p (filename) | |
2164 "Like `file-accessible-directory-p' for tramp files." | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2165 (with-parsed-tramp-file-name filename nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2166 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2167 (tramp-invoke-ange-ftp 'file-accessible-directory-p filename)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2168 (and (zerop (tramp-run-test "-d" filename)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2169 (zerop (tramp-run-test "-r" filename)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2170 (zerop (tramp-run-test "-x" filename))))) |
45861 | 2171 |
2172 ;; When the remote shell is started, it looks for a shell which groks | |
2173 ;; tilde expansion. Here, we assume that all shells which grok tilde | |
2174 ;; expansion will also provide a `test' command which groks `-nt' (for | |
2175 ;; newer than). If this breaks, tell me about it and I'll try to do | |
2176 ;; something smarter about it. | |
2177 (defun tramp-handle-file-newer-than-file-p (file1 file2) | |
2178 "Like `file-newer-than-file-p' for tramp files." | |
2179 (cond ((not (file-exists-p file1)) | |
2180 nil) | |
2181 ((not (file-exists-p file2)) | |
2182 t) | |
47577
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2183 ;; We are sure both files exist at this point. |
45861 | 2184 (t |
2185 (save-excursion | |
47577
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2186 ;; We try to get the mtime of both files. If they are not |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2187 ;; equal to the "dont-know" value, then we subtract the times |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2188 ;; and obtain the result. |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2189 (let ((fa1 (file-attributes file1)) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2190 (fa2 (file-attributes file2))) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2191 (if (and (not (equal (nth 5 fa1) '(0 0))) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2192 (not (equal (nth 5 fa2) '(0 0)))) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2193 (> 0 (car (subtract-time (nth 5 fa1) (nth 5 fa2)))) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2194 ;; If one of them is the dont-know value, then we can |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2195 ;; still try to run a shell command on the remote host. |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2196 ;; However, this only works if both files are Tramp |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2197 ;; files and both have the same method, same user, same |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2198 ;; host. |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2199 (unless (and (tramp-tramp-file-p file1) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2200 (tramp-tramp-file-p file2)) |
47577
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2201 (signal |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2202 'file-error |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2203 (list |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2204 "Cannot check if Tramp file is newer than non-Tramp file" |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2205 file1 file2))) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2206 (with-parsed-tramp-file-name file1 v1 |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2207 (with-parsed-tramp-file-name file2 v2 |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2208 (when (and (tramp-ange-ftp-file-name-p |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2209 v1-multi-method v1-method) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2210 (tramp-ange-ftp-file-name-p |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2211 v2-multi-method v2-method)) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2212 (tramp-invoke-ange-ftp 'file-newer-than-file-p |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2213 file1 file2)) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2214 (unless (and (equal v1-multi-method v2-multi-method) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2215 (equal v1-method v2-method) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2216 (equal v1-user v2-user) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2217 (equal v1-host v2-host)) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2218 (signal 'file-error |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2219 (list "Files must have same method, user, host" |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2220 file1 file2))) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2221 (unless (and (tramp-tramp-file-p file1) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2222 (tramp-tramp-file-p file2)) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2223 (signal 'file-error |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2224 (list "Files must be tramp files on same host" |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2225 file1 file2))) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2226 (if (tramp-get-test-groks-nt |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2227 v1-multi-method v1-method v1-user v1-host) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2228 (zerop (tramp-run-test2 "test" file1 file2 "-nt")) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2229 (zerop (tramp-run-test2 |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2230 "tramp_test_nt" file1 file2))))))))))) |
45861 | 2231 |
2232 ;; Functions implemented using the basic functions above. | |
2233 | |
2234 (defun tramp-handle-file-modes (filename) | |
2235 "Like `file-modes' for tramp files." | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2236 (with-parsed-tramp-file-name filename nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2237 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2238 (tramp-invoke-ange-ftp 'file-modes filename)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2239 (when (file-exists-p filename) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2240 (tramp-mode-string-to-int |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2241 (nth 8 (tramp-handle-file-attributes filename)))))) |
45861 | 2242 |
2243 (defun tramp-handle-file-directory-p (filename) | |
2244 "Like `file-directory-p' for tramp files." | |
2245 ;; Care must be taken that this function returns `t' for symlinks | |
2246 ;; pointing to directories. Surely the most obvious implementation | |
2247 ;; would be `test -d', but that returns false for such symlinks. | |
2248 ;; CCC: Stefan Monnier says that `test -d' follows symlinks. And | |
2249 ;; I now think he's right. So we could be using `test -d', couldn't | |
2250 ;; we? | |
2251 ;; | |
2252 ;; Alternatives: `cd %s', `test -d %s' | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2253 (with-parsed-tramp-file-name filename nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2254 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2255 (tramp-invoke-ange-ftp 'file-directory-p filename)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2256 (save-excursion |
45861 | 2257 (zerop |
2258 (tramp-send-command-and-check | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2259 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2260 (format "test -d %s" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2261 (tramp-shell-quote-argument path)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2262 t))))) ;run command in subshell |
45861 | 2263 |
2264 (defun tramp-handle-file-regular-p (filename) | |
2265 "Like `file-regular-p' for tramp files." | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2266 (with-parsed-tramp-file-name filename nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2267 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2268 (tramp-invoke-ange-ftp 'file-regular-p filename)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2269 (and (tramp-handle-file-exists-p filename) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2270 (eq ?- (aref (nth 8 (tramp-handle-file-attributes filename)) 0))))) |
45861 | 2271 |
2272 (defun tramp-handle-file-symlink-p (filename) | |
2273 "Like `file-symlink-p' for tramp files." | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2274 (with-parsed-tramp-file-name filename nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2275 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2276 (tramp-invoke-ange-ftp 'file-symlink-p filename)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2277 (let ((x (car (tramp-handle-file-attributes filename)))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2278 (when (stringp x) x)))) |
45861 | 2279 |
2280 (defun tramp-handle-file-writable-p (filename) | |
2281 "Like `file-writable-p' for tramp files." | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2282 (with-parsed-tramp-file-name filename nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2283 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2284 (tramp-invoke-ange-ftp 'file-writable-p filename)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2285 (if (tramp-handle-file-exists-p filename) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2286 ;; Existing files must be writable. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2287 (zerop (tramp-run-test "-w" filename)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2288 ;; If file doesn't exist, check if directory is writable. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2289 (and (zerop (tramp-run-test |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2290 "-d" (tramp-handle-file-name-directory filename))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2291 (zerop (tramp-run-test |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2292 "-w" (tramp-handle-file-name-directory filename))))))) |
45861 | 2293 |
2294 (defun tramp-handle-file-ownership-preserved-p (filename) | |
2295 "Like `file-ownership-preserved-p' for tramp files." | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2296 (with-parsed-tramp-file-name filename nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2297 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2298 (tramp-invoke-ange-ftp 'file-ownership-preserved-p filename)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2299 (or (not (tramp-handle-file-exists-p filename)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2300 ;; Existing files must be writable. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2301 (zerop (tramp-run-test "-O" filename))))) |
45861 | 2302 |
2303 ;; Other file name ops. | |
2304 | |
2305 ;; ;; Matthias Köppe <mkoeppe@mail.math.uni-magdeburg.de> | |
2306 ;; (defun tramp-handle-directory-file-name (directory) | |
2307 ;; "Like `directory-file-name' for tramp files." | |
2308 ;; (if (and (eq (aref directory (- (length directory) 1)) ?/) | |
2309 ;; (not (eq (aref directory (- (length directory) 2)) ?:))) | |
2310 ;; (substring directory 0 (- (length directory) 1)) | |
2311 ;; directory)) | |
2312 | |
2313 ;; Philippe Troin <phil@fifi.org> | |
2314 (defun tramp-handle-directory-file-name (directory) | |
2315 "Like `directory-file-name' for tramp files." | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2316 (with-parsed-tramp-file-name directory nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2317 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2318 (tramp-invoke-ange-ftp 'directory-file-name directory)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2319 (let ((directory-length-1 (1- (length directory)))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2320 (save-match-data |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2321 (if (and (eq (aref directory directory-length-1) ?/) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2322 (eq (string-match tramp-file-name-regexp directory) 0) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2323 (/= (match-end 0) directory-length-1)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2324 (substring directory 0 directory-length-1) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2325 directory))))) |
45861 | 2326 |
2327 ;; Directory listings. | |
2328 | |
46752 | 2329 (defun tramp-handle-directory-files (directory |
2330 &optional full match nosort files-only) | |
45861 | 2331 "Like `directory-files' for tramp files." |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2332 (with-parsed-tramp-file-name directory nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2333 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2334 (tramp-invoke-ange-ftp 'directory-files |
46752 | 2335 directory full match nosort files-only)) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2336 (let (result x) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2337 (save-excursion |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2338 (tramp-barf-unless-okay |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2339 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2340 (concat "cd " (tramp-shell-quote-argument path)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2341 nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2342 'file-error |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2343 "tramp-handle-directory-files: couldn't `cd %s'" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2344 (tramp-shell-quote-argument path)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2345 (tramp-send-command |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2346 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2347 (concat (tramp-get-ls-command multi-method method user host) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2348 " -a | cat")) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2349 (tramp-wait-for-output) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2350 (goto-char (point-max)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2351 (while (zerop (forward-line -1)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2352 (setq x (buffer-substring (point) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2353 (tramp-line-end-position))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2354 (when (or (not match) (string-match match x)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2355 (if full |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2356 (push (concat (file-name-as-directory directory) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2357 x) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2358 result) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2359 (push x result)))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2360 (tramp-send-command multi-method method user host "cd") |
46752 | 2361 (tramp-wait-for-output) |
2362 ;; Remove non-files or non-directories if necessary. Using | |
2363 ;; the remote shell for this would probably be way faster. | |
2364 ;; Maybe something could be adapted from | |
2365 ;; tramp-handle-file-name-all-completions. | |
2366 (when files-only | |
2367 (let ((temp (nreverse result)) | |
2368 item) | |
2369 (setq result nil) | |
2370 (if (equal files-only t) | |
2371 ;; files only | |
2372 (while temp | |
2373 (setq item (pop temp)) | |
2374 (when (file-regular-p item) | |
2375 (push item result))) | |
2376 ;; directories only | |
2377 (while temp | |
2378 (setq item (pop temp)) | |
2379 (when (file-directory-p item) | |
2380 (push item result))))))) | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2381 result))) |
45861 | 2382 |
2383 ;; This function should return "foo/" for directories and "bar" for | |
2384 ;; files. We use `ls -ad' to get a list of files (including | |
2385 ;; directories), and `find . -type d \! -name . -prune' to get a list | |
2386 ;; of directories. | |
2387 (defun tramp-handle-file-name-all-completions (filename directory) | |
2388 "Like `file-name-all-completions' for tramp files." | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2389 (with-parsed-tramp-file-name directory nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2390 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2391 (tramp-invoke-ange-ftp 'file-name-all-completions |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2392 filename directory)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2393 (unless (save-match-data (string-match "/" filename)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2394 (let* ((nowild tramp-completion-without-shell-p) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2395 result) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2396 (save-excursion |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2397 (tramp-barf-unless-okay |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2398 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2399 (format "cd %s" (tramp-shell-quote-argument path)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2400 nil 'file-error |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2401 "tramp-handle-file-name-all-completions: Couldn't `cd %s'" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2402 (tramp-shell-quote-argument path)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2403 |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2404 ;; Get a list of directories and files, including reliably |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2405 ;; tagging the directories with a trailing '/'. Because I |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2406 ;; rock. --daniel@danann.net |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2407 (tramp-send-command |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2408 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2409 (format (concat "%s -a %s 2>/dev/null | while read f; do " |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2410 "if test -d \"$f\" 2>/dev/null; " |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2411 "then echo \"$f/\"; else echo \"$f\"; fi; done") |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2412 (tramp-get-ls-command multi-method method user host) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2413 (if (or nowild (zerop (length filename))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2414 "" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2415 (format "-d %s*" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2416 (tramp-shell-quote-argument filename))))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2417 |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2418 ;; Now grab the output. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2419 (tramp-wait-for-output) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2420 (goto-char (point-max)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2421 (while (zerop (forward-line -1)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2422 (push (buffer-substring (point) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2423 (tramp-line-end-position)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2424 result)) |
45861 | 2425 |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2426 (tramp-send-command multi-method method user host "cd") |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2427 (tramp-wait-for-output) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2428 |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2429 ;; Return the list. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2430 (if nowild |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2431 (all-completions filename (mapcar 'list result)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2432 result)))))) |
45861 | 2433 |
2434 | |
2435 ;; The following isn't needed for Emacs 20 but for 19.34? | |
2436 (defun tramp-handle-file-name-completion (filename directory) | |
2437 "Like `file-name-completion' for tramp files." | |
2438 (unless (tramp-tramp-file-p directory) | |
2439 (error | |
2440 "tramp-handle-file-name-completion invoked on non-tramp directory `%s'" | |
2441 directory)) | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2442 (with-parsed-tramp-file-name directory nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2443 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2444 (tramp-invoke-ange-ftp 'file-name-completion |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2445 filename directory)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2446 (try-completion |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2447 filename |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2448 (mapcar (lambda (x) (cons x nil)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2449 (tramp-handle-file-name-all-completions filename directory))))) |
45861 | 2450 |
2451 ;; cp, mv and ln | |
2452 | |
2453 (defun tramp-handle-add-name-to-file | |
2454 (filename newname &optional ok-if-already-exists) | |
2455 "Like `add-name-to-file' for tramp files." | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2456 (with-parsed-tramp-file-name filename v1 |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2457 (with-parsed-tramp-file-name newname v2 |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2458 (let ((ln (when v1 (tramp-get-remote-ln |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2459 v1-multi-method v1-method v1-user v1-host)))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2460 (unless (and v1-method v2-method v1-user v2-user v1-host v2-host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2461 (equal v1-multi-method v2-multi-method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2462 (equal v1-method v2-method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2463 (equal v1-user v2-user) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2464 (equal v1-host v2-host)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2465 (error "add-name-to-file: %s" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2466 "only implemented for same method, same user, same host")) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2467 (when (and (tramp-ange-ftp-file-name-p v1-multi-method v1-method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2468 (tramp-ange-ftp-file-name-p v2-multi-method v2-method)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2469 (tramp-invoke-ange-ftp 'add-name-to-file |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2470 filename newname ok-if-already-exists)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2471 (when (tramp-ange-ftp-file-name-p v1-multi-method v1-method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2472 (tramp-invoke-ange-ftp 'add-name-to-file |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2473 filename newname ok-if-already-exists)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2474 (when (tramp-ange-ftp-file-name-p v2-multi-method v2-method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2475 (tramp-invoke-ange-ftp 'add-name-to-file |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2476 filename newname ok-if-already-exists)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2477 (when (and (not ok-if-already-exists) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2478 (file-exists-p newname) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2479 (not (numberp ok-if-already-exists)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2480 (y-or-n-p |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2481 (format |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2482 "File %s already exists; make it a new name anyway? " |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2483 newname))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2484 (error "add-name-to-file: file %s already exists" newname)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2485 (tramp-barf-unless-okay |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2486 v1-multi-method v1-method v1-user v1-host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2487 (format "%s %s %s" ln (tramp-shell-quote-argument v1-path) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2488 (tramp-shell-quote-argument v2-path)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2489 nil 'file-error |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2490 "error with add-name-to-file, see buffer `%s' for details" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2491 (buffer-name)))))) |
45861 | 2492 |
2493 (defun tramp-handle-copy-file | |
2494 (filename newname &optional ok-if-already-exists keep-date) | |
2495 "Like `copy-file' for tramp files." | |
2496 ;; Check if both files are local -- invoke normal copy-file. | |
2497 ;; Otherwise, use tramp from local system. | |
2498 (setq filename (expand-file-name filename)) | |
2499 (setq newname (expand-file-name newname)) | |
2500 ;; At least one file a tramp file? | |
2501 (if (or (tramp-tramp-file-p filename) | |
2502 (tramp-tramp-file-p newname)) | |
2503 (tramp-do-copy-or-rename-file | |
2504 'copy filename newname ok-if-already-exists keep-date) | |
2505 (tramp-run-real-handler | |
2506 'copy-file | |
2507 (list filename newname ok-if-already-exists keep-date)))) | |
2508 | |
2509 (defun tramp-handle-rename-file | |
2510 (filename newname &optional ok-if-already-exists) | |
2511 "Like `rename-file' for tramp files." | |
2512 ;; Check if both files are local -- invoke normal rename-file. | |
2513 ;; Otherwise, use tramp from local system. | |
2514 (setq filename (expand-file-name filename)) | |
2515 (setq newname (expand-file-name newname)) | |
2516 ;; At least one file a tramp file? | |
2517 (if (or (tramp-tramp-file-p filename) | |
2518 (tramp-tramp-file-p newname)) | |
2519 (tramp-do-copy-or-rename-file | |
2520 'rename filename newname ok-if-already-exists) | |
2521 (tramp-run-real-handler 'rename-file | |
2522 (list filename newname ok-if-already-exists)))) | |
2523 | |
2524 (defun tramp-do-copy-or-rename-file | |
2525 (op filename newname &optional ok-if-already-exists keep-date) | |
2526 "Copy or rename a remote file. | |
2527 OP must be `copy' or `rename' and indicates the operation to perform. | |
2528 FILENAME specifies the file to copy or rename, NEWNAME is the name of | |
2529 the new file (for copy) or the new name of the file (for rename). | |
2530 OK-IF-ALREADY-EXISTS means don't barf if NEWNAME exists already. | |
2531 KEEP-DATE means to make sure that NEWNAME has the same timestamp | |
2532 as FILENAME. | |
2533 | |
2534 This function is invoked by `tramp-handle-copy-file' and | |
2535 `tramp-handle-rename-file'. It is an error if OP is neither of `copy' | |
2536 and `rename'. FILENAME and NEWNAME must be absolute file names." | |
2537 (unless (memq op '(copy rename)) | |
2538 (error "Unknown operation `%s', must be `copy' or `rename'" op)) | |
2539 (unless ok-if-already-exists | |
2540 (when (file-exists-p newname) | |
2541 (signal 'file-already-exists | |
2542 (list newname)))) | |
46584
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2543 (let ((t1 (tramp-tramp-file-p filename)) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2544 (t2 (tramp-tramp-file-p newname))) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2545 ;; Check which ones of source and target are Tramp files. |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2546 (cond |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2547 ((and t1 t2) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2548 ;; Both are Tramp files. |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2549 (with-parsed-tramp-file-name filename v1 |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2550 (with-parsed-tramp-file-name newname v2 |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2551 ;; Possibly invoke Ange-FTP. |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2552 (when (and (tramp-ange-ftp-file-name-p v1-multi-method v1-method) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2553 (tramp-ange-ftp-file-name-p v2-multi-method v2-method)) |
47205
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
2554 (if (eq op 'copy) |
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
2555 (tramp-invoke-ange-ftp |
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
2556 'copy-file filename newname ok-if-already-exists keep-date) |
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
2557 (tramp-invoke-ange-ftp |
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
2558 'rename-file filename newname ok-if-already-exists))) |
46584
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2559 ;; Check if we can use a shortcut. |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2560 (if (and (equal v1-multi-method v2-multi-method) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2561 (equal v1-method v2-method) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2562 (equal v1-host v2-host) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2563 (equal v1-user v2-user)) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2564 ;; Shortcut: if method, host, user are the same for both |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2565 ;; files, we invoke `cp' or `mv' on the remote host |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2566 ;; directly. |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2567 (tramp-do-copy-or-rename-file-directly |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2568 op v1-multi-method v1-method v1-user v1-host |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2569 v1-path v2-path keep-date) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2570 ;; The shortcut was not possible. So we copy the |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2571 ;; file first. If the operation was `rename', we go |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2572 ;; back and delete the original file (if the copy was |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2573 ;; successful). The approach is simple-minded: we |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2574 ;; create a new buffer, insert the contents of the |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2575 ;; source file into it, then write out the buffer to |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2576 ;; the target file. The advantage is that it doesn't |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2577 ;; matter which filename handlers are used for the |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2578 ;; source and target file. |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2579 |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2580 ;; CCC: If both source and target are Tramp files, |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2581 ;; and both are using the same rcp-program, then we |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2582 ;; can invoke rcp directly. Note that |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2583 ;; default-directory should point to a local |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2584 ;; directory if we want to invoke rcp. |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2585 (tramp-do-copy-or-rename-via-buffer |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2586 op filename newname keep-date))))) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2587 ((or t1 t2) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2588 ;; Use the generic method via a Tramp buffer. |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2589 (tramp-do-copy-or-rename-via-buffer op filename newname keep-date)) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2590 (t |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2591 ;; One of them must be a Tramp file. |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2592 (error "Tramp implementation says this cannot happen"))))) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2593 |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2594 (defun tramp-do-copy-or-rename-via-buffer (op filename newname keep-date) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2595 "Use an Emacs buffer to copy or rename a file. |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2596 First arg OP is either `copy' or `rename' and indicates the operation. |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2597 FILENAME is the source file, NEWNAME the target file. |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2598 KEEP-DATE is non-nil if NEWNAME should have the same timestamp as FILENAME." |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2599 (let ((trampbuf (get-buffer-create "*tramp output*"))) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2600 (when keep-date |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2601 (tramp-message |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2602 1 (concat "Warning: cannot preserve file time stamp" |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2603 " with inline copying across machines"))) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2604 (save-excursion |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2605 (set-buffer trampbuf) (erase-buffer) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2606 (insert-file-contents-literally filename) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2607 (let ((coding-system-for-write 'no-conversion)) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2608 (write-region (point-min) (point-max) newname))) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2609 ;; If the operation was `rename', delete the original file. |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2610 (unless (eq op 'copy) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
2611 (delete-file filename)))) |
45861 | 2612 |
2613 (defun tramp-do-copy-or-rename-file-directly | |
2614 (op multi-method method user host path1 path2 keep-date) | |
2615 "Invokes `cp' or `mv' on the remote system. | |
2616 OP must be one of `copy' or `rename', indicating `cp' or `mv', | |
2617 respectively. METHOD, USER, and HOST specify the connection. | |
2618 PATH1 and PATH2 specify the two arguments of `cp' or `mv'. | |
2619 If KEEP-DATE is non-nil, preserve the time stamp when copying." | |
2620 ;; CCC: What happens to the timestamp when renaming? | |
2621 (let ((cmd (cond ((and (eq op 'copy) keep-date) "cp -f -p") | |
2622 ((eq op 'copy) "cp -f") | |
2623 ((eq op 'rename) "mv -f") | |
2624 (t (error | |
2625 "Unknown operation `%s', must be `copy' or `rename'" | |
2626 op))))) | |
2627 (save-excursion | |
2628 (tramp-barf-unless-okay | |
2629 multi-method method user host | |
2630 (format "%s %s %s" | |
2631 cmd | |
2632 (tramp-shell-quote-argument path1) | |
2633 (tramp-shell-quote-argument path2)) | |
2634 nil 'file-error | |
2635 "Copying directly failed, see buffer `%s' for details." | |
2636 (buffer-name))))) | |
2637 | |
2638 ;; mkdir | |
2639 (defun tramp-handle-make-directory (dir &optional parents) | |
2640 "Like `make-directory' for tramp files." | |
46752 | 2641 (setq dir (expand-file-name dir)) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2642 (with-parsed-tramp-file-name dir nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2643 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2644 (tramp-invoke-ange-ftp 'make-directory dir parents)) |
46790 | 2645 (save-excursion |
2646 (tramp-barf-unless-okay | |
2647 multi-method method user host | |
2648 (format " %s %s" | |
2649 (if parents "mkdir -p" "mkdir") | |
2650 (tramp-shell-quote-argument path)) | |
2651 nil 'file-error | |
2652 "Couldn't make directory %s" dir)))) | |
45861 | 2653 |
2654 ;; CCC error checking? | |
2655 (defun tramp-handle-delete-directory (directory) | |
2656 "Like `delete-directory' for tramp files." | |
46752 | 2657 (setq directory (expand-file-name directory)) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2658 (with-parsed-tramp-file-name directory nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2659 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2660 (tramp-invoke-ange-ftp 'delete-directory directory)) |
45861 | 2661 (save-excursion |
2662 (tramp-send-command | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2663 multi-method method user host |
45861 | 2664 (format "rmdir %s ; echo ok" |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2665 (tramp-shell-quote-argument path))) |
45861 | 2666 (tramp-wait-for-output)))) |
2667 | |
2668 (defun tramp-handle-delete-file (filename) | |
2669 "Like `delete-file' for tramp files." | |
46752 | 2670 (setq filename (expand-file-name filename)) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2671 (with-parsed-tramp-file-name filename nil |
46048
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
2672 (when (tramp-ange-ftp-file-name-p multi-method method) |
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
2673 (tramp-invoke-ange-ftp 'delete-file filename)) |
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
2674 (save-excursion |
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
2675 (unless (zerop (tramp-send-command-and-check |
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
2676 multi-method method user host |
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
2677 (format "rm -f %s" |
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
2678 (tramp-shell-quote-argument path)))) |
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
2679 (signal 'file-error "Couldn't delete Tramp file"))))) |
45861 | 2680 |
2681 ;; Dired. | |
2682 | |
2683 ;; CCC: This does not seem to be enough. Something dies when | |
2684 ;; we try and delete two directories under TRAMP :/ | |
2685 (defun tramp-handle-dired-recursive-delete-directory (filename) | |
2686 "Recursively delete the directory given. | |
2687 This is like `dired-recursive-delete-directory' for tramp files." | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2688 (with-parsed-tramp-file-name filename nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2689 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2690 (tramp-invoke-ange-ftp 'dired-recursive-delete-directory |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2691 filename)) |
45861 | 2692 ;; run a shell command 'rm -r <path>' |
2693 ;; Code shamelessly stolen for the dired implementation and, um, hacked :) | |
2694 (or (tramp-handle-file-exists-p filename) | |
2695 (signal | |
2696 'file-error | |
2697 (list "Removing old file name" "no such directory" filename))) | |
2698 ;; Which is better, -r or -R? (-r works for me <daniel@danann.net>) | |
2699 (tramp-send-command multi-method method user host | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2700 (format "rm -r %s" (tramp-shell-quote-argument path))) |
45861 | 2701 ;; Wait for the remote system to return to us... |
2702 ;; This might take a while, allow it plenty of time. | |
2703 (tramp-wait-for-output 120) | |
2704 ;; Make sure that it worked... | |
2705 (and (tramp-handle-file-exists-p filename) | |
2706 (error "Failed to recusively delete %s" filename)))) | |
2707 | |
2708 | |
2709 (defun tramp-handle-dired-call-process (program discard &rest arguments) | |
2710 "Like `dired-call-process' for tramp files." | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2711 (with-parsed-tramp-file-name default-directory nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2712 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2713 (let ((default-directory |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2714 (tramp-make-ange-ftp-file-name user host path))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2715 (tramp-invoke-ange-ftp 'dired-call-process |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2716 program discard arguments))) |
45861 | 2717 (save-excursion |
2718 (tramp-barf-unless-okay | |
2719 multi-method method user host | |
2720 (format "cd %s" (tramp-shell-quote-argument path)) | |
2721 nil 'file-error | |
2722 "tramp-handle-dired-call-process: Couldn't `cd %s'" | |
2723 (tramp-shell-quote-argument path)) | |
2724 (tramp-send-command | |
2725 multi-method method user host | |
2726 (mapconcat #'tramp-shell-quote-argument (cons program arguments) " ")) | |
2727 (tramp-wait-for-output)) | |
2728 (unless discard | |
2729 (insert-buffer (tramp-get-buffer multi-method method user host))) | |
2730 (save-excursion | |
2731 (prog1 | |
2732 (tramp-send-command-and-check multi-method method user host nil) | |
2733 (tramp-send-command multi-method method user host "cd") | |
2734 (tramp-wait-for-output))))) | |
2735 | |
2736 ;; Pacify byte-compiler. The function is needed on XEmacs only. I'm | |
2737 ;; not sure at all that this is the right way to do it, but let's hope | |
2738 ;; it works for now, and wait for a guru to point out the Right Way to | |
2739 ;; achieve this. | |
2740 ;;(eval-when-compile | |
2741 ;; (unless (fboundp 'dired-insert-set-properties) | |
2742 ;; (fset 'dired-insert-set-properties 'ignore))) | |
2743 ;; Gerd suggests this: | |
2744 (eval-when-compile (require 'dired)) | |
2745 ;; Note that dired is required at run-time, too, when it is needed. | |
2746 ;; It is only needed on XEmacs for the function | |
2747 ;; `dired-insert-set-properties'. | |
2748 | |
2749 (defun tramp-handle-insert-directory | |
2750 (filename switches &optional wildcard full-directory-p) | |
2751 "Like `insert-directory' for tramp files." | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2752 ;; For the moment, we assume that the remote "ls" program does not |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2753 ;; grok "--dired". In the future, we should detect this on |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2754 ;; connection setup. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2755 (when (string-match "^--dired\\s-+" switches) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2756 (setq switches (replace-match "" nil t switches))) |
46752 | 2757 (setq filename (expand-file-name filename)) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2758 (with-parsed-tramp-file-name filename nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2759 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2760 (tramp-invoke-ange-ftp 'insert-directory |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2761 filename switches wildcard full-directory-p)) |
45861 | 2762 (tramp-message-for-buffer |
2763 multi-method method user host 10 | |
2764 "Inserting directory `ls %s %s', wildcard %s, fulldir %s" | |
2765 switches filename (if wildcard "yes" "no") | |
2766 (if full-directory-p "yes" "no")) | |
2767 (when wildcard | |
2768 (setq wildcard (file-name-nondirectory path)) | |
2769 (setq path (file-name-directory path))) | |
2770 (when (listp switches) | |
2771 (setq switches (mapconcat 'identity switches " "))) | |
2772 (unless full-directory-p | |
2773 (setq switches (concat "-d " switches))) | |
2774 (when wildcard | |
2775 (setq switches (concat switches " " wildcard))) | |
2776 (save-excursion | |
2777 ;; If `full-directory-p', we just say `ls -l FILENAME'. | |
2778 ;; Else we chdir to the parent directory, then say `ls -ld BASENAME'. | |
2779 (if full-directory-p | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2780 (tramp-send-command |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2781 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2782 (format "%s %s %s" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2783 (tramp-get-ls-command multi-method method user host) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2784 switches |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2785 (if wildcard |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2786 path |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2787 (tramp-shell-quote-argument (concat path "."))))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2788 (tramp-barf-unless-okay |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2789 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2790 (format "cd %s" (tramp-shell-quote-argument |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2791 (file-name-directory path))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2792 nil 'file-error |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2793 "Couldn't `cd %s'" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2794 (tramp-shell-quote-argument (file-name-directory path))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2795 (tramp-send-command |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2796 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2797 (format "%s %s %s" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2798 (tramp-get-ls-command multi-method method user host) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2799 switches |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2800 (if full-directory-p |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2801 ;; Add "/." to make sure we got complete dir |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2802 ;; listing for symlinks, too. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2803 (concat (file-name-as-directory |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2804 (file-name-nondirectory path)) ".") |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2805 (file-name-nondirectory path))))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2806 (sit-for 1) ;needed for rsh but not ssh? |
45861 | 2807 (tramp-wait-for-output)) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2808 (let ((old-pos (point))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2809 (insert-buffer-substring |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2810 (tramp-get-buffer multi-method method user host)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2811 ;; On XEmacs, we want to call (exchange-point-and-mark t), but |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2812 ;; that doesn't exist on Emacs, so we use this workaround instead. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2813 ;; Since zmacs-region-stays doesn't exist in Emacs, this ought to |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2814 ;; be safe. Thanks to Daniel Pittman <daniel@danann.net>. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2815 ;; (let ((zmacs-region-stays t)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2816 ;; (exchange-point-and-mark)) |
45861 | 2817 (save-excursion |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2818 (tramp-send-command multi-method method user host "cd") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2819 (tramp-wait-for-output)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2820 ;; Another XEmacs specialty follows. What's the right way to do |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2821 ;; it? |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2822 (when (and (featurep 'xemacs) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2823 (eq major-mode 'dired-mode)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2824 (save-excursion |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2825 (require 'dired) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2826 (dired-insert-set-properties old-pos (point))))))) |
45861 | 2827 |
2828 ;; Continuation of kluge to pacify byte-compiler. | |
2829 ;;(eval-when-compile | |
2830 ;; (when (eq (symbol-function 'dired-insert-set-properties) 'ignore) | |
2831 ;; (fmakunbound 'dired-insert-set-properties))) | |
2832 | |
2833 ;; CCC is this the right thing to do? | |
2834 (defun tramp-handle-unhandled-file-name-directory (filename) | |
2835 "Like `unhandled-file-name-directory' for tramp files." | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2836 (with-parsed-tramp-file-name filename nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2837 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2838 (tramp-invoke-ange-ftp 'unhandled-file-name-directory |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2839 filename)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2840 (expand-file-name "~/"))) |
45861 | 2841 |
2842 ;; Canonicalization of file names. | |
2843 | |
2844 (defun tramp-drop-volume-letter (name) | |
2845 "Cut off unnecessary drive letter from file NAME. | |
2846 The function `tramp-handle-expand-file-name' calls `expand-file-name' | |
2847 locally on a remote file name. When the local system is a W32 system | |
2848 but the remote system is Unix, this introduces a superfluous drive | |
2849 letter into the file name. This function removes it. | |
2850 | |
2851 Doesn't do anything if the NAME does not start with a drive letter." | |
2852 (if (and (> (length name) 1) | |
2853 (char-equal (aref name 1) ?:) | |
2854 (let ((c1 (aref name 0))) | |
2855 (or (and (>= c1 ?A) (<= c1 ?Z)) | |
2856 (and (>= c1 ?a) (<= c1 ?z))))) | |
2857 (substring name 2) | |
2858 name)) | |
2859 | |
2860 (defun tramp-handle-expand-file-name (name &optional dir) | |
2861 "Like `expand-file-name' for tramp files." | |
2862 ;; If DIR is not given, use DEFAULT-DIRECTORY or "/". | |
2863 (setq dir (or dir default-directory "/")) | |
2864 ;; Unless NAME is absolute, concat DIR and NAME. | |
2865 (unless (file-name-absolute-p name) | |
2866 (setq name (concat (file-name-as-directory dir) name))) | |
2867 ;; If NAME is not a tramp file, run the real handler | |
2868 (if (not (tramp-tramp-file-p name)) | |
2869 (tramp-run-real-handler 'expand-file-name | |
2870 (list name nil)) | |
2871 ;; Dissect NAME. | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2872 (with-parsed-tramp-file-name name nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2873 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2874 (tramp-invoke-ange-ftp 'expand-file-name name nil)) |
45861 | 2875 (unless (file-name-absolute-p path) |
2876 (setq path (concat "~/" path))) | |
2877 (save-excursion | |
2878 ;; Tilde expansion if necessary. This needs a shell which | |
2879 ;; groks tilde expansion! The function `tramp-find-shell' is | |
2880 ;; supposed to find such a shell on the remote host. Please | |
2881 ;; tell me about it when this doesn't work on your system. | |
2882 (when (string-match "\\`\\(~[^/]*\\)\\(.*\\)\\'" path) | |
2883 (let ((uname (match-string 1 path)) | |
2884 (fname (match-string 2 path))) | |
2885 ;; CCC fanatic error checking? | |
2886 (set-buffer (tramp-get-buffer multi-method method user host)) | |
2887 (erase-buffer) | |
2888 (tramp-send-command | |
2889 multi-method method user host | |
2890 (format "cd %s; pwd" uname) | |
2891 t) | |
2892 (tramp-wait-for-output) | |
2893 (goto-char (point-min)) | |
2894 (setq uname (buffer-substring (point) (tramp-line-end-position))) | |
2895 (setq path (concat uname fname)) | |
2896 (erase-buffer))) | |
2897 ;; No tilde characters in file name, do normal | |
2898 ;; expand-file-name (this does "/./" and "/../"). We bind | |
2899 ;; directory-sep-char here for XEmacs on Windows, which would | |
2900 ;; otherwise use backslash. | |
2901 (let ((directory-sep-char ?/)) | |
2902 (tramp-make-tramp-file-name | |
2903 multi-method method user host | |
2904 (tramp-drop-volume-letter | |
2905 (tramp-run-real-handler 'expand-file-name (list path))))))))) | |
2906 | |
2907 ;; Remote commands. | |
2908 | |
2909 (defun tramp-handle-shell-command (command &optional output-buffer error-buffer) | |
2910 "Like `shell-command' for tramp files. | |
2911 This will break if COMMAND prints a newline, followed by the value of | |
2912 `tramp-end-of-output', followed by another newline." | |
46752 | 2913 (when (tramp-tramp-file-p default-directory) |
2914 (with-parsed-tramp-file-name default-directory nil | |
2915 (when (tramp-ange-ftp-file-name-p multi-method method) | |
2916 (let ((default-directory (tramp-make-ange-ftp-file-name | |
2917 user host path))) | |
2918 (tramp-invoke-ange-ftp 'shell-command | |
2919 command output-buffer error-buffer))) | |
2920 (let (status) | |
2921 (when (string-match "&[ \t]*\\'" command) | |
2922 (error "Tramp doesn't grok asynchronous shell commands, yet")) | |
2923 (when error-buffer | |
2924 (error "Tramp doesn't grok optional third arg ERROR-BUFFER, yet")) | |
2925 (save-excursion | |
2926 (tramp-barf-unless-okay | |
2927 multi-method method user host | |
2928 (format "cd %s" (tramp-shell-quote-argument path)) | |
2929 nil 'file-error | |
2930 "tramp-handle-shell-command: Couldn't `cd %s'" | |
2931 (tramp-shell-quote-argument path)) | |
2932 (tramp-send-command multi-method method user host | |
2933 (concat command "; tramp_old_status=$?")) | |
2934 ;; This will break if the shell command prints "/////" | |
2935 ;; somewhere. Let's just hope for the best... | |
2936 (tramp-wait-for-output)) | |
2937 (unless output-buffer | |
2938 (setq output-buffer (get-buffer-create "*Shell Command Output*")) | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2939 (set-buffer output-buffer) |
46752 | 2940 (erase-buffer)) |
2941 (unless (bufferp output-buffer) | |
2942 (setq output-buffer (current-buffer))) | |
2943 (set-buffer output-buffer) | |
2944 (insert-buffer (tramp-get-buffer multi-method method user host)) | |
2945 (save-excursion | |
2946 (tramp-send-command multi-method method user host "cd") | |
2947 (tramp-wait-for-output) | |
2948 (tramp-send-command | |
2949 multi-method method user host | |
2950 (concat "tramp_set_exit_status $tramp_old_status;" | |
2951 " echo tramp_exit_status $?")) | |
2952 (tramp-wait-for-output) | |
2953 (goto-char (point-max)) | |
2954 (unless (search-backward "tramp_exit_status " nil t) | |
2955 (error "Couldn't find exit status of `%s'" command)) | |
2956 (skip-chars-forward "^ ") | |
2957 (setq status (read (current-buffer)))) | |
2958 (unless (zerop (buffer-size)) | |
2959 (pop-to-buffer output-buffer)) | |
2960 status))) | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2961 ;; The following is only executed if something strange was |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2962 ;; happening. Emit a helpful message and do it anyway. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2963 (message "tramp-handle-shell-command called with non-tramp directory: `%s'" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2964 default-directory) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2965 (tramp-run-real-handler 'shell-command |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2966 (list command output-buffer error-buffer))) |
45861 | 2967 |
2968 ;; File Editing. | |
2969 | |
2970 (defsubst tramp-make-temp-file () | |
2971 (funcall (if (fboundp 'make-temp-file) 'make-temp-file 'make-temp-name) | |
2972 (expand-file-name tramp-temp-name-prefix | |
2973 (tramp-temporary-file-directory)))) | |
2974 | |
2975 (defun tramp-handle-file-local-copy (filename) | |
2976 "Like `file-local-copy' for tramp files." | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2977 (with-parsed-tramp-file-name filename nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2978 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2979 (tramp-invoke-ange-ftp 'file-local-copy filename)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2980 (let ((trampbuf (get-buffer-create "*tramp output*")) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2981 (rcp-program (tramp-get-rcp-program |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2982 multi-method |
47577
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2983 (tramp-find-method multi-method method user host) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2984 user host)) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2985 (rcp-args (tramp-get-rcp-args |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2986 multi-method |
47577
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2987 (tramp-find-method multi-method method user host) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
2988 user host)) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2989 tmpfil) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2990 (unless (file-exists-p filename) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2991 (error "Cannot make local copy of non-existing file `%s'" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2992 filename)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2993 (setq tmpfil (tramp-make-temp-file)) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
2994 (cond (rcp-program |
46752 | 2995 ;; Use rcp-like program for file transfer. |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2996 (tramp-message-for-buffer |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2997 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2998 5 "Fetching %s to tmp file %s..." filename tmpfil) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
2999 (save-excursion (set-buffer trampbuf) (erase-buffer)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3000 (unless (equal |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3001 0 |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3002 (apply #'call-process |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3003 rcp-program |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3004 nil trampbuf nil |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3005 (append rcp-args |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3006 (list |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3007 (tramp-make-rcp-program-file-name |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3008 user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3009 (tramp-shell-quote-argument path)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3010 tmpfil)))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3011 (pop-to-buffer trampbuf) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3012 (error |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3013 (concat "tramp-handle-file-local-copy: `%s' didn't work, " |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3014 "see buffer `%s' for details") |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3015 rcp-program trampbuf)) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3016 (tramp-message-for-buffer |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3017 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3018 5 "Fetching %s to tmp file %s...done" filename tmpfil)) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3019 ((and (tramp-get-remote-encoding multi-method method user host) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3020 (tramp-get-remote-decoding multi-method method user host)) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3021 ;; Use inline encoding for file transfer. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3022 (save-excursion |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3023 ;; Following line for setting tramp-current-method, |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3024 ;; tramp-current-user, tramp-current-host. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3025 (set-buffer (tramp-get-buffer multi-method method user host)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3026 (tramp-message 5 "Encoding remote file %s..." filename) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3027 (tramp-barf-unless-okay |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3028 multi-method method user host |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3029 (concat (tramp-get-remote-encoding |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3030 multi-method method user host) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3031 " < " (tramp-shell-quote-argument path)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3032 nil 'file-error |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3033 "Encoding remote file failed, see buffer `%s' for details" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3034 (tramp-get-buffer multi-method method user host)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3035 ;; Remove trailing status code |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3036 (goto-char (point-max)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3037 (delete-region (point) (progn (forward-line -1) (point))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3038 |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3039 (tramp-message 5 "Decoding remote file %s..." filename) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3040 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3041 (let ((loc-enc (tramp-get-local-encoding |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3042 multi-method method user host)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3043 (loc-dec (tramp-get-local-decoding |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3044 multi-method method user host))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3045 (if (and (symbolp loc-dec) (fboundp loc-dec)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3046 ;; If local decoding is a function, we call it. |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3047 (let ((tmpbuf (get-buffer-create " *tramp tmp*"))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3048 (set-buffer tmpbuf) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3049 (erase-buffer) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3050 (insert-buffer (tramp-get-buffer multi-method method |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3051 user host)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3052 (tramp-message-for-buffer |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3053 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3054 6 "Decoding remote file %s with function %s..." |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3055 filename loc-dec) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3056 (set-buffer tmpbuf) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3057 ;; Douglas Gray Stephens <DGrayStephens@slb.com> |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3058 ;; says that we need to strip tramp_exit_status |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3059 ;; line from the output here. Go to point-max, |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3060 ;; search backward for tramp_exit_status, delete |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3061 ;; between point and point-max if found. |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3062 (let ((coding-system-for-write 'no-conversion)) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3063 (funcall loc-dec (point-min) (point-max)) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3064 (write-region (point-min) (point-max) tmpfil)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3065 (kill-buffer tmpbuf)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3066 ;; If tramp-decoding-function is not defined for this |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3067 ;; method, we invoke tramp-decoding-command instead. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3068 (let ((tmpfil2 (tramp-make-temp-file))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3069 (write-region (point-min) (point-max) tmpfil2) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3070 (tramp-message |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3071 6 "Decoding remote file %s with command %s..." |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3072 filename loc-dec) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3073 (tramp-call-local-coding-command |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3074 loc-dec tmpfil2 tmpfil) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3075 (delete-file tmpfil2))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3076 (tramp-message-for-buffer |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3077 multi-method method user host |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3078 5 "Decoding remote file %s...done" filename)))) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3079 |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3080 (t (error "Wrong method specification for `%s'" method))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3081 tmpfil))) |
45861 | 3082 |
3083 | |
3084 (defun tramp-handle-insert-file-contents | |
3085 (filename &optional visit beg end replace) | |
3086 "Like `insert-file-contents' for tramp files." | |
3087 (barf-if-buffer-read-only) | |
3088 (setq filename (expand-file-name filename)) | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3089 (with-parsed-tramp-file-name filename nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3090 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3091 (tramp-invoke-ange-ftp 'insert-file-contents |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3092 filename visit beg end replace)) |
45861 | 3093 (if (not (tramp-handle-file-exists-p filename)) |
3094 (progn | |
3095 (when visit | |
3096 (setq buffer-file-name filename) | |
3097 (set-visited-file-modtime) | |
3098 (set-buffer-modified-p nil)) | |
3099 (signal 'file-error | |
3100 (format "File `%s' not found on remote host" filename)) | |
3101 (list (tramp-handle-expand-file-name filename) 0)) | |
3102 (let ((local-copy (tramp-handle-file-local-copy filename)) | |
3103 (coding-system-used nil) | |
3104 (result nil)) | |
3105 (when visit | |
3106 (setq buffer-file-name filename) | |
3107 (set-visited-file-modtime) | |
3108 (set-buffer-modified-p nil)) | |
3109 (tramp-message-for-buffer | |
3110 multi-method method user host | |
3111 9 "Inserting local temp file `%s'..." local-copy) | |
3112 (setq result | |
3113 (tramp-run-real-handler 'insert-file-contents | |
3114 (list local-copy nil beg end replace))) | |
3115 ;; Now `last-coding-system-used' has right value. Remember it. | |
3116 (when (boundp 'last-coding-system-used) | |
3117 (setq coding-system-used last-coding-system-used)) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3118 (tramp-message-for-buffer |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3119 multi-method method user host |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3120 9 "Inserting local temp file `%s'...done" local-copy) |
45861 | 3121 (delete-file local-copy) |
3122 (when (boundp 'last-coding-system-used) | |
3123 (setq last-coding-system-used coding-system-used)) | |
3124 (list (expand-file-name filename) | |
3125 (second result)))))) | |
3126 | |
3127 ;; CCC grok APPEND, LOCKNAME, CONFIRM | |
3128 (defun tramp-handle-write-region | |
3129 (start end filename &optional append visit lockname confirm) | |
3130 "Like `write-region' for tramp files." | |
3131 (unless (eq append nil) | |
3132 (error "Cannot append to file using tramp (`%s')" filename)) | |
3133 (setq filename (expand-file-name filename)) | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3134 ;; Following part commented out because we don't know what to do about |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3135 ;; file locking, and it does not appear to be a problem to ignore it. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3136 ;; Ange-ftp ignores it, too. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3137 ;; (when (and lockname (stringp lockname)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3138 ;; (setq lockname (expand-file-name lockname))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3139 ;; (unless (or (eq lockname nil) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3140 ;; (string= lockname filename)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3141 ;; (error |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3142 ;; "tramp-handle-write-region: LOCKNAME must be nil or equal FILENAME")) |
45861 | 3143 ;; XEmacs takes a coding system as the sevent argument, not `confirm' |
3144 (when (and (not (featurep 'xemacs)) | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3145 confirm (file-exists-p filename)) |
45861 | 3146 (unless (y-or-n-p (format "File %s exists; overwrite anyway? " |
3147 filename)) | |
3148 (error "File not overwritten"))) | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3149 (with-parsed-tramp-file-name filename nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3150 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3151 (tramp-invoke-ange-ftp 'write-region |
47205
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
3152 start end filename append visit)) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3153 (let ((curbuf (current-buffer)) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3154 (rcp-program (tramp-get-rcp-program |
47577
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
3155 multi-method (tramp-find-method multi-method method user host) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
3156 user host)) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3157 (rcp-args (tramp-get-rcp-args |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3158 multi-method |
47577
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
3159 (tramp-find-method multi-method method user host) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
3160 user host)) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3161 (rem-enc (tramp-get-remote-encoding multi-method method user host)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3162 (rem-dec (tramp-get-remote-decoding multi-method method user host)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3163 (loc-enc (tramp-get-local-encoding multi-method method user host)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3164 (loc-dec (tramp-get-local-decoding multi-method method user host)) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3165 (trampbuf (get-buffer-create "*tramp output*")) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3166 ;; We use this to save the value of `last-coding-system-used' |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3167 ;; after writing the tmp file. At the end of the function, |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3168 ;; we set `last-coding-system-used' to this saved value. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3169 ;; This way, any intermediary coding systems used while |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3170 ;; talking to the remote shell or suchlike won't hose this |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3171 ;; variable. This approach was snarfed from ange-ftp.el. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3172 coding-system-used |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3173 tmpfil) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3174 ;; Write region into a tmp file. This isn't really needed if we |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3175 ;; use an encoding function, but currently we use it always |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3176 ;; because this makes the logic simpler. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3177 (setq tmpfil (tramp-make-temp-file)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3178 ;; We say `no-message' here because we don't want the visited file |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3179 ;; modtime data to be clobbered from the temp file. We call |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3180 ;; `set-visited-file-modtime' ourselves later on. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3181 (tramp-run-real-handler |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3182 'write-region |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3183 (if confirm ; don't pass this arg unless defined for backward compat. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3184 (list start end tmpfil append 'no-message lockname confirm) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3185 (list start end tmpfil append 'no-message lockname))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3186 ;; Now, `last-coding-system-used' has the right value. Remember it. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3187 (when (boundp 'last-coding-system-used) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3188 (setq coding-system-used last-coding-system-used)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3189 ;; This is a bit lengthy due to the different methods possible for |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3190 ;; file transfer. First, we check whether the method uses an rcp |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3191 ;; program. If so, we call it. Otherwise, both encoding and |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3192 ;; decoding command must be specified. However, if the method |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3193 ;; _also_ specifies an encoding function, then that is used for |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3194 ;; encoding the contents of the tmp file. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3195 (cond (rcp-program |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3196 ;; use rcp-like program for file transfer |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3197 (let ((argl (append rcp-args |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3198 (list |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3199 tmpfil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3200 (tramp-make-rcp-program-file-name |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3201 user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3202 (tramp-shell-quote-argument path)))))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3203 (tramp-message-for-buffer |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3204 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3205 6 "Writing tmp file using `%s'..." rcp-program) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3206 (save-excursion (set-buffer trampbuf) (erase-buffer)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3207 (when tramp-debug-buffer |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3208 (save-excursion |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3209 (set-buffer (tramp-get-debug-buffer multi-method |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3210 method user host)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3211 (goto-char (point-max)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3212 (tramp-insert-with-face |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3213 'bold (format "$ %s %s\n" rcp-program |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3214 (mapconcat 'identity argl " "))))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3215 (unless (equal 0 |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3216 (apply #'call-process |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3217 rcp-program nil trampbuf nil argl)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3218 (pop-to-buffer trampbuf) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3219 (error |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3220 "Cannot write region to file `%s', command `%s' failed" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3221 filename rcp-program)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3222 (tramp-message-for-buffer |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3223 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3224 6 "Transferring file using `%s'...done" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3225 rcp-program))) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3226 ((and rem-enc rem-dec) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3227 ;; Use inline file transfer |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3228 (let ((tmpbuf (get-buffer-create " *tramp file transfer*"))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3229 (save-excursion |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3230 ;; Encode tmpfil into tmpbuf |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3231 (tramp-message-for-buffer multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3232 5 "Encoding region...") |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3233 (set-buffer tmpbuf) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3234 (erase-buffer) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3235 ;; Use encoding function or command. |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3236 (if (and (symbolp loc-enc) (fboundp loc-enc)) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3237 (progn |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3238 (tramp-message-for-buffer |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3239 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3240 6 "Encoding region using function...") |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3241 (insert-file-contents-literally tmpfil) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3242 ;; CCC. The following `let' is a workaround for |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3243 ;; the base64.el that comes with pgnus-0.84. If |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3244 ;; both of the following conditions are |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3245 ;; satisfied, it tries to write to a local file |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3246 ;; in default-directory, but at this point, |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3247 ;; default-directory is remote. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3248 ;; (CALL-PROCESS-REGION can't write to remote |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3249 ;; files, it seems.) The file in question is a |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3250 ;; tmp file anyway. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3251 (let ((default-directory |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3252 (tramp-temporary-file-directory))) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3253 (funcall loc-enc (point-min) (point-max))) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3254 (goto-char (point-max)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3255 (unless (bolp) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3256 (newline))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3257 (tramp-message-for-buffer |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3258 multi-method method user host |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3259 6 "Encoding region using command `%s'..." loc-enc) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3260 (unless (equal 0 (tramp-call-local-coding-command |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3261 loc-enc tmpfil t)) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3262 (pop-to-buffer trampbuf) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3263 (error (concat "Cannot write to `%s', local encoding" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3264 " command `%s' failed") |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3265 filename loc-enc))) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3266 ;; Send tmpbuf into remote decoding command which |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3267 ;; writes to remote file. Because this happens on the |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3268 ;; remote host, we cannot use the function. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3269 (tramp-message-for-buffer |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3270 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3271 5 "Decoding region into remote file %s..." filename) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3272 (tramp-send-command |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3273 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3274 (format "%s >%s <<'EOF'" |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3275 rem-dec |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3276 (tramp-shell-quote-argument path))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3277 (set-buffer tmpbuf) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3278 (tramp-message-for-buffer |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3279 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3280 6 "Sending data to remote host...") |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3281 (tramp-send-region multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3282 (point-min) (point-max)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3283 ;; wait for remote decoding to complete |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3284 (tramp-message-for-buffer |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3285 multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3286 6 "Sending end of data token...") |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3287 (tramp-send-command |
46992
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
3288 multi-method method user host "EOF" nil t) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3289 (tramp-message-for-buffer |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3290 multi-method method user host 6 |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3291 "Waiting for remote host to process data...") |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3292 (set-buffer (tramp-get-buffer multi-method method user host)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3293 (tramp-wait-for-output) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3294 (tramp-barf-unless-okay |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3295 multi-method method user host nil nil 'file-error |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3296 (concat "Couldn't write region to `%s'," |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3297 " decode using `%s' failed") |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3298 filename rem-dec) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3299 (tramp-message 5 "Decoding region into remote file %s...done" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3300 filename) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3301 (kill-buffer tmpbuf)))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3302 (t |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3303 (error |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3304 (concat "Method `%s' should specify both encoding and " |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3305 "decoding command or an rcp program") |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3306 method))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3307 (delete-file tmpfil) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3308 (unless (equal curbuf (current-buffer)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3309 (error "Buffer has changed from `%s' to `%s'" |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3310 curbuf (current-buffer))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3311 (when (eq visit t) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3312 (set-visited-file-modtime)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3313 ;; Make `last-coding-system-used' have the right value. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3314 (when (boundp 'last-coding-system-used) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3315 (setq last-coding-system-used coding-system-used)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3316 (when (or (eq visit t) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3317 (eq visit nil) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3318 (stringp visit)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3319 (message "Wrote %s" filename))))) |
45861 | 3320 |
3321 ;; Call down to the real handler. | |
3322 ;; Because EFS does not play nicely with TRAMP (both systems match an | |
3323 ;; TRAMP path) it is needed to disable efs as well as tramp for the | |
3324 ;; operation. | |
3325 ;; | |
3326 ;; Other than that, this is the canon file-handler code that the doco | |
3327 ;; says should be used here. Which is nice. | |
3328 ;; | |
3329 ;; Under XEmacs current, EFS also hooks in as | |
3330 ;; efs-sifn-handler-function to handle any path with environment | |
3331 ;; variables. This has two implications: | |
3332 ;; 1) That EFS may not be completely dead (yet) for TRAMP paths | |
3333 ;; 2) That TRAMP might want to do the same thing. | |
3334 ;; Details as they come in. | |
3335 ;; | |
3336 ;; Daniel Pittman <daniel@danann.net> | |
3337 | |
3338 ;; (defun tramp-run-real-handler (operation args) | |
3339 ;; "Invoke normal file name handler for OPERATION. | |
3340 ;; This inhibits EFS and Ange-FTP, too, because they conflict with tramp. | |
3341 ;; First arg specifies the OPERATION, remaining ARGS are passed to the | |
3342 ;; OPERATION." | |
3343 ;; (let ((inhibit-file-name-handlers | |
3344 ;; (list 'tramp-file-name-handler | |
3345 ;; 'efs-file-handler-function | |
3346 ;; 'ange-ftp-hook-function | |
3347 ;; (and (eq inhibit-file-name-operation operation) | |
3348 ;; inhibit-file-name-handlers))) | |
3349 ;; (inhibit-file-name-operation operation)) | |
3350 ;; (apply operation args))) | |
3351 | |
3352 (defun tramp-run-real-handler (operation args) | |
3353 "Invoke normal file name handler for OPERATION. | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3354 First arg specifies the OPERATION, second arg is a list of arguments to |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3355 pass to the OPERATION." |
46835
df25ef3d3237
Version 2.0.12 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46808
diff
changeset
|
3356 (let* ((op (if (eq operation 'ange-ftp-hook-function) |
df25ef3d3237
Version 2.0.12 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46808
diff
changeset
|
3357 (car args) |
df25ef3d3237
Version 2.0.12 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46808
diff
changeset
|
3358 operation)) |
df25ef3d3237
Version 2.0.12 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46808
diff
changeset
|
3359 (inhibit-file-name-handlers |
df25ef3d3237
Version 2.0.12 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46808
diff
changeset
|
3360 (list 'tramp-file-name-handler |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3361 'tramp-completion-file-name-handler |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3362 (and (eq inhibit-file-name-operation op) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3363 inhibit-file-name-handlers))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3364 (inhibit-file-name-operation op)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3365 (apply operation args))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3366 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3367 ;; This function is used from `tramp-completion-file-name-handler' functions |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3368 ;; only, if `tramp-completion-mode' is true. But this cannot be checked here |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3369 ;; because the check is based on a full filename, not available for all |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3370 ;; basic I/O operations. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3371 (defun tramp-completion-run-real-handler (operation args) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3372 "Invoke `tramp-file-name-handler' for OPERATION. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3373 First arg specifies the OPERATION, second arg is a list of arguments to |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3374 pass to the OPERATION." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3375 (let* ((op (if (eq operation 'ange-ftp-hook-function) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3376 (car args) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3377 operation)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3378 (inhibit-file-name-handlers |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3379 (list 'tramp-completion-file-name-handler |
46835
df25ef3d3237
Version 2.0.12 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46808
diff
changeset
|
3380 (and (eq inhibit-file-name-operation op) |
df25ef3d3237
Version 2.0.12 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46808
diff
changeset
|
3381 inhibit-file-name-handlers))) |
df25ef3d3237
Version 2.0.12 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46808
diff
changeset
|
3382 (inhibit-file-name-operation op)) |
45861 | 3383 (apply operation args))) |
3384 | |
3385 ;; Main function. | |
3386 ;;;###autoload | |
3387 (defun tramp-file-name-handler (operation &rest args) | |
3388 "Invoke tramp file name handler. | |
3389 Falls back to normal file name handler if no tramp file name handler exists." | |
3390 (let ((fn (assoc operation tramp-file-name-handler-alist))) | |
3391 (if fn | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3392 (catch 'tramp-forward-to-ange-ftp |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3393 (save-match-data (apply (cdr fn) args))) |
45861 | 3394 (tramp-run-real-handler operation args)))) |
3395 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3396 (put 'tramp-file-name-handler 'file-remote-p t) ;for file-remote-p |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3397 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3398 ;;;###autoload |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3399 (defun tramp-completion-file-name-handler (operation &rest args) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3400 "Invoke tramp file name completion handler. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3401 Falls back to normal file name handler if no tramp file name handler exists." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3402 ;; (setq tramp-debug-buffer t) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3403 ;; (tramp-message 1 "%s %s" operation args) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3404 ;; (tramp-message 1 "%s %s\n%s" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3405 ;; operation args (with-output-to-string (backtrace))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3406 (let ((fn (assoc operation tramp-completion-file-name-handler-alist))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3407 (if fn |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3408 (catch 'tramp-forward-to-ange-ftp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3409 (save-match-data (apply (cdr fn) args))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3410 (tramp-completion-run-real-handler operation args)))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3411 |
45861 | 3412 ;; Register in file name handler alist |
3413 ;;;###autoload | |
3414 (add-to-list 'file-name-handler-alist | |
3415 (cons tramp-file-name-regexp 'tramp-file-name-handler)) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3416 (add-to-list 'file-name-handler-alist |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3417 (cons tramp-completion-file-name-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3418 'tramp-completion-file-name-handler)) |
45861 | 3419 |
46306
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
3420 ;; To handle EFS, the following functions need to be dealt with: |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
3421 ;; |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
3422 ;; * dired-before-readin-hook contains efs-dired-before-readin |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
3423 ;; * file-name-handler-alist contains efs-file-handler-function |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
3424 ;; and efs-root-handler-function and efs-sifn-handler-function |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
3425 ;; * find-file-hooks contains efs-set-buffer-mode |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
3426 ;; |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
3427 ;; But it won't happen for EFS since the XEmacs maintainers |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
3428 ;; don't want to use a unified filename syntax. |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
3429 (defun tramp-disable-ange-ftp () |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
3430 "Turn Ange-FTP off. |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
3431 This is useful for unified remoting. See |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
3432 `tramp-file-name-structure-unified' and |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
3433 `tramp-file-name-structure-separate' for details. Requests suitable |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
3434 for Ange-FTP will be forwarded to Ange-FTP. Also see the variables |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
3435 `tramp-ftp-method', `tramp-default-method', and |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
3436 `tramp-default-method-alist'. |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
3437 |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
3438 This function is not needed in Emacsen which include Tramp, but is |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
3439 present for backward compatibility." |
46060
40298ba8e901
(tramp-handle-ange-ftp): Fix typo.
Andreas Schwab <schwab@suse.de>
parents:
46048
diff
changeset
|
3440 (let ((a1 (rassq 'ange-ftp-hook-function file-name-handler-alist)) |
46306
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
3441 (a2 (rassq 'ange-ftp-completion-hook-function file-name-handler-alist))) |
45861 | 3442 (setq file-name-handler-alist |
46306
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
3443 (delete a1 (delete a2 file-name-handler-alist))))) |
66cce4969490
(tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46166
diff
changeset
|
3444 (tramp-disable-ange-ftp) |
46048
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
3445 |
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
3446 (defun tramp-repair-jka-compr () |
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
3447 "If jka-compr is already loaded, move it to the front of |
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
3448 `file-name-handler-alist'. On Emacs 21.4 or so this will not be |
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
3449 necessary anymore." |
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
3450 (let ((jka (rassoc 'jka-compr-handler file-name-handler-alist))) |
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
3451 (when jka |
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
3452 (setq file-name-handler-alist |
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
3453 (cons jka (delete jka file-name-handler-alist)))))) |
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
3454 (tramp-repair-jka-compr) |
45861 | 3455 |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3456 (defun tramp-flatten-list (arg) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3457 "Expands all lists inside ARG to a sequential list. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3458 Return (nil) if arg is nil." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3459 (let ((car (car arg)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3460 (cdr (cdr arg))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3461 (cond |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3462 ((eq arg nil) '(nil)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3463 ((listp car) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3464 (if (null cdr) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3465 (tramp-flatten-list car) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3466 (append (tramp-flatten-list car) (tramp-flatten-list cdr)))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3467 ((null cdr) (list car)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3468 (t (cons car (tramp-flatten-list cdr)))))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3469 |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3470 (defun tramp-invoke-ange-ftp (operation &rest args) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3471 "Invoke the Ange-FTP handler function and throw." |
47205
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
3472 (or (boundp 'ange-ftp-name-format) |
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
3473 (and (require 'ange-ftp) |
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
3474 (tramp-disable-ange-ftp))) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3475 (let ((ange-ftp-name-format |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3476 (list (nth 0 tramp-file-name-structure) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3477 (nth 3 tramp-file-name-structure) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3478 (nth 2 tramp-file-name-structure) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3479 (nth 4 tramp-file-name-structure)))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3480 (throw 'tramp-forward-to-ange-ftp |
46808
cf225aed7a75
Version 2.0.11 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46802
diff
changeset
|
3481 (tramp-run-real-handler 'ange-ftp-hook-function |
cf225aed7a75
Version 2.0.11 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46802
diff
changeset
|
3482 (cons operation args))))) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3483 |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3484 (defun tramp-ange-ftp-file-name-p (multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3485 "Check if it's a filename that should be forwarded to Ange-FTP." |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3486 (and tramp-unified-filenames |
47205
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
3487 (null multi-method) |
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
3488 (string= method tramp-ftp-method))) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3489 |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3490 |
45861 | 3491 ;;; Interactions with other packages: |
3492 | |
3493 ;; -- complete.el -- | |
3494 | |
3495 ;; This function contributed by Ed Sabol | |
3496 (defun tramp-handle-expand-many-files (name) | |
3497 "Like `PC-expand-many-files' for tramp files." | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3498 (with-parsed-tramp-file-name name nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3499 (when (tramp-ange-ftp-file-name-p multi-method method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3500 (tramp-invoke-ange-ftp 'expand-many-files name)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3501 (save-match-data |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3502 (if (or (string-match "\\*" name) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3503 (string-match "\\?" name) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3504 (string-match "\\[.*\\]" name)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3505 (save-excursion |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3506 (let (bufstr) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3507 ;; CCC: To do it right, we should quote certain characters |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3508 ;; in the file name, but since the echo command is going to |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3509 ;; break anyway when there are spaces in the file names, we |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3510 ;; don't bother. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3511 ;;-(let ((comint-file-name-quote-list |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3512 ;;- (set-difference tramp-file-name-quote-list |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3513 ;;- '(?\* ?\? ?[ ?])))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3514 ;;- (tramp-send-command |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3515 ;;- multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3516 ;;- (format "echo %s" (comint-quote-filename path))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3517 ;;- (tramp-wait-for-output)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3518 (tramp-send-command multi-method method user host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3519 (format "echo %s" path)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3520 (tramp-wait-for-output) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3521 (setq bufstr (buffer-substring (point-min) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3522 (tramp-line-end-position))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3523 (goto-char (point-min)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3524 (if (string-equal path bufstr) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3525 nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3526 (insert "(\"") |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3527 (while (search-forward " " nil t) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3528 (delete-backward-char 1) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3529 (insert "\" \"")) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3530 (goto-char (point-max)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3531 (delete-backward-char 1) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3532 (insert "\")") |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3533 (goto-char (point-min)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3534 (mapcar |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3535 (function (lambda (x) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3536 (tramp-make-tramp-file-name multi-method method |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3537 user host x))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3538 (read (current-buffer)))))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
3539 (list (tramp-handle-expand-file-name name)))))) |
45861 | 3540 |
3541 ;; Check for complete.el and override PC-expand-many-files if appropriate. | |
3542 (eval-when-compile | |
3543 (defun tramp-save-PC-expand-many-files (name))); avoid compiler warning | |
3544 | |
3545 (defun tramp-setup-complete () | |
3546 (fset 'tramp-save-PC-expand-many-files | |
3547 (symbol-function 'PC-expand-many-files)) | |
3548 (defun PC-expand-many-files (name) | |
3549 (if (tramp-tramp-file-p name) | |
3550 (tramp-handle-expand-many-files name) | |
3551 (tramp-save-PC-expand-many-files name)))) | |
3552 | |
3553 ;; Why isn't eval-after-load sufficient? | |
3554 (if (fboundp 'PC-expand-many-files) | |
3555 (tramp-setup-complete) | |
3556 (eval-after-load "complete" '(tramp-setup-complete))) | |
3557 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3558 ;;; File name handler functions for completion mode |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3559 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3560 ;; Necessary because `tramp-file-name-regexp-unified' and |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3561 ;; `tramp-completion-file-name-regexp-unified' aren't different. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3562 ;; If nil, `tramp-completion-run-real-handler' is called (i.e. forwarding to |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3563 ;; `tramp-file-name-handler'). Otherwise, it takes `tramp-run-real-handler'. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3564 ;; Using `last-input-event' is a little bit risky, because completing a file |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3565 ;; might require loading other files, like "~/.netrc", and for them it |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3566 ;; shouldn't be decided based on that variable. On the other hand, those files |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3567 ;; shouldn't have partial tramp file name syntax. Maybe another variable should |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3568 ;; be introduced overwriting this check in such cases. Or we change tramp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3569 ;; file name syntax in order to avoid ambiguities, like in XEmacs ... |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3570 ;; In case of XEmacs it can be always true (and wouldn't be necessary). |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3571 (defun tramp-completion-mode (file) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3572 "Checks whether method / user name / host name completion is active." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3573 (cond |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3574 ((featurep 'xemacs) t) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3575 ((string-match "^/.*:.*:$" file) nil) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3576 ((string-match |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3577 (concat |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3578 tramp-prefix-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3579 tramp-method-regexp tramp-postfix-single-method-regexp "$") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3580 file) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3581 (member (match-string 1 file) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3582 (cons tramp-ftp-method (mapcar 'car tramp-methods)))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3583 ((or (equal last-input-event 'tab) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3584 (and (not (event-modifiers last-input-event)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3585 (integerp last-input-event) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3586 (or (char-equal last-input-event ?\?) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3587 (char-equal last-input-event ?\t) ; handled by 'tab already? |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3588 (char-equal last-input-event ?\ )))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3589 t))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3590 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3591 (defun tramp-completion-handle-file-exists-p (filename) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3592 "Like `file-exists-p' for tramp files." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3593 (if (tramp-completion-mode filename) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3594 (tramp-run-real-handler |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3595 'file-exists-p (list filename)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3596 (tramp-completion-run-real-handler |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3597 'file-exists-p (list filename)))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3598 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3599 ;; Path manipulation in case of partial TRAMP file names. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3600 (defun tramp-completion-handle-file-name-directory (file) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3601 "Like `file-name-directory' but aware of TRAMP files." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3602 (if (tramp-completion-mode file) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3603 "/" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3604 (tramp-completion-run-real-handler |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3605 'file-name-directory (list file)))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3606 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3607 ;; Path manipulation in case of partial TRAMP file names. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3608 (defun tramp-completion-handle-file-name-nondirectory (file) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3609 "Like `file-name-nondirectory' but aware of TRAMP files." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3610 (substring |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3611 file (length (tramp-completion-handle-file-name-directory file)))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3612 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3613 ;; Method, host name and user name completion. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3614 ;; `tramp-completion-dissect-file-name' returns a list of |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3615 ;; tramp-file-name structures. For all of them we return possible completions. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3616 (defun tramp-completion-handle-file-name-all-completions (filename directory) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3617 "Like `file-name-all-completions' for partial tramp files." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3618 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3619 (let* |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3620 ((fullname (concat directory filename)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3621 ;; local files |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3622 (result |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3623 (if (tramp-completion-mode fullname) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3624 (tramp-run-real-handler |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3625 'file-name-all-completions (list filename directory)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3626 (tramp-completion-run-real-handler |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3627 'file-name-all-completions (list filename directory)))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3628 ;; possible completion structures |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3629 (v (tramp-completion-dissect-file-name fullname))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3630 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3631 (while v |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3632 (let* ((car (car v)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3633 (multi-method (tramp-file-name-multi-method car)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3634 (method (tramp-file-name-method car)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3635 (user (tramp-file-name-user car)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3636 (host (tramp-file-name-host car)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3637 (path (tramp-file-name-path car)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3638 (m (tramp-find-method multi-method method user host)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3639 all-user-hosts) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3640 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3641 (unless (or multi-method ;; Not handled (yet). |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3642 path) ;; Nothing to complete |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3643 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3644 (if (or user host) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3645 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3646 ;; Method dependent user / host combinations |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3647 (progn |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3648 (mapcar |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3649 '(lambda (x) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3650 (setq all-user-hosts |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3651 (append all-user-hosts |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3652 (funcall (nth 0 x) (nth 1 x))))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3653 (tramp-get-completion-function m)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3654 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3655 (setq result (append result |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3656 (mapcar |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3657 '(lambda (x) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3658 (tramp-get-completion-user-host |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3659 method user host (nth 0 x) (nth 1 x))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3660 (delq nil all-user-hosts))))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3661 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3662 ;; Possible methods |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3663 (setq result |
47578
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3664 (append result (tramp-get-completion-methods m))))) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3665 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3666 (setq v (delq car v)))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3667 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3668 ;;; unify list, remove nil elements |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3669 (let (result1) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3670 (while result |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3671 (let ((car (car result))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3672 (when car (add-to-list 'result1 car)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3673 (setq result (delq car result)))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3674 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3675 result1))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3676 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3677 ;; Method, host name and user name completion for a file. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3678 (defun tramp-completion-handle-file-name-completion (filename directory) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3679 "Like `file-name-completion' for tramp files." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3680 (try-completion filename |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3681 (mapcar 'list (file-name-all-completions filename directory)))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3682 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3683 ;; I misuse a little bit the tramp-file-name structure in order to handle |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3684 ;; completion possibilities for partial methods / user names / host names. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3685 ;; Return value is a list of tramp-file-name structures according to possible |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3686 ;; completions. If "multi-method" or "path" is non-nil it means there |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3687 ;; shouldn't be a completion anymore. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3688 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3689 ;; Expected results: |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3690 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3691 ;; "/x" "/[x" "/x@" "/[x@" "/x@y" "/[x@y" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3692 ;; [nil nil nil "x" nil] [nil nil "x" nil nil] [nil nil "x" "y" nil] |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3693 ;; [nil nil "x" nil nil] |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3694 ;; [nil "x" nil nil nil] |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3695 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3696 ;; "/x:" "/x:y" "/x:y:" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3697 ;; [nil nil nil "x" ""] [nil nil nil "x" "y"] [nil "x" nil "y" ""] |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3698 ;; "/[x/" "/[x/y" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3699 ;; [nil "x" nil "" nil] [nil "x" nil "y" nil] |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3700 ;; [nil "x" "" nil nil] [nil "x" "y" nil nil] |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3701 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3702 ;; "/x:y@" "/x:y@z" "/x:y@z:" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3703 ;; [nil nil nil "x" "y@"] [nil nil nil "x" "y@z"] [nil "x" "y" "z" ""] |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3704 ;; "/[x/y@" "/[x/y@z" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3705 ;; [nil "x" nil "y" nil] [nil "x" "y" "z" nil] |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3706 (defun tramp-completion-dissect-file-name (name) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3707 "Returns a list of `tramp-file-name' structures. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3708 They are collected by `tramp-completion-dissect-file-name1'." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3709 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3710 (let* ((result) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3711 (x-nil "\\|\\(\\)")) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3712 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3713 ;; "/method" "/[method" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3714 (defconst tramp-completion-file-name-structure1 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3715 (list (concat tramp-prefix-regexp "\\(" tramp-method-regexp x-nil "\\)$") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3716 1 9 9 9)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3717 ;; "/user" "/[user" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3718 (defconst tramp-completion-file-name-structure2 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3719 (list (concat tramp-prefix-regexp "\\(" tramp-user-regexp x-nil "\\)$") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3720 9 1 9 9)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3721 ;; "/host" "/[host" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3722 (defconst tramp-completion-file-name-structure3 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3723 (list (concat tramp-prefix-regexp "\\(" tramp-host-regexp x-nil "\\)$") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3724 9 9 1 9)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3725 ;; "/user@host" "/[user@host" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3726 (defconst tramp-completion-file-name-structure4 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3727 (list (concat tramp-prefix-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3728 "\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3729 "\\(" tramp-host-regexp x-nil "\\)$") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3730 9 1 2 9)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3731 ;; "/method:user" "/[method/user" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3732 (defconst tramp-completion-file-name-structure5 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3733 (list (concat tramp-prefix-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3734 "\\(" tramp-method-regexp "\\)" tramp-postfix-single-method-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3735 "\\(" tramp-user-regexp x-nil "\\)$") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3736 1 2 9 9)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3737 ;; "/method:host" "/[method/host" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3738 (defconst tramp-completion-file-name-structure6 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3739 (list (concat tramp-prefix-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3740 "\\(" tramp-method-regexp "\\)" tramp-postfix-single-method-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3741 "\\(" tramp-host-regexp x-nil "\\)$") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3742 1 9 2 9)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3743 ;; "/method:user@host" "/[method/user@host" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3744 (defconst tramp-completion-file-name-structure7 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3745 (list (concat tramp-prefix-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3746 "\\(" tramp-method-regexp "\\)" tramp-postfix-single-method-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3747 "\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3748 "\\(" tramp-host-regexp x-nil "\\)$") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3749 1 2 3 9)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3750 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3751 (mapcar '(lambda (regexp) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3752 (add-to-list 'result |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3753 (tramp-completion-dissect-file-name1 regexp name))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3754 (list |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3755 tramp-completion-file-name-structure1 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3756 tramp-completion-file-name-structure2 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3757 tramp-completion-file-name-structure3 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3758 tramp-completion-file-name-structure4 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3759 tramp-completion-file-name-structure5 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3760 tramp-completion-file-name-structure6 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3761 tramp-completion-file-name-structure7 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3762 tramp-file-name-structure)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3763 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3764 (delq nil result))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3765 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3766 (defun tramp-completion-dissect-file-name1 (structure name) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3767 "Returns a `tramp-file-name' structure matching STRUCTURE. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3768 The structure consists of multi-method, remote method, remote user, |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3769 remote host and remote path name." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3770 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3771 (let (method) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3772 (save-match-data |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3773 (when (string-match (nth 0 structure) name) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3774 (setq method (match-string (nth 1 structure) name)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3775 (if (and method (member method tramp-multi-methods)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3776 ;; Not handled (yet). |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3777 (make-tramp-file-name |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3778 :multi-method method |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3779 :method nil |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3780 :user nil |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3781 :host nil |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3782 :path nil) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3783 (let ((user (match-string (nth 2 structure) name)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3784 (host (match-string (nth 3 structure) name)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3785 (path (match-string (nth 4 structure) name))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3786 (make-tramp-file-name |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3787 :multi-method nil |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3788 :method method |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3789 :user user |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3790 :host host |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3791 :path path))))))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3792 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3793 ;; This function returns all possible method completions, adding the |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3794 ;; trailing method delimeter. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3795 ;; In case of Emacs, `tramp-ftp-method' is handled as well because it doesn't |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3796 ;; belong to `tramp-methods'. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3797 (defun tramp-get-completion-methods (partial-method) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3798 "Returns all method completions for PARTIAL-METHOD." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3799 (let ((all-methods (delete "multi" (mapcar 'car tramp-methods)))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3800 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3801 (mapcar |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3802 '(lambda (method) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3803 (and method |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3804 (string-match (concat "^" (regexp-quote partial-method)) method) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3805 ;; we must remove leading "/". |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3806 (substring (tramp-make-tramp-file-name nil method nil nil nil) 1))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3807 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3808 (add-to-list 'all-methods |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3809 (when tramp-unified-filenames tramp-ftp-method))))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3810 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3811 ;; Compares partial user and host names with possible completions. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3812 (defun tramp-get-completion-user-host (method partial-user partial-host user host) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3813 "Returns the most expanded string for user and host name completion. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3814 PARTIAL-USER must match USER, PARTIAL-HOST must match HOST." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3815 (cond |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3816 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3817 ((and partial-user partial-host) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3818 (if (and host |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3819 (string-match (concat "^" (regexp-quote partial-host)) host) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3820 (string-equal partial-user (or user partial-user))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3821 (setq user partial-user) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3822 (setq user nil |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3823 host nil))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3824 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3825 (partial-user |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3826 (setq host nil) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3827 (unless |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3828 (and user (string-match (concat "^" (regexp-quote partial-user)) user)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3829 (setq user nil))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3830 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3831 (partial-host |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3832 (setq user nil) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3833 (unless |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3834 (and host (string-match (concat "^" (regexp-quote partial-host)) host)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3835 (setq host nil))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3836 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3837 (t (setq user nil |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3838 host nil))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3839 |
47578
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3840 (unless (zerop (+ (length user) (length host))) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3841 ;; we must remove leading "/". |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3842 (substring (tramp-make-tramp-file-name nil method user host nil) 1))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3843 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3844 (defun tramp-parse-rhosts (filename) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3845 "Return a list of (user host) tuples allowed to access. |
47578
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3846 Either user or host may be nil." |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3847 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3848 (let (res) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3849 (when (file-exists-p filename) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3850 (with-temp-buffer |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3851 (insert-file-contents filename) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3852 (goto-char (point-min)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3853 (while (not (eobp)) |
47578
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3854 (push (tramp-parse-rhosts-group) res)))) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3855 res)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3856 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3857 ;; Taken from gnus/netrc.el |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3858 (eval-and-compile |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3859 (defalias 'tramp-point-at-eol |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3860 (if (fboundp 'point-at-eol) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3861 'point-at-eol |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3862 'line-end-position))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3863 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3864 (defun tramp-parse-rhosts-group () |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3865 "Return a (user host) tuple allowed to access. |
47578
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3866 Either user or host may be nil." |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3867 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3868 (let ((result) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3869 (regexp |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3870 (concat |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3871 "^\\(" tramp-host-regexp "\\)" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3872 "\\([ \t]+" "\\(" tramp-user-regexp "\\)" "\\)?"))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3873 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3874 (narrow-to-region (point) (tramp-point-at-eol)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3875 (when (re-search-forward regexp nil t) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3876 (setq result (append (list (match-string 3) (match-string 1))))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3877 (widen) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3878 (forward-line 1) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3879 result)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3880 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3881 (defun tramp-parse-shosts (filename) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3882 "Return a list of (user host) tuples allowed to access. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3883 User is always nil." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3884 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3885 (let (res) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3886 (when (file-exists-p filename) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3887 (with-temp-buffer |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3888 (insert-file-contents filename) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3889 (goto-char (point-min)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3890 (while (not (eobp)) |
47578
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3891 (push (tramp-parse-shosts-group) res)))) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3892 res)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3893 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3894 (defun tramp-parse-shosts-group () |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3895 "Return a (user host) tuple allowed to access. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3896 User is always nil." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3897 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3898 (let ((result) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3899 (regexp (concat "^\\(" tramp-host-regexp "\\)"))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3900 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3901 (narrow-to-region (point) (tramp-point-at-eol)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3902 (when (re-search-forward regexp nil t) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3903 (setq result (list nil (match-string 1)))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3904 (widen) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3905 (or |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3906 (> (skip-chars-forward ",") 0) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3907 (forward-line 1)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3908 result)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3909 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3910 (defun tramp-parse-hosts (filename) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3911 "Return a list of (user host) tuples allowed to access. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3912 User is always nil." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3913 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3914 (let (res) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3915 (when (file-exists-p filename) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3916 (with-temp-buffer |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3917 (insert-file-contents filename) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3918 (goto-char (point-min)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3919 (while (not (eobp)) |
47578
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3920 (push (tramp-parse-hosts-group) res)))) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3921 res)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3922 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3923 (defun tramp-parse-hosts-group () |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3924 "Return a (user host) tuple allowed to access. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3925 User is always nil." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3926 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3927 (let ((result) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3928 (regexp (concat "^\\(" tramp-host-regexp "\\)"))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3929 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3930 (narrow-to-region (point) (tramp-point-at-eol)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3931 (when (re-search-forward regexp nil t) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3932 (unless (char-equal (or (char-after) ?\n) ?:) ; no IPv6 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3933 (setq result (list nil (match-string 1))))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3934 (widen) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3935 (or |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3936 (> (skip-chars-forward " \t") 0) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3937 (forward-line 1)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3938 result)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3939 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3940 (defun tramp-parse-passwd (filename) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3941 "Return a list of (user host) tuples allowed to access. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3942 Host is always \"localhost\"." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3943 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3944 (let (res) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3945 (if (and (symbolp 'user) (zerop (length user))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3946 '(("root" nil)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3947 (when (file-exists-p filename) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3948 (with-temp-buffer |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3949 (insert-file-contents filename) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3950 (goto-char (point-min)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3951 (while (not (eobp)) |
47578
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3952 (push (tramp-parse-passwd-group) res)))) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3953 res))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3954 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3955 (defun tramp-parse-passwd-group () |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3956 "Return a (user host) tuple allowed to access. |
47578
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3957 Host is always \"localhost\"." |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3958 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3959 (let ((result) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3960 (regexp (concat "^\\(" tramp-user-regexp "\\):"))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3961 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3962 (narrow-to-region (point) (tramp-point-at-eol)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3963 (when (re-search-forward regexp nil t) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3964 (setq result (list (match-string 1) "localhost"))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3965 (widen) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3966 (forward-line 1) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3967 result)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3968 |
47578
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3969 (defun tramp-parse-netrc (filename) |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3970 "Return a list of (user host) tuples allowed to access. |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3971 User may be nil." |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3972 |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3973 (let (res) |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3974 (when (file-exists-p filename) |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3975 (with-temp-buffer |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3976 (insert-file-contents filename) |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3977 (goto-char (point-min)) |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3978 (while (not (eobp)) |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3979 (push (tramp-parse-netrc-group) res)))) |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3980 res)) |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3981 |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3982 (defun tramp-parse-netrc-group () |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3983 "Return a (user host) tuple allowed to access. |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3984 User may be nil." |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3985 |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3986 (let ((result) |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3987 (regexp |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3988 (concat |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3989 "^[ \t]*machine[ \t]+" "\\(" tramp-host-regexp "\\)" |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3990 "\\([ \t]+login[ \t]+" "\\(" tramp-user-regexp "\\)" "\\)?"))) |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3991 |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3992 (narrow-to-region (point) (tramp-point-at-eol)) |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3993 (when (re-search-forward regexp nil t) |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3994 (setq result (list (match-string 3) (match-string 1)))) |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3995 (widen) |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3996 (forward-line 1) |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3997 result)) |
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
3998 |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
3999 (defun tramp-completion-handle-expand-file-name (name &optional dir) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4000 "Like `expand-file-name' for tramp files." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4001 (let ((fullname (concat (or dir default-directory) name))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4002 (if (tramp-completion-mode fullname) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4003 (tramp-run-real-handler |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4004 'expand-file-name (list name dir)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4005 (tramp-completion-run-real-handler |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4006 'expand-file-name (list name dir))))) |
45861 | 4007 |
4008 ;;; Internal Functions: | |
4009 | |
4010 (defun tramp-set-auto-save () | |
4011 (when (and (buffer-file-name) | |
4012 (tramp-tramp-file-p (buffer-file-name)) | |
4013 auto-save-default) | |
4014 (auto-save-mode 1))) | |
4015 (add-hook 'find-file-hooks 'tramp-set-auto-save t) | |
4016 | |
4017 (defun tramp-run-test (switch filename) | |
4018 "Run `test' on the remote system, given a SWITCH and a FILENAME. | |
4019 Returns the exit code of the `test' program." | |
4020 (let ((v (tramp-dissect-file-name filename))) | |
4021 (save-excursion | |
4022 (tramp-send-command-and-check | |
4023 (tramp-file-name-multi-method v) (tramp-file-name-method v) | |
4024 (tramp-file-name-user v) (tramp-file-name-host v) | |
4025 (format "test %s %s" switch | |
4026 (tramp-shell-quote-argument (tramp-file-name-path v))))))) | |
4027 | |
4028 (defun tramp-run-test2 (program file1 file2 &optional switch) | |
4029 "Run `test'-like PROGRAM on the remote system, given FILE1, FILE2. | |
4030 The optional SWITCH is inserted between the two files. | |
4031 Returns the exit code of the `test' PROGRAM. Barfs if the methods, | |
4032 hosts, or files, disagree." | |
4033 (let* ((v1 (tramp-dissect-file-name file1)) | |
4034 (v2 (tramp-dissect-file-name file2)) | |
4035 (mmethod1 (tramp-file-name-multi-method v1)) | |
4036 (mmethod2 (tramp-file-name-multi-method v2)) | |
4037 (method1 (tramp-file-name-method v1)) | |
4038 (method2 (tramp-file-name-method v2)) | |
4039 (user1 (tramp-file-name-user v1)) | |
4040 (user2 (tramp-file-name-user v2)) | |
4041 (host1 (tramp-file-name-host v1)) | |
4042 (host2 (tramp-file-name-host v2)) | |
4043 (path1 (tramp-file-name-path v1)) | |
4044 (path2 (tramp-file-name-path v2))) | |
4045 (unless (and method1 method2 host1 host2 | |
4046 (equal mmethod1 mmethod2) | |
4047 (equal method1 method2) | |
4048 (equal user1 user2) | |
4049 (equal host1 host2)) | |
4050 (error "tramp-run-test2: %s" | |
4051 "only implemented for same method, same user, same host")) | |
4052 (save-excursion | |
4053 (tramp-send-command-and-check | |
4054 mmethod1 method1 user1 host1 | |
4055 (format "%s %s %s %s" | |
4056 program | |
4057 (tramp-shell-quote-argument path1) | |
4058 (or switch "") | |
4059 (tramp-shell-quote-argument path2)))))) | |
4060 | |
4061 (defun tramp-buffer-name (multi-method method user host) | |
4062 "A name for the connection buffer for USER at HOST using METHOD." | |
4063 (cond (multi-method | |
4064 (tramp-buffer-name-multi-method "tramp" multi-method method user host)) | |
4065 (user | |
4066 (format "*tramp/%s %s@%s*" method user host)) | |
4067 (t | |
4068 (format "*tramp/%s %s*" method host)))) | |
4069 | |
4070 (defun tramp-buffer-name-multi-method (prefix multi-method method user host) | |
4071 "A name for the multi method connection buffer. | |
4072 MULTI-METHOD gives the multi method, METHOD the array of methods, | |
4073 USER the array of user names, HOST the array of host names." | |
4074 (unless (and (= (length method) (length user)) | |
4075 (= (length method) (length host))) | |
4076 (error "Syntax error in multi method (implementation error)")) | |
4077 (let ((len (length method)) | |
4078 (i 0) | |
4079 string-list) | |
4080 (while (< i len) | |
4081 (setq string-list | |
4082 (cons (if (aref user i) | |
4083 (format "%s#%s@%s:" (aref method i) | |
4084 (aref user i) (aref host i)) | |
4085 (format "%s@%s:" (aref method i) (aref host i))) | |
4086 string-list)) | |
4087 (incf i)) | |
4088 (format "*%s/%s %s*" | |
4089 prefix multi-method | |
4090 (apply 'concat (reverse string-list))))) | |
4091 | |
4092 (defun tramp-get-buffer (multi-method method user host) | |
4093 "Get the connection buffer to be used for USER at HOST using METHOD." | |
4094 (get-buffer-create (tramp-buffer-name multi-method method user host))) | |
4095 | |
4096 (defun tramp-debug-buffer-name (multi-method method user host) | |
4097 "A name for the debug buffer for USER at HOST using METHOD." | |
4098 (cond (multi-method | |
4099 (tramp-buffer-name-multi-method "debug tramp" | |
4100 multi-method method user host)) | |
4101 (user | |
4102 (format "*debug tramp/%s %s@%s*" method user host)) | |
4103 (t | |
4104 (format "*debug tramp/%s %s*" method host)))) | |
4105 | |
4106 (defun tramp-get-debug-buffer (multi-method method user host) | |
4107 "Get the debug buffer for USER at HOST using METHOD." | |
4108 (get-buffer-create (tramp-debug-buffer-name multi-method method user host))) | |
4109 | |
4110 (defun tramp-find-executable (multi-method method user host | |
4111 progname dirlist ignore-tilde) | |
4112 "Searches for PROGNAME in all directories mentioned in DIRLIST. | |
4113 First args METHOD, USER and HOST specify the connection, PROGNAME | |
4114 is the program to search for, and DIRLIST gives the list of directories | |
4115 to search. If IGNORE-TILDE is non-nil, directory names starting | |
4116 with `~' will be ignored. | |
4117 | |
4118 Returns the full path name of PROGNAME, if found, and nil otherwise. | |
4119 | |
4120 This function expects to be in the right *tramp* buffer." | |
4121 (let (result) | |
4122 (when ignore-tilde | |
4123 ;; Remove all ~/foo directories from dirlist. In Emacs 20, | |
4124 ;; `remove' is in CL, and we want to avoid CL dependencies. | |
4125 (let (newdl d) | |
4126 (while dirlist | |
4127 (setq d (car dirlist)) | |
4128 (setq dirlist (cdr dirlist)) | |
4129 (unless (char-equal ?~ (aref d 0)) | |
4130 (setq newdl (cons d newdl)))) | |
4131 (setq dirlist (nreverse newdl)))) | |
4132 (tramp-send-command | |
4133 multi-method method user host | |
4134 (format (concat "while read d; " | |
4135 "do if test -x $d/%s -a -f $d/%s; " | |
4136 "then echo tramp_executable $d/%s; " | |
4137 "break; fi; done <<'EOF'") | |
4138 progname progname progname)) | |
4139 (mapcar (lambda (d) | |
4140 (tramp-send-command multi-method method user host d)) | |
4141 dirlist) | |
4142 (tramp-send-command multi-method method user host "EOF") | |
4143 (tramp-wait-for-output) | |
4144 (goto-char (point-max)) | |
4145 (when (search-backward "tramp_executable " nil t) | |
4146 (skip-chars-forward "^ ") | |
4147 (skip-chars-forward " ") | |
4148 (buffer-substring (point) (tramp-line-end-position))))) | |
4149 | |
4150 (defun tramp-set-remote-path (multi-method method user host var dirlist) | |
4151 "Sets the remote environment VAR to existing directories from DIRLIST. | |
4152 I.e., for each directory in DIRLIST, it is tested whether it exists and if | |
4153 so, it is added to the environment variable VAR." | |
4154 (let ((existing-dirs | |
4155 (mapcar | |
4156 (lambda (x) | |
4157 (when (and | |
4158 (file-exists-p | |
4159 (tramp-make-tramp-file-name multi-method method user host x)) | |
4160 (file-directory-p | |
4161 (tramp-make-tramp-file-name multi-method method user host x))) | |
4162 x)) | |
4163 dirlist))) | |
4164 (tramp-send-command | |
4165 multi-method method user host | |
4166 (concat var "=" | |
4167 (mapconcat 'identity (delq nil existing-dirs) ":") | |
4168 "; export " var)) | |
4169 (tramp-wait-for-output))) | |
4170 | |
4171 ;; -- communication with external shell -- | |
4172 | |
4173 (defun tramp-find-file-exists-command (multi-method method user host) | |
4174 "Find a command on the remote host for checking if a file exists. | |
4175 Here, we are looking for a command which has zero exit status if the | |
4176 file exists and nonzero exit status otherwise." | |
4177 (make-local-variable 'tramp-file-exists-command) | |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4178 (tramp-message 9 "Finding command to check if file exists") |
45861 | 4179 (let ((existing |
4180 (tramp-make-tramp-file-name | |
4181 multi-method method user host | |
4182 "/")) ;assume this file always exists | |
4183 (nonexisting | |
4184 (tramp-make-tramp-file-name | |
4185 multi-method method user host | |
4186 "/ this file does not exist "))) ;assume this never exists | |
4187 ;; The algorithm is as follows: we try a list of several commands. | |
4188 ;; For each command, we first run `$cmd /' -- this should return | |
4189 ;; true, as the root directory always exists. And then we run | |
4190 ;; `$cmd /this\ file\ does\ not\ exist', hoping that the file indeed | |
4191 ;; does not exist. This should return false. We use the first | |
4192 ;; command we find that seems to work. | |
4193 ;; The list of commands to try is as follows: | |
4194 ;; `ls -d' This works on most systems, but NetBSD 1.4 | |
4195 ;; has a bug: `ls' always returns zero exit | |
4196 ;; status, even for files which don't exist. | |
4197 ;; `test -e' Some Bourne shells have a `test' builtin | |
4198 ;; which does not know the `-e' option. | |
4199 ;; `/bin/test -e' For those, the `test' binary on disk normally | |
4200 ;; provides the option. Alas, the binary | |
4201 ;; is sometimes `/bin/test' and sometimes it's | |
4202 ;; `/usr/bin/test'. | |
4203 ;; `/usr/bin/test -e' In case `/bin/test' does not exist. | |
4204 (unless (or | |
4205 (and (setq tramp-file-exists-command "test -e %s") | |
4206 (tramp-handle-file-exists-p existing) | |
4207 (not (tramp-handle-file-exists-p nonexisting))) | |
4208 (and (setq tramp-file-exists-command "/bin/test -e %s") | |
4209 (tramp-handle-file-exists-p existing) | |
4210 (not (tramp-handle-file-exists-p nonexisting))) | |
4211 (and (setq tramp-file-exists-command "/usr/bin/test -e %s") | |
4212 (tramp-handle-file-exists-p existing) | |
46808
cf225aed7a75
Version 2.0.11 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46802
diff
changeset
|
4213 (not (tramp-handle-file-exists-p nonexisting))) |
cf225aed7a75
Version 2.0.11 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46802
diff
changeset
|
4214 (and (setq tramp-file-exists-command "ls -d %s") |
cf225aed7a75
Version 2.0.11 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46802
diff
changeset
|
4215 (tramp-handle-file-exists-p existing) |
45861 | 4216 (not (tramp-handle-file-exists-p nonexisting)))) |
4217 (error "Couldn't find command to check if file exists.")))) | |
4218 | |
4219 | |
4220 ;; CCC test ksh or bash found for tilde expansion? | |
4221 (defun tramp-find-shell (multi-method method user host) | |
4222 "Find a shell on the remote host which groks tilde expansion." | |
4223 (let ((shell nil)) | |
4224 (tramp-send-command multi-method method user host "echo ~root") | |
4225 (tramp-wait-for-output) | |
4226 (cond | |
4227 ((string-match "^~root$" (buffer-string)) | |
4228 (setq shell | |
4229 (or (tramp-find-executable multi-method method user host | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
4230 "bash" tramp-remote-path t) |
45861 | 4231 (tramp-find-executable multi-method method user host |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
4232 "ksh" tramp-remote-path t))) |
45861 | 4233 (unless shell |
4234 (error "Couldn't find a shell which groks tilde expansion")) | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
4235 ;; Find arguments for this shell. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
4236 (let ((alist tramp-sh-extra-args) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
4237 item extra-args) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
4238 (while (and alist (null extra-args)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
4239 (setq item (pop alist)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
4240 (when (string-match (car item) shell) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
4241 (setq extra-args (cdr item)))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
4242 (when extra-args (setq shell (concat shell " " extra-args)))) |
45861 | 4243 (tramp-message |
4244 5 "Starting remote shell `%s' for tilde expansion..." shell) | |
4245 (tramp-send-command | |
4246 multi-method method user host | |
46801
3fafc6fca8a8
Version 2.0.9 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46799
diff
changeset
|
4247 (concat "PS1='$ ' exec " shell)) ; |
45861 | 4248 (unless (tramp-wait-for-regexp |
4249 (get-buffer-process (current-buffer)) | |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4250 60 (format "\\(\\(%s\\)\\|\\(%s\\)\\)\\'" |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4251 tramp-shell-prompt-pattern shell-prompt-pattern)) |
45861 | 4252 (pop-to-buffer (buffer-name)) |
4253 (error "Couldn't find remote `%s' prompt." shell)) | |
46801
3fafc6fca8a8
Version 2.0.9 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46799
diff
changeset
|
4254 (tramp-message |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4255 9 "Setting remote shell prompt...") |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4256 ;; Douglas Gray Stephens <DGrayStephens@slb.com> says that we |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4257 ;; must use "\n" here, not tramp-rsh-end-of-line. Kai left the |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4258 ;; last tramp-rsh-end-of-line, Douglas wanted to replace that, |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4259 ;; as well. |
45861 | 4260 (process-send-string nil (format "PS1='%s%s%s'; PS2=''; PS3=''%s" |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4261 tramp-rsh-end-of-line |
45861 | 4262 tramp-end-of-output |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4263 tramp-rsh-end-of-line |
45861 | 4264 tramp-rsh-end-of-line)) |
4265 (tramp-wait-for-output) | |
46801
3fafc6fca8a8
Version 2.0.9 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46799
diff
changeset
|
4266 (tramp-message |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4267 9 "Setting remote shell prompt...done") |
46835
df25ef3d3237
Version 2.0.12 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46808
diff
changeset
|
4268 ) |
45861 | 4269 (t (tramp-message 5 "Remote `%s' groks tilde expansion, good" |
47577
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
4270 (tramp-get-remote-sh multi-method method user host)))))) |
45861 | 4271 |
4272 (defun tramp-check-ls-command (multi-method method user host cmd) | |
4273 "Checks whether the given `ls' executable groks `-n'. | |
4274 METHOD, USER and HOST specify the connection, CMD (the full path name of) | |
4275 the `ls' executable. Returns t if CMD supports the `-n' option, nil | |
4276 otherwise." | |
4277 (tramp-message 9 "Checking remote `%s' command for `-n' option" | |
4278 cmd) | |
4279 (when (tramp-handle-file-executable-p | |
4280 (tramp-make-tramp-file-name multi-method method user host cmd)) | |
4281 (let ((result nil)) | |
4282 (tramp-message 7 "Testing remote command `%s' for -n..." cmd) | |
4283 (setq result | |
4284 (tramp-send-command-and-check | |
4285 multi-method method user host | |
4286 (format "%s -lnd / >/dev/null" | |
4287 cmd))) | |
4288 (tramp-message 7 "Testing remote command `%s' for -n...%s" | |
4289 cmd | |
4290 (if (zerop result) "okay" "failed")) | |
4291 (zerop result)))) | |
4292 | |
4293 (defun tramp-check-ls-commands (multi-method method user host cmd dirlist) | |
4294 "Checks whether the given `ls' executable in one of the dirs groks `-n'. | |
4295 Returns nil if none was found, else the command is returned." | |
4296 (let ((dl dirlist) | |
46835
df25ef3d3237
Version 2.0.12 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46808
diff
changeset
|
4297 (result nil) |
df25ef3d3237
Version 2.0.12 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46808
diff
changeset
|
4298 (directory-sep-char ?/)) ;for XEmacs |
45861 | 4299 ;; It would be better to use the CL function `find', but |
4300 ;; we don't want run-time dependencies on CL. | |
4301 (while (and dl (not result)) | |
4302 (let ((x (concat (file-name-as-directory (car dl)) cmd))) | |
4303 (when (tramp-check-ls-command multi-method method user host x) | |
4304 (setq result x))) | |
4305 (setq dl (cdr dl))) | |
4306 result)) | |
4307 | |
4308 (defun tramp-find-ls-command (multi-method method user host) | |
4309 "Finds an `ls' command which groks the `-n' option, returning nil if failed. | |
4310 \(This option prints numeric user and group ids in a long listing.)" | |
4311 (tramp-message 9 "Finding a suitable `ls' command") | |
4312 (or | |
4313 (tramp-check-ls-commands multi-method method user host "ls" tramp-remote-path) | |
4314 (tramp-check-ls-commands multi-method method user host "gnuls" tramp-remote-path) | |
4315 (tramp-check-ls-commands multi-method method user host "gls" tramp-remote-path))) | |
4316 | |
4317 ;; ------------------------------------------------------------ | |
4318 ;; -- Functions for establishing connection -- | |
4319 ;; ------------------------------------------------------------ | |
4320 | |
46752 | 4321 ;; The following functions are actions to be taken when seeing certain |
4322 ;; prompts from the remote host. See the variable | |
4323 ;; `tramp-actions-before-shell' for usage of these functions. | |
4324 | |
4325 (defun tramp-action-login (p multi-method method user host) | |
4326 "Send the login name." | |
4327 (tramp-message 9 "Sending login name `%s'" | |
4328 (or user (user-login-name))) | |
4329 (erase-buffer) | |
4330 (process-send-string nil (concat (or user (user-login-name)) | |
4331 tramp-rsh-end-of-line))) | |
4332 | |
4333 (defun tramp-action-password (p multi-method method user host) | |
4334 "Query the user for a password." | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4335 (when (tramp-method-out-of-band-p multi-method method user host) |
46752 | 4336 (kill-process (get-buffer-process (current-buffer))) |
4337 (error (concat "Out of band method `%s' not applicable " | |
4338 "for remote shell asking for a password") | |
4339 method)) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4340 (tramp-message 9 "Sending password") |
46752 | 4341 (tramp-enter-password p (match-string 0))) |
4342 | |
4343 (defun tramp-action-succeed (p multi-method method user host) | |
4344 "Signal success in finding shell prompt." | |
4345 (tramp-message 9 "Found remote shell prompt.") | |
4346 (erase-buffer) | |
4347 (throw 'tramp-action 'ok)) | |
4348 | |
4349 (defun tramp-action-permission-denied (p multi-method method user host) | |
4350 "Signal permission denied." | |
46790 | 4351 (pop-to-buffer (tramp-get-buffer multi-method method user host)) |
46752 | 4352 (tramp-message 9 "Permission denied by remote host.") |
4353 (kill-process p) | |
4354 (throw 'tramp-action 'permission-denied)) | |
4355 | |
4356 (defun tramp-action-yesno (p multi-method method user host) | |
46992
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
4357 "Ask the user for confirmation using `yes-or-no-p'. |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
4358 Send \"yes\" to remote process on confirmation, abort otherwise. |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
4359 See also `tramp-action-yn'." |
46752 | 4360 (save-window-excursion |
4361 (pop-to-buffer (tramp-get-buffer multi-method method user host)) | |
4362 (unless (yes-or-no-p (match-string 0)) | |
4363 (kill-process p) | |
4364 (erase-buffer) | |
4365 (throw 'tramp-action 'permission-denied)) | |
4366 (process-send-string p (concat "yes" tramp-rsh-end-of-line)) | |
4367 (erase-buffer))) | |
4368 | |
46992
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
4369 (defun tramp-action-yn (p multi-method method user host) |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
4370 "Ask the user for confirmation using `y-or-n-p'. |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
4371 Send \"y\" to remote process on confirmation, abort otherwise. |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
4372 See also `tramp-action-yesno'." |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
4373 (save-window-excursion |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
4374 (pop-to-buffer (tramp-get-buffer multi-method method user host)) |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
4375 (unless (y-or-n-p (match-string 0)) |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
4376 (kill-process p) |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
4377 (erase-buffer) |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
4378 (throw 'tramp-action 'permission-denied)) |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
4379 (process-send-string p (concat "y" tramp-rsh-end-of-line)))) |
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
4380 |
46752 | 4381 ;; The following functions are specifically for multi connections. |
4382 | |
4383 (defun tramp-multi-action-login (p method user host) | |
4384 "Send the login name." | |
4385 (tramp-message 9 "Sending login name `%s'" user) | |
4386 (erase-buffer) | |
4387 (process-send-string p (concat user tramp-rsh-end-of-line))) | |
4388 | |
4389 (defun tramp-multi-action-password (p method user host) | |
4390 "Query the user for a password." | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4391 (tramp-message 9 "Sending password") |
46752 | 4392 (tramp-enter-password p (match-string 0))) |
4393 | |
4394 (defun tramp-multi-action-succeed (p method user host) | |
4395 "Signal success in finding shell prompt." | |
4396 (tramp-message 9 "Found shell prompt on `%s'" host) | |
4397 (erase-buffer) | |
4398 (throw 'tramp-action 'ok)) | |
4399 | |
4400 (defun tramp-multi-action-permission-denied (p method user host) | |
4401 "Signal permission denied." | |
4402 (tramp-message 9 "Permission denied by remote host `%s'" host) | |
4403 (kill-process p) | |
4404 (erase-buffer) | |
4405 (throw 'tramp-action 'permission-denied)) | |
4406 | |
4407 ;; Functions for processing the actions. | |
4408 | |
4409 (defun tramp-process-one-action (p multi-method method user host actions) | |
4410 "Wait for output from the shell and perform one action." | |
4411 (let (found item pattern action todo) | |
4412 (erase-buffer) | |
4413 (tramp-message 9 "Waiting 60s for prompt from remote shell") | |
4414 (with-timeout (60 (throw 'tramp-action 'timeout)) | |
4415 (while (not found) | |
4416 (accept-process-output p 1) | |
4417 (goto-char (point-min)) | |
4418 (setq todo actions) | |
4419 (while todo | |
4420 (goto-char (point-min)) | |
4421 (setq item (pop todo)) | |
4422 (setq pattern (symbol-value (nth 0 item))) | |
4423 (setq action (nth 1 item)) | |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4424 (tramp-message 10 "Looking for regexp \"%s\" from remote shell" |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4425 pattern) |
46752 | 4426 (when (re-search-forward (concat pattern "\\'") nil t) |
4427 (setq found (funcall action p multi-method method user host))))) | |
4428 found))) | |
4429 | |
4430 (defun tramp-process-actions (p multi-method method user host actions) | |
4431 "Perform actions until success." | |
4432 (let (exit) | |
4433 (while (not exit) | |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4434 (tramp-message 9 "Waiting for prompts from remote shell") |
46752 | 4435 (setq exit |
4436 (catch 'tramp-action | |
4437 (tramp-process-one-action | |
4438 p multi-method method user host actions) | |
4439 nil))) | |
4440 (unless (eq exit 'ok) | |
4441 (error "Login failed")))) | |
4442 | |
4443 ;; For multi-actions. | |
4444 | |
4445 (defun tramp-process-one-multi-action (p method user host actions) | |
4446 "Wait for output from the shell and perform one action." | |
4447 (let (found item pattern action todo) | |
4448 (erase-buffer) | |
4449 (tramp-message 9 "Waiting 60s for prompt from remote shell") | |
4450 (with-timeout (60 (throw 'tramp-action 'timeout)) | |
4451 (while (not found) | |
4452 (accept-process-output p 1) | |
4453 (setq todo actions) | |
4454 (goto-char (point-min)) | |
4455 (while todo | |
4456 (goto-char (point-min)) | |
4457 (setq item (pop todo)) | |
4458 (setq pattern (symbol-value (nth 0 item))) | |
4459 (setq action (nth 1 item)) | |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4460 (tramp-message 10 "Looking for regexp \"%s\" from remote shell" |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4461 pattern) |
46752 | 4462 (when (re-search-forward (concat pattern "\\'") nil t) |
4463 (setq found (funcall action p method user host))))) | |
4464 found))) | |
4465 | |
4466 (defun tramp-process-multi-actions (p method user host actions) | |
4467 "Perform actions until success." | |
4468 (let (exit) | |
4469 (while (not exit) | |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4470 (tramp-message 9 "Waiting for prompts from remote shell") |
46752 | 4471 (setq exit |
4472 (catch 'tramp-action | |
4473 (tramp-process-one-multi-action p method user host actions) | |
4474 nil))) | |
4475 (unless (eq exit 'ok) | |
4476 (error "Login failed")))) | |
4477 | |
4478 ;; The actual functions for opening connections. | |
45861 | 4479 |
4480 (defun tramp-open-connection-telnet (multi-method method user host) | |
4481 "Open a connection using a telnet METHOD. | |
4482 This starts the command `telnet HOST ARGS'[*], then waits for a remote | |
4483 login prompt, then sends the user name USER, then waits for a remote | |
4484 password prompt. It queries the user for the password, then sends the | |
4485 password to the remote host. | |
4486 | |
4487 If USER is nil, uses value returned by `(user-login-name)' instead. | |
4488 | |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4489 Recognition of the remote shell prompt is based on the variables |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4490 `shell-prompt-pattern' and `tramp-shell-prompt-pattern' which must be |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4491 set up correctly. |
45861 | 4492 |
4493 Please note that it is NOT possible to use this connection method | |
4494 together with an out-of-band transfer method! You must use an inline | |
4495 transfer method. | |
4496 | |
4497 Maybe the different regular expressions need to be tuned. | |
4498 | |
4499 * Actually, the telnet program as well as the args to be used can be | |
4500 specified in the method parameters, see the variable `tramp-methods'." | |
4501 (save-match-data | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4502 (when (tramp-method-out-of-band-p multi-method method user host) |
45861 | 4503 (error "Cannot use out-of-band method `%s' with telnet connection method" |
4504 method)) | |
4505 (when multi-method | |
4506 (error "Cannot multi-connect using telnet connection method")) | |
4507 (tramp-pre-connection multi-method method user host) | |
4508 (tramp-message 7 "Opening connection for %s@%s using %s..." | |
4509 (or user (user-login-name)) host method) | |
4510 (let ((process-environment (copy-sequence process-environment))) | |
4511 (setenv "TERM" tramp-terminal-type) | |
4512 (let* ((default-directory (tramp-temporary-file-directory)) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4513 ;; If we omit the conditional here, then we would use |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4514 ;; `undecided-dos' in some cases. With the conditional, |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4515 ;; we use nil in these cases. Which one is right? |
45861 | 4516 (coding-system-for-read (unless (and (not (featurep 'xemacs)) |
4517 (> emacs-major-version 20)) | |
4518 tramp-dos-coding-system)) | |
4519 (p (apply 'start-process | |
4520 (tramp-buffer-name multi-method method user host) | |
4521 (tramp-get-buffer multi-method method user host) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4522 (tramp-get-telnet-program |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4523 multi-method |
47577
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
4524 (tramp-find-method multi-method method user host) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
4525 user host) |
45861 | 4526 host |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4527 (tramp-get-telnet-args |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4528 multi-method |
47577
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
4529 (tramp-find-method multi-method method user host) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
4530 user host))) |
45861 | 4531 (found nil) |
4532 (pw nil)) | |
4533 (process-kill-without-query p) | |
46752 | 4534 (set-buffer (tramp-get-buffer multi-method method user host)) |
4535 (erase-buffer) | |
4536 (tramp-process-actions p multi-method method user host | |
4537 tramp-actions-before-shell) | |
45861 | 4538 (tramp-open-connection-setup-interactive-shell |
4539 p multi-method method user host) | |
4540 (tramp-post-connection multi-method method user host))))) | |
4541 | |
46752 | 4542 |
45861 | 4543 (defun tramp-open-connection-rsh (multi-method method user host) |
4544 "Open a connection using an rsh METHOD. | |
4545 This starts the command `rsh HOST -l USER'[*], then waits for a remote | |
4546 password or shell prompt. If a password prompt is seen, the user is | |
4547 queried for a password, this function sends the password to the remote | |
4548 host and waits for a shell prompt. | |
4549 | |
4550 If USER is nil, start the command `rsh HOST'[*] instead | |
4551 | |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4552 Recognition of the remote shell prompt is based on the variables |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4553 `shell-prompt-pattern' and `tramp-shell-prompt-pattern' which must be |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4554 set up correctly. |
45861 | 4555 |
4556 Please note that it is NOT possible to use this connection method with | |
4557 an out-of-band transfer method if this function asks the user for a | |
4558 password! You must use an inline transfer method in this case. | |
4559 Sadly, the transfer method cannot be switched on the fly, instead you | |
4560 must specify the right method in the file name. | |
4561 | |
46010
d07b0e5f80b9
(tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46009
diff
changeset
|
4562 Kludgy feature: if HOST has the form \"xx#yy\", then yy is assumed to |
d07b0e5f80b9
(tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46009
diff
changeset
|
4563 be a port number for ssh, and \"-p yy\" will be added to the list of |
d07b0e5f80b9
(tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46009
diff
changeset
|
4564 arguments, and xx will be used as the host name to connect to. |
d07b0e5f80b9
(tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46009
diff
changeset
|
4565 |
45861 | 4566 * Actually, the rsh program to be used can be specified in the |
4567 method parameters, see the variable `tramp-methods'." | |
4568 (save-match-data | |
4569 (when multi-method | |
4570 (error "Cannot multi-connect using rsh connection method")) | |
4571 (tramp-pre-connection multi-method method user host) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4572 (if (and user (not (string= user ""))) |
45861 | 4573 (tramp-message 7 "Opening connection for %s@%s using %s..." |
4574 user host method) | |
4575 (tramp-message 7 "Opening connection at %s using %s..." host method)) | |
46010
d07b0e5f80b9
(tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46009
diff
changeset
|
4576 (let ((process-environment (copy-sequence process-environment)) |
d07b0e5f80b9
(tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46009
diff
changeset
|
4577 (bufnam (tramp-buffer-name multi-method method user host)) |
d07b0e5f80b9
(tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46009
diff
changeset
|
4578 (buf (tramp-get-buffer multi-method method user host)) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4579 (rsh-program (tramp-get-rsh-program |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4580 multi-method |
47577
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
4581 (tramp-find-method multi-method method user host) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
4582 user host)) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4583 (rsh-args (tramp-get-rsh-args |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4584 multi-method |
47577
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
4585 (tramp-find-method multi-method method user host) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
4586 user host))) |
46010
d07b0e5f80b9
(tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46009
diff
changeset
|
4587 ;; The following should be changed. We need a more general |
d07b0e5f80b9
(tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46009
diff
changeset
|
4588 ;; mechanism to parse extra host args. |
d07b0e5f80b9
(tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46009
diff
changeset
|
4589 (when (string-match "\\([^#]*\\)#\\(.*\\)" host) |
d07b0e5f80b9
(tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46009
diff
changeset
|
4590 (setq rsh-args (cons "-p" (cons (match-string 2 host) rsh-args))) |
d07b0e5f80b9
(tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46009
diff
changeset
|
4591 (setq host (match-string 1 host))) |
45861 | 4592 (setenv "TERM" tramp-terminal-type) |
4593 (let* ((default-directory (tramp-temporary-file-directory)) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4594 ;; If we omit the conditional, we would use |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4595 ;; `undecided-dos' in some cases. With the conditional, |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4596 ;; we use nil in these cases. Which one is right? |
45861 | 4597 (coding-system-for-read (unless (and (not (featurep 'xemacs)) |
4598 (> emacs-major-version 20)) | |
4599 tramp-dos-coding-system)) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4600 (p (if (and user (not (string= user ""))) |
46010
d07b0e5f80b9
(tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46009
diff
changeset
|
4601 (apply #'start-process bufnam buf rsh-program |
d07b0e5f80b9
(tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46009
diff
changeset
|
4602 host "-l" user rsh-args) |
d07b0e5f80b9
(tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46009
diff
changeset
|
4603 (apply #'start-process bufnam buf rsh-program |
d07b0e5f80b9
(tramp-open-connection-rsh): Support a kludgy feature for the
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46009
diff
changeset
|
4604 host rsh-args))) |
45861 | 4605 (found nil)) |
4606 (process-kill-without-query p) | |
46752 | 4607 |
4608 (set-buffer buf) | |
4609 (tramp-process-actions p multi-method method user host | |
4610 tramp-actions-before-shell) | |
45861 | 4611 (tramp-message 7 "Initializing remote shell") |
4612 (tramp-open-connection-setup-interactive-shell | |
4613 p multi-method method user host) | |
4614 (tramp-post-connection multi-method method user host))))) | |
4615 | |
4616 (defun tramp-open-connection-su (multi-method method user host) | |
4617 "Open a connection using the `su' program with METHOD. | |
4618 This starts `su - USER', then waits for a password prompt. The HOST | |
4619 name must be equal to the local host name or to `localhost'. | |
4620 | |
4621 If USER is nil, uses value returned by user-login-name instead. | |
4622 | |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4623 Recognition of the remote shell prompt is based on the variables |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4624 `shell-prompt-pattern' and `tramp-shell-prompt-pattern' which must be |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4625 set up correctly. Note that the other user may have a different shell |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4626 prompt than you do, so it is not at all unlikely that the variable |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4627 `shell-prompt-pattern' is set up wrongly!" |
45861 | 4628 (save-match-data |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4629 (when (tramp-method-out-of-band-p multi-method method user host) |
45861 | 4630 (error "Cannot use out-of-band method `%s' with `su' connection method" |
4631 method)) | |
4632 (unless (or (string-match (concat "^" (regexp-quote host)) | |
4633 (system-name)) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4634 (string= "localhost" host) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4635 (string= "" host)) |
45861 | 4636 (error |
4637 "Cannot connect to different host `%s' with `su' connection method" | |
4638 host)) | |
4639 (tramp-pre-connection multi-method method user host) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4640 (tramp-message 7 "Opening connection for `%s' using `%s'..." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4641 (or user "<root>") method) |
45861 | 4642 (let ((process-environment (copy-sequence process-environment))) |
4643 (setenv "TERM" tramp-terminal-type) | |
4644 (let* ((default-directory (tramp-temporary-file-directory)) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4645 ;; If we omit the conditional, we use `undecided-dos' in |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4646 ;; some cases. With the conditional, we use nil in these |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4647 ;; cases. What's the difference? Which one is right? |
45861 | 4648 (coding-system-for-read (unless (and (not (featurep 'xemacs)) |
4649 (> emacs-major-version 20)) | |
4650 tramp-dos-coding-system)) | |
4651 (p (apply 'start-process | |
46752 | 4652 (tramp-buffer-name multi-method method user host) |
4653 (tramp-get-buffer multi-method method user host) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4654 (tramp-get-su-program |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4655 multi-method |
47577
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
4656 (tramp-find-method multi-method method user host) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
4657 user host) |
45861 | 4658 (mapcar |
4659 '(lambda (x) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4660 (format-spec x `((?u . ,(or user "root"))))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4661 (tramp-get-su-args |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4662 multi-method |
47577
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
4663 (tramp-find-method multi-method method user host) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
4664 user host)))) |
45861 | 4665 (found nil) |
4666 (pw nil)) | |
4667 (process-kill-without-query p) | |
46752 | 4668 (set-buffer (tramp-get-buffer multi-method method user host)) |
4669 (tramp-process-actions p multi-method method user host | |
4670 tramp-actions-before-shell) | |
45861 | 4671 (tramp-open-connection-setup-interactive-shell |
4672 p multi-method method user host) | |
4673 (tramp-post-connection multi-method method | |
4674 user host))))) | |
4675 | |
4676 ;; HHH: Not Changed. Multi method. It is not clear to me how this can | |
4677 ;; handle not giving a user name in the "file name". | |
4678 ;; | |
4679 ;; This is more difficult than for the single-hop method. In the | |
4680 ;; multi-hop-method, the desired behaviour should be that the | |
4681 ;; user must specify names for the telnet hops of which the user | |
4682 ;; name is different than the "original" name (or different from | |
4683 ;; the previous hop. | |
4684 (defun tramp-open-connection-multi (multi-method method user host) | |
4685 "Open a multi-hop connection using METHOD. | |
4686 This uses a slightly changed file name syntax. The idea is to say | |
4687 [multi/telnet:u1@h1/rsh:u2@h2]/path/to/file | |
4688 This will use telnet to log in as u1 to h1, then use rsh from there to | |
4689 log in as u2 to h2." | |
4690 (save-match-data | |
4691 (unless multi-method | |
4692 (error "Multi-hop open connection function called on non-multi method")) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4693 (when (tramp-method-out-of-band-p multi-method method user host) |
45861 | 4694 (error "No out of band multi-hop connections")) |
4695 (unless (and (arrayp method) (not (stringp method))) | |
4696 (error "METHOD must be an array of strings for multi methods")) | |
4697 (unless (and (arrayp user) (not (stringp user))) | |
4698 (error "USER must be an array of strings for multi methods")) | |
4699 (unless (and (arrayp host) (not (stringp host))) | |
4700 (error "HOST must be an array of strings for multi methods")) | |
4701 (unless (and (= (length method) (length user)) | |
4702 (= (length method) (length host))) | |
4703 (error "Arrays METHOD, USER, HOST must have equal length")) | |
4704 (tramp-pre-connection multi-method method user host) | |
4705 (tramp-message 7 "Opening `%s' connection..." multi-method) | |
4706 (let ((process-environment (copy-sequence process-environment))) | |
4707 (setenv "TERM" tramp-terminal-type) | |
4708 (let* ((default-directory (tramp-temporary-file-directory)) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4709 ;; If we omit the conditional, we use `undecided-dos' in |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4710 ;; some cases. With the conditional, we use nil in these |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4711 ;; cases. What's the difference? Which one is right? |
45861 | 4712 (coding-system-for-read (unless (and (not (featurep 'xemacs)) |
4713 (> emacs-major-version 20)) | |
4714 tramp-dos-coding-system)) | |
4715 (p (start-process (tramp-buffer-name multi-method method user host) | |
4716 (tramp-get-buffer multi-method method user host) | |
46584
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
4717 tramp-multi-sh-program)) |
45861 | 4718 (num-hops (length method)) |
4719 (i 0)) | |
4720 (process-kill-without-query p) | |
4721 (tramp-message 9 "Waiting 60s for local shell to come up...") | |
4722 (unless (tramp-wait-for-regexp | |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4723 p 60 (format "\\(%s\\)\\'\\|\\(%s\\)\\'" |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4724 shell-prompt-pattern tramp-shell-prompt-pattern)) |
45861 | 4725 (pop-to-buffer (buffer-name)) |
4726 (kill-process p) | |
4727 (error "Couldn't find local shell prompt")) | |
4728 ;; Now do all the connections as specified. | |
4729 (while (< i num-hops) | |
4730 (let* ((m (aref method i)) | |
4731 (u (aref user i)) | |
4732 (h (aref host i)) | |
4733 (entry (assoc m tramp-multi-connection-function-alist)) | |
4734 (multi-func (nth 1 entry)) | |
4735 (command (nth 2 entry))) | |
47205
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
4736 ;; The multi-funcs don't need to do save-match-data, as that |
45861 | 4737 ;; is done here. |
4738 (funcall multi-func p m u h command) | |
4739 (erase-buffer) | |
4740 (incf i))) | |
4741 (tramp-open-connection-setup-interactive-shell | |
4742 p multi-method method user host) | |
4743 (tramp-post-connection multi-method method user host))))) | |
4744 | |
4745 ;; HHH: Changed. Multi method. Don't know how to handle this in the case | |
4746 ;; of no user name provided. Hack to make it work as it did before: | |
4747 ;; changed `user' to `(or user (user-login-name))' in the places where | |
4748 ;; the value is actually used. | |
4749 (defun tramp-multi-connect-telnet (p method user host command) | |
4750 "Issue `telnet' command. | |
4751 Uses shell COMMAND to issue a `telnet' command to log in as USER to | |
4752 HOST. You can use percent escapes in COMMAND: `%h' is replaced with | |
4753 the host name, and `%n' is replaced with an end of line character, as | |
4754 set in `tramp-rsh-end-of-line'. Use `%%' if you want a literal percent | |
4755 character. | |
4756 | |
4757 If USER is nil, uses the return value of (user-login-name) instead." | |
46752 | 4758 (let ((cmd (format-spec command |
4759 `((?h . ,host) (?n . ,tramp-rsh-end-of-line)))) | |
4760 (cmd1 (format-spec command `((?h . ,host) (?n . "")))) | |
45861 | 4761 found pw) |
4762 (erase-buffer) | |
4763 (tramp-message 9 "Sending telnet command `%s'" cmd1) | |
4764 (process-send-string p cmd) | |
46752 | 4765 (tramp-process-multi-actions p method user host |
47205
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
4766 tramp-multi-actions))) |
45861 | 4767 |
4768 ;; HHH: Changed. Multi method. Don't know how to handle this in the case | |
4769 ;; of no user name provided. Hack to make it work as it did before: | |
4770 ;; changed `user' to `(or user (user-login-name))' in the places where | |
4771 ;; the value is actually used. | |
4772 (defun tramp-multi-connect-rlogin (p method user host command) | |
4773 "Issue `rlogin' command. | |
4774 Uses shell COMMAND to issue an `rlogin' command to log in as USER to | |
4775 HOST. You can use percent escapes in COMMAND. `%u' will be replaced | |
4776 with the user name, `%h' will be replaced with the host name, and `%n' | |
4777 will be replaced with the value of `tramp-rsh-end-of-line'. You can use | |
4778 `%%' if you want to use a literal percent character. | |
4779 | |
4780 If USER is nil, uses the return value of (user-login-name) instead." | |
46752 | 4781 (let ((cmd (format-spec command `((?h . ,host) |
4782 (?u . ,(or user (user-login-name))) | |
4783 (?n . ,tramp-rsh-end-of-line)))) | |
4784 (cmd1 (format-spec command `((?h . ,host) | |
4785 (?u . ,(or user (user-login-name))) | |
4786 (?n . "")))) | |
45861 | 4787 found) |
4788 (erase-buffer) | |
4789 (tramp-message 9 "Sending rlogin command `%s'" cmd1) | |
4790 (process-send-string p cmd) | |
46752 | 4791 (tramp-process-multi-actions p method user host |
47205
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
4792 tramp-multi-actions))) |
45861 | 4793 |
4794 ;; HHH: Changed. Multi method. Don't know how to handle this in the case | |
4795 ;; of no user name provided. Hack to make it work as it did before: | |
4796 ;; changed `user' to `(or user (user-login-name))' in the places where | |
4797 ;; the value is actually used. | |
4798 (defun tramp-multi-connect-su (p method user host command) | |
4799 "Issue `su' command. | |
4800 Uses shell COMMAND to issue a `su' command to log in as USER on | |
4801 HOST. The HOST name is ignored, this just changes the user id on the | |
4802 host currently logged in to. | |
4803 | |
4804 If USER is nil, uses the return value of (user-login-name) instead. | |
4805 | |
4806 You can use percent escapes in the COMMAND. `%u' is replaced with the | |
4807 user name, and `%n' is replaced with the value of | |
4808 `tramp-rsh-end-of-line'. Use `%%' if you want a literal percent | |
4809 character." | |
46752 | 4810 (let ((cmd (format-spec command `((?u . ,(or user (user-login-name))) |
4811 (?n . ,tramp-rsh-end-of-line)))) | |
4812 (cmd1 (format-spec command `((?u . ,(or user (user-login-name))) | |
4813 (?n . "")))) | |
45861 | 4814 found) |
4815 (erase-buffer) | |
4816 (tramp-message 9 "Sending su command `%s'" cmd1) | |
4817 (process-send-string p cmd) | |
46752 | 4818 (tramp-process-multi-actions p method user host |
47205
8a2bf9dded0f
* net/tramp.el: Version 2.0.15 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46998
diff
changeset
|
4819 tramp-multi-actions))) |
45861 | 4820 |
4821 ;; Utility functions. | |
4822 | |
4823 (defun tramp-wait-for-regexp (proc timeout regexp) | |
4824 "Wait for a REGEXP to appear from process PROC within TIMEOUT seconds. | |
4825 Expects the output of PROC to be sent to the current buffer. Returns | |
4826 the string that matched, or nil. Waits indefinitely if TIMEOUT is | |
4827 nil." | |
4828 (let ((found nil) | |
4829 (start-time (current-time))) | |
4830 (cond (timeout | |
4831 ;; Work around a bug in XEmacs 21, where the timeout | |
4832 ;; expires faster than it should. This degenerates | |
4833 ;; to polling for buggy XEmacsen, but oh, well. | |
4834 (while (and (not found) | |
4835 (< (tramp-time-diff (current-time) start-time) | |
4836 timeout)) | |
4837 (with-timeout (timeout) | |
4838 (while (not found) | |
4839 (accept-process-output proc 1) | |
4840 (goto-char (point-min)) | |
4841 (setq found (when (re-search-forward regexp nil t) | |
4842 (tramp-match-string-list))))))) | |
4843 (t | |
4844 (while (not found) | |
4845 (accept-process-output proc 1) | |
4846 (goto-char (point-min)) | |
4847 (setq found (when (re-search-forward regexp nil t) | |
4848 (tramp-match-string-list)))))) | |
4849 (when tramp-debug-buffer | |
4850 (append-to-buffer | |
4851 (tramp-get-debug-buffer tramp-current-multi-method tramp-current-method | |
4852 tramp-current-user tramp-current-host) | |
4853 (point-min) (point-max)) | |
4854 (when (not found) | |
4855 (save-excursion | |
4856 (set-buffer | |
4857 (tramp-get-debug-buffer tramp-current-multi-method tramp-current-method | |
4858 tramp-current-user tramp-current-host)) | |
4859 (goto-char (point-max)) | |
4860 (insert "[[Regexp `" regexp "' not found" | |
46048
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
4861 (if timeout (format " in %d secs" timeout) "") |
45861 | 4862 "]]")))) |
4863 found)) | |
4864 | |
4865 (defun tramp-enter-password (p prompt) | |
4866 "Prompt for a password and send it to the remote end. | |
4867 Uses PROMPT as a prompt and sends the password to process P." | |
4868 (let ((pw (tramp-read-passwd prompt))) | |
46752 | 4869 (erase-buffer) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4870 (process-send-string p (concat pw tramp-password-end-of-line)))) |
45861 | 4871 |
4872 ;; HHH: Not Changed. This might handle the case where USER is not | |
4873 ;; given in the "File name" very poorly. Then, the local | |
4874 ;; variable tramp-current user will be set to nil. | |
4875 (defun tramp-pre-connection (multi-method method user host) | |
4876 "Do some setup before actually logging in. | |
4877 METHOD, USER and HOST specify the connection." | |
4878 (set-buffer (tramp-get-buffer multi-method method user host)) | |
4879 (set (make-local-variable 'tramp-current-multi-method) multi-method) | |
4880 (set (make-local-variable 'tramp-current-method) method) | |
4881 (set (make-local-variable 'tramp-current-user) user) | |
4882 (set (make-local-variable 'tramp-current-host) host) | |
4883 (set (make-local-variable 'inhibit-eol-conversion) nil) | |
4884 (erase-buffer)) | |
4885 | |
4886 (defun tramp-open-connection-setup-interactive-shell | |
4887 (p multi-method method user host) | |
4888 "Set up an interactive shell. | |
4889 Mainly sets the prompt and the echo correctly. P is the shell process | |
4890 to set up. METHOD, USER and HOST specify the connection." | |
4891 ;; Wait a bit in case the remote end feels like sending a little | |
4892 ;; junk first. It seems that fencepost.gnu.org does this when doing | |
4893 ;; a Kerberos login. | |
4894 (sit-for 1) | |
4895 (tramp-discard-garbage-erase-buffer p multi-method method user host) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4896 ;; It is useful to set the prompt in the following command because |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4897 ;; some people have a setting for $PS1 which /bin/sh doesn't know |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4898 ;; about and thus /bin/sh will display a strange prompt. For |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4899 ;; example, if $PS1 has "${CWD}" in the value, then ksh will display |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4900 ;; the current working directory but /bin/sh will display a dollar |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4901 ;; sign. The following command line sets $PS1 to a sane value, and |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4902 ;; works under Bourne-ish shells as well as csh-like shells. Daniel |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4903 ;; Pittman reports that the unusual positioning of the single quotes |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4904 ;; makes it work under `rc', too. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4905 (process-send-string nil (format "exec env 'PS1=$ ' %s%s" |
47577
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
4906 (tramp-get-remote-sh |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
4907 multi-method method user host) |
45861 | 4908 tramp-rsh-end-of-line)) |
4909 (when tramp-debug-buffer | |
4910 (save-excursion | |
4911 (set-buffer (tramp-get-debug-buffer multi-method method user host)) | |
4912 (goto-char (point-max)) | |
4913 (tramp-insert-with-face | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
4914 'bold (format "$ exec env PS1='$ ' %s\n" |
47577
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
4915 (tramp-get-remote-sh multi-method method user host))))) |
45861 | 4916 (tramp-message 9 "Waiting 30s for remote `%s' to come up..." |
47577
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
4917 (tramp-get-remote-sh multi-method method user host)) |
45861 | 4918 (unless (tramp-wait-for-regexp |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4919 p 30 (format "\\(%s\\|%s\\)\\'" |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4920 shell-prompt-pattern tramp-shell-prompt-pattern)) |
45861 | 4921 (pop-to-buffer (buffer-name)) |
4922 (error "Remote `%s' didn't come up. See buffer `%s' for details" | |
47577
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
4923 (tramp-get-remote-sh multi-method method user host) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
4924 (buffer-name))) |
45861 | 4925 (tramp-message 9 "Setting up remote shell environment") |
4926 (tramp-discard-garbage-erase-buffer p multi-method method user host) | |
4927 (process-send-string | |
4928 nil (format "stty -inlcr -echo kill '^U'%s" tramp-rsh-end-of-line)) | |
4929 (unless (tramp-wait-for-regexp | |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4930 p 30 (format "\\(%s\\|%s\\)\\'" |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4931 shell-prompt-pattern tramp-shell-prompt-pattern)) |
45861 | 4932 (pop-to-buffer (buffer-name)) |
4933 (error "Couldn't `stty -echo', see buffer `%s'" (buffer-name))) | |
4934 (erase-buffer) | |
4935 (process-send-string nil (format "TERM=dumb; export TERM%s" | |
4936 tramp-rsh-end-of-line)) | |
4937 (unless (tramp-wait-for-regexp | |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4938 p 30 (format "\\(%s\\|%s\\)\\'" |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4939 shell-prompt-pattern tramp-shell-prompt-pattern)) |
45861 | 4940 (pop-to-buffer (buffer-name)) |
4941 (error "Couldn't `TERM=dumb; export TERM', see buffer `%s'" (buffer-name))) | |
4942 ;; Try to set up the coding system correctly. | |
4943 ;; CCC this can't be the right way to do it. Hm. | |
4944 (save-excursion | |
4945 (erase-buffer) | |
4946 (tramp-message 9 "Determining coding system") | |
4947 (process-send-string nil (format "echo foo ; echo bar %s" | |
4948 tramp-rsh-end-of-line)) | |
4949 (unless (tramp-wait-for-regexp | |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4950 p 30 (format "\\(%s\\|%s\\)\\'" |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4951 shell-prompt-pattern tramp-shell-prompt-pattern)) |
45861 | 4952 (pop-to-buffer (buffer-name)) |
4953 (error "Couldn't `echo foo; echo bar' to determine line endings'")) | |
4954 (goto-char (point-min)) | |
4955 (if (featurep 'mule) | |
4956 ;; Use MULE to select the right EOL convention for communicating | |
4957 ;; with the process. | |
4958 (let* ((cs (or (process-coding-system p) (cons 'undecided 'undecided))) | |
4959 cs-decode cs-encode) | |
4960 (when (symbolp cs) (setq cs (cons cs cs))) | |
4961 (setq cs-decode (car cs)) | |
4962 (setq cs-encode (cdr cs)) | |
4963 (unless cs-decode (setq cs-decode 'undecided)) | |
4964 (unless cs-encode (setq cs-encode 'undecided)) | |
4965 (setq cs-encode (tramp-coding-system-change-eol-conversion | |
4966 cs-encode 'unix)) | |
4967 (when (search-forward "\r" nil t) | |
4968 (setq cs-decode (tramp-coding-system-change-eol-conversion | |
4969 cs-decode 'dos))) | |
4970 (set-buffer-process-coding-system cs-decode cs-encode)) | |
4971 ;; Look for ^M and do something useful if found. | |
4972 (when (search-forward "\r" nil t) | |
4973 ;; We have found a ^M but cannot frob the process coding system | |
4974 ;; because we're running on a non-MULE Emacs. Let's try | |
4975 ;; stty, instead. | |
4976 (tramp-message 9 "Trying `stty -onlcr'") | |
4977 (process-send-string nil (format "stty -onlcr%s" tramp-rsh-end-of-line)) | |
4978 (unless (tramp-wait-for-regexp | |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4979 p 30 (format "\\(%s\\|%s\\)\\'" |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4980 shell-prompt-pattern tramp-shell-prompt-pattern)) |
45861 | 4981 (pop-to-buffer (buffer-name)) |
4982 (error "Couldn't `stty -onlcr', see buffer `%s'" (buffer-name)))))) | |
4983 (erase-buffer) | |
4984 (tramp-message | |
4985 9 "Waiting 30s for `HISTFILE=$HOME/.tramp_history; HISTSIZE=1'") | |
4986 (process-send-string | |
4987 nil (format "HISTFILE=$HOME/.tramp_history; HISTSIZE=1%s" | |
4988 tramp-rsh-end-of-line)) | |
4989 (unless (tramp-wait-for-regexp | |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4990 p 30 (format "\\(%s\\|%s\\)\\'" |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
4991 shell-prompt-pattern tramp-shell-prompt-pattern)) |
45861 | 4992 (pop-to-buffer (buffer-name)) |
4993 (error (concat "Couldn't `HISTFILE=$HOME/.tramp_history; " | |
4994 "HISTSIZE=1', see buffer `%s'") | |
4995 (buffer-name))) | |
4996 (erase-buffer) | |
4997 (tramp-message 9 "Waiting 30s for `set +o vi +o emacs'") | |
4998 (process-send-string | |
4999 nil (format "set +o vi +o emacs%s" ;mustn't `>/dev/null' with AIX? | |
5000 tramp-rsh-end-of-line)) | |
5001 (unless (tramp-wait-for-regexp | |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
5002 p 30 (format "\\(%s\\|%s\\)\\'" |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
5003 shell-prompt-pattern tramp-shell-prompt-pattern)) |
45861 | 5004 (pop-to-buffer (buffer-name)) |
5005 (error "Couldn't `set +o vi +o emacs', see buffer `%s'" | |
5006 (buffer-name))) | |
5007 (erase-buffer) | |
5008 (tramp-message 9 "Waiting 30s for `unset MAIL MAILCHECK MAILPATH'") | |
5009 (process-send-string | |
5010 nil (format "unset MAIL MAILCHECK MAILPATH 1>/dev/null 2>/dev/null%s" | |
5011 tramp-rsh-end-of-line)) | |
5012 (unless (tramp-wait-for-regexp | |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
5013 p 30 (format "\\(%s\\|%s\\)\\'" |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
5014 shell-prompt-pattern tramp-shell-prompt-pattern)) |
45861 | 5015 (pop-to-buffer (buffer-name)) |
5016 (error "Couldn't `unset MAIL MAILCHECK MAILPATH', see buffer `%s'" | |
5017 (buffer-name))) | |
5018 (erase-buffer) | |
5019 (tramp-message 9 "Waiting 30s for `unset CDPATH'") | |
5020 (process-send-string | |
5021 nil (format "unset CDPATH%s" tramp-rsh-end-of-line)) | |
5022 (unless (tramp-wait-for-regexp | |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
5023 p 30 (format "\\(%s\\|%s\\)\\'" |
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
5024 shell-prompt-pattern tramp-shell-prompt-pattern)) |
45861 | 5025 (pop-to-buffer (buffer-name)) |
5026 (error "Couldn't `unset CDPATH', see buffer `%s'" | |
5027 (buffer-name))) | |
5028 (erase-buffer) | |
5029 (tramp-message 9 "Setting shell prompt") | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5030 ;; Douglas Gray Stephens <DGrayStephens@slb.com> says that we must |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5031 ;; use "\n" here, not tramp-rsh-end-of-line. |
45861 | 5032 (tramp-send-command |
5033 multi-method method user host | |
5034 (format "PS1='%s%s%s'; PS2=''; PS3=''" | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5035 tramp-rsh-end-of-line |
45861 | 5036 tramp-end-of-output |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5037 tramp-rsh-end-of-line)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5038 (tramp-wait-for-output)) |
45861 | 5039 |
5040 (defun tramp-post-connection (multi-method method user host) | |
5041 "Prepare a remote shell before being able to work on it. | |
5042 METHOD, USER and HOST specify the connection. | |
5043 Among other things, this finds a shell which groks tilde expansion, | |
5044 tries to find an `ls' command which groks the `-n' option, sets the | |
5045 locale to C and sets up the remote shell search path." | |
5046 ;; Search for a good shell before searching for a command which | |
5047 ;; checks if a file exists. This is done because Tramp wants to use | |
5048 ;; "test foo; echo $?" to check if various conditions hold, and | |
5049 ;; there are buggy /bin/sh implementations which don't execute the | |
5050 ;; "echo $?" part if the "test" part has an error. In particular, | |
5051 ;; the Solaris /bin/sh is a problem. I'm betting that all systems | |
5052 ;; with buggy /bin/sh implementations will have a working bash or | |
5053 ;; ksh. Whee... | |
5054 (tramp-find-shell multi-method method user host) | |
5055 ;; Without (sit-for 0.1) at least, my machine will almost always blow | |
5056 ;; up on 'not numberp /root' - a race that causes the 'echo ~root' | |
5057 ;; output of (tramp-find-shell) to show up along with the output of | |
5058 ;; (tramp-find-ls-command) testing. | |
5059 ;; | |
5060 ;; I can't work out why this is a problem though. The (tramp-wait-for-output) | |
5061 ;; call in (tramp-find-shell) *should* make this not happen, I thought. | |
5062 ;; | |
5063 ;; After much debugging I couldn't find any problem with the implementation | |
5064 ;; of that function though. The workaround stays for me at least. :/ | |
5065 ;; | |
5066 ;; Daniel Pittman <daniel@danann.net> | |
46802
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
5067 (sleep-for 1) |
46808
cf225aed7a75
Version 2.0.11 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46802
diff
changeset
|
5068 (erase-buffer) |
46802
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
5069 (tramp-find-file-exists-command multi-method method user host) |
45861 | 5070 (make-local-variable 'tramp-ls-command) |
5071 (setq tramp-ls-command (tramp-find-ls-command multi-method method user host)) | |
5072 (unless tramp-ls-command | |
5073 (tramp-message | |
5074 1 | |
5075 "Danger! Couldn't find ls which groks -n. Muddling through anyway") | |
5076 (setq tramp-ls-command | |
5077 (tramp-find-executable multi-method method user host | |
5078 "ls" tramp-remote-path nil))) | |
5079 (unless tramp-ls-command | |
5080 (error "Fatal error: Couldn't find remote executable `ls'")) | |
5081 (tramp-message 5 "Using remote command `%s' for getting directory listings" | |
5082 tramp-ls-command) | |
5083 (tramp-send-command multi-method method user host | |
5084 (concat "tramp_set_exit_status () {" tramp-rsh-end-of-line | |
5085 "return $1" tramp-rsh-end-of-line | |
5086 "}")) | |
5087 (tramp-wait-for-output) | |
5088 ;; Set remote PATH variable. | |
5089 (tramp-set-remote-path multi-method method user host "PATH" tramp-remote-path) | |
5090 ;; Tell remote shell to use standard time format, needed for | |
5091 ;; parsing `ls -l' output. | |
5092 (tramp-send-command multi-method method user host | |
5093 "LC_TIME=C; export LC_TIME; echo huhu") | |
5094 (tramp-wait-for-output) | |
5095 (tramp-send-command multi-method method user host | |
5096 "mesg n; echo huhu") | |
5097 (tramp-wait-for-output) | |
5098 (tramp-send-command multi-method method user host | |
5099 "biff n ; echo huhu") | |
5100 (tramp-wait-for-output) | |
5101 ;; Unalias ls(1) to work around issues with those silly people who make it | |
5102 ;; spit out ANSI escapes or whatever. | |
5103 (tramp-send-command multi-method method user host | |
5104 "unalias ls; echo huhu") | |
5105 (tramp-wait-for-output) | |
5106 ;; Does `test A -nt B' work? Use abominable `find' construct if it | |
5107 ;; doesn't. BSD/OS 4.0 wants the parentheses around the command, | |
5108 ;; for otherwise the shell crashes. | |
5109 (erase-buffer) | |
5110 (make-local-variable 'tramp-test-groks-nt) | |
5111 (tramp-send-command multi-method method user host | |
5112 "( test / -nt / )") | |
5113 (tramp-wait-for-output) | |
5114 (goto-char (point-min)) | |
5115 (setq tramp-test-groks-nt | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5116 (looking-at (format "\n%s\r?\n" (regexp-quote tramp-end-of-output)))) |
45861 | 5117 (unless tramp-test-groks-nt |
5118 (tramp-send-command | |
5119 multi-method method user host | |
5120 (concat "tramp_test_nt () {" tramp-rsh-end-of-line | |
5121 "test -n \"`find $1 -prune -newer $2 -print`\"" tramp-rsh-end-of-line | |
5122 "}"))) | |
5123 (tramp-wait-for-output) | |
46802
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
5124 ;; Send the fallback `uudecode' script. |
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
5125 (erase-buffer) |
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
5126 (tramp-send-linewise multi-method method user host tramp-uudecode) |
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
5127 (tramp-wait-for-output) |
45861 | 5128 ;; Find a `perl'. |
5129 (erase-buffer) | |
5130 (let ((tramp-remote-perl | |
5131 (or (tramp-find-executable multi-method method user host | |
46802
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
5132 "perl5" tramp-remote-path nil) |
45861 | 5133 (tramp-find-executable multi-method method user host |
46802
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
5134 "perl" tramp-remote-path nil)))) |
45861 | 5135 (when tramp-remote-perl |
46802
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
5136 (tramp-set-connection-property "perl" tramp-remote-perl |
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
5137 multi-method method user host) |
45861 | 5138 ;; Set up stat in Perl if we can. |
5139 (when tramp-remote-perl | |
5140 (tramp-message 5 "Sending the Perl `file-attributes' implementation.") | |
5141 (tramp-send-linewise | |
5142 multi-method method user host | |
5143 (concat "tramp_file_attributes () {\n" | |
5144 tramp-remote-perl | |
5145 " -e '" tramp-perl-file-attributes "' $1 2>/dev/null\n" | |
5146 "}")) | |
5147 (tramp-wait-for-output) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5148 (unless (tramp-get-rcp-program |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5149 multi-method |
47577
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
5150 (tramp-find-method multi-method method user host) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
5151 user host) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5152 (tramp-message 5 "Sending the Perl `mime-encode' implementations.") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5153 (tramp-send-linewise |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5154 multi-method method user host |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5155 (concat "tramp_encode () {\n" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5156 (format tramp-perl-encode tramp-remote-perl) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5157 " 2>/dev/null" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5158 "\n}")) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5159 (tramp-wait-for-output) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5160 (tramp-send-linewise |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5161 multi-method method user host |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5162 (concat "tramp_encode_with_module () {\n" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5163 (format tramp-perl-encode-with-module tramp-remote-perl) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5164 " 2>/dev/null" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5165 "\n}")) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5166 (tramp-wait-for-output) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5167 (tramp-message 5 "Sending the Perl `mime-decode' implementations.") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5168 (tramp-send-linewise |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5169 multi-method method user host |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5170 (concat "tramp_decode () {\n" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5171 (format tramp-perl-decode tramp-remote-perl) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5172 " 2>/dev/null" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5173 "\n}")) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5174 (tramp-wait-for-output) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5175 (tramp-send-linewise |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5176 multi-method method user host |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5177 (concat "tramp_decode_with_module () {\n" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5178 (format tramp-perl-decode-with-module tramp-remote-perl) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5179 " 2>/dev/null" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5180 "\n}")) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5181 (tramp-wait-for-output))))) |
45861 | 5182 ;; Find ln(1) |
5183 (erase-buffer) | |
5184 (let ((ln (tramp-find-executable multi-method method user host | |
5185 "ln" tramp-remote-path nil))) | |
5186 (when ln | |
5187 (tramp-set-connection-property "ln" ln multi-method method user host))) | |
5188 (erase-buffer) | |
46752 | 5189 ;; Find the right encoding/decoding commands to use. |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5190 (unless (tramp-get-rcp-program |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5191 multi-method |
47577
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
5192 (tramp-find-method multi-method method user host) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
5193 user host) |
46752 | 5194 (tramp-find-inline-encoding multi-method method user host)) |
45861 | 5195 ;; If encoding/decoding command are given, test to see if they work. |
5196 ;; CCC: Maybe it would be useful to run the encoder both locally and | |
5197 ;; remotely to see if they produce the same result. | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5198 (let ((rem-enc (tramp-get-remote-encoding multi-method method user host)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5199 (rem-dec (tramp-get-remote-decoding multi-method method user host)) |
45861 | 5200 (magic-string "xyzzy")) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5201 (when (and (or rem-dec rem-enc) (not (and rem-dec rem-enc))) |
45861 | 5202 (tramp-kill-process multi-method method user host) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5203 ;; Improve error message and/or error check. |
45861 | 5204 (error |
5205 "Must give both decoding and encoding command in method definition")) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5206 (when (and rem-enc rem-dec) |
45861 | 5207 (tramp-message |
5208 5 | |
5209 "Checking to see if encoding/decoding commands work on remote host...") | |
5210 (tramp-send-command | |
5211 multi-method method user host | |
5212 (format "echo %s | %s | %s" | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5213 (tramp-shell-quote-argument magic-string) rem-enc rem-dec)) |
45861 | 5214 (tramp-wait-for-output) |
5215 (unless (looking-at (regexp-quote magic-string)) | |
5216 (tramp-kill-process multi-method method user host) | |
5217 (error "Remote host cannot execute de/encoding commands. See buffer `%s' for details" | |
5218 (buffer-name))) | |
5219 (erase-buffer) | |
5220 (tramp-message | |
5221 5 "Checking to see if encoding/decoding commands work on remote host...done")))) | |
5222 | |
46752 | 5223 ;; CCC: We should either implement a Perl version of base64 encoding |
5224 ;; and decoding. Then we just use that in the last item. The other | |
5225 ;; alternative is to use the Perl version of UU encoding. But then | |
5226 ;; we need a Lisp version of uuencode. | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5227 ;; |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5228 ;; Old text from documentation of tramp-methods: |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5229 ;; Using a uuencode/uudecode inline method is discouraged, please use one |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5230 ;; of the base64 methods instead since base64 encoding is much more |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5231 ;; reliable and the commands are more standardized between the different |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5232 ;; Unix versions. But if you can't use base64 for some reason, please |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5233 ;; note that the default uudecode command does not work well for some |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5234 ;; Unices, in particular AIX and Irix. For AIX, you might want to use |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5235 ;; the following command for uudecode: |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5236 ;; |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5237 ;; sed '/^begin/d;/^[` ]$/d;/^end/d' | iconv -f uucode -t ISO8859-1 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5238 ;; |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5239 ;; For Irix, no solution is known yet. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5240 |
46752 | 5241 (defvar tramp-coding-commands |
5242 '(("mimencode -b" "mimencode -u -b" | |
5243 base64-encode-region base64-decode-region) | |
5244 ("mmencode -b" "mmencode -u -b" | |
5245 base64-encode-region base64-decode-region) | |
5246 ("recode data..base64" "recode base64..data" | |
5247 base64-encode-region base64-decode-region) | |
5248 ("uuencode xxx" "uudecode -o -" | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5249 tramp-uuencode-region uudecode-decode-region) |
46752 | 5250 ("uuencode xxx" "uudecode -p" |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5251 tramp-uuencode-region uudecode-decode-region) |
46802
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
5252 ("uuencode xxx" "tramp_uudecode" |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5253 tramp-uuencode-region uudecode-decode-region) |
46790 | 5254 ("tramp_encode_with_module" "tramp_decode_with_module" |
5255 base64-encode-region base64-decode-region) | |
46752 | 5256 ("tramp_encode" "tramp_decode" |
5257 base64-encode-region base64-decode-region)) | |
5258 "List of coding commands for inline transfer. | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5259 Each item is a list that looks like this: |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5260 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5261 \(REMOTE-ENCODING REMOTE-DECODING LOCAL-ENCODING LOCAL-DECODING) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5262 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5263 The REMOTE-ENCODING should be a string, giving a command accepting a |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5264 plain file on standard input and writing the encoded file to standard |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5265 output. The REMOTE-DECODING should also be a string, giving a command |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5266 accepting an encoded file on standard input and writing the decoded |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5267 file to standard output. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5268 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5269 LOCAL-ENCODING and LOCAL-DECODING can be strings, giving commands, or |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5270 symbols, giving functions. If they are strings, then they can contain |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5271 the \"%s\" format specifier. If that specifier is present, the input |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5272 filename will be put into the command line at that spot. If the |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5273 specifier is not present, the input should be read from standard |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5274 input. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5275 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5276 If they are functions, they will be called with two arguments, start |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5277 and end of region, and are expected to replace the region contents |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5278 with the encoded or decoded results, respectively.") |
46752 | 5279 |
5280 (defun tramp-find-inline-encoding (multi-method method user host) | |
5281 "Find an inline transfer encoding that works. | |
5282 Goes through the list `tramp-coding-commands'." | |
5283 (let ((commands tramp-coding-commands) | |
5284 item found) | |
5285 (while (and commands (null found)) | |
5286 (setq item (pop commands)) | |
5287 (catch 'wont-work | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5288 (let ((rem-enc (nth 0 item)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5289 (rem-dec (nth 1 item)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5290 (loc-enc (nth 2 item)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5291 (loc-dec (nth 3 item))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5292 ;; Check if remote encoding and decoding commands can be |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5293 ;; called remotely with null input and output. This makes |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5294 ;; sure there are no syntax errors and the command is really |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5295 ;; found. |
46752 | 5296 (tramp-message-for-buffer |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
5297 multi-method method user host 9 |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5298 "Checking remote encoding command `%s' for sanity" rem-enc) |
46752 | 5299 (unless (zerop (tramp-send-command-and-check |
5300 multi-method method user host | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5301 (format "%s </dev/null >/dev/null" rem-enc) t)) |
46752 | 5302 (throw 'wont-work nil)) |
5303 (tramp-message-for-buffer | |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
5304 multi-method method user host 9 |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5305 "Checking remote decoding command `%s' for sanity" rem-dec) |
46752 | 5306 (unless (zerop (tramp-send-command-and-check |
5307 multi-method method user host | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5308 (format "echo xyzzy | %s | %s >/dev/null" |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5309 rem-enc rem-dec) t)) |
46752 | 5310 (throw 'wont-work nil)) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5311 ;; If the local encoder or decoder is a string, the |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5312 ;; corresponding command has to work locally. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5313 (when (stringp loc-enc) |
46752 | 5314 (tramp-message-for-buffer |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
5315 multi-method method user host 9 |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5316 "Checking local encoding command `%s' for sanity" loc-enc) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5317 (unless (zerop (tramp-call-local-coding-command |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5318 loc-enc nil nil)) |
46752 | 5319 (throw 'wont-work nil))) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5320 (when (stringp loc-dec) |
46752 | 5321 (tramp-message-for-buffer |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
5322 multi-method method user host 9 |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5323 "Checking local decoding command `%s' for sanity" loc-dec) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5324 (unless (zerop (tramp-call-local-coding-command |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5325 loc-dec nil nil)) |
46752 | 5326 (throw 'wont-work nil))) |
5327 ;; CCC: At this point, maybe we should check that the output | |
5328 ;; of the commands is correct. But for the moment we will | |
5329 ;; assume that commands working on empty input will also | |
5330 ;; work in practice. | |
5331 (setq found item)))) | |
5332 ;; Did we find something? If not, issue error. If so, | |
5333 ;; set connection properties. | |
5334 (unless found | |
5335 (error "Couldn't find an inline transfer encoding")) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5336 (let ((rem-enc (nth 0 found)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5337 (rem-dec (nth 1 found)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5338 (loc-enc (nth 2 found)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5339 (loc-dec (nth 3 found))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5340 (tramp-message 10 "Using remote encoding %s" rem-enc) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5341 (tramp-set-remote-encoding multi-method method user host rem-enc) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5342 (tramp-message 10 "Using remote decoding %s" rem-dec) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5343 (tramp-set-remote-decoding multi-method method user host rem-dec) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5344 (tramp-message 10 "Using local encoding %s" loc-enc) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5345 (tramp-set-local-encoding multi-method method user host loc-enc) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5346 (tramp-message 10 "Using local decoding %s" loc-dec) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5347 (tramp-set-local-decoding multi-method method user host loc-dec)))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5348 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5349 (defun tramp-call-local-coding-command (cmd input output) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5350 "Call the local encoding or decoding command. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5351 If CMD contains \"%s\", provide input file INPUT there in command. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5352 Otherwise, INPUT is passed via standard input. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5353 INPUT can also be nil which means `/dev/null'. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5354 OUTPUT can be a string (which specifies a filename), or t (which |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5355 means standard output and thus the current buffer), or nil (which |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5356 means discard it)." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5357 (call-process |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5358 tramp-encoding-shell ;program |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5359 (when (and input (not (string-match "%s" cmd))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5360 input) ;input |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5361 (if (eq output t) t nil) ;output |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5362 nil ;redisplay |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5363 tramp-encoding-command-switch |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5364 ;; actual shell command |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5365 (concat |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5366 (if (string-match "%s" cmd) (format cmd input) cmd) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5367 (if (stringp output) (concat "> " output) "")))) |
45861 | 5368 |
5369 (defun tramp-maybe-open-connection (multi-method method user host) | |
5370 "Maybe open a connection to HOST, logging in as USER, using METHOD. | |
5371 Does not do anything if a connection is already open, but re-opens the | |
5372 connection if a previous connection has died for some reason." | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5373 (let ((p (get-buffer-process |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5374 (tramp-get-buffer multi-method method user host))) |
46752 | 5375 last-cmd-time) |
5376 ;; If too much time has passed since last command was sent, look | |
5377 ;; whether process is still alive. If it isn't, kill it. When | |
5378 ;; using ssh, it can sometimes happen that the remote end has hung | |
5379 ;; up but the local ssh client doesn't recognize this until it | |
5380 ;; tries to send some data to the remote end. So that's why we | |
5381 ;; try to send a command from time to time, then look again | |
5382 ;; whether the process is really alive. | |
5383 (save-excursion | |
5384 (set-buffer (tramp-get-buffer multi-method method user host)) | |
5385 (when (and tramp-last-cmd-time | |
46992
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
5386 (> (tramp-time-diff (current-time) tramp-last-cmd-time) 60)) |
46835
df25ef3d3237
Version 2.0.12 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46808
diff
changeset
|
5387 (tramp-send-command |
df25ef3d3237
Version 2.0.12 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46808
diff
changeset
|
5388 multi-method method user host "echo are you awake" nil t) |
df25ef3d3237
Version 2.0.12 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46808
diff
changeset
|
5389 (unless (tramp-wait-for-output 10) |
46752 | 5390 (delete-process p) |
5391 (setq p nil)) | |
5392 (erase-buffer))) | |
5393 (unless (and p (processp p) (memq (process-status p) '(run open))) | |
45861 | 5394 (when (and p (processp p)) |
5395 (delete-process p)) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5396 (funcall (tramp-get-connection-function |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5397 multi-method |
47577
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
5398 (tramp-find-method multi-method method user host) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
5399 user host) |
45861 | 5400 multi-method method user host)))) |
5401 | |
5402 (defun tramp-send-command | |
46835
df25ef3d3237
Version 2.0.12 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46808
diff
changeset
|
5403 (multi-method method user host command &optional noerase neveropen) |
45861 | 5404 "Send the COMMAND to USER at HOST (logged in using METHOD). |
5405 Erases temporary buffer before sending the command (unless NOERASE | |
46835
df25ef3d3237
Version 2.0.12 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46808
diff
changeset
|
5406 is true). |
df25ef3d3237
Version 2.0.12 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46808
diff
changeset
|
5407 If optional seventh arg NEVEROPEN is non-nil, never try to open the |
df25ef3d3237
Version 2.0.12 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46808
diff
changeset
|
5408 connection. This is meant to be used from |
df25ef3d3237
Version 2.0.12 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46808
diff
changeset
|
5409 `tramp-maybe-open-connection' only." |
df25ef3d3237
Version 2.0.12 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46808
diff
changeset
|
5410 (or neveropen |
df25ef3d3237
Version 2.0.12 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46808
diff
changeset
|
5411 (tramp-maybe-open-connection multi-method method user host)) |
46752 | 5412 (setq tramp-last-cmd-time (current-time)) |
45861 | 5413 (when tramp-debug-buffer |
5414 (save-excursion | |
5415 (set-buffer (tramp-get-debug-buffer multi-method method user host)) | |
5416 (goto-char (point-max)) | |
5417 (tramp-insert-with-face 'bold (format "$ %s\n" command)))) | |
5418 (let ((proc nil)) | |
5419 (set-buffer (tramp-get-buffer multi-method method user host)) | |
5420 (unless noerase (erase-buffer)) | |
5421 (setq proc (get-buffer-process (current-buffer))) | |
5422 (process-send-string proc | |
5423 (concat command tramp-rsh-end-of-line)))) | |
5424 | |
5425 ;; It seems that Tru64 Unix does not like it if long strings are sent | |
5426 ;; to it in one go. (This happens when sending the Perl | |
5427 ;; `file-attributes' implementation, for instance.) Therefore, we | |
5428 ;; have this function which waits a bit at each line. | |
5429 (defun tramp-send-linewise | |
5430 (multi-method method user host string &optional noerase) | |
5431 "Send the STRING to USER at HOST linewise. | |
5432 Erases temporary buffer before sending the STRING (unless NOERASE | |
5433 is true). | |
5434 | |
5435 The STRING is expected to use Unix line-endings, but the lines sent to | |
5436 the remote host use line-endings as defined in the variable | |
5437 `tramp-rsh-end-of-line'." | |
5438 (tramp-maybe-open-connection multi-method method user host) | |
5439 (when tramp-debug-buffer | |
5440 (save-excursion | |
5441 (set-buffer (tramp-get-debug-buffer multi-method method user host)) | |
5442 (goto-char (point-max)) | |
5443 (tramp-insert-with-face 'bold (format "$ %s\n" string)))) | |
5444 (let ((proc nil) | |
5445 (lines (split-string string "\n"))) | |
5446 (set-buffer (tramp-get-buffer multi-method method user host)) | |
5447 (unless noerase (erase-buffer)) | |
5448 (setq proc (get-buffer-process (current-buffer))) | |
5449 (mapcar (lambda (x) | |
5450 (sleep-for 0.1) | |
5451 (process-send-string proc | |
5452 (concat x tramp-rsh-end-of-line))) | |
5453 lines))) | |
5454 | |
5455 (defun tramp-wait-for-output (&optional timeout) | |
5456 "Wait for output from remote rsh command." | |
5457 (let ((proc (get-buffer-process (current-buffer))) | |
5458 (found nil) | |
5459 (start-time (current-time)) | |
5460 (end-of-output (concat "^" | |
5461 (regexp-quote tramp-end-of-output) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5462 "\r?$"))) |
45861 | 5463 ;; Algorithm: get waiting output. See if last line contains |
5464 ;; end-of-output sentinel. If not, wait a bit and again get | |
5465 ;; waiting output. Repeat until timeout expires or end-of-output | |
5466 ;; sentinel is seen. Will hang if timeout is nil and | |
5467 ;; end-of-output sentinel never appears. | |
5468 (save-match-data | |
5469 (cond (timeout | |
5470 ;; Work around an XEmacs bug, where the timeout expires | |
5471 ;; faster than it should. This degenerates into polling | |
5472 ;; for buggy XEmacsen, but oh, well. | |
5473 (while (and (not found) | |
5474 (< (tramp-time-diff (current-time) start-time) | |
5475 timeout)) | |
5476 (with-timeout (timeout) | |
5477 (while (not found) | |
5478 (accept-process-output proc 1) | |
5479 (goto-char (point-max)) | |
5480 (forward-line -1) | |
5481 (setq found (looking-at end-of-output)))))) | |
5482 (t | |
5483 (while (not found) | |
5484 (accept-process-output proc 1) | |
5485 (goto-char (point-max)) | |
5486 (forward-line -1) | |
5487 (setq found (looking-at end-of-output)))))) | |
5488 ;; At this point, either the timeout has expired or we have found | |
5489 ;; the end-of-output sentinel. | |
5490 (when found | |
5491 (goto-char (point-max)) | |
5492 (forward-line -2) | |
5493 (delete-region (point) (point-max))) | |
5494 ;; Add output to debug buffer if appropriate. | |
5495 (when tramp-debug-buffer | |
5496 (append-to-buffer | |
5497 (tramp-get-debug-buffer tramp-current-multi-method tramp-current-method | |
5498 tramp-current-user tramp-current-host) | |
5499 (point-min) (point-max)) | |
5500 (when (not found) | |
5501 (save-excursion | |
5502 (set-buffer | |
5503 (tramp-get-debug-buffer tramp-current-multi-method tramp-current-method | |
5504 tramp-current-user tramp-current-host)) | |
5505 (goto-char (point-max)) | |
5506 (insert "[[Remote prompt `" end-of-output "' not found" | |
46048
05db6f1e91ca
(tramp-file-name-structure)
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46010
diff
changeset
|
5507 (if timeout (format " in %d secs" timeout) "") |
45861 | 5508 "]]")))) |
5509 (goto-char (point-min)) | |
5510 ;; Return value is whether end-of-output sentinel was found. | |
5511 found)) | |
5512 | |
5513 (defun tramp-match-string-list (&optional string) | |
5514 "Returns list of all match strings. | |
5515 That is, (list (match-string 0) (match-string 1) ...), according to the | |
5516 number of matches." | |
5517 (let* ((nmatches (/ (length (match-data)) 2)) | |
5518 (i (- nmatches 1)) | |
5519 (res nil)) | |
5520 (while (>= i 0) | |
5521 (setq res (cons (match-string i string) res)) | |
5522 (setq i (- i 1))) | |
5523 res)) | |
5524 | |
5525 (defun tramp-send-command-and-check (multi-method method user host command | |
5526 &optional subshell) | |
5527 "Run COMMAND and check its exit status. | |
5528 MULTI-METHOD and METHOD specify how to log in (as USER) to the remote HOST. | |
5529 Sends `echo $?' along with the COMMAND for checking the exit status. If | |
5530 COMMAND is nil, just sends `echo $?'. Returns the exit status found. | |
5531 | |
5532 If the optional argument SUBSHELL is non-nil, the command is executed in | |
5533 a subshell, ie surrounded by parentheses." | |
5534 (tramp-send-command multi-method method user host | |
5535 (concat (if subshell "( " "") | |
5536 command | |
5537 (if command " 2>/dev/null; " "") | |
5538 "echo tramp_exit_status $?" | |
5539 (if subshell " )" " "))) | |
5540 (tramp-wait-for-output) | |
5541 (goto-char (point-max)) | |
5542 (unless (search-backward "tramp_exit_status " nil t) | |
5543 (error "Couldn't find exit status of `%s'" command)) | |
5544 (skip-chars-forward "^ ") | |
5545 (read (current-buffer))) | |
5546 | |
5547 (defun tramp-barf-unless-okay (multi-method method user host command subshell | |
5548 signal fmt &rest args) | |
5549 "Run COMMAND, check exit status, throw error if exit status not okay. | |
5550 Similar to `tramp-send-command-and-check' but accepts two more arguments | |
5551 FMT and ARGS which are passed to `error'." | |
5552 (unless (zerop (tramp-send-command-and-check | |
5553 multi-method method user host command subshell)) | |
5554 ;; CCC: really pop-to-buffer? Maybe it's appropriate to be more | |
5555 ;; silent. | |
5556 (pop-to-buffer (current-buffer)) | |
5557 (funcall 'signal signal (apply 'format fmt args)))) | |
5558 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5559 ;; Chunked sending kluge. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5560 (defvar tramp-chunksize nil |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5561 "If non-nil, chunksize for sending things to remote host.") |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5562 |
45861 | 5563 (defun tramp-send-region (multi-method method user host start end) |
5564 "Send the region from START to END to remote command | |
5565 running as USER on HOST using METHOD." | |
5566 (let ((proc (get-buffer-process | |
5567 (tramp-get-buffer multi-method method user host)))) | |
5568 (unless proc | |
5569 (error "Can't send region to remote host -- not logged in")) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5570 (if tramp-chunksize |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5571 (let ((pos start)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5572 (while (< pos end) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5573 (tramp-message-for-buffer |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5574 multi-method method user host 10 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5575 "Sending chunk from %s to %s" pos end) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5576 (process-send-region proc |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5577 pos |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5578 (min (+ pos tramp-chunksize) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5579 end)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5580 (setq pos (+ pos tramp-chunksize)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5581 (sleep-for 0.1))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5582 (process-send-region proc start end)) |
45861 | 5583 (when tramp-debug-buffer |
5584 (append-to-buffer | |
5585 (tramp-get-debug-buffer multi-method method user host) | |
5586 start end)))) | |
5587 | |
5588 (defun tramp-send-eof (multi-method method user host) | |
5589 "Send EOF to the remote end. | |
46151
eff75835ac2e
(tramp-send-eof): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
46060
diff
changeset
|
5590 METHOD, HOST and USER specify the connection." |
45861 | 5591 (let ((proc (get-buffer-process |
5592 (tramp-get-buffer multi-method method user host)))) | |
5593 (unless proc | |
5594 (error "Can't send EOF to remote host -- not logged in")) | |
5595 (process-send-eof proc))) | |
5596 ; (process-send-string proc "\^D"))) | |
5597 | |
5598 (defun tramp-kill-process (multi-method method user host) | |
5599 "Kill the connection process used by Tramp. | |
46151
eff75835ac2e
(tramp-send-eof): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
46060
diff
changeset
|
5600 MULTI-METHOD, METHOD, USER, and HOST specify the connection." |
45861 | 5601 (let ((proc (get-buffer-process |
5602 (tramp-get-buffer multi-method method user host)))) | |
5603 (kill-process proc))) | |
5604 | |
5605 (defun tramp-discard-garbage-erase-buffer (p multi-method method user host) | |
5606 "Erase buffer, then discard subsequent garbage. | |
5607 If `tramp-discard-garbage' is nil, just erase buffer." | |
5608 (if (not tramp-discard-garbage) | |
5609 (erase-buffer) | |
5610 (while (prog1 (erase-buffer) (accept-process-output p 0.25)) | |
5611 (when tramp-debug-buffer | |
5612 (save-excursion | |
5613 (set-buffer (tramp-get-debug-buffer multi-method method user host)) | |
5614 (goto-char (point-max)) | |
5615 (tramp-insert-with-face | |
5616 'bold (format "Additional characters detected\n"))))))) | |
5617 | |
5618 (defun tramp-mode-string-to-int (mode-string) | |
5619 "Converts a ten-letter `drwxrwxrwx'-style mode string into mode bits." | |
5620 (let* ((mode-chars (string-to-vector mode-string)) | |
5621 (owner-read (aref mode-chars 1)) | |
5622 (owner-write (aref mode-chars 2)) | |
5623 (owner-execute-or-setid (aref mode-chars 3)) | |
5624 (group-read (aref mode-chars 4)) | |
5625 (group-write (aref mode-chars 5)) | |
5626 (group-execute-or-setid (aref mode-chars 6)) | |
5627 (other-read (aref mode-chars 7)) | |
5628 (other-write (aref mode-chars 8)) | |
5629 (other-execute-or-sticky (aref mode-chars 9))) | |
5630 (save-match-data | |
5631 (logior | |
5632 (case owner-read | |
5633 (?r (tramp-octal-to-decimal "00400")) (?- 0) | |
5634 (t (error "Second char `%c' must be one of `r-'" owner-read))) | |
5635 (case owner-write | |
5636 (?w (tramp-octal-to-decimal "00200")) (?- 0) | |
5637 (t (error "Third char `%c' must be one of `w-'" owner-write))) | |
5638 (case owner-execute-or-setid | |
5639 (?x (tramp-octal-to-decimal "00100")) | |
5640 (?S (tramp-octal-to-decimal "04000")) | |
5641 (?s (tramp-octal-to-decimal "04100")) | |
5642 (?- 0) | |
5643 (t (error "Fourth char `%c' must be one of `xsS-'" | |
5644 owner-execute-or-setid))) | |
5645 (case group-read | |
5646 (?r (tramp-octal-to-decimal "00040")) (?- 0) | |
5647 (t (error "Fifth char `%c' must be one of `r-'" group-read))) | |
5648 (case group-write | |
5649 (?w (tramp-octal-to-decimal "00020")) (?- 0) | |
5650 (t (error "Sixth char `%c' must be one of `w-'" group-write))) | |
5651 (case group-execute-or-setid | |
5652 (?x (tramp-octal-to-decimal "00010")) | |
5653 (?S (tramp-octal-to-decimal "02000")) | |
5654 (?s (tramp-octal-to-decimal "02010")) | |
5655 (?- 0) | |
5656 (t (error "Seventh char `%c' must be one of `xsS-'" | |
5657 group-execute-or-setid))) | |
5658 (case other-read | |
5659 (?r (tramp-octal-to-decimal "00004")) (?- 0) | |
5660 (t (error "Eighth char `%c' must be one of `r-'" other-read))) | |
5661 (case other-write | |
5662 (?w (tramp-octal-to-decimal "00002")) (?- 0) | |
5663 (t (error "Nineth char `%c' must be one of `w-'" other-write))) | |
5664 (case other-execute-or-sticky | |
5665 (?x (tramp-octal-to-decimal "00001")) | |
5666 (?T (tramp-octal-to-decimal "01000")) | |
5667 (?t (tramp-octal-to-decimal "01001")) | |
5668 (?- 0) | |
5669 (t (error "Tenth char `%c' must be one of `xtT-'" | |
5670 other-execute-or-sticky))))))) | |
5671 | |
5672 | |
5673 (defun tramp-file-mode-from-int (mode) | |
5674 "Turn an integer representing a file mode into an ls(1)-like string." | |
5675 (let ((type (cdr (assoc (logand (lsh mode -12) 15) tramp-file-mode-type-map))) | |
5676 (user (logand (lsh mode -6) 7)) | |
5677 (group (logand (lsh mode -3) 7)) | |
5678 (other (logand (lsh mode -0) 7)) | |
5679 (suid (> (logand (lsh mode -9) 4) 0)) | |
5680 (sgid (> (logand (lsh mode -9) 2) 0)) | |
5681 (sticky (> (logand (lsh mode -9) 1) 0))) | |
5682 (setq user (tramp-file-mode-permissions user suid "s")) | |
5683 (setq group (tramp-file-mode-permissions group sgid "s")) | |
5684 (setq other (tramp-file-mode-permissions other sticky "t")) | |
5685 (concat type user group other))) | |
5686 | |
5687 | |
5688 (defun tramp-file-mode-permissions (perm suid suid-text) | |
5689 "Convert a permission bitset into a string. | |
5690 This is used internally by `tramp-file-mode-from-int'." | |
5691 (let ((r (> (logand perm 4) 0)) | |
5692 (w (> (logand perm 2) 0)) | |
5693 (x (> (logand perm 1) 0))) | |
5694 (concat (or (and r "r") "-") | |
5695 (or (and w "w") "-") | |
5696 (or (and suid x suid-text) ; suid, execute | |
5697 (and suid (upcase suid-text)) ; suid, !execute | |
5698 (and x "x") "-")))) ; !suid | |
5699 | |
5700 | |
5701 (defun tramp-decimal-to-octal (i) | |
5702 "Return a string consisting of the octal digits of I. | |
5703 Not actually used. Use `(format \"%o\" i)' instead?" | |
5704 (cond ((< i 0) (error "Cannot convert negative number to octal")) | |
5705 ((not (integerp i)) (error "Cannot convert non-integer to octal")) | |
5706 ((zerop i) "0") | |
5707 (t (concat (tramp-decimal-to-octal (/ i 8)) | |
5708 (number-to-string (% i 8)))))) | |
5709 | |
5710 | |
5711 ;;(defun tramp-octal-to-decimal (ostr) | |
5712 ;; "Given a string of octal digits, return a decimal number." | |
5713 ;; (cond ((null ostr) 0) | |
5714 ;; ((string= "" ostr) 0) | |
5715 ;; (t (let ((last (aref ostr (1- (length ostr)))) | |
5716 ;; (rest (substring ostr 0 (1- (length ostr))))) | |
5717 ;; (unless (and (>= last ?0) | |
5718 ;; (<= last ?7)) | |
5719 ;; (error "Not an octal digit: %c" last)) | |
5720 ;; (+ (- last ?0) (* 8 (tramp-octal-to-decimal rest))))))) | |
5721 ;; Kudos to Gerd Moellmann for this suggestion. | |
5722 (defun tramp-octal-to-decimal (ostr) | |
5723 "Given a string of octal digits, return a decimal number." | |
5724 (let ((x (or ostr ""))) | |
5725 ;; `save-match' is in `tramp-mode-string-to-int' which calls this. | |
5726 (unless (string-match "\\`[0-7]*\\'" x) | |
5727 (error "Non-octal junk in string `%s'" x)) | |
5728 (string-to-number ostr 8))) | |
5729 | |
5730 (defun tramp-shell-case-fold (string) | |
5731 "Converts STRING to shell glob pattern which ignores case." | |
5732 (mapconcat | |
5733 (lambda (c) | |
5734 (if (equal (downcase c) (upcase c)) | |
5735 (vector c) | |
5736 (format "[%c%c]" (downcase c) (upcase c)))) | |
5737 string | |
5738 "")) | |
5739 | |
5740 | |
5741 ;; ------------------------------------------------------------ | |
5742 ;; -- TRAMP file names -- | |
5743 ;; ------------------------------------------------------------ | |
5744 ;; Conversion functions between external representation and | |
5745 ;; internal data structure. Convenience functions for internal | |
5746 ;; data structure. | |
5747 | |
5748 (defstruct tramp-file-name multi-method method user host path) | |
5749 | |
5750 (defun tramp-tramp-file-p (name) | |
5751 "Return t iff NAME is a tramp file." | |
5752 (save-match-data | |
5753 (string-match tramp-file-name-regexp name))) | |
5754 | |
5755 ;; HHH: Changed. Used to assign the return value of (user-login-name) | |
5756 ;; to the `user' part of the structure if a user name was not | |
5757 ;; provided, now it assigns nil. | |
5758 (defun tramp-dissect-file-name (name) | |
5759 "Return an `tramp-file-name' structure. | |
5760 The structure consists of remote method, remote user, remote host and | |
5761 remote path name." | |
5762 (let (method) | |
5763 (save-match-data | |
5764 (unless (string-match (nth 0 tramp-file-name-structure) name) | |
5765 (error "Not a tramp file name: %s" name)) | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5766 (setq method (match-string (nth 1 tramp-file-name-structure) name)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5767 (if (and method (member method tramp-multi-methods)) |
45861 | 5768 ;; If it's a multi method, the file name structure contains |
5769 ;; arrays of method, user and host. | |
5770 (tramp-dissect-multi-file-name name) | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5771 ;; Normal method. First, find out default method. |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5772 (let ((user (match-string (nth 2 tramp-file-name-structure) name)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5773 (host (match-string (nth 3 tramp-file-name-structure) name)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5774 (path (match-string (nth 4 tramp-file-name-structure) name))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5775 (make-tramp-file-name |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5776 :multi-method nil |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5777 :method method |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5778 :user (or user nil) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5779 :host host |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5780 :path path)))))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5781 |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5782 (defun tramp-find-default-method (user host) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5783 "Look up the right method to use in `tramp-default-method-alist'." |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5784 (let ((choices tramp-default-method-alist) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5785 (method tramp-default-method) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5786 item) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5787 (while choices |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5788 (setq item (pop choices)) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5789 (when (and (string-match (nth 0 item) (or host "")) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5790 (string-match (nth 1 item) (or user ""))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5791 (setq method (nth 2 item)) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5792 (setq choices nil))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5793 method)) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5794 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5795 (defun tramp-find-method (multi-method method user host) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5796 "Return the right method string to use. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5797 This is MULTI-METHOD, if non-nil. Otherwise, it is METHOD, if non-nil. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5798 If both MULTI-METHOD and METHOD are nil, do a lookup in |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5799 `tramp-default-method-alist'." |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5800 (or multi-method method (tramp-find-default-method user host))) |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5801 |
45861 | 5802 ;; HHH: Not Changed. Multi method. Will probably not handle the case where |
5803 ;; a user name is not provided in the "file name" very well. | |
5804 (defun tramp-dissect-multi-file-name (name) | |
5805 "Not implemented yet." | |
5806 (let ((regexp (nth 0 tramp-multi-file-name-structure)) | |
5807 (method-index (nth 1 tramp-multi-file-name-structure)) | |
5808 (hops-index (nth 2 tramp-multi-file-name-structure)) | |
5809 (path-index (nth 3 tramp-multi-file-name-structure)) | |
5810 (hop-regexp (nth 0 tramp-multi-file-name-hop-structure)) | |
5811 (hop-method-index (nth 1 tramp-multi-file-name-hop-structure)) | |
5812 (hop-user-index (nth 2 tramp-multi-file-name-hop-structure)) | |
5813 (hop-host-index (nth 3 tramp-multi-file-name-hop-structure)) | |
5814 method hops len hop-methods hop-users hop-hosts path) | |
5815 (unless (string-match (format regexp hop-regexp) name) | |
5816 (error "Not a multi tramp file name: %s" name)) | |
5817 (setq method (match-string method-index name)) | |
5818 (setq hops (match-string hops-index name)) | |
5819 (setq len (/ (length (match-data t)) 2)) | |
5820 (when (< path-index 0) (incf path-index len)) | |
5821 (setq path (match-string path-index name)) | |
5822 (let ((index 0)) | |
5823 (while (string-match hop-regexp hops index) | |
5824 (setq index (match-end 0)) | |
5825 (setq hop-methods | |
5826 (cons (match-string hop-method-index hops) hop-methods)) | |
5827 (setq hop-users | |
5828 (cons (match-string hop-user-index hops) hop-users)) | |
5829 (setq hop-hosts | |
5830 (cons (match-string hop-host-index hops) hop-hosts)))) | |
5831 (make-tramp-file-name | |
5832 :multi-method method | |
5833 :method (apply 'vector (reverse hop-methods)) | |
5834 :user (apply 'vector (reverse hop-users)) | |
5835 :host (apply 'vector (reverse hop-hosts)) | |
5836 :path path))) | |
5837 | |
5838 (defun tramp-make-tramp-file-name (multi-method method user host path) | |
5839 "Constructs a tramp file name from METHOD, USER, HOST and PATH." | |
5840 (if multi-method | |
5841 (tramp-make-tramp-multi-file-name multi-method method user host path) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5842 (format-spec |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5843 (concat tramp-prefix-format |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5844 (when method (concat "%m" tramp-postfix-single-method-format)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5845 (when user (concat "%u" tramp-postfix-user-format)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5846 (when host (concat "%h" tramp-postfix-host-format)) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5847 (when path (concat "%p"))) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5848 `((?m . ,method) (?u . ,user) (?h . ,host) (?p . ,path))))) |
45861 | 5849 |
5850 ;; CCC: Henrik Holm: Not Changed. Multi Method. What should be done | |
5851 ;; with this when USER is nil? | |
5852 (defun tramp-make-tramp-multi-file-name (multi-method method user host path) | |
5853 "Constructs a tramp file name for a multi-hop method." | |
5854 (unless tramp-make-multi-tramp-file-format | |
5855 (error "`tramp-make-multi-tramp-file-format' is nil")) | |
5856 (let* ((prefix-format (nth 0 tramp-make-multi-tramp-file-format)) | |
5857 (hop-format (nth 1 tramp-make-multi-tramp-file-format)) | |
5858 (path-format (nth 2 tramp-make-multi-tramp-file-format)) | |
46752 | 5859 (prefix (format-spec prefix-format `((?m . ,multi-method)))) |
45861 | 5860 (hops "") |
46752 | 5861 (path (format-spec path-format `((?p . ,path)))) |
45861 | 5862 (i 0) |
5863 (len (length method))) | |
5864 (while (< i len) | |
46584
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
5865 (let ((m (aref method i)) (u (aref user i)) (h (aref host i))) |
f548d7d0c651
Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46347
diff
changeset
|
5866 (setq hops (concat hops (format-spec hop-format |
46752 | 5867 `((?m . ,m) (?u . ,u) (?h . ,h))))) |
45861 | 5868 (incf i))) |
5869 (concat prefix hops path))) | |
5870 | |
5871 (defun tramp-make-rcp-program-file-name (user host path) | |
5872 "Create a file name suitable to be passed to `rcp'." | |
5873 (if user | |
5874 (format "%s@%s:%s" user host path) | |
5875 (format "%s:%s" host path))) | |
5876 | |
46009
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5877 (defun tramp-make-ange-ftp-file-name (user host path) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5878 "Given user, host, and path, return an Ange-FTP filename." |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5879 (if user |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5880 (format "/%s@%s:%s" user host path) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5881 (format "/%s:%s" host path))) |
72200622ada8
(tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
45861
diff
changeset
|
5882 |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5883 (defun tramp-method-out-of-band-p (multi-method method user host) |
45861 | 5884 "Return t if this is an out-of-band method, nil otherwise. |
5885 It is important to check for this condition, since it is not possible | |
5886 to enter a password for the `tramp-rcp-program'." | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5887 (tramp-get-rcp-program |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5888 multi-method |
47577
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
5889 (tramp-find-method multi-method method user host) |
20336ef6b20a
Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47576
diff
changeset
|
5890 user host)) |
45861 | 5891 |
5892 ;; Variables local to connection. | |
5893 | |
5894 (defun tramp-get-ls-command (multi-method method user host) | |
5895 (save-excursion | |
5896 (tramp-maybe-open-connection multi-method method user host) | |
5897 (set-buffer (tramp-get-buffer multi-method method user host)) | |
5898 tramp-ls-command)) | |
5899 | |
5900 (defun tramp-get-test-groks-nt (multi-method method user host) | |
5901 (save-excursion | |
5902 (tramp-maybe-open-connection multi-method method user host) | |
5903 (set-buffer (tramp-get-buffer multi-method method user host)) | |
5904 tramp-test-groks-nt)) | |
5905 | |
5906 (defun tramp-get-file-exists-command (multi-method method user host) | |
5907 (save-excursion | |
5908 (tramp-maybe-open-connection multi-method method user host) | |
5909 (set-buffer (tramp-get-buffer multi-method method user host)) | |
5910 tramp-file-exists-command)) | |
5911 | |
5912 (defun tramp-get-remote-perl (multi-method method user host) | |
5913 (tramp-get-connection-property "perl" nil multi-method method user host)) | |
5914 | |
5915 (defun tramp-get-remote-ln (multi-method method user host) | |
5916 (tramp-get-connection-property "ln" nil multi-method method user host)) | |
5917 | |
5918 ;; Get a property of a TRAMP connection. | |
46752 | 5919 (defun tramp-get-connection-property |
5920 (property default multi-method method user host) | |
45861 | 5921 "Get the named property for the connection. |
5922 If the value is not set for the connection, return `default'" | |
5923 (tramp-maybe-open-connection multi-method method user host) | |
5924 (with-current-buffer (tramp-get-buffer multi-method method user host) | |
5925 (let (error) | |
5926 (condition-case nil | |
5927 (symbol-value (intern (concat "tramp-connection-property-" property))) | |
5928 (error default))))) | |
5929 | |
5930 ;; Set a property of a TRAMP connection. | |
46752 | 5931 (defun tramp-set-connection-property |
5932 (property value multi-method method user host) | |
45861 | 5933 "Set the named property of a TRAMP connection." |
5934 (tramp-maybe-open-connection multi-method method user host) | |
5935 (with-current-buffer (tramp-get-buffer multi-method method user host) | |
5936 (set (make-local-variable | |
5937 (intern (concat "tramp-connection-property-" property))) | |
5938 value))) | |
5939 | |
46752 | 5940 ;; Some predefined connection properties. |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5941 (defun tramp-set-remote-encoding (multi-method method user host rem-enc) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5942 (tramp-set-connection-property "remote-encoding" rem-enc |
46752 | 5943 multi-method method user host)) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5944 (defun tramp-get-remote-encoding (multi-method method user host) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5945 (tramp-get-connection-property "remote-encoding" nil |
46752 | 5946 multi-method method user host)) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5947 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5948 (defun tramp-set-remote-decoding (multi-method method user host rem-dec) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5949 (tramp-set-connection-property "remote-decoding" rem-dec |
46752 | 5950 multi-method method user host)) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5951 (defun tramp-get-remote-decoding (multi-method method user host) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5952 (tramp-get-connection-property "remote-decoding" nil |
46752 | 5953 multi-method method user host)) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5954 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5955 (defun tramp-set-local-encoding (multi-method method user host loc-enc) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5956 (tramp-set-connection-property "local-encoding" loc-enc |
46752 | 5957 multi-method method user host)) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5958 (defun tramp-get-local-encoding (multi-method method user host) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5959 (tramp-get-connection-property "local-encoding" nil |
46752 | 5960 multi-method method user host)) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5961 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5962 (defun tramp-set-local-decoding (multi-method method user host loc-dec) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5963 (tramp-set-connection-property "local-decoding" loc-dec |
46752 | 5964 multi-method method user host)) |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5965 (defun tramp-get-local-decoding (multi-method method user host) |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5966 (tramp-get-connection-property "local-decoding" nil |
46752 | 5967 multi-method method user host)) |
45861 | 5968 |
5969 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5970 |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5971 (defun tramp-get-connection-function (multi-method method user host) |
45861 | 5972 (second (or (assoc 'tramp-connection-function |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5973 (assoc (tramp-find-method multi-method method user host) |
45861 | 5974 tramp-methods)) |
5975 (error "Method `%s' didn't specify a connection function" | |
5976 (or multi-method method))))) | |
5977 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5978 (defun tramp-get-remote-sh (multi-method method user host) |
45861 | 5979 (second (or (assoc 'tramp-remote-sh |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5980 (assoc (tramp-find-method multi-method method user host) |
45861 | 5981 tramp-methods)) |
5982 (error "Method `%s' didn't specify a remote shell" | |
5983 (or multi-method method))))) | |
5984 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5985 (defun tramp-get-rsh-program (multi-method method user host) |
45861 | 5986 (second (or (assoc 'tramp-rsh-program |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5987 (assoc (tramp-find-method multi-method method user host) |
45861 | 5988 tramp-methods)) |
5989 (error "Method `%s' didn't specify an rsh program" | |
5990 (or multi-method method))))) | |
5991 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5992 (defun tramp-get-rsh-args (multi-method method user host) |
45861 | 5993 (second (or (assoc 'tramp-rsh-args |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5994 (assoc (tramp-find-method multi-method method user host) |
45861 | 5995 tramp-methods)) |
5996 (error "Method `%s' didn't specify rsh args" | |
5997 (or multi-method method))))) | |
5998 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
5999 (defun tramp-get-rcp-program (multi-method method user host) |
45861 | 6000 (second (or (assoc 'tramp-rcp-program |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6001 (assoc (tramp-find-method multi-method method user host) |
45861 | 6002 tramp-methods)) |
6003 (error "Method `%s' didn't specify an rcp program" | |
6004 (or multi-method method))))) | |
6005 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6006 (defun tramp-get-rcp-args (multi-method method user host) |
45861 | 6007 (second (or (assoc 'tramp-rcp-args |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6008 (assoc (tramp-find-method multi-method method user host) |
45861 | 6009 tramp-methods)) |
6010 (error "Method `%s' didn't specify rcp args" | |
6011 (or multi-method method))))) | |
6012 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6013 (defun tramp-get-rcp-keep-date-arg (multi-method method user host) |
45861 | 6014 (second (or (assoc 'tramp-rcp-keep-date-arg |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6015 (assoc (tramp-find-method multi-method method user host) |
45861 | 6016 tramp-methods)) |
6017 (error "Method `%s' didn't specify `keep-date' arg for tramp" | |
6018 (or multi-method method))))) | |
6019 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6020 (defun tramp-get-su-program (multi-method method user host) |
45861 | 6021 (second (or (assoc 'tramp-su-program |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6022 (assoc (tramp-find-method multi-method method user host) |
45861 | 6023 tramp-methods)) |
6024 (error "Method `%s' didn't specify a su program" | |
6025 (or multi-method method))))) | |
6026 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6027 (defun tramp-get-su-args (multi-method method user host) |
45861 | 6028 (second (or (assoc 'tramp-su-args |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6029 (assoc (tramp-find-method multi-method method user host) |
45861 | 6030 tramp-methods)) |
6031 (error "Method `%s' didn't specify su args" | |
6032 (or multi-method method))))) | |
6033 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6034 (defun tramp-get-telnet-program (multi-method method user host) |
45861 | 6035 (second (or (assoc 'tramp-telnet-program |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6036 (assoc (tramp-find-method multi-method method user host) |
45861 | 6037 tramp-methods)) |
6038 (error "Method `%s' didn't specify a telnet program" | |
6039 (or multi-method method))))) | |
6040 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6041 (defun tramp-get-telnet-args (multi-method method user host) |
45861 | 6042 (second (or (assoc 'tramp-telnet-args |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6043 (assoc (tramp-find-method multi-method method user host) |
45861 | 6044 tramp-methods)) |
6045 (error "Method `%s' didn't specify telnet args" | |
6046 (or multi-method method))))) | |
6047 | |
46752 | 6048 |
45861 | 6049 ;; Auto saving to a special directory. |
6050 | |
6051 (defun tramp-make-auto-save-file-name (fn) | |
6052 "Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |
6053 (when tramp-auto-save-directory | |
6054 (unless (file-exists-p tramp-auto-save-directory) | |
6055 (make-directory tramp-auto-save-directory t))) | |
6056 ;; jka-compr doesn't like auto-saving, so by appending "~" to the | |
6057 ;; file name we make sure that jka-compr isn't used for the | |
6058 ;; auto-save file. | |
6059 (let ((buffer-file-name (expand-file-name | |
6060 (tramp-subst-strs-in-string '(("_" . "|") | |
6061 ("/" . "_a") | |
6062 (":" . "_b") | |
6063 ("|" . "__") | |
6064 ("[" . "_l") | |
6065 ("]" . "_r")) | |
6066 fn) | |
6067 tramp-auto-save-directory))) | |
6068 (make-auto-save-file-name))) | |
6069 | |
6070 (defadvice make-auto-save-file-name | |
6071 (around tramp-advice-make-auto-save-file-name () activate) | |
6072 "Invoke `tramp-make-auto-save-file-name' for tramp files." | |
6073 (if (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)) | |
6074 tramp-auto-save-directory) | |
6075 (setq ad-return-value | |
6076 (tramp-make-auto-save-file-name (buffer-file-name))) | |
6077 ad-do-it)) | |
6078 | |
6079 (defun tramp-subst-strs-in-string (alist string) | |
6080 "Replace all occurrences of the string FROM with TO in STRING. | |
6081 ALIST is of the form ((FROM . TO) ...)." | |
6082 (save-match-data | |
6083 (while alist | |
6084 (let* ((pr (car alist)) | |
6085 (from (car pr)) | |
6086 (to (cdr pr))) | |
6087 (while (string-match (regexp-quote from) string) | |
6088 (setq string (replace-match to t t string))) | |
6089 (setq alist (cdr alist)))) | |
6090 string)) | |
6091 | |
6092 (defun tramp-insert-with-face (face string) | |
6093 "Insert text with a specific face." | |
6094 (let ((start (point))) | |
6095 (insert string) | |
6096 (add-text-properties start (point) (list 'face face)))) | |
6097 | |
6098 ;; ------------------------------------------------------------ | |
6099 ;; -- Compatibility functions section -- | |
6100 ;; ------------------------------------------------------------ | |
6101 | |
6102 (defun tramp-temporary-file-directory () | |
6103 "Return name of directory for temporary files (compat function). | |
6104 For Emacs, this is the variable `temporary-file-directory', for XEmacs | |
6105 this is the function `temp-directory'." | |
6106 (cond ((boundp 'temporary-file-directory) | |
6107 (symbol-value 'temporary-file-directory)) | |
6108 ((fboundp 'temp-directory) | |
6109 (funcall (symbol-function 'temp-directory))) ;pacify byte-compiler | |
6110 ((let ((d (getenv "TEMP"))) (and d (file-directory-p d))) | |
6111 (file-name-as-directory (getenv "TEMP"))) | |
6112 ((let ((d (getenv "TMP"))) (and d (file-directory-p d))) | |
6113 (file-name-as-directory (getenv "TMP"))) | |
6114 ((let ((d (getenv "TMPDIR"))) (and d (file-directory-p d))) | |
6115 (file-name-as-directory (getenv "TMPDIR"))) | |
6116 ((file-exists-p "c:/temp") (file-name-as-directory "c:/temp")) | |
6117 (t (message (concat "Neither `temporary-file-directory' nor " | |
6118 "`temp-directory' is defined -- using /tmp.")) | |
6119 (file-name-as-directory "/tmp")))) | |
6120 | |
6121 (defun tramp-read-passwd (prompt) | |
6122 "Read a password from user (compat function). | |
6123 Invokes `read-passwd' if that is defined, else `ange-ftp-read-passwd'." | |
6124 (apply | |
6125 (if (fboundp 'read-passwd) #'read-passwd #'ange-ftp-read-passwd) | |
6126 (list prompt))) | |
6127 | |
6128 (defun tramp-time-diff (t1 t2) | |
6129 "Return the difference between the two times, in seconds. | |
6130 T1 and T2 are time values (as returned by `current-time' for example). | |
6131 | |
6132 NOTE: This function will fail if the time difference is too large to | |
6133 fit in an integer." | |
6134 ;; Pacify byte-compiler with `symbol-function'. | |
6135 (cond ((fboundp 'subtract-time) | |
6136 (cadr (funcall (symbol-function 'subtract-time) t1 t2))) | |
6137 ((fboundp 'itimer-time-difference) | |
6138 (floor (funcall | |
6139 (symbol-function 'itimer-time-difference) | |
6140 (if (< (length t1) 3) (append t1 '(0)) t1) | |
6141 (if (< (length t2) 3) (append t2 '(0)) t2)))) | |
6142 (t | |
6143 ;; snarfed from Emacs 21 time-date.el | |
6144 (cadr (let ((borrow (< (cadr t1) (cadr t2)))) | |
6145 (list (- (car t1) (car t2) (if borrow 1 0)) | |
6146 (- (+ (if borrow 65536 0) (cadr t1)) (cadr t2)))))))) | |
6147 | |
6148 (defun tramp-coding-system-change-eol-conversion (coding-system eol-type) | |
6149 "Return a coding system like CODING-SYSTEM but with given EOL-TYPE. | |
6150 EOL-TYPE can be one of `dos', `unix', or `mac'." | |
6151 (cond ((fboundp 'coding-system-change-eol-conversion) | |
6152 (apply #'coding-system-change-eol-conversion | |
6153 (list coding-system eol-type))) | |
6154 ((fboundp 'subsidiary-coding-system) | |
6155 (apply | |
6156 #'subsidiary-coding-system | |
6157 (list coding-system | |
6158 (cond ((eq eol-type 'dos) 'crlf) | |
6159 ((eq eol-type 'unix) 'lf) | |
6160 ((eq eol-type 'mac) 'cr) | |
6161 (t | |
6162 (error "Unknown EOL-TYPE `%s', must be %s" | |
6163 eol-type | |
6164 "`dos', `unix', or `mac'")))))) | |
6165 (t (error "Can't change EOL conversion -- is MULE missing?")))) | |
6166 | |
6167 (defun tramp-split-string (string pattern) | |
6168 "Like `split-string' but omit empty strings. | |
6169 In Emacs, (split-string \"/foo/bar\" \"/\") returns (\"foo\" \"bar\"). | |
6170 This is, the first, empty, element is omitted. In XEmacs, the first | |
6171 element is not omitted. | |
6172 | |
6173 Note: this function has been written for `tramp-handle-file-truename'. | |
6174 If you want to use it for something else, you'll have to check whether | |
6175 it does the right thing." | |
6176 (delete "" (split-string string pattern))) | |
6177 | |
6178 ;; ------------------------------------------------------------ | |
6179 ;; -- Kludges section -- | |
6180 ;; ------------------------------------------------------------ | |
6181 | |
6182 ;; Currently (as of Emacs 20.5), the function `shell-quote-argument' | |
6183 ;; does not deal well with newline characters. Newline is replaced by | |
6184 ;; backslash newline. But if, say, the string `a backslash newline b' | |
6185 ;; is passed to a shell, the shell will expand this into "ab", | |
6186 ;; completely omitting the newline. This is not what was intended. | |
6187 ;; It does not appear to be possible to make the function | |
6188 ;; `shell-quote-argument' work with newlines without making it | |
6189 ;; dependent on the shell used. But within this package, we know that | |
6190 ;; we will always use a Bourne-like shell, so we use an approach which | |
6191 ;; groks newlines. | |
6192 ;; | |
6193 ;; The approach is simple: we call `shell-quote-argument', then | |
6194 ;; massage the newline part of the result. | |
6195 ;; | |
6196 ;; This function should produce a string which is grokked by a Unix | |
6197 ;; shell, even if the Emacs is running on Windows. Since this is the | |
6198 ;; kludges section, we bind `system-type' in such a way that | |
6199 ;; `shell-quote-arguments' behaves as if on Unix. | |
6200 ;; | |
6201 ;; Thanks to Mario DeWeerd for the hint that it is sufficient for this | |
6202 ;; function to work with Bourne-like shells. | |
6203 ;; | |
6204 ;; CCC: This function should be rewritten so that | |
6205 ;; `shell-quote-argument' is not used. This way, we are safe from | |
6206 ;; changes in `shell-quote-argument'. | |
6207 (defun tramp-shell-quote-argument (s) | |
6208 "Similar to `shell-quote-argument', but groks newlines. | |
6209 Only works for Bourne-like shells." | |
6210 (let ((system-type 'not-windows)) | |
6211 (save-match-data | |
6212 (let ((result (shell-quote-argument s)) | |
6213 (nl (regexp-quote (format "\\%s" tramp-rsh-end-of-line)))) | |
6214 (when (and (>= (length result) 2) | |
6215 (string= (substring result 0 2) "\\~")) | |
6216 (setq result (substring result 1))) | |
6217 (while (string-match nl result) | |
6218 (setq result (replace-match (format "'%s'" tramp-rsh-end-of-line) | |
6219 t t result))) | |
6220 result)))) | |
6221 | |
6222 ;; ;; EFS hooks itself into the file name handling stuff in more places | |
6223 ;; ;; than just `file-name-handler-alist'. The following tells EFS to stay | |
6224 ;; ;; away from tramp.el paths. | |
6225 ;; ;; | |
6226 ;; ;; This is needed because EFS installs (efs-dired-before-readin) into | |
6227 ;; ;; 'dired-before-readin-hook'. This prevents EFS from opening an FTP | |
6228 ;; ;; connection to help it's dired process. Not that I have any real | |
6229 ;; ;; idea *why* this is helpful to dired. | |
6230 ;; ;; | |
6231 ;; ;; Anyway, this advice fixes the problem (with a sledgehammer :) | |
6232 ;; ;; | |
6233 ;; ;; Daniel Pittman <daniel@danann.net> | |
6234 ;; ;; | |
6235 ;; ;; CCC: when the other defadvice calls have disappeared, make sure | |
6236 ;; ;; not to call defadvice unless it's necessary. How do we find out whether | |
6237 ;; ;; it is necessary? (featurep 'efs) is surely the wrong way -- | |
6238 ;; ;; EFS might nicht be loaded yet. | |
6239 ;; (defadvice efs-ftp-path (around dont-match-tramp-path activate protect) | |
6240 ;; "Cause efs-ftp-path to fail when the path is a TRAMP path." | |
6241 ;; (if (tramp-tramp-file-p (ad-get-arg 0)) | |
6242 ;; nil | |
6243 ;; ad-do-it)) | |
6244 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6245 ;; We currently (sometimes) use "[" and "]" in the filename format. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6246 ;; This means that Emacs wants to expand wildcards if |
45861 | 6247 ;; `find-file-wildcards' is non-nil, and then barfs because no |
6248 ;; expansion could be found. We detect this situation and do | |
6249 ;; something really awful: we have `file-expand-wildcards' return the | |
6250 ;; original filename if it can't expand anything. Let's just hope | |
6251 ;; that this doesn't break anything else. | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6252 ;; CCC: This check is now also really awful; we should search all |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6253 ;; of the filename format, not just the prefix. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6254 (when (string-match "\\[" tramp-prefix-format) |
45861 | 6255 (defadvice file-expand-wildcards (around tramp-fix activate) |
6256 (let ((name (ad-get-arg 0))) | |
6257 (if (tramp-tramp-file-p name) | |
6258 ;; If it's a Tramp file, dissect it and look if wildcards | |
6259 ;; need to be expanded at all. | |
6260 (let ((v (tramp-dissect-file-name name))) | |
6261 (if (string-match "[[*?]" (tramp-file-name-path v)) | |
6262 (let ((res ad-do-it)) | |
6263 (setq ad-return-value (or res (list name)))) | |
6264 (setq ad-return-value (list name)))) | |
6265 ;; If it is not a Tramp file, just run the original function. | |
6266 (let ((res ad-do-it)) | |
6267 (setq ad-return-value (or res (list name))))))) | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6268 ) |
45861 | 6269 |
46752 | 6270 ;; Tramp version is useful in a number of situations. |
6271 | |
6272 (defun tramp-version (arg) | |
6273 "Print version number of tramp.el in minibuffer or current buffer." | |
6274 (interactive "P") | |
6275 (if arg (insert tramp-version) (message tramp-version))) | |
6276 | |
45861 | 6277 ;; Make the `reporter` functionality available for making bug reports about |
6278 ;; the package. A most useful piece of code. | |
6279 | |
6280 (unless (fboundp 'reporter-submit-bug-report) | |
6281 (autoload 'reporter-submit-bug-report "reporter")) | |
6282 | |
6283 (defun tramp-bug () | |
6284 "Submit a bug report to the TRAMP developers." | |
6285 (interactive) | |
6286 (require 'reporter) | |
6287 (let ((reporter-prompt-for-summary-p t)) | |
6288 (reporter-submit-bug-report | |
6289 tramp-bug-report-address ; to-address | |
6290 (format "tramp (%s)" tramp-version) ; package name and version | |
6291 `(;; Current state | |
6292 tramp-ls-command | |
6293 tramp-test-groks-nt | |
6294 tramp-file-exists-command | |
6295 tramp-current-multi-method | |
6296 tramp-current-method | |
6297 tramp-current-user | |
6298 tramp-current-host | |
6299 | |
6300 ;; System defaults | |
6301 tramp-auto-save-directory ; vars to dump | |
6302 tramp-default-method | |
6303 tramp-rsh-end-of-line | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6304 tramp-password-end-of-line |
45861 | 6305 tramp-remote-path |
6306 tramp-login-prompt-regexp | |
6307 tramp-password-prompt-regexp | |
6308 tramp-wrong-passwd-regexp | |
46802
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
6309 tramp-yesno-prompt-regexp |
46992
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
6310 tramp-yn-prompt-regexp |
45861 | 6311 tramp-temp-name-prefix |
6312 tramp-file-name-structure | |
6313 tramp-file-name-regexp | |
6314 tramp-multi-file-name-structure | |
6315 tramp-multi-file-name-hop-structure | |
6316 tramp-multi-methods | |
6317 tramp-multi-connection-function-alist | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6318 tramp-methods |
45861 | 6319 tramp-end-of-output |
46802
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
6320 tramp-coding-commands |
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
6321 tramp-actions-before-shell |
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
6322 tramp-multi-actions |
46835
df25ef3d3237
Version 2.0.12 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46808
diff
changeset
|
6323 tramp-terminal-type |
46998
9d6aef07c793
Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46992
diff
changeset
|
6324 tramp-shell-prompt-pattern |
45861 | 6325 |
6326 ;; Non-tramp variables of interest | |
6327 shell-prompt-pattern | |
6328 backup-by-copying | |
6329 backup-by-copying-when-linked | |
6330 backup-by-copying-when-mismatch | |
6331 ,(when (boundp 'backup-by-copying-when-privileged-mismatch) | |
6332 'backup-by-copying-when-privileged-mismatch) | |
6333 file-name-handler-alist) | |
6334 nil ; pre-hook | |
6335 nil ; post-hook | |
6336 "\ | |
6337 Enter your bug report in this message, including as much detail as you | |
6338 possibly can about the problem, what you did to cause it and what the | |
6339 local and remote machines are. | |
6340 | |
6341 If you can give a simple set of instructions to make this bug happen | |
6342 reliably, please include those. Thank you for helping kill bugs in | |
6343 TRAMP. | |
46801
3fafc6fca8a8
Version 2.0.9 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46799
diff
changeset
|
6344 |
3fafc6fca8a8
Version 2.0.9 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46799
diff
changeset
|
6345 Another useful thing to do is to put (setq tramp-debug-buffer t) in |
3fafc6fca8a8
Version 2.0.9 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46799
diff
changeset
|
6346 the ~/.emacs file and to repeat the bug. Then, include the contents |
3fafc6fca8a8
Version 2.0.9 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46799
diff
changeset
|
6347 of the *tramp/foo* buffer and the *debug tramp/foo* buffer in your bug |
3fafc6fca8a8
Version 2.0.9 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46799
diff
changeset
|
6348 report. |
3fafc6fca8a8
Version 2.0.9 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46799
diff
changeset
|
6349 |
46802
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
6350 --bug report follows this line-- |
10aa49b3d28a
Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46801
diff
changeset
|
6351 "))) |
45861 | 6352 |
6353 (defalias 'tramp-submit-bug 'tramp-bug) | |
6354 | |
6355 (provide 'tramp) | |
6356 | |
6357 ;; Make sure that we get integration with the VC package. | |
6358 ;; When it is loaded, we need to pull in the integration module. | |
6359 ;; This must come after (provide 'tramp) because tramp-vc.el | |
6360 ;; requires tramp. | |
6361 (eval-after-load "vc" | |
6362 '(require 'tramp-vc)) | |
6363 | |
6364 ;;; TODO: | |
6365 | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6366 ;; * Autodetect if remote `ls' groks the "--dired" switch. |
46790 | 6367 ;; * Add fallback for inline encodings. This should be used |
6368 ;; if the remote end doesn't support mimencode or a similar program. | |
6369 ;; For reading files from the remote host, we can just parse the output | |
6370 ;; of `od -b'. For writing files to the remote host, we construct | |
6371 ;; a shell program which contains only "safe" ascii characters | |
6372 ;; and which writes the right bytes to the file. We can use printf(1) | |
6373 ;; or "echo -e" or the printf function in awk and use octal escapes | |
6374 ;; for the "dangerous" characters. The null byte might be a problem. | |
6375 ;; On some systems, the octal escape doesn't work. So we try the following | |
6376 ;; two commands to write a null byte: | |
6377 ;; dd if=/dev/zero bs=1 count=1 | |
6378 ;; echo | tr '\n' '\000' | |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6379 ;; * Separate local `tramp-coding-commands' from remote ones. Connect |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6380 ;; the two via a format which can be `uu' or `b64'. Then we can search |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6381 ;; for the right local commands and the right remote commands separately. |
45861 | 6382 ;; * Cooperate with PCL-CVS. It uses start-process, which doesn't |
6383 ;; work for remote files. | |
6384 ;; * Rewrite `tramp-shell-quote-argument' to abstain from using | |
46790 | 6385 ;; `shell-quote-argument'. |
45861 | 6386 ;; * Completion gets confused when you leave out the method name. |
6387 ;; * Support `dired-compress-file' filename handler. | |
6388 ;; * In Emacs 21, `insert-directory' shows total number of bytes used | |
6389 ;; by the files in that directory. Add this here. | |
6390 ;; * Avoid screen blanking when hitting `g' in dired. (Eli Tziperman) | |
6391 ;; * Make ffap.el grok Tramp filenames. (Eli Tziperman) | |
6392 ;; * When logging in, keep looking for questions according to an alist | |
6393 ;; and then invoke the right function. | |
6394 ;; * Case-insensitive filename completion. (Norbert Goevert.) | |
6395 ;; * Running CVS remotely doesn't appear to work right. It thinks | |
6396 ;; files are locked by somebody else even if I'm the locking user. | |
6397 ;; Sometimes, one gets `No CVSROOT specified' errors from CVS. | |
6398 ;; (Skip Montanaro) | |
6399 ;; * Don't use globbing for directories with many files, as this is | |
6400 ;; likely to produce long command lines, and some shells choke on | |
6401 ;; long command lines. | |
6402 ;; * Find out about the new auto-save mechanism in Emacs 21 and | |
6403 ;; do the right thing. | |
6404 ;; * `vc-directory' does not work. It never displays any files, even | |
6405 ;; if it does show files when run locally. | |
6406 ;; * Allow correction of passwords, if the remote end allows this. | |
6407 ;; (Mark Hershberger) | |
6408 ;; * Make sure permissions of tmp file are good. | |
6409 ;; (Nelson Minar <nelson@media.mit.edu>) | |
6410 ;; * Grok passwd prompts with scp? (David Winter | |
6411 ;; <winter@nevis1.nevis.columbia.edu>). Maybe just do `ssh -l user | |
6412 ;; host', then wait a while for the passwd or passphrase prompt. If | |
6413 ;; there is one, remember the passwd/phrase. | |
6414 ;; * How to deal with MULE in `insert-file-contents' and `write-region'? | |
6415 ;; * Do asynchronous `shell-command's. | |
6416 ;; * Grok `append' parameter for `write-region'. | |
6417 ;; * Test remote ksh or bash for tilde expansion in `tramp-find-shell'? | |
6418 ;; * abbreviate-file-name | |
6419 ;; * grok ~ in tramp-remote-path (Henrik Holm <henrikh@tele.ntnu.no>) | |
6420 ;; * `C' in dired gives error `not tramp file name'. | |
6421 ;; * Also allow to omit user names when doing multi-hop. Not sure yet | |
6422 ;; what the user names should default to, though. | |
6423 ;; * better error checking. At least whenever we see something | |
6424 ;; strange when doing zerop, we should kill the process and start | |
6425 ;; again. (Greg Stark) | |
6426 ;; * Add caching for filename completion. (Greg Stark) | |
6427 ;; Of course, this has issues with usability (stale cache bites) | |
6428 ;; -- <daniel@danann.net> | |
6429 ;; * Provide a local cache of old versions of remote files for the rsync | |
6430 ;; transfer method to use. (Greg Stark) | |
6431 ;; * Remove unneeded parameters from methods. | |
6432 ;; * Invoke rsync once for copying a whole directory hierarchy. | |
6433 ;; (Francesco Potort́) | |
6434 ;; * Should we set PATH ourselves or should we rely on the remote end | |
6435 ;; to do it? | |
6436 ;; * Do the autoconf thing. | |
6437 ;; * Make it work for XEmacs 20, which is missing `with-timeout'. | |
6438 ;; * Allow non-Unix remote systems. (More a long-term thing.) | |
6439 ;; * Make it work for different encodings, and for different file name | |
6440 ;; encodings, too. (Daniel Pittman) | |
6441 ;; * Change applicable functions to pass a struct tramp-file-name rather | |
6442 ;; than the individual items MULTI-METHOD, METHOD, USER, HOST, PATH. | |
6443 ;; * Implement asynchronous shell commands. | |
6444 ;; * Clean up unused *tramp/foo* buffers after a while. (Pete Forman) | |
6445 ;; * Progress reports while copying files. (Michael Kifer) | |
6446 ;; * `Smart' connection method that uses inline for small and out of | |
6447 ;; band for large files. (Michael Kifer) | |
6448 ;; * Don't search for perl5 and perl. Instead, only search for perl and | |
6449 ;; then look if it's the right version (with `perl -v'). | |
6450 ;; * When editing a remote CVS controlled file as a different user, VC | |
6451 ;; gets confused about the file locking status. Try to find out why | |
6452 ;; the workaround doesn't work. | |
6453 ;; * When user is running ssh-agent, it would be useful to add the | |
6454 ;; passwords typed by the user to that agent. This way, the next time | |
6455 ;; round, the users don't have to type all this in again. | |
6456 ;; This would be especially useful for start-process, I think. | |
6457 ;; An easy way to implement start-process is to open a second shell | |
6458 ;; connection which is inconvenient if the user has to reenter | |
6459 ;; passwords. | |
6460 ;; * Change `copy-file' to grok the case where the filename handler | |
6461 ;; for the source and the target file are different. Right now, | |
6462 ;; it looks at the source file and then calls that handler, if | |
6463 ;; there is one. But since ange-ftp, for instance, does not know | |
6464 ;; about Tramp, it does not do the right thing if the target file | |
6465 ;; name is a Tramp name. | |
46992
6529728ddf05
Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
46835
diff
changeset
|
6466 ;; * Username and hostname completion. |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6467 ;; ** If `partial-completion-mode' isn't loaded, "/foo:bla" tries to |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6468 ;; connect to host "blabla" already if that host is unique. No idea |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6469 ;; how to suppress. Maybe not an essential problem. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6470 ;; ** For "/ssh1-old:", `(file-name-all-completions "ssh1" "/")' is called |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6471 ;; only. Likely due to word delimeter property of "-". Maybe we can remove |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6472 ;; all the "*-old" methods? Or rename them to "*_old"? |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6473 ;; ** Try to avoid usage of `last-input-event' in `tramp-completion-mode'. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6474 ;; ** Handle quoted file names, starting with "/:". Problem is that |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6475 ;; `file-name-non-special' calls later on `file-name-all-completions' |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6476 ;; without ":". Hmm. Worth a bug report? |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6477 ;; ** Acknowledge port numbers. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6478 ;; ** Extend `tramp-get-completion-su' for NIS and shadow passwords. |
47578
6e910ba94c42
Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47577
diff
changeset
|
6479 ;; ** Unify `tramp-parse-{rhosts,shosts,hosts,passwd,netrc}'. |
47576
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6480 ;; Code is nearly identical. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6481 ;; ** Decide whiche files to take for searching user/host names depending on |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6482 ;; operating system (windows-nt) in `tramp-completion-function-alist'. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6483 ;; ** Enhance variables for debug. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6484 ;; ** Implement "/multi:" completion. |
b31c8ab7336a
Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
47205
diff
changeset
|
6485 ;; ** Add a learning mode for completion. Make results persistent. |
45861 | 6486 |
6487 ;; Functions for file-name-handler-alist: | |
6488 ;; diff-latest-backup-file -- in diff.el | |
6489 ;; dired-compress-file | |
6490 ;; dired-uncache -- this will be needed when we do insert-directory caching | |
6491 ;; file-name-as-directory -- use primitive? | |
6492 ;; file-name-directory -- use primitive? | |
6493 ;; file-name-nondirectory -- use primitive? | |
6494 ;; file-name-sans-versions -- use primitive? | |
6495 ;; file-newer-than-file-p | |
6496 ;; find-backup-file-name | |
6497 ;; get-file-buffer -- use primitive | |
6498 ;; load | |
6499 ;; unhandled-file-name-directory | |
6500 ;; vc-registered | |
6501 | |
6502 ;;; tramp.el ends here |