110321
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1 ;;; tramp-sh.el --- Tramp access functions for (s)sh-like connections
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4 ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
6 ;; (copyright statements below in code to be updated with the above notice)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
7
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
8 ;; Author: Kai Gro�johann <kai.grossjohann@gmx.net>
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
9 ;; Michael Albinus <michael.albinus@gmx.de>
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
10 ;; Keywords: comm, processes
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
11 ;; Package: tramp
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
12
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
13 ;; This file is part of GNU Emacs.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
14
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
15 ;; GNU Emacs is free software: you can redistribute it and/or modify
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
16 ;; it under the terms of the GNU General Public License as published by
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
17 ;; the Free Software Foundation, either version 3 of the License, or
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
18 ;; (at your option) any later version.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
19
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
20 ;; GNU Emacs is distributed in the hope that it will be useful,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
23 ;; GNU General Public License for more details.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
24
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
25 ;; You should have received a copy of the GNU General Public License
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
26 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
27
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
28 ;;; Code:
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
29
|
110374
|
30 (eval-when-compile (require 'cl)) ; ignore-errors
|
110321
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
31 (require 'tramp)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
32 (require 'shell)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
33
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
34 ;; Pacify byte-compiler. The function is needed on XEmacs only. I'm
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
35 ;; not sure at all that this is the right way to do it, but let's hope
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
36 ;; it works for now, and wait for a guru to point out the Right Way to
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
37 ;; achieve this.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
38 ;;(eval-when-compile
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
39 ;; (unless (fboundp 'dired-insert-set-properties)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
40 ;; (fset 'dired-insert-set-properties 'ignore)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
41 ;; Gerd suggests this:
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
42 (eval-when-compile (require 'dired))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
43 ;; Note that dired is required at run-time, too, when it is needed.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
44 ;; It is only needed on XEmacs for the function
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
45 ;; `dired-insert-set-properties'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
46
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
47 (defcustom tramp-inline-compress-start-size 4096
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
48 "*The minimum size of compressing where inline transfer.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
49 When inline transfer, compress transfered data of file
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
50 whose size is this value or above (up to `tramp-copy-size-limit').
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
51 If it is nil, no compression at all will be applied."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
52 :group 'tramp
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
53 :type '(choice (const nil) integer))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
54
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
55 (defcustom tramp-copy-size-limit 10240
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
56 "*The maximum file size where inline copying is preferred over an out-of-the-band copy.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
57 If it is nil, inline out-of-the-band copy will be used without a check."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
58 :group 'tramp
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
59 :type '(choice (const nil) integer))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
60
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
61 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
62 (defcustom tramp-terminal-type "dumb"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
63 "*Value of TERM environment variable for logging in to remote host.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
64 Because Tramp wants to parse the output of the remote shell, it is easily
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
65 confused by ANSI color escape sequences and suchlike. Often, shell init
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
66 files conditionalize this setup based on the TERM environment variable."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
67 :group 'tramp
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
68 :type 'string)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
69
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
70 ;; ksh on OpenBSD 4.5 requires, that PS1 contains a `#' character for
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
71 ;; root users. It uses the `$' character for other users. In order
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
72 ;; to guarantee a proper prompt, we use "#$" for the prompt.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
73
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
74 (defvar tramp-end-of-output
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
75 (format
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
76 "///%s#$"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
77 (md5 (concat (prin1-to-string process-environment) (current-time-string))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
78 "String used to recognize end of output.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
79 The '$' character at the end is quoted; the string cannot be
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
80 detected as prompt when being sent on echoing hosts, therefore.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
81
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
82 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
83 (defconst tramp-initial-end-of-output "#$ "
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
84 "Prompt when establishing a connection.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
85
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
86 ;; Initialize `tramp-methods' with the supported methods.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
87 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
88 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
89 '("rcp"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
90 (tramp-login-program "rsh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
91 (tramp-login-args (("%h") ("-l" "%u")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
92 (tramp-remote-sh "/bin/sh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
93 (tramp-copy-program "rcp")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
94 (tramp-copy-args (("-p" "%k") ("-r")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
95 (tramp-copy-keep-date t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
96 (tramp-copy-recursive t)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
97 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
98 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
99 '("remcp"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
100 (tramp-login-program "remsh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
101 (tramp-login-args (("%h") ("-l" "%u")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
102 (tramp-remote-sh "/bin/sh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
103 (tramp-copy-program "rcp")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
104 (tramp-copy-args (("-p" "%k")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
105 (tramp-copy-keep-date t)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
106 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
107 (add-to-list
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
108 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
109 '("scp" (tramp-login-program "ssh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
110 (tramp-login-args (("-l" "%u") ("-p" "%p") ("-e" "none") ("%h")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
111 (tramp-async-args (("-q")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
112 (tramp-remote-sh "/bin/sh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
113 (tramp-copy-program "scp")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
114 (tramp-copy-args (("-P" "%p") ("-p" "%k") ("-q") ("-r")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
115 (tramp-copy-keep-date t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
116 (tramp-copy-recursive t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
117 (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
118 ("-o" "UserKnownHostsFile=/dev/null")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
119 ("-o" "StrictHostKeyChecking=no")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
120 (tramp-default-port 22)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
121 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
122 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
123 '("scp1"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
124 (tramp-login-program "ssh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
125 (tramp-login-args (("-l" "%u") ("-p" "%p")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
126 ("-1") ("-e" "none") ("%h")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
127 (tramp-async-args (("-q")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
128 (tramp-remote-sh "/bin/sh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
129 (tramp-copy-program "scp")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
130 (tramp-copy-args (("-1") ("-P" "%p") ("-p" "%k") ("-q") ("-r")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
131 (tramp-copy-keep-date t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
132 (tramp-copy-recursive t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
133 (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
134 ("-o" "UserKnownHostsFile=/dev/null")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
135 ("-o" "StrictHostKeyChecking=no")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
136 (tramp-default-port 22)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
137 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
138 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
139 '("scp2"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
140 (tramp-login-program "ssh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
141 (tramp-login-args (("-l" "%u") ("-p" "%p")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
142 ("-2") ("-e" "none") ("%h")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
143 (tramp-async-args (("-q")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
144 (tramp-remote-sh "/bin/sh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
145 (tramp-copy-program "scp")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
146 (tramp-copy-args (("-2") ("-P" "%p") ("-p" "%k") ("-q") ("-r")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
147 (tramp-copy-keep-date t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
148 (tramp-copy-recursive t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
149 (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
150 ("-o" "UserKnownHostsFile=/dev/null")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
151 ("-o" "StrictHostKeyChecking=no")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
152 (tramp-default-port 22)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
153 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
154 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
155 '("scpc"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
156 (tramp-login-program "ssh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
157 (tramp-login-args (("-l" "%u") ("-p" "%p")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
158 ("-o" "ControlPath=%t.%%r@%%h:%%p")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
159 ("-o" "ControlMaster=yes")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
160 ("-e" "none") ("%h")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
161 (tramp-async-args (("-q")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
162 (tramp-remote-sh "/bin/sh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
163 (tramp-copy-program "scp")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
164 (tramp-copy-args (("-P" "%p") ("-p" "%k") ("-q")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
165 ("-o" "ControlPath=%t.%%r@%%h:%%p")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
166 ("-o" "ControlMaster=auto")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
167 (tramp-copy-keep-date t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
168 (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
169 ("-o" "UserKnownHostsFile=/dev/null")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
170 ("-o" "StrictHostKeyChecking=no")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
171 (tramp-default-port 22)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
172 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
173 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
174 '("scpx"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
175 (tramp-login-program "ssh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
176 (tramp-login-args (("-l" "%u") ("-p" "%p")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
177 ("-e" "none") ("-t" "-t")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
178 ("%h") ("/bin/sh")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
179 (tramp-async-args (("-q")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
180 (tramp-remote-sh "/bin/sh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
181 (tramp-copy-program "scp")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
182 (tramp-copy-args (("-p" "%k")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
183 (tramp-copy-keep-date t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
184 (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
185 ("-o" "UserKnownHostsFile=/dev/null")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
186 ("-o" "StrictHostKeyChecking=no")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
187 (tramp-default-port 22)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
188 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
189 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
190 '("sftp"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
191 (tramp-login-program "ssh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
192 (tramp-login-args (("-l" "%u") ("-p" "%p") ("-e" "none") ("%h")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
193 (tramp-async-args (("-q")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
194 (tramp-remote-sh "/bin/sh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
195 (tramp-copy-program "sftp")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
196 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
197 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
198 '("rsync"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
199 (tramp-login-program "ssh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
200 (tramp-login-args (("-l" "%u") ("-p" "%p") ("-e" "none") ("%h")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
201 (tramp-async-args (("-q")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
202 (tramp-remote-sh "/bin/sh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
203 (tramp-copy-program "rsync")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
204 (tramp-copy-args (("-e" "ssh") ("-t" "%k") ("-r")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
205 (tramp-copy-keep-date t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
206 (tramp-copy-keep-tmpfile t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
207 (tramp-copy-recursive t)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
208 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
209 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
210 `("rsyncc"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
211 (tramp-login-program "ssh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
212 (tramp-login-args (("-l" "%u") ("-p" "%p")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
213 ("-o" "ControlPath=%t.%%r@%%h:%%p")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
214 ("-o" "ControlMaster=yes")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
215 ("-e" "none") ("%h")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
216 (tramp-async-args (("-q")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
217 (tramp-remote-sh "/bin/sh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
218 (tramp-copy-program "rsync")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
219 (tramp-copy-args (("-t" "%k") ("-r")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
220 (tramp-copy-env (("RSYNC_RSH")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
221 (,(concat
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
222 "ssh"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
223 " -o ControlPath=%t.%%r@%%h:%%p"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
224 " -o ControlMaster=auto"))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
225 (tramp-copy-keep-date t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
226 (tramp-copy-keep-tmpfile t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
227 (tramp-copy-recursive t)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
228 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
229 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
230 '("rsh"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
231 (tramp-login-program "rsh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
232 (tramp-login-args (("%h") ("-l" "%u")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
233 (tramp-remote-sh "/bin/sh")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
234 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
235 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
236 '("remsh"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
237 (tramp-login-program "remsh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
238 (tramp-login-args (("%h") ("-l" "%u")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
239 (tramp-remote-sh "/bin/sh")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
240 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
241 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
242 '("ssh"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
243 (tramp-login-program "ssh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
244 (tramp-login-args (("-l" "%u") ("-p" "%p") ("-e" "none") ("%h")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
245 (tramp-async-args (("-q")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
246 (tramp-remote-sh "/bin/sh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
247 (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
248 ("-o" "UserKnownHostsFile=/dev/null")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
249 ("-o" "StrictHostKeyChecking=no")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
250 (tramp-default-port 22)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
251 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
252 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
253 '("ssh1"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
254 (tramp-login-program "ssh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
255 (tramp-login-args (("-l" "%u") ("-p" "%p")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
256 ("-1") ("-e" "none") ("%h")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
257 (tramp-async-args (("-q")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
258 (tramp-remote-sh "/bin/sh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
259 (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
260 ("-o" "UserKnownHostsFile=/dev/null")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
261 ("-o" "StrictHostKeyChecking=no")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
262 (tramp-default-port 22)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
263 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
264 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
265 '("ssh2"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
266 (tramp-login-program "ssh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
267 (tramp-login-args (("-l" "%u") ("-p" "%p")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
268 ("-2") ("-e" "none") ("%h")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
269 (tramp-async-args (("-q")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
270 (tramp-remote-sh "/bin/sh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
271 (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
272 ("-o" "UserKnownHostsFile=/dev/null")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
273 ("-o" "StrictHostKeyChecking=no")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
274 (tramp-default-port 22)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
275 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
276 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
277 '("sshx"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
278 (tramp-login-program "ssh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
279 (tramp-login-args (("-l" "%u") ("-p" "%p")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
280 ("-e" "none") ("-t" "-t")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
281 ("%h") ("/bin/sh")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
282 (tramp-async-args (("-q")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
283 (tramp-remote-sh "/bin/sh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
284 (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
285 ("-o" "UserKnownHostsFile=/dev/null")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
286 ("-o" "StrictHostKeyChecking=no")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
287 (tramp-default-port 22)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
288 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
289 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
290 '("telnet"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
291 (tramp-login-program "telnet")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
292 (tramp-login-args (("%h") ("%p")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
293 (tramp-remote-sh "/bin/sh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
294 (tramp-default-port 23)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
295 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
296 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
297 '("su"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
298 (tramp-login-program "su")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
299 (tramp-login-args (("-") ("%u")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
300 (tramp-remote-sh "/bin/sh")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
301 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
302 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
303 '("sudo"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
304 (tramp-login-program "sudo")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
305 (tramp-login-args (("-u" "%u") ("-s") ("-H") ("-p" "Password:")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
306 (tramp-remote-sh "/bin/sh")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
307 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
308 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
309 '("krlogin"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
310 (tramp-login-program "krlogin")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
311 (tramp-login-args (("%h") ("-l" "%u") ("-x")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
312 (tramp-remote-sh "/bin/sh")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
313 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
314 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
315 '("plink"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
316 (tramp-login-program "plink")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
317 (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("%h")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
318 (tramp-remote-sh "/bin/sh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
319 (tramp-password-end-of-line "xy") ;see docstring for "xy"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
320 (tramp-default-port 22)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
321 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
322 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
323 '("plink1"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
324 (tramp-login-program "plink")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
325 (tramp-login-args (("-l" "%u") ("-P" "%p") ("-1" "-ssh") ("%h")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
326 (tramp-remote-sh "/bin/sh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
327 (tramp-password-end-of-line "xy") ;see docstring for "xy"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
328 (tramp-default-port 22)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
329 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
330 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
331 `("plinkx"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
332 (tramp-login-program "plink")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
333 ;; ("%h") must be a single element, see
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
334 ;; `tramp-compute-multi-hops'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
335 (tramp-login-args (("-load") ("%h") ("-t")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
336 (,(format
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
337 "env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
338 tramp-terminal-type
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
339 tramp-initial-end-of-output))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
340 ("/bin/sh")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
341 (tramp-remote-sh "/bin/sh")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
342 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
343 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
344 '("pscp"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
345 (tramp-login-program "plink")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
346 (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("%h")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
347 (tramp-remote-sh "/bin/sh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
348 (tramp-copy-program "pscp")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
349 (tramp-copy-args (("-P" "%p") ("-scp") ("-p" "%k")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
350 (tramp-copy-keep-date t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
351 (tramp-password-end-of-line "xy") ;see docstring for "xy"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
352 (tramp-default-port 22)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
353 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
354 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
355 '("psftp"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
356 (tramp-login-program "plink")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
357 (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("%h")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
358 (tramp-remote-sh "/bin/sh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
359 (tramp-copy-program "pscp")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
360 (tramp-copy-args (("-P" "%p") ("-sftp") ("-p" "%k")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
361 (tramp-copy-keep-date t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
362 (tramp-password-end-of-line "xy"))) ;see docstring for "xy"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
363 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
364 (add-to-list 'tramp-methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
365 '("fcp"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
366 (tramp-login-program "fsh")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
367 (tramp-login-args (("%h") ("-l" "%u") ("sh" "-i")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
368 (tramp-remote-sh "/bin/sh -i")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
369 (tramp-copy-program "fcp")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
370 (tramp-copy-args (("-p" "%k")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
371 (tramp-copy-keep-date t)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
372
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
373 (add-to-list 'tramp-default-method-alist
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
374 `(,tramp-local-host-regexp "\\`root\\'" "su"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
375
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
376 (add-to-list 'tramp-default-user-alist
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
377 '("\\`su\\(do\\)?\\'" nil "root"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
378 (add-to-list 'tramp-default-user-alist
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
379 `("\\`r\\(em\\)?\\(cp\\|sh\\)\\|telnet\\|plink1?\\'"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
380 nil ,(user-login-name)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
381
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
382 (defconst tramp-completion-function-alist-rsh
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
383 '((tramp-parse-rhosts "/etc/hosts.equiv")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
384 (tramp-parse-rhosts "~/.rhosts"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
385 "Default list of (FUNCTION FILE) pairs to be examined for rsh methods.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
386
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
387 (defconst tramp-completion-function-alist-ssh
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
388 '((tramp-parse-rhosts "/etc/hosts.equiv")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
389 (tramp-parse-rhosts "/etc/shosts.equiv")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
390 (tramp-parse-shosts "/etc/ssh_known_hosts")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
391 (tramp-parse-sconfig "/etc/ssh_config")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
392 (tramp-parse-shostkeys "/etc/ssh2/hostkeys")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
393 (tramp-parse-sknownhosts "/etc/ssh2/knownhosts")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
394 (tramp-parse-rhosts "~/.rhosts")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
395 (tramp-parse-rhosts "~/.shosts")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
396 (tramp-parse-shosts "~/.ssh/known_hosts")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
397 (tramp-parse-sconfig "~/.ssh/config")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
398 (tramp-parse-shostkeys "~/.ssh2/hostkeys")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
399 (tramp-parse-sknownhosts "~/.ssh2/knownhosts"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
400 "Default list of (FUNCTION FILE) pairs to be examined for ssh methods.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
401
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
402 (defconst tramp-completion-function-alist-telnet
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
403 '((tramp-parse-hosts "/etc/hosts"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
404 "Default list of (FUNCTION FILE) pairs to be examined for telnet methods.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
405
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
406 (defconst tramp-completion-function-alist-su
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
407 '((tramp-parse-passwd "/etc/passwd"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
408 "Default list of (FUNCTION FILE) pairs to be examined for su methods.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
409
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
410 (defconst tramp-completion-function-alist-putty
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
411 '((tramp-parse-putty
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
412 "HKEY_CURRENT_USER\\Software\\SimonTatham\\PuTTY\\Sessions"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
413 "Default list of (FUNCTION REGISTRY) pairs to be examined for putty methods.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
414
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
415 (tramp-set-completion-function "rcp" tramp-completion-function-alist-rsh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
416 (tramp-set-completion-function "remcp" tramp-completion-function-alist-rsh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
417 (tramp-set-completion-function "scp" tramp-completion-function-alist-ssh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
418 (tramp-set-completion-function "scp1" tramp-completion-function-alist-ssh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
419 (tramp-set-completion-function "scp2" tramp-completion-function-alist-ssh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
420 (tramp-set-completion-function "scpc" tramp-completion-function-alist-ssh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
421 (tramp-set-completion-function "scpx" tramp-completion-function-alist-ssh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
422 (tramp-set-completion-function "sftp" tramp-completion-function-alist-ssh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
423 (tramp-set-completion-function "rsync" tramp-completion-function-alist-ssh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
424 (tramp-set-completion-function "rsyncc" tramp-completion-function-alist-ssh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
425 (tramp-set-completion-function "rsh" tramp-completion-function-alist-rsh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
426 (tramp-set-completion-function "remsh" tramp-completion-function-alist-rsh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
427 (tramp-set-completion-function "ssh" tramp-completion-function-alist-ssh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
428 (tramp-set-completion-function "ssh1" tramp-completion-function-alist-ssh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
429 (tramp-set-completion-function "ssh2" tramp-completion-function-alist-ssh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
430 (tramp-set-completion-function "ssh1_old" tramp-completion-function-alist-ssh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
431 (tramp-set-completion-function "ssh2_old" tramp-completion-function-alist-ssh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
432 (tramp-set-completion-function "sshx" tramp-completion-function-alist-ssh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
433 (tramp-set-completion-function "telnet" tramp-completion-function-alist-telnet)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
434 (tramp-set-completion-function "su" tramp-completion-function-alist-su)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
435 (tramp-set-completion-function "sudo" tramp-completion-function-alist-su)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
436 (tramp-set-completion-function "krlogin" tramp-completion-function-alist-rsh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
437 (tramp-set-completion-function "plink" tramp-completion-function-alist-ssh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
438 (tramp-set-completion-function "plink1" tramp-completion-function-alist-ssh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
439 (tramp-set-completion-function "plinkx" tramp-completion-function-alist-putty)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
440 (tramp-set-completion-function "pscp" tramp-completion-function-alist-ssh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
441 (tramp-set-completion-function "fcp" tramp-completion-function-alist-ssh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
442
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
443 ;; "getconf PATH" yields:
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
444 ;; HP-UX: /usr/bin:/usr/ccs/bin:/opt/ansic/bin:/opt/langtools/bin:/opt/fortran/bin
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
445 ;; Solaris: /usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
446 ;; GNU/Linux (Debian, Suse): /bin:/usr/bin
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
447 ;; FreeBSD: /usr/bin:/bin:/usr/sbin:/sbin: - beware trailing ":"!
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
448 ;; IRIX64: /usr/bin
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
449 (defcustom tramp-remote-path
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
450 '(tramp-default-remote-path "/usr/sbin" "/usr/local/bin"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
451 "/local/bin" "/local/freeware/bin" "/local/gnu/bin"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
452 "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
453 "*List of directories to search for executables on remote host.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
454 For every remote host, this variable will be set buffer local,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
455 keeping the list of existing directories on that host.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
456
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
457 You can use `~' in this list, but when searching for a shell which groks
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
458 tilde expansion, all directory names starting with `~' will be ignored.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
459
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
460 `Default Directories' represent the list of directories given by
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
461 the command \"getconf PATH\". It is recommended to use this
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
462 entry on top of this list, because these are the default
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
463 directories for POSIX compatible commands.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
464
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
465 `Private Directories' are the settings of the $PATH environment,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
466 as given in your `~/.profile'."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
467 :group 'tramp
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
468 :type '(repeat (choice
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
469 (const :tag "Default Directories" tramp-default-remote-path)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
470 (const :tag "Private Directories" tramp-own-remote-path)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
471 (string :tag "Directory"))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
472
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
473 (defcustom tramp-remote-process-environment
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
474 `("HISTFILE=$HOME/.tramp_history" "HISTSIZE=1" "LC_ALL=C"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
475 ,(format "TERM=%s" tramp-terminal-type)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
476 "EMACS=t" ;; Deprecated.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
477 ,(format "INSIDE_EMACS='%s,tramp:%s'" emacs-version tramp-version)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
478 "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH="
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
479 "autocorrect=" "correct=")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
480
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
481 "*List of environment variables to be set on the remote host.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
482
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
483 Each element should be a string of the form ENVVARNAME=VALUE. An
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
484 entry ENVVARNAME= diables the corresponding environment variable,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
485 which might have been set in the init files like ~/.profile.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
486
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
487 Special handling is applied to the PATH environment, which should
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
488 not be set here. Instead of, it should be set via `tramp-remote-path'."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
489 :group 'tramp
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
490 :type '(repeat string))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
491
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
492 (defcustom tramp-sh-extra-args '(("/bash\\'" . "-norc -noprofile"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
493 "*Alist specifying extra arguments to pass to the remote shell.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
494 Entries are (REGEXP . ARGS) where REGEXP is a regular expression
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
495 matching the shell file name and ARGS is a string specifying the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
496 arguments.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
497
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
498 This variable is only used when Tramp needs to start up another shell
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
499 for tilde expansion. The extra arguments should typically prevent the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
500 shell from reading its init file."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
501 :group 'tramp
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
502 ;; This might be the wrong way to test whether the widget type
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
503 ;; `alist' is available. Who knows the right way to test it?
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
504 :type (if (get 'alist 'widget-type)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
505 '(alist :key-type string :value-type string)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
506 '(repeat (cons string string))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
507
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
508 (defconst tramp-actions-before-shell
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
509 '((tramp-login-prompt-regexp tramp-action-login)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
510 (tramp-password-prompt-regexp tramp-action-password)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
511 (tramp-wrong-passwd-regexp tramp-action-permission-denied)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
512 (shell-prompt-pattern tramp-action-succeed)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
513 (tramp-shell-prompt-pattern tramp-action-succeed)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
514 (tramp-yesno-prompt-regexp tramp-action-yesno)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
515 (tramp-yn-prompt-regexp tramp-action-yn)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
516 (tramp-terminal-prompt-regexp tramp-action-terminal)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
517 (tramp-process-alive-regexp tramp-action-process-alive))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
518 "List of pattern/action pairs.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
519 Whenever a pattern matches, the corresponding action is performed.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
520 Each item looks like (PATTERN ACTION).
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
521
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
522 The PATTERN should be a symbol, a variable. The value of this
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
523 variable gives the regular expression to search for. Note that the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
524 regexp must match at the end of the buffer, \"\\'\" is implicitly
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
525 appended to it.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
526
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
527 The ACTION should also be a symbol, but a function. When the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
528 corresponding PATTERN matches, the ACTION function is called.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
529
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
530 (defconst tramp-actions-copy-out-of-band
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
531 '((tramp-password-prompt-regexp tramp-action-password)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
532 (tramp-wrong-passwd-regexp tramp-action-permission-denied)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
533 (tramp-copy-failed-regexp tramp-action-permission-denied)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
534 (tramp-process-alive-regexp tramp-action-out-of-band))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
535 "List of pattern/action pairs.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
536 This list is used for copying/renaming with out-of-band methods.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
537
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
538 See `tramp-actions-before-shell' for more info.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
539
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
540 (defconst tramp-uudecode
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
541 "(echo begin 600 /tmp/tramp.$$; tail +2) | uudecode
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
542 cat /tmp/tramp.$$
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
543 rm -f /tmp/tramp.$$"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
544 "Shell function to implement `uudecode' to standard output.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
545 Many systems support `uudecode -o /dev/stdout' or `uudecode -o -'
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
546 for this or `uudecode -p', but some systems don't, and for them
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
547 we have this shell function.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
548
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
549 (defconst tramp-perl-file-truename
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
550 "%s -e '
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
551 use File::Spec;
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
552 use Cwd \"realpath\";
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
553
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
554 sub recursive {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
555 my ($volume, @dirs) = @_;
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
556 my $real = realpath(File::Spec->catpath(
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
557 $volume, File::Spec->catdir(@dirs), \"\"));
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
558 if ($real) {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
559 my ($vol, $dir) = File::Spec->splitpath($real, 1);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
560 return ($vol, File::Spec->splitdir($dir));
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
561 }
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
562 else {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
563 my $last = pop(@dirs);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
564 ($volume, @dirs) = recursive($volume, @dirs);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
565 push(@dirs, $last);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
566 return ($volume, @dirs);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
567 }
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
568 }
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
569
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
570 $result = realpath($ARGV[0]);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
571 if (!$result) {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
572 my ($vol, $dir) = File::Spec->splitpath($ARGV[0], 1);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
573 ($vol, @dirs) = recursive($vol, File::Spec->splitdir($dir));
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
574
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
575 $result = File::Spec->catpath($vol, File::Spec->catdir(@dirs), \"\");
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
576 }
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
577
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
578 if ($ARGV[0] =~ /\\/$/) {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
579 $result = $result . \"/\";
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
580 }
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
581
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
582 print \"\\\"$result\\\"\\n\";
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
583 ' \"$1\" 2>/dev/null"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
584 "Perl script to produce output suitable for use with `file-truename'
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
585 on the remote file system.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
586 Escape sequence %s is replaced with name of Perl binary.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
587 This string is passed to `format', so percent characters need to be doubled.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
588
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
589 (defconst tramp-perl-file-name-all-completions
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
590 "%s -e 'sub case {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
591 my $str = shift;
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
592 if ($ARGV[2]) {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
593 return lc($str);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
594 }
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
595 else {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
596 return $str;
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
597 }
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
598 }
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
599 opendir(d, $ARGV[0]) || die(\"$ARGV[0]: $!\\nfail\\n\");
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
600 @files = readdir(d); closedir(d);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
601 foreach $f (@files) {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
602 if (case(substr($f, 0, length($ARGV[1]))) eq case($ARGV[1])) {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
603 if (-d \"$ARGV[0]/$f\") {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
604 print \"$f/\\n\";
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
605 }
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
606 else {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
607 print \"$f\\n\";
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
608 }
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
609 }
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
610 }
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
611 print \"ok\\n\"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
612 ' \"$1\" \"$2\" \"$3\" 2>/dev/null"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
613 "Perl script to produce output suitable for use with
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
614 `file-name-all-completions' on the remote file system. Escape
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
615 sequence %s is replaced with name of Perl binary. This string is
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
616 passed to `format', so percent characters need to be doubled.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
617
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
618 ;; Perl script to implement `file-attributes' in a Lisp `read'able
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
619 ;; output. If you are hacking on this, note that you get *no* output
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
620 ;; unless this spits out a complete line, including the '\n' at the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
621 ;; end.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
622 ;; The device number is returned as "-1", because there will be a virtual
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
623 ;; device number set in `tramp-handle-file-attributes'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
624 (defconst tramp-perl-file-attributes
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
625 "%s -e '
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
626 @stat = lstat($ARGV[0]);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
627 if (!@stat) {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
628 print \"nil\\n\";
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
629 exit 0;
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
630 }
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
631 if (($stat[2] & 0170000) == 0120000)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
632 {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
633 $type = readlink($ARGV[0]);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
634 $type = \"\\\"$type\\\"\";
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
635 }
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
636 elsif (($stat[2] & 0170000) == 040000)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
637 {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
638 $type = \"t\";
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
639 }
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
640 else
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
641 {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
642 $type = \"nil\"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
643 };
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
644 $uid = ($ARGV[1] eq \"integer\") ? $stat[4] : \"\\\"\" . getpwuid($stat[4]) . \"\\\"\";
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
645 $gid = ($ARGV[1] eq \"integer\") ? $stat[5] : \"\\\"\" . getgrgid($stat[5]) . \"\\\"\";
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
646 printf(
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
647 \"(%%s %%u %%s %%s (%%u %%u) (%%u %%u) (%%u %%u) %%u.0 %%u t (%%u . %%u) -1)\\n\",
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
648 $type,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
649 $stat[3],
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
650 $uid,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
651 $gid,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
652 $stat[8] >> 16 & 0xffff,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
653 $stat[8] & 0xffff,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
654 $stat[9] >> 16 & 0xffff,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
655 $stat[9] & 0xffff,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
656 $stat[10] >> 16 & 0xffff,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
657 $stat[10] & 0xffff,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
658 $stat[7],
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
659 $stat[2],
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
660 $stat[1] >> 16 & 0xffff,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
661 $stat[1] & 0xffff
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
662 );' \"$1\" \"$2\" 2>/dev/null"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
663 "Perl script to produce output suitable for use with `file-attributes'
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
664 on the remote file system.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
665 Escape sequence %s is replaced with name of Perl binary.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
666 This string is passed to `format', so percent characters need to be doubled.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
667
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
668 (defconst tramp-perl-directory-files-and-attributes
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
669 "%s -e '
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
670 chdir($ARGV[0]) or printf(\"\\\"Cannot change to $ARGV[0]: $''!''\\\"\\n\"), exit();
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
671 opendir(DIR,\".\") or printf(\"\\\"Cannot open directory $ARGV[0]: $''!''\\\"\\n\"), exit();
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
672 @list = readdir(DIR);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
673 closedir(DIR);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
674 $n = scalar(@list);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
675 printf(\"(\\n\");
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
676 for($i = 0; $i < $n; $i++)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
677 {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
678 $filename = $list[$i];
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
679 @stat = lstat($filename);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
680 if (($stat[2] & 0170000) == 0120000)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
681 {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
682 $type = readlink($filename);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
683 $type = \"\\\"$type\\\"\";
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
684 }
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
685 elsif (($stat[2] & 0170000) == 040000)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
686 {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
687 $type = \"t\";
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
688 }
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
689 else
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
690 {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
691 $type = \"nil\"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
692 };
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
693 $uid = ($ARGV[1] eq \"integer\") ? $stat[4] : \"\\\"\" . getpwuid($stat[4]) . \"\\\"\";
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
694 $gid = ($ARGV[1] eq \"integer\") ? $stat[5] : \"\\\"\" . getgrgid($stat[5]) . \"\\\"\";
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
695 printf(
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
696 \"(\\\"%%s\\\" %%s %%u %%s %%s (%%u %%u) (%%u %%u) (%%u %%u) %%u.0 %%u t (%%u . %%u) (%%u . %%u))\\n\",
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
697 $filename,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
698 $type,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
699 $stat[3],
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
700 $uid,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
701 $gid,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
702 $stat[8] >> 16 & 0xffff,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
703 $stat[8] & 0xffff,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
704 $stat[9] >> 16 & 0xffff,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
705 $stat[9] & 0xffff,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
706 $stat[10] >> 16 & 0xffff,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
707 $stat[10] & 0xffff,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
708 $stat[7],
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
709 $stat[2],
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
710 $stat[1] >> 16 & 0xffff,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
711 $stat[1] & 0xffff,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
712 $stat[0] >> 16 & 0xffff,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
713 $stat[0] & 0xffff);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
714 }
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
715 printf(\")\\n\");' \"$1\" \"$2\" 2>/dev/null"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
716 "Perl script implementing `directory-files-attributes' as Lisp `read'able
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
717 output.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
718 Escape sequence %s is replaced with name of Perl binary.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
719 This string is passed to `format', so percent characters need to be doubled.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
720
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
721 ;; These two use base64 encoding.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
722 (defconst tramp-perl-encode-with-module
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
723 "%s -MMIME::Base64 -0777 -ne 'print encode_base64($_)' 2>/dev/null"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
724 "Perl program to use for encoding a file.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
725 Escape sequence %s is replaced with name of Perl binary.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
726 This string is passed to `format', so percent characters need to be doubled.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
727 This implementation requires the MIME::Base64 Perl module to be installed
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
728 on the remote host.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
729
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
730 (defconst tramp-perl-decode-with-module
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
731 "%s -MMIME::Base64 -0777 -ne 'print decode_base64($_)' 2>/dev/null"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
732 "Perl program to use for decoding a file.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
733 Escape sequence %s is replaced with name of Perl binary.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
734 This string is passed to `format', so percent characters need to be doubled.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
735 This implementation requires the MIME::Base64 Perl module to be installed
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
736 on the remote host.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
737
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
738 (defconst tramp-perl-encode
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
739 "%s -e '
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
740 # This script contributed by Juanma Barranquero <lektu@terra.es>.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
741 # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
742 # Free Software Foundation, Inc.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
743 use strict;
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
744
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
745 my %%trans = do {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
746 my $i = 0;
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
747 map {(substr(unpack(q(B8), chr $i++), 2, 6), $_)}
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
748 split //, q(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
749 };
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
750
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
751 binmode(\\*STDIN);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
752
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
753 # We read in chunks of 54 bytes, to generate output lines
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
754 # of 72 chars (plus end of line)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
755 $/ = \\54;
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
756
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
757 while (my $data = <STDIN>) {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
758 my $pad = q();
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
759
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
760 # Only for the last chunk, and only if did not fill the last three-byte packet
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
761 if (eof) {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
762 my $mod = length($data) %% 3;
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
763 $pad = q(=) x (3 - $mod) if $mod;
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
764 }
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
765
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
766 # Not the fastest method, but it is simple: unpack to binary string, split
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
767 # by groups of 6 bits and convert back from binary to byte; then map into
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
768 # the translation table
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
769 print
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
770 join q(),
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
771 map($trans{$_},
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
772 (substr(unpack(q(B*), $data) . q(00000), 0, 432) =~ /....../g)),
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
773 $pad,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
774 qq(\\n);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
775 }' 2>/dev/null"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
776 "Perl program to use for encoding a file.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
777 Escape sequence %s is replaced with name of Perl binary.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
778 This string is passed to `format', so percent characters need to be doubled.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
779
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
780 (defconst tramp-perl-decode
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
781 "%s -e '
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
782 # This script contributed by Juanma Barranquero <lektu@terra.es>.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
783 # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
784 # Free Software Foundation, Inc.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
785 use strict;
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
786
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
787 my %%trans = do {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
788 my $i = 0;
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
789 map {($_, substr(unpack(q(B8), chr $i++), 2, 6))}
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
790 split //, q(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
791 };
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
792
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
793 my %%bytes = map {(unpack(q(B8), chr $_), chr $_)} 0 .. 255;
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
794
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
795 binmode(\\*STDOUT);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
796
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
797 # We are going to accumulate into $pending to accept any line length
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
798 # (we do not check they are <= 76 chars as the RFC says)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
799 my $pending = q();
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
800
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
801 while (my $data = <STDIN>) {
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
802 chomp $data;
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
803
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
804 # If we find one or two =, we have reached the end and
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
805 # any following data is to be discarded
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
806 my $finished = $data =~ s/(==?).*/$1/;
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
807 $pending .= $data;
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
808
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
809 my $len = length($pending);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
810 my $chunk = substr($pending, 0, $len & ~3);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
811 $pending = substr($pending, $len & ~3 + 1);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
812
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
813 # Easy method: translate from chars to (pregenerated) six-bit packets, join,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
814 # split in 8-bit chunks and convert back to char.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
815 print join q(),
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
816 map $bytes{$_},
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
817 ((join q(), map {$trans{$_} || q()} split //, $chunk) =~ /......../g);
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
818
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
819 last if $finished;
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
820 }' 2>/dev/null"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
821 "Perl program to use for decoding a file.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
822 Escape sequence %s is replaced with name of Perl binary.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
823 This string is passed to `format', so percent characters need to be doubled.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
824
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
825 (defconst tramp-vc-registered-read-file-names
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
826 "echo \"(\"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
827 while read file; do
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
828 if %s \"$file\"; then
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
829 echo \"(\\\"$file\\\" \\\"file-exists-p\\\" t)\"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
830 else
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
831 echo \"(\\\"$file\\\" \\\"file-exists-p\\\" nil)\"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
832 fi
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
833 if %s \"$file\"; then
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
834 echo \"(\\\"$file\\\" \\\"file-readable-p\\\" t)\"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
835 else
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
836 echo \"(\\\"$file\\\" \\\"file-readable-p\\\" nil)\"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
837 fi
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
838 done
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
839 echo \")\""
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
840 "Script to check existence of VC related files.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
841 It must be send formatted with two strings; the tests for file
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
842 existence, and file readability. Input shall be read via
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
843 here-document, otherwise the command could exceed maximum length
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
844 of command line.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
845
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
846 (defconst tramp-file-mode-type-map
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
847 '((0 . "-") ; Normal file (SVID-v2 and XPG2)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
848 (1 . "p") ; fifo
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
849 (2 . "c") ; character device
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
850 (3 . "m") ; multiplexed character device (v7)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
851 (4 . "d") ; directory
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
852 (5 . "?") ; Named special file (XENIX)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
853 (6 . "b") ; block device
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
854 (7 . "?") ; multiplexed block device (v7)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
855 (8 . "-") ; regular file
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
856 (9 . "n") ; network special file (HP-UX)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
857 (10 . "l") ; symlink
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
858 (11 . "?") ; ACL shadow inode (Solaris, not userspace)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
859 (12 . "s") ; socket
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
860 (13 . "D") ; door special (Solaris)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
861 (14 . "w")) ; whiteout (BSD)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
862 "A list of file types returned from the `stat' system call.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
863 This is used to map a mode number to a permission string.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
864
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
865 ;; New handlers should be added here. The following operations can be
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
866 ;; handled using the normal primitives: file-name-sans-versions,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
867 ;; get-file-buffer.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
868 (defconst tramp-sh-file-name-handler-alist
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
869 '((load . tramp-handle-load)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
870 (make-symbolic-link . tramp-handle-make-symbolic-link)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
871 (file-name-as-directory . tramp-handle-file-name-as-directory)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
872 (file-name-directory . tramp-handle-file-name-directory)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
873 (file-name-nondirectory . tramp-handle-file-name-nondirectory)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
874 (file-truename . tramp-handle-file-truename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
875 (file-exists-p . tramp-handle-file-exists-p)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
876 (file-directory-p . tramp-handle-file-directory-p)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
877 (file-executable-p . tramp-handle-file-executable-p)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
878 (file-readable-p . tramp-handle-file-readable-p)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
879 (file-regular-p . tramp-handle-file-regular-p)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
880 (file-symlink-p . tramp-handle-file-symlink-p)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
881 (file-writable-p . tramp-handle-file-writable-p)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
882 (file-ownership-preserved-p . tramp-handle-file-ownership-preserved-p)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
883 (file-newer-than-file-p . tramp-handle-file-newer-than-file-p)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
884 (file-attributes . tramp-handle-file-attributes)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
885 (file-modes . tramp-handle-file-modes)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
886 (directory-files . tramp-handle-directory-files)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
887 (directory-files-and-attributes . tramp-handle-directory-files-and-attributes)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
888 (file-name-all-completions . tramp-handle-file-name-all-completions)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
889 (file-name-completion . tramp-handle-file-name-completion)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
890 (add-name-to-file . tramp-handle-add-name-to-file)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
891 (copy-file . tramp-handle-copy-file)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
892 (copy-directory . tramp-handle-copy-directory)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
893 (rename-file . tramp-handle-rename-file)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
894 (set-file-modes . tramp-handle-set-file-modes)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
895 (set-file-times . tramp-handle-set-file-times)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
896 (make-directory . tramp-handle-make-directory)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
897 (delete-directory . tramp-handle-delete-directory)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
898 (delete-file . tramp-handle-delete-file)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
899 (directory-file-name . tramp-handle-directory-file-name)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
900 ;; `executable-find' is not official yet.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
901 (executable-find . tramp-handle-executable-find)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
902 (start-file-process . tramp-handle-start-file-process)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
903 (process-file . tramp-handle-process-file)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
904 (shell-command . tramp-handle-shell-command)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
905 (insert-directory . tramp-handle-insert-directory)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
906 (expand-file-name . tramp-handle-expand-file-name)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
907 (substitute-in-file-name . tramp-handle-substitute-in-file-name)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
908 (file-local-copy . tramp-handle-file-local-copy)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
909 (file-remote-p . tramp-handle-file-remote-p)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
910 (insert-file-contents . tramp-handle-insert-file-contents)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
911 (insert-file-contents-literally
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
912 . tramp-handle-insert-file-contents-literally)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
913 (write-region . tramp-handle-write-region)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
914 (find-backup-file-name . tramp-handle-find-backup-file-name)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
915 (make-auto-save-file-name . tramp-handle-make-auto-save-file-name)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
916 (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
917 (dired-compress-file . tramp-handle-dired-compress-file)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
918 (dired-recursive-delete-directory
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
919 . tramp-handle-dired-recursive-delete-directory)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
920 (dired-uncache . tramp-handle-dired-uncache)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
921 (set-visited-file-modtime . tramp-handle-set-visited-file-modtime)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
922 (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
923 (file-selinux-context . tramp-handle-file-selinux-context)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
924 (set-file-selinux-context . tramp-handle-set-file-selinux-context)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
925 (vc-registered . tramp-handle-vc-registered))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
926 "Alist of handler functions.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
927 Operations not mentioned here will be handled by the normal Emacs functions.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
928
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
929 ;; This must be the last entry, because `identity' always matches.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
930 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
931 (add-to-list 'tramp-foreign-file-name-handler-alist
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
932 '(identity . tramp-sh-file-name-handler) 'append)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
933
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
934 ;;; File Name Handler Functions:
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
935
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
936 (defun tramp-handle-make-symbolic-link
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
937 (filename linkname &optional ok-if-already-exists)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
938 "Like `make-symbolic-link' for Tramp files.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
939 If LINKNAME is a non-Tramp file, it is used verbatim as the target of
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
940 the symlink. If LINKNAME is a Tramp file, only the localname component is
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
941 used as the target of the symlink.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
942
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
943 If LINKNAME is a Tramp file and the localname component is relative, then
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
944 it is expanded first, before the localname component is taken. Note that
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
945 this can give surprising results if the user/host for the source and
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
946 target of the symlink differ."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
947 (with-parsed-tramp-file-name linkname l
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
948 (let ((ln (tramp-get-remote-ln l))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
949 (cwd (tramp-run-real-handler
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
950 'file-name-directory (list l-localname))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
951 (unless ln
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
952 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
953 l 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
954 "Making a symbolic link. ln(1) does not exist on the remote host."))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
955
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
956 ;; Do the 'confirm if exists' thing.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
957 (when (file-exists-p linkname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
958 ;; What to do?
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
959 (if (or (null ok-if-already-exists) ; not allowed to exist
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
960 (and (numberp ok-if-already-exists)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
961 (not (yes-or-no-p
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
962 (format
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
963 "File %s already exists; make it a link anyway? "
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
964 l-localname)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
965 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
966 l 'file-already-exists "File %s already exists" l-localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
967 (delete-file linkname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
968
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
969 ;; If FILENAME is a Tramp name, use just the localname component.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
970 (when (tramp-tramp-file-p filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
971 (setq filename
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
972 (tramp-file-name-localname
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
973 (tramp-dissect-file-name (expand-file-name filename)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
974
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
975 (tramp-flush-file-property l (file-name-directory l-localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
976 (tramp-flush-file-property l l-localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
977
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
978 ;; Right, they are on the same host, regardless of user, method, etc.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
979 ;; We now make the link on the remote machine. This will occur as the user
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
980 ;; that FILENAME belongs to.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
981 (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
982 l
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
983 (format
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
984 "cd %s && %s -sf %s %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
985 (tramp-shell-quote-argument cwd)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
986 ln
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
987 (tramp-shell-quote-argument filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
988 (tramp-shell-quote-argument l-localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
989 t))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
990
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
991 (defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
992 "Like `load' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
993 (with-parsed-tramp-file-name (expand-file-name file) nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
994 (unless nosuffix
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
995 (cond ((file-exists-p (concat file ".elc"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
996 (setq file (concat file ".elc")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
997 ((file-exists-p (concat file ".el"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
998 (setq file (concat file ".el")))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
999 (when must-suffix
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1000 ;; The first condition is always true for absolute file names.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1001 ;; Included for safety's sake.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1002 (unless (or (file-name-directory file)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1003 (string-match "\\.elc?\\'" file))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1004 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1005 v 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1006 "File `%s' does not include a `.el' or `.elc' suffix" file)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1007 (unless noerror
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1008 (when (not (file-exists-p file))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1009 (tramp-error v 'file-error "Cannot load nonexistent file `%s'" file)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1010 (if (not (file-exists-p file))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1011 nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1012 (let ((tramp-message-show-message (not nomessage)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1013 (with-progress-reporter v 0 (format "Loading %s" file)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1014 (let ((local-copy (file-local-copy file)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1015 ;; MUST-SUFFIX doesn't exist on XEmacs, so let it default to nil.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1016 (unwind-protect
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1017 (load local-copy noerror t t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1018 (delete-file local-copy)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1019 t)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1020
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1021 ;; Localname manipulation functions that grok Tramp localnames...
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1022 (defun tramp-handle-file-name-as-directory (file)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1023 "Like `file-name-as-directory' but aware of Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1024 ;; `file-name-as-directory' would be sufficient except localname is
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1025 ;; the empty string.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1026 (let ((v (tramp-dissect-file-name file t)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1027 ;; Run the command on the localname portion only.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1028 (tramp-make-tramp-file-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1029 (tramp-file-name-method v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1030 (tramp-file-name-user v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1031 (tramp-file-name-host v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1032 (tramp-run-real-handler
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1033 'file-name-as-directory (list (or (tramp-file-name-localname v) ""))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1034
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1035 (defun tramp-handle-file-name-directory (file)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1036 "Like `file-name-directory' but aware of Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1037 ;; Everything except the last filename thing is the directory. We
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1038 ;; cannot apply `with-parsed-tramp-file-name', because this expands
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1039 ;; the remote file name parts. This is a problem when we are in
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1040 ;; file name completion.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1041 (let ((v (tramp-dissect-file-name file t)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1042 ;; Run the command on the localname portion only.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1043 (tramp-make-tramp-file-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1044 (tramp-file-name-method v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1045 (tramp-file-name-user v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1046 (tramp-file-name-host v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1047 (tramp-run-real-handler
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1048 'file-name-directory (list (or (tramp-file-name-localname v) ""))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1049
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1050 (defun tramp-handle-file-name-nondirectory (file)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1051 "Like `file-name-nondirectory' but aware of Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1052 (with-parsed-tramp-file-name file nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1053 (tramp-run-real-handler 'file-name-nondirectory (list localname))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1054
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1055 (defun tramp-handle-file-truename (filename &optional counter prev-dirs)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1056 "Like `file-truename' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1057 (with-parsed-tramp-file-name (expand-file-name filename) nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1058 (with-file-property v localname "file-truename"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1059 (let ((result nil)) ; result steps in reverse order
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1060 (tramp-message v 4 "Finding true name for `%s'" filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1061 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1062 ;; Use GNU readlink --canonicalize-missing where available.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1063 ((tramp-get-remote-readlink v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1064 (setq result
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1065 (tramp-send-command-and-read
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1066 v
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1067 (format "echo \"\\\"`%s --canonicalize-missing %s`\\\"\""
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1068 (tramp-get-remote-readlink v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1069 (tramp-shell-quote-argument localname)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1070
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1071 ;; Use Perl implementation.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1072 ((and (tramp-get-remote-perl v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1073 (tramp-get-connection-property v "perl-file-spec" nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1074 (tramp-get-connection-property v "perl-cwd-realpath" nil))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1075 (tramp-maybe-send-script
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1076 v tramp-perl-file-truename "tramp_perl_file_truename")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1077 (setq result
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1078 (tramp-send-command-and-read
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1079 v
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1080 (format "tramp_perl_file_truename %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1081 (tramp-shell-quote-argument localname)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1082
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1083 ;; Do it yourself. We bind `directory-sep-char' here for
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1084 ;; XEmacs on Windows, which would otherwise use backslash.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1085 (t (let* ((directory-sep-char ?/)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1086 (steps (tramp-compat-split-string localname "/"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1087 (localnamedir (tramp-run-real-handler
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1088 'file-name-as-directory (list localname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1089 (is-dir (string= localname localnamedir))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1090 (thisstep nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1091 (numchase 0)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1092 ;; Don't make the following value larger than
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1093 ;; necessary. People expect an error message in a
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1094 ;; timely fashion when something is wrong;
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1095 ;; otherwise they might think that Emacs is hung.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1096 ;; Of course, correctness has to come first.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1097 (numchase-limit 20)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1098 symlink-target)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1099 (while (and steps (< numchase numchase-limit))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1100 (setq thisstep (pop steps))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1101 (tramp-message
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1102 v 5 "Check %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1103 (mapconcat 'identity
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1104 (append '("") (reverse result) (list thisstep))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1105 "/"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1106 (setq symlink-target
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1107 (nth 0 (file-attributes
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1108 (tramp-make-tramp-file-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1109 method user host
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1110 (mapconcat 'identity
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1111 (append '("")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1112 (reverse result)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1113 (list thisstep))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1114 "/")))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1115 (cond ((string= "." thisstep)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1116 (tramp-message v 5 "Ignoring step `.'"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1117 ((string= ".." thisstep)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1118 (tramp-message v 5 "Processing step `..'")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1119 (pop result))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1120 ((stringp symlink-target)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1121 ;; It's a symlink, follow it.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1122 (tramp-message v 5 "Follow symlink to %s" symlink-target)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1123 (setq numchase (1+ numchase))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1124 (when (file-name-absolute-p symlink-target)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1125 (setq result nil))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1126 ;; If the symlink was absolute, we'll get a string like
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1127 ;; "/user@host:/some/target"; extract the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1128 ;; "/some/target" part from it.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1129 (when (tramp-tramp-file-p symlink-target)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1130 (unless (tramp-equal-remote filename symlink-target)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1131 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1132 v 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1133 "Symlink target `%s' on wrong host" symlink-target))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1134 (setq symlink-target localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1135 (setq steps
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1136 (append (tramp-compat-split-string
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1137 symlink-target "/")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1138 steps)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1139 (t
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1140 ;; It's a file.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1141 (setq result (cons thisstep result)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1142 (when (>= numchase numchase-limit)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1143 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1144 v 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1145 "Maximum number (%d) of symlinks exceeded" numchase-limit))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1146 (setq result (reverse result))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1147 ;; Combine list to form string.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1148 (setq result
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1149 (if result
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1150 (mapconcat 'identity (cons "" result) "/")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1151 "/"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1152 (when (and is-dir (or (string= "" result)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1153 (not (string= (substring result -1) "/"))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1154 (setq result (concat result "/"))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1155
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1156 (tramp-message v 4 "True name of `%s' is `%s'" filename result)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1157 (tramp-make-tramp-file-name method user host result)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1158
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1159 ;; Basic functions.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1160
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1161 (defun tramp-handle-file-exists-p (filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1162 "Like `file-exists-p' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1163 (with-parsed-tramp-file-name filename nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1164 (with-file-property v localname "file-exists-p"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1165 (or (not (null (tramp-get-file-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1166 v localname "file-attributes-integer" nil)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1167 (not (null (tramp-get-file-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1168 v localname "file-attributes-string" nil)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1169 (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1170 v
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1171 (format
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1172 "%s %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1173 (tramp-get-file-exists-command v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1174 (tramp-shell-quote-argument localname)))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1175
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1176 ;; CCC: This should check for an error condition and signal failure
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1177 ;; when something goes wrong.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1178 ;; Daniel Pittman <daniel@danann.net>
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1179 (defun tramp-handle-file-attributes (filename &optional id-format)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1180 "Like `file-attributes' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1181 (unless id-format (setq id-format 'integer))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1182 ;; Don't modify `last-coding-system-used' by accident.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1183 (let ((last-coding-system-used last-coding-system-used))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1184 (with-parsed-tramp-file-name (expand-file-name filename) nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1185 (with-file-property v localname (format "file-attributes-%s" id-format)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1186 (save-excursion
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1187 (tramp-convert-file-attributes
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1188 v
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1189 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1190 ((tramp-get-remote-stat v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1191 (tramp-do-file-attributes-with-stat v localname id-format))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1192 ((tramp-get-remote-perl v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1193 (tramp-do-file-attributes-with-perl v localname id-format))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1194 (t
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1195 (tramp-do-file-attributes-with-ls v localname id-format)))))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1196
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1197 (defun tramp-do-file-attributes-with-ls (vec localname &optional id-format)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1198 "Implement `file-attributes' for Tramp files using the ls(1) command."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1199 (let (symlinkp dirp
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1200 res-inode res-filemodes res-numlinks
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1201 res-uid res-gid res-size res-symlink-target)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1202 (tramp-message vec 5 "file attributes with ls: %s" localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1203 (tramp-send-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1204 vec
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1205 (format "(%s %s || %s -h %s) && %s %s %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1206 (tramp-get-file-exists-command vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1207 (tramp-shell-quote-argument localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1208 (tramp-get-test-command vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1209 (tramp-shell-quote-argument localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1210 (tramp-get-ls-command vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1211 (if (eq id-format 'integer) "-ildn" "-ild")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1212 (tramp-shell-quote-argument localname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1213 ;; parse `ls -l' output ...
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1214 (with-current-buffer (tramp-get-buffer vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1215 (when (> (buffer-size) 0)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1216 (goto-char (point-min))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1217 ;; ... inode
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1218 (setq res-inode
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1219 (condition-case err
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1220 (read (current-buffer))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1221 (invalid-read-syntax
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1222 (when (and (equal (cadr err)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1223 "Integer constant overflow in reader")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1224 (string-match
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1225 "^[0-9]+\\([0-9][0-9][0-9][0-9][0-9]\\)\\'"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1226 (car (cddr err))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1227 (let* ((big (read (substring (car (cddr err)) 0
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1228 (match-beginning 1))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1229 (small (read (match-string 1 (car (cddr err)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1230 (twiddle (/ small 65536)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1231 (cons (+ big twiddle)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1232 (- small (* twiddle 65536))))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1233 ;; ... file mode flags
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1234 (setq res-filemodes (symbol-name (read (current-buffer))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1235 ;; ... number links
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1236 (setq res-numlinks (read (current-buffer)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1237 ;; ... uid and gid
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1238 (setq res-uid (read (current-buffer)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1239 (setq res-gid (read (current-buffer)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1240 (if (eq id-format 'integer)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1241 (progn
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1242 (unless (numberp res-uid) (setq res-uid -1))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1243 (unless (numberp res-gid) (setq res-gid -1)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1244 (progn
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1245 (unless (stringp res-uid) (setq res-uid (symbol-name res-uid)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1246 (unless (stringp res-gid) (setq res-gid (symbol-name res-gid)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1247 ;; ... size
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1248 (setq res-size (read (current-buffer)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1249 ;; From the file modes, figure out other stuff.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1250 (setq symlinkp (eq ?l (aref res-filemodes 0)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1251 (setq dirp (eq ?d (aref res-filemodes 0)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1252 ;; if symlink, find out file name pointed to
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1253 (when symlinkp
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1254 (search-forward "-> ")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1255 (setq res-symlink-target
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1256 (buffer-substring (point) (tramp-compat-line-end-position))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1257 ;; return data gathered
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1258 (list
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1259 ;; 0. t for directory, string (name linked to) for symbolic
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1260 ;; link, or nil.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1261 (or dirp res-symlink-target)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1262 ;; 1. Number of links to file.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1263 res-numlinks
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1264 ;; 2. File uid.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1265 res-uid
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1266 ;; 3. File gid.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1267 res-gid
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1268 ;; 4. Last access time, as a list of two integers. First
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1269 ;; integer has high-order 16 bits of time, second has low 16
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1270 ;; bits.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1271 ;; 5. Last modification time, likewise.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1272 ;; 6. Last status change time, likewise.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1273 '(0 0) '(0 0) '(0 0) ;CCC how to find out?
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1274 ;; 7. Size in bytes (-1, if number is out of range).
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1275 res-size
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1276 ;; 8. File modes, as a string of ten letters or dashes as in ls -l.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1277 res-filemodes
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1278 ;; 9. t if file's gid would change if file were deleted and
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1279 ;; recreated. Will be set in `tramp-convert-file-attributes'
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1280 t
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1281 ;; 10. inode number.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1282 res-inode
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1283 ;; 11. Device number. Will be replaced by a virtual device number.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1284 -1
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1285 )))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1286
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1287 (defun tramp-do-file-attributes-with-perl
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1288 (vec localname &optional id-format)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1289 "Implement `file-attributes' for Tramp files using a Perl script."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1290 (tramp-message vec 5 "file attributes with perl: %s" localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1291 (tramp-maybe-send-script
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1292 vec tramp-perl-file-attributes "tramp_perl_file_attributes")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1293 (tramp-send-command-and-read
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1294 vec
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1295 (format "tramp_perl_file_attributes %s %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1296 (tramp-shell-quote-argument localname) id-format)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1297
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1298 (defun tramp-do-file-attributes-with-stat
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1299 (vec localname &optional id-format)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1300 "Implement `file-attributes' for Tramp files using stat(1) command."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1301 (tramp-message vec 5 "file attributes with stat: %s" localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1302 (tramp-send-command-and-read
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1303 vec
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1304 (format
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1305 ;; On Opsware, pdksh (which is the true name of ksh there) doesn't
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1306 ;; parse correctly the sequence "((". Therefore, we add a space.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1307 "( (%s %s || %s -h %s) && %s -c '( (\"%%N\") %%h %s %s %%X.0 %%Y.0 %%Z.0 %%s.0 \"%%A\" t %%i.0 -1)' %s || echo nil)"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1308 (tramp-get-file-exists-command vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1309 (tramp-shell-quote-argument localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1310 (tramp-get-test-command vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1311 (tramp-shell-quote-argument localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1312 (tramp-get-remote-stat vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1313 (if (eq id-format 'integer) "%u" "\"%U\"")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1314 (if (eq id-format 'integer) "%g" "\"%G\"")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1315 (tramp-shell-quote-argument localname))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1316
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1317 (defun tramp-handle-set-visited-file-modtime (&optional time-list)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1318 "Like `set-visited-file-modtime' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1319 (unless (buffer-file-name)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1320 (error "Can't set-visited-file-modtime: buffer `%s' not visiting a file"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1321 (buffer-name)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1322 (if time-list
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1323 (tramp-run-real-handler 'set-visited-file-modtime (list time-list))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1324 (let ((f (buffer-file-name))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1325 coding-system-used)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1326 (with-parsed-tramp-file-name f nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1327 (let* ((attr (file-attributes f))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1328 ;; '(-1 65535) means file doesn't exists yet.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1329 (modtime (or (nth 5 attr) '(-1 65535))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1330 (when (boundp 'last-coding-system-used)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1331 (setq coding-system-used (symbol-value 'last-coding-system-used)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1332 ;; We use '(0 0) as a don't-know value. See also
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1333 ;; `tramp-do-file-attributes-with-ls'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1334 (if (not (equal modtime '(0 0)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1335 (tramp-run-real-handler 'set-visited-file-modtime (list modtime))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1336 (progn
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1337 (tramp-send-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1338 v
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1339 (format "%s -ild %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1340 (tramp-get-ls-command v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1341 (tramp-shell-quote-argument localname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1342 (setq attr (buffer-substring (point)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1343 (progn (end-of-line) (point)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1344 (tramp-set-file-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1345 v localname "visited-file-modtime-ild" attr))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1346 (when (boundp 'last-coding-system-used)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1347 (set 'last-coding-system-used coding-system-used))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1348 nil)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1349
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1350 ;; This function makes the same assumption as
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1351 ;; `tramp-handle-set-visited-file-modtime'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1352 (defun tramp-handle-verify-visited-file-modtime (buf)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1353 "Like `verify-visited-file-modtime' for Tramp files.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1354 At the time `verify-visited-file-modtime' calls this function, we
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1355 already know that the buffer is visiting a file and that
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1356 `visited-file-modtime' does not return 0. Do not call this
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1357 function directly, unless those two cases are already taken care
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1358 of."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1359 (with-current-buffer buf
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1360 (let ((f (buffer-file-name)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1361 ;; There is no file visiting the buffer, or the buffer has no
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1362 ;; recorded last modification time, or there is no established
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1363 ;; connection.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1364 (if (or (not f)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1365 (eq (visited-file-modtime) 0)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1366 (not (tramp-file-name-handler 'file-remote-p f nil 'connected)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1367 t
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1368 (with-parsed-tramp-file-name f nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1369 (tramp-flush-file-property v localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1370 (let* ((attr (file-attributes f))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1371 (modtime (nth 5 attr))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1372 (mt (visited-file-modtime)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1373
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1374 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1375 ;; File exists, and has a known modtime.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1376 ((and attr (not (equal modtime '(0 0))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1377 (< (abs (tramp-time-diff
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1378 modtime
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1379 ;; For compatibility, deal with both the old
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1380 ;; (HIGH . LOW) and the new (HIGH LOW) return
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1381 ;; values of `visited-file-modtime'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1382 (if (atom (cdr mt))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1383 (list (car mt) (cdr mt))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1384 mt)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1385 2))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1386 ;; Modtime has the don't know value.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1387 (attr
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1388 (tramp-send-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1389 v
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1390 (format "%s -ild %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1391 (tramp-get-ls-command v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1392 (tramp-shell-quote-argument localname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1393 (with-current-buffer (tramp-get-buffer v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1394 (setq attr (buffer-substring
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1395 (point) (progn (end-of-line) (point)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1396 (equal
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1397 attr
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1398 (tramp-get-file-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1399 v localname "visited-file-modtime-ild" "")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1400 ;; If file does not exist, say it is not modified if and
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1401 ;; only if that agrees with the buffer's record.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1402 (t (equal mt '(-1 65535))))))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1403
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1404 (defun tramp-handle-set-file-modes (filename mode)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1405 "Like `set-file-modes' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1406 (with-parsed-tramp-file-name filename nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1407 (tramp-flush-file-property v localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1408 ;; FIXME: extract the proper text from chmod's stderr.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1409 (tramp-barf-unless-okay
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1410 v
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1411 (format "chmod %s %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1412 (tramp-compat-decimal-to-octal mode)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1413 (tramp-shell-quote-argument localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1414 "Error while changing file's mode %s" filename)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1415
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1416 (defun tramp-handle-set-file-times (filename &optional time)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1417 "Like `set-file-times' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1418 (if (file-remote-p filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1419 (with-parsed-tramp-file-name filename nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1420 (tramp-flush-file-property v localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1421 (let ((time (if (or (null time) (equal time '(0 0)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1422 (current-time)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1423 time))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1424 ;; With GNU Emacs, `format-time-string' has an optional
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1425 ;; parameter UNIVERSAL. This is preferred, because we
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1426 ;; could handle the case when the remote host is located
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1427 ;; in a different time zone as the local host.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1428 (utc (not (featurep 'xemacs))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1429 (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1430 v (format "%s touch -t %s %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1431 (if utc "TZ=UTC; export TZ;" "")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1432 (if utc
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1433 (format-time-string "%Y%m%d%H%M.%S" time t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1434 (format-time-string "%Y%m%d%H%M.%S" time))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1435 (tramp-shell-quote-argument localname)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1436
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1437 ;; We handle also the local part, because in older Emacsen,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1438 ;; without `set-file-times', this function is an alias for this.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1439 ;; We are local, so we don't need the UTC settings.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1440 (zerop
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1441 (tramp-compat-call-process
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1442 "touch" nil nil nil "-t"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1443 (format-time-string "%Y%m%d%H%M.%S" time)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1444 (tramp-shell-quote-argument filename)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1445
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1446 (defun tramp-set-file-uid-gid (filename &optional uid gid)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1447 "Set the ownership for FILENAME.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1448 If UID and GID are provided, these values are used; otherwise uid
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1449 and gid of the corresponding user is taken. Both parameters must be integers."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1450 ;; Modern Unices allow chown only for root. So we might need
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1451 ;; another implementation, see `dired-do-chown'. OTOH, it is mostly
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1452 ;; working with su(do)? when it is needed, so it shall succeed in
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1453 ;; the majority of cases.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1454 ;; Don't modify `last-coding-system-used' by accident.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1455 (let ((last-coding-system-used last-coding-system-used))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1456 (if (file-remote-p filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1457 (with-parsed-tramp-file-name filename nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1458 (if (and (zerop (user-uid)) (tramp-local-host-p v))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1459 ;; If we are root on the local host, we can do it directly.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1460 (tramp-set-file-uid-gid localname uid gid)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1461 (let ((uid (or (and (integerp uid) uid)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1462 (tramp-get-remote-uid v 'integer)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1463 (gid (or (and (integerp gid) gid)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1464 (tramp-get-remote-gid v 'integer))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1465 (tramp-send-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1466 v (format
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1467 "chown %d:%d %s" uid gid
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1468 (tramp-shell-quote-argument localname))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1469
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1470 ;; We handle also the local part, because there doesn't exist
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1471 ;; `set-file-uid-gid'. On W32 "chown" might not work.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1472 (let ((uid (or (and (integerp uid) uid) (tramp-get-local-uid 'integer)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1473 (gid (or (and (integerp gid) gid) (tramp-get-local-gid 'integer))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1474 (tramp-compat-call-process
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1475 "chown" nil nil nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1476 (format "%d:%d" uid gid) (tramp-shell-quote-argument filename))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1477
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1478 (defun tramp-remote-selinux-p (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1479 "Check, whether SELINUX is enabled on the remote host."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1480 (with-connection-property (tramp-get-connection-process vec) "selinux-p"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1481 (let ((result (tramp-find-executable
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1482 vec "getenforce" (tramp-get-remote-path vec) t t)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1483 (and result
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1484 (string-equal
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1485 (tramp-send-command-and-read
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1486 vec (format "echo \\\"`%S`\\\"" result))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1487 "Enforcing")))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1488
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1489 (defun tramp-handle-file-selinux-context (filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1490 "Like `file-selinux-context' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1491 (with-parsed-tramp-file-name filename nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1492 (with-file-property v localname "file-selinux-context"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1493 (let ((context '(nil nil nil nil))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1494 (regexp (concat "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\):"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1495 "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\)")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1496 (when (and (tramp-remote-selinux-p v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1497 (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1498 v (format
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1499 "%s -d -Z %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1500 (tramp-get-ls-command v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1501 (tramp-shell-quote-argument localname))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1502 (with-current-buffer (tramp-get-connection-buffer v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1503 (goto-char (point-min))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1504 (when (re-search-forward regexp (tramp-compat-line-end-position) t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1505 (setq context (list (match-string 1) (match-string 2)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1506 (match-string 3) (match-string 4))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1507 ;; Return the context.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1508 context))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1509
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1510 (defun tramp-handle-set-file-selinux-context (filename context)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1511 "Like `set-file-selinux-context' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1512 (with-parsed-tramp-file-name filename nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1513 (if (and (consp context)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1514 (tramp-remote-selinux-p v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1515 (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1516 v (format "chcon %s %s %s %s %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1517 (if (stringp (nth 0 context))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1518 (format "--user=%s" (nth 0 context)) "")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1519 (if (stringp (nth 1 context))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1520 (format "--role=%s" (nth 1 context)) "")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1521 (if (stringp (nth 2 context))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1522 (format "--type=%s" (nth 2 context)) "")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1523 (if (stringp (nth 3 context))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1524 (format "--range=%s" (nth 3 context)) "")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1525 (tramp-shell-quote-argument localname))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1526 (tramp-set-file-property v localname "file-selinux-context" context)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1527 (tramp-set-file-property v localname "file-selinux-context" 'undef)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1528 ;; We always return nil.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1529 nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1530
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1531 ;; Simple functions using the `test' command.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1532
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1533 (defun tramp-handle-file-executable-p (filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1534 "Like `file-executable-p' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1535 (with-parsed-tramp-file-name filename nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1536 (with-file-property v localname "file-executable-p"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1537 ;; Examine `file-attributes' cache to see if request can be
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1538 ;; satisfied without remote operation.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1539 (or (tramp-check-cached-permissions v ?x)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1540 (tramp-run-test "-x" filename)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1541
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1542 (defun tramp-handle-file-readable-p (filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1543 "Like `file-readable-p' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1544 (with-parsed-tramp-file-name filename nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1545 (with-file-property v localname "file-readable-p"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1546 ;; Examine `file-attributes' cache to see if request can be
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1547 ;; satisfied without remote operation.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1548 (or (tramp-check-cached-permissions v ?r)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1549 (tramp-run-test "-r" filename)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1550
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1551 ;; When the remote shell is started, it looks for a shell which groks
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1552 ;; tilde expansion. Here, we assume that all shells which grok tilde
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1553 ;; expansion will also provide a `test' command which groks `-nt' (for
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1554 ;; newer than). If this breaks, tell me about it and I'll try to do
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1555 ;; something smarter about it.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1556 (defun tramp-handle-file-newer-than-file-p (file1 file2)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1557 "Like `file-newer-than-file-p' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1558 (cond ((not (file-exists-p file1))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1559 nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1560 ((not (file-exists-p file2))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1561 t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1562 ;; We are sure both files exist at this point.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1563 (t
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1564 (save-excursion
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1565 ;; We try to get the mtime of both files. If they are not
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1566 ;; equal to the "dont-know" value, then we subtract the times
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1567 ;; and obtain the result.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1568 (let ((fa1 (file-attributes file1))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1569 (fa2 (file-attributes file2)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1570 (if (and (not (equal (nth 5 fa1) '(0 0)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1571 (not (equal (nth 5 fa2) '(0 0))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1572 (> 0 (tramp-time-diff (nth 5 fa2) (nth 5 fa1)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1573 ;; If one of them is the dont-know value, then we can
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1574 ;; still try to run a shell command on the remote host.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1575 ;; However, this only works if both files are Tramp
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1576 ;; files and both have the same method, same user, same
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1577 ;; host.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1578 (unless (tramp-equal-remote file1 file2)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1579 (with-parsed-tramp-file-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1580 (if (tramp-tramp-file-p file1) file1 file2) nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1581 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1582 v 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1583 "Files %s and %s must have same method, user, host"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1584 file1 file2)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1585 (with-parsed-tramp-file-name file1 nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1586 (tramp-run-test2
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1587 (tramp-get-test-nt-command v) file1 file2))))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1588
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1589 ;; Functions implemented using the basic functions above.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1590
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1591 (defun tramp-handle-file-modes (filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1592 "Like `file-modes' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1593 (let ((truename (or (file-truename filename) filename)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1594 (when (file-exists-p truename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1595 (tramp-mode-string-to-int (nth 8 (file-attributes truename))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1596
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1597 (defun tramp-handle-file-directory-p (filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1598 "Like `file-directory-p' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1599 ;; Care must be taken that this function returns `t' for symlinks
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1600 ;; pointing to directories. Surely the most obvious implementation
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1601 ;; would be `test -d', but that returns false for such symlinks.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1602 ;; CCC: Stefan Monnier says that `test -d' follows symlinks. And
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1603 ;; I now think he's right. So we could be using `test -d', couldn't
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1604 ;; we?
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1605 ;;
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1606 ;; Alternatives: `cd %s', `test -d %s'
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1607 (with-parsed-tramp-file-name filename nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1608 (with-file-property v localname "file-directory-p"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1609 (tramp-run-test "-d" filename))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1610
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1611 (defun tramp-handle-file-regular-p (filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1612 "Like `file-regular-p' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1613 (and (file-exists-p filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1614 (eq ?- (aref (nth 8 (file-attributes filename)) 0))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1615
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1616 (defun tramp-handle-file-symlink-p (filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1617 "Like `file-symlink-p' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1618 (with-parsed-tramp-file-name filename nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1619 (let ((x (car (file-attributes filename))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1620 (when (stringp x)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1621 ;; When Tramp is running on VMS, then `file-name-absolute-p'
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1622 ;; might do weird things.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1623 (if (file-name-absolute-p x)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1624 (tramp-make-tramp-file-name method user host x)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1625 x)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1626
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1627 (defun tramp-handle-file-writable-p (filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1628 "Like `file-writable-p' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1629 (with-parsed-tramp-file-name filename nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1630 (with-file-property v localname "file-writable-p"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1631 (if (file-exists-p filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1632 ;; Examine `file-attributes' cache to see if request can be
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1633 ;; satisfied without remote operation.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1634 (or (tramp-check-cached-permissions v ?w)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1635 (tramp-run-test "-w" filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1636 ;; If file doesn't exist, check if directory is writable.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1637 (and (tramp-run-test "-d" (file-name-directory filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1638 (tramp-run-test "-w" (file-name-directory filename)))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1639
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1640 (defun tramp-handle-file-ownership-preserved-p (filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1641 "Like `file-ownership-preserved-p' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1642 (with-parsed-tramp-file-name filename nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1643 (with-file-property v localname "file-ownership-preserved-p"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1644 (let ((attributes (file-attributes filename)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1645 ;; Return t if the file doesn't exist, since it's true that no
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1646 ;; information would be lost by an (attempted) delete and create.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1647 (or (null attributes)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1648 (= (nth 2 attributes) (tramp-get-remote-uid v 'integer)))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1649
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1650 ;; Other file name ops.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1651
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1652 (defun tramp-handle-directory-file-name (directory)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1653 "Like `directory-file-name' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1654 ;; If localname component of filename is "/", leave it unchanged.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1655 ;; Otherwise, remove any trailing slash from localname component.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1656 ;; Method, host, etc, are unchanged. Does it make sense to try
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1657 ;; to avoid parsing the filename?
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1658 (with-parsed-tramp-file-name directory nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1659 (if (and (not (zerop (length localname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1660 (eq (aref localname (1- (length localname))) ?/)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1661 (not (string= localname "/")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1662 (substring directory 0 -1)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1663 directory)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1664
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1665 ;; Directory listings.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1666
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1667 (defun tramp-handle-directory-files
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1668 (directory &optional full match nosort files-only)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1669 "Like `directory-files' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1670 ;; FILES-ONLY is valid for XEmacs only.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1671 (when (file-directory-p directory)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1672 (setq directory (file-name-as-directory (expand-file-name directory)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1673 (let ((temp (nreverse (file-name-all-completions "" directory)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1674 result item)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1675
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1676 (while temp
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1677 (setq item (directory-file-name (pop temp)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1678 (when (and (or (null match) (string-match match item))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1679 (or (null files-only)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1680 ;; Files only.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1681 (and (equal files-only t) (file-regular-p item))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1682 ;; Directories only.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1683 (file-directory-p item)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1684 (push (if full (concat directory item) item)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1685 result)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1686 (if nosort result (sort result 'string<)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1687
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1688 (defun tramp-handle-directory-files-and-attributes
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1689 (directory &optional full match nosort id-format)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1690 "Like `directory-files-and-attributes' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1691 (unless id-format (setq id-format 'integer))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1692 (when (file-directory-p directory)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1693 (setq directory (expand-file-name directory))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1694 (let* ((temp
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1695 (copy-tree
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1696 (with-parsed-tramp-file-name directory nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1697 (with-file-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1698 v localname
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1699 (format "directory-files-and-attributes-%s" id-format)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1700 (save-excursion
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1701 (mapcar
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1702 (lambda (x)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1703 (cons (car x)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1704 (tramp-convert-file-attributes v (cdr x))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1705 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1706 ((tramp-get-remote-stat v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1707 (tramp-do-directory-files-and-attributes-with-stat
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1708 v localname id-format))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1709 ((tramp-get-remote-perl v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1710 (tramp-do-directory-files-and-attributes-with-perl
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1711 v localname id-format)))))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1712 result item)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1713
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1714 (while temp
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1715 (setq item (pop temp))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1716 (when (or (null match) (string-match match (car item)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1717 (when full
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1718 (setcar item (expand-file-name (car item) directory)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1719 (push item result)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1720
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1721 (if nosort
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1722 result
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1723 (sort result (lambda (x y) (string< (car x) (car y))))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1724
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1725 (defun tramp-do-directory-files-and-attributes-with-perl
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1726 (vec localname &optional id-format)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1727 "Implement `directory-files-and-attributes' for Tramp files using a Perl script."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1728 (tramp-message vec 5 "directory-files-and-attributes with perl: %s" localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1729 (tramp-maybe-send-script
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1730 vec tramp-perl-directory-files-and-attributes
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1731 "tramp_perl_directory_files_and_attributes")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1732 (let ((object
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1733 (tramp-send-command-and-read
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1734 vec
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1735 (format "tramp_perl_directory_files_and_attributes %s %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1736 (tramp-shell-quote-argument localname) id-format))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1737 (when (stringp object) (tramp-error vec 'file-error object))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1738 object))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1739
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1740 (defun tramp-do-directory-files-and-attributes-with-stat
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1741 (vec localname &optional id-format)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1742 "Implement `directory-files-and-attributes' for Tramp files using stat(1) command."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1743 (tramp-message vec 5 "directory-files-and-attributes with stat: %s" localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1744 (tramp-send-command-and-read
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1745 vec
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1746 (format
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1747 (concat
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1748 ;; We must care about filenames with spaces, or starting with
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1749 ;; "-"; this would confuse xargs. "ls -aQ" might be a solution,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1750 ;; but it does not work on all remote systems. Therefore, we
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1751 ;; quote the filenames via sed.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1752 "cd %s; echo \"(\"; (%s -a | sed -e s/\\$/\\\"/g -e s/^/\\\"/g | xargs "
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1753 "%s -c '(\"%%n\" (\"%%N\") %%h %s %s %%X.0 %%Y.0 %%Z.0 %%s.0 \"%%A\" t %%i.0 -1)'); "
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1754 "echo \")\"")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1755 (tramp-shell-quote-argument localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1756 (tramp-get-ls-command vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1757 (tramp-get-remote-stat vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1758 (if (eq id-format 'integer) "%u" "\"%U\"")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1759 (if (eq id-format 'integer) "%g" "\"%G\""))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1760
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1761 ;; This function should return "foo/" for directories and "bar" for
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1762 ;; files.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1763 (defun tramp-handle-file-name-all-completions (filename directory)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1764 "Like `file-name-all-completions' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1765 (unless (save-match-data (string-match "/" filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1766 (with-parsed-tramp-file-name (expand-file-name directory) nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1767
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1768 (all-completions
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1769 filename
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1770 (mapcar
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1771 'list
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1772 (or
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1773 ;; Try cache first
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1774 (and
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1775 ;; Ignore if expired
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1776 (or (not (integerp tramp-completion-reread-directory-timeout))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1777 (<= (tramp-time-diff
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1778 (current-time)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1779 (tramp-get-file-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1780 v localname "last-completion" '(0 0 0)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1781 tramp-completion-reread-directory-timeout))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1782
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1783 ;; Try cache entries for filename, filename with last
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1784 ;; character removed, filename with last two characters
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1785 ;; removed, ..., and finally the empty string - all
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1786 ;; concatenated to the local directory name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1787
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1788 ;; This is inefficient for very long filenames, pity
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1789 ;; `reduce' is not available...
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1790 (car
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1791 (apply
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1792 'append
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1793 (mapcar
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1794 (lambda (x)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1795 (let ((cache-hit
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1796 (tramp-get-file-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1797 v
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1798 (concat localname (substring filename 0 x))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1799 "file-name-all-completions"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1800 nil)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1801 (when cache-hit (list cache-hit))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1802 (tramp-compat-number-sequence (length filename) 0 -1)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1803
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1804 ;; Cache expired or no matching cache entry found so we need
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1805 ;; to perform a remote operation
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1806 (let (result)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1807 ;; Get a list of directories and files, including reliably
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1808 ;; tagging the directories with a trailing '/'. Because I
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1809 ;; rock. --daniel@danann.net
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1810
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1811 ;; Changed to perform `cd' in the same remote op and only
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1812 ;; get entries starting with `filename'. Capture any `cd'
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1813 ;; error messages. Ensure any `cd' and `echo' aliases are
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1814 ;; ignored.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1815 (tramp-send-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1816 v
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1817 (if (tramp-get-remote-perl v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1818 (progn
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1819 (tramp-maybe-send-script
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1820 v tramp-perl-file-name-all-completions
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1821 "tramp_perl_file_name_all_completions")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1822 (format "tramp_perl_file_name_all_completions %s %s %d"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1823 (tramp-shell-quote-argument localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1824 (tramp-shell-quote-argument filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1825 (if (symbol-value
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1826 ;; `read-file-name-completion-ignore-case'
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1827 ;; is introduced with Emacs 22.1.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1828 (if (boundp
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1829 'read-file-name-completion-ignore-case)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1830 'read-file-name-completion-ignore-case
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1831 'completion-ignore-case))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1832 1 0)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1833
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1834 (format (concat
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1835 "(\\cd %s 2>&1 && (%s %s -a 2>/dev/null"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1836 ;; `ls' with wildcard might fail with `Argument
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1837 ;; list too long' error in some corner cases; if
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1838 ;; `ls' fails after `cd' succeeded, chances are
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1839 ;; that's the case, so let's retry without
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1840 ;; wildcard. This will return "too many" entries
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1841 ;; but that isn't harmful.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1842 " || %s -a 2>/dev/null)"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1843 " | while read f; do"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1844 " if %s -d \"$f\" 2>/dev/null;"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1845 " then \\echo \"$f/\"; else \\echo \"$f\"; fi; done"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1846 " && \\echo ok) || \\echo fail")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1847 (tramp-shell-quote-argument localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1848 (tramp-get-ls-command v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1849 ;; When `filename' is empty, just `ls' without
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1850 ;; filename argument is more efficient than `ls *'
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1851 ;; for very large directories and might avoid the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1852 ;; `Argument list too long' error.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1853 ;;
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1854 ;; With and only with wildcard, we need to add
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1855 ;; `-d' to prevent `ls' from descending into
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1856 ;; sub-directories.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1857 (if (zerop (length filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1858 "."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1859 (concat (tramp-shell-quote-argument filename) "* -d"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1860 (tramp-get-ls-command v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1861 (tramp-get-test-command v))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1862
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1863 ;; Now grab the output.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1864 (with-current-buffer (tramp-get-buffer v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1865 (goto-char (point-max))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1866
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1867 ;; Check result code, found in last line of output
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1868 (forward-line -1)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1869 (if (looking-at "^fail$")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1870 (progn
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1871 ;; Grab error message from line before last line
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1872 ;; (it was put there by `cd 2>&1')
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1873 (forward-line -1)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1874 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1875 v 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1876 "tramp-handle-file-name-all-completions: %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1877 (buffer-substring
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1878 (point) (tramp-compat-line-end-position))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1879 ;; For peace of mind, if buffer doesn't end in `fail'
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1880 ;; then it should end in `ok'. If neither are in the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1881 ;; buffer something went seriously wrong on the remote
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1882 ;; side.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1883 (unless (looking-at "^ok$")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1884 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1885 v 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1886 "\
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1887 tramp-handle-file-name-all-completions: internal error accessing `%s': `%s'"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1888 (tramp-shell-quote-argument localname) (buffer-string))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1889
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1890 (while (zerop (forward-line -1))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1891 (push (buffer-substring
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1892 (point) (tramp-compat-line-end-position))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1893 result)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1894
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1895 ;; Because the remote op went through OK we know the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1896 ;; directory we `cd'-ed to exists
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1897 (tramp-set-file-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1898 v localname "file-exists-p" t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1899
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1900 ;; Because the remote op went through OK we know every
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1901 ;; file listed by `ls' exists.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1902 (mapc (lambda (entry)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1903 (tramp-set-file-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1904 v (concat localname entry) "file-exists-p" t))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1905 result)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1906
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1907 (tramp-set-file-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1908 v localname "last-completion" (current-time))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1909
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1910 ;; Store result in the cache
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1911 (tramp-set-file-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1912 v (concat localname filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1913 "file-name-all-completions"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1914 result))))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1915
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1916 (defun tramp-handle-file-name-completion
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1917 (filename directory &optional predicate)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1918 "Like `file-name-completion' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1919 (unless (tramp-tramp-file-p directory)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1920 (error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1921 "tramp-handle-file-name-completion invoked on non-tramp directory `%s'"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1922 directory))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1923 (try-completion
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1924 filename
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1925 (mapcar 'list (file-name-all-completions filename directory))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1926 (when predicate
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1927 (lambda (x) (funcall predicate (expand-file-name (car x) directory))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1928
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1929 ;; cp, mv and ln
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1930
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1931 (defun tramp-handle-add-name-to-file
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1932 (filename newname &optional ok-if-already-exists)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1933 "Like `add-name-to-file' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1934 (unless (tramp-equal-remote filename newname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1935 (with-parsed-tramp-file-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1936 (if (tramp-tramp-file-p filename) filename newname) nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1937 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1938 v 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1939 "add-name-to-file: %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1940 "only implemented for same method, same user, same host")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1941 (with-parsed-tramp-file-name filename v1
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1942 (with-parsed-tramp-file-name newname v2
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1943 (let ((ln (when v1 (tramp-get-remote-ln v1))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1944 (when (and (not ok-if-already-exists)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1945 (file-exists-p newname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1946 (not (numberp ok-if-already-exists))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1947 (y-or-n-p
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1948 (format
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1949 "File %s already exists; make it a new name anyway? "
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1950 newname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1951 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1952 v2 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1953 "add-name-to-file: file %s already exists" newname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1954 (tramp-flush-file-property v2 (file-name-directory v2-localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1955 (tramp-flush-file-property v2 v2-localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1956 (tramp-barf-unless-okay
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1957 v1
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1958 (format "%s %s %s" ln (tramp-shell-quote-argument v1-localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1959 (tramp-shell-quote-argument v2-localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1960 "error with add-name-to-file, see buffer `%s' for details"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1961 (buffer-name))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1962
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1963 (defun tramp-handle-copy-file
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1964 (filename newname &optional ok-if-already-exists keep-date
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1965 preserve-uid-gid preserve-selinux-context)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1966 "Like `copy-file' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1967 (setq filename (expand-file-name filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1968 (setq newname (expand-file-name newname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1969 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1970 ;; At least one file a Tramp file?
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1971 ((or (tramp-tramp-file-p filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1972 (tramp-tramp-file-p newname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1973 (tramp-do-copy-or-rename-file
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1974 'copy filename newname ok-if-already-exists keep-date
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1975 preserve-uid-gid preserve-selinux-context))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1976 ;; Compat section.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1977 (preserve-selinux-context
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1978 (tramp-run-real-handler
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1979 'copy-file
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1980 (list filename newname ok-if-already-exists keep-date
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1981 preserve-uid-gid preserve-selinux-context)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1982 (preserve-uid-gid
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1983 (tramp-run-real-handler
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1984 'copy-file
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1985 (list filename newname ok-if-already-exists keep-date preserve-uid-gid)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1986 (t
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1987 (tramp-run-real-handler
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1988 'copy-file (list filename newname ok-if-already-exists keep-date)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1989
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1990 (defun tramp-handle-copy-directory (dirname newname &optional keep-date parents)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1991 "Like `copy-directory' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1992 (let ((t1 (tramp-tramp-file-p dirname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1993 (t2 (tramp-tramp-file-p newname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1994 (with-parsed-tramp-file-name (if t1 dirname newname) nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1995 (if (and (tramp-get-method-parameter method 'tramp-copy-recursive)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1996 ;; When DIRNAME and NEWNAME are remote, they must have
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1997 ;; the same method.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1998 (or (null t1) (null t2)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
1999 (string-equal
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2000 (tramp-file-name-method (tramp-dissect-file-name dirname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2001 (tramp-file-name-method (tramp-dissect-file-name newname)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2002 ;; scp or rsync DTRT.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2003 (progn
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2004 (setq dirname (directory-file-name (expand-file-name dirname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2005 newname (directory-file-name (expand-file-name newname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2006 (if (and (file-directory-p newname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2007 (not (string-equal (file-name-nondirectory dirname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2008 (file-name-nondirectory newname))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2009 (setq newname
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2010 (expand-file-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2011 (file-name-nondirectory dirname) newname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2012 (if (not (file-directory-p (file-name-directory newname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2013 (make-directory (file-name-directory newname) parents))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2014 (tramp-do-copy-or-rename-file-out-of-band
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2015 'copy dirname newname keep-date))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2016 ;; We must do it file-wise.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2017 (tramp-run-real-handler
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2018 'copy-directory (list dirname newname keep-date parents)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2019
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2020 ;; When newname did exist, we have wrong cached values.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2021 (when t2
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2022 (with-parsed-tramp-file-name newname nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2023 (tramp-flush-file-property v (file-name-directory localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2024 (tramp-flush-file-property v localname))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2025
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2026 (defun tramp-handle-rename-file
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2027 (filename newname &optional ok-if-already-exists)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2028 "Like `rename-file' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2029 ;; Check if both files are local -- invoke normal rename-file.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2030 ;; Otherwise, use Tramp from local system.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2031 (setq filename (expand-file-name filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2032 (setq newname (expand-file-name newname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2033 ;; At least one file a Tramp file?
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2034 (if (or (tramp-tramp-file-p filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2035 (tramp-tramp-file-p newname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2036 (tramp-do-copy-or-rename-file
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2037 'rename filename newname ok-if-already-exists t t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2038 (tramp-run-real-handler
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2039 'rename-file (list filename newname ok-if-already-exists))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2040
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2041 (defun tramp-do-copy-or-rename-file
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2042 (op filename newname &optional ok-if-already-exists keep-date
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2043 preserve-uid-gid preserve-selinux-context)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2044 "Copy or rename a remote file.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2045 OP must be `copy' or `rename' and indicates the operation to perform.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2046 FILENAME specifies the file to copy or rename, NEWNAME is the name of
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2047 the new file (for copy) or the new name of the file (for rename).
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2048 OK-IF-ALREADY-EXISTS means don't barf if NEWNAME exists already.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2049 KEEP-DATE means to make sure that NEWNAME has the same timestamp
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2050 as FILENAME. PRESERVE-UID-GID, when non-nil, instructs to keep
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2051 the uid and gid if both files are on the same host.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2052 PRESERVE-SELINUX-CONTEXT activates selinux commands.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2053
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2054 This function is invoked by `tramp-handle-copy-file' and
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2055 `tramp-handle-rename-file'. It is an error if OP is neither of `copy'
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2056 and `rename'. FILENAME and NEWNAME must be absolute file names."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2057 (unless (memq op '(copy rename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2058 (error "Unknown operation `%s', must be `copy' or `rename'" op))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2059 (let ((t1 (tramp-tramp-file-p filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2060 (t2 (tramp-tramp-file-p newname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2061 (context (and preserve-selinux-context
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2062 (apply 'file-selinux-context (list filename))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2063 pr tm)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2064
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2065 (with-parsed-tramp-file-name (if t1 filename newname) nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2066 (when (and (not ok-if-already-exists) (file-exists-p newname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2067 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2068 v 'file-already-exists "File %s already exists" newname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2069
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2070 (with-progress-reporter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2071 v 0 (format "%s %s to %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2072 (if (eq op 'copy) "Copying" "Renaming")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2073 filename newname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2074
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2075 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2076 ;; Both are Tramp files.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2077 ((and t1 t2)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2078 (with-parsed-tramp-file-name filename v1
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2079 (with-parsed-tramp-file-name newname v2
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2080 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2081 ;; Shortcut: if method, host, user are the same for
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2082 ;; both files, we invoke `cp' or `mv' on the remote
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2083 ;; host directly.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2084 ((tramp-equal-remote filename newname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2085 (tramp-do-copy-or-rename-file-directly
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2086 op filename newname
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2087 ok-if-already-exists keep-date preserve-uid-gid))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2088
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2089 ;; Try out-of-band operation.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2090 ((tramp-method-out-of-band-p
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2091 v1 (nth 7 (file-attributes filename)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2092 (tramp-do-copy-or-rename-file-out-of-band
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2093 op filename newname keep-date))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2094
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2095 ;; No shortcut was possible. So we copy the file
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2096 ;; first. If the operation was `rename', we go back
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2097 ;; and delete the original file (if the copy was
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2098 ;; successful). The approach is simple-minded: we
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2099 ;; create a new buffer, insert the contents of the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2100 ;; source file into it, then write out the buffer to
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2101 ;; the target file. The advantage is that it doesn't
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2102 ;; matter which filename handlers are used for the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2103 ;; source and target file.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2104 (t
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2105 (tramp-do-copy-or-rename-file-via-buffer
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2106 op filename newname keep-date))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2107
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2108 ;; One file is a Tramp file, the other one is local.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2109 ((or t1 t2)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2110 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2111 ;; Fast track on local machine.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2112 ((tramp-local-host-p v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2113 (tramp-do-copy-or-rename-file-directly
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2114 op filename newname
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2115 ok-if-already-exists keep-date preserve-uid-gid))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2116
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2117 ;; If the Tramp file has an out-of-band method, the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2118 ;; corresponding copy-program can be invoked.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2119 ((tramp-method-out-of-band-p v (nth 7 (file-attributes filename)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2120 (tramp-do-copy-or-rename-file-out-of-band
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2121 op filename newname keep-date))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2122
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2123 ;; Use the inline method via a Tramp buffer.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2124 (t (tramp-do-copy-or-rename-file-via-buffer
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2125 op filename newname keep-date))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2126
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2127 (t
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2128 ;; One of them must be a Tramp file.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2129 (error "Tramp implementation says this cannot happen")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2130
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2131 ;; Handle `preserve-selinux-context'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2132 (when context (apply 'set-file-selinux-context (list newname context)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2133
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2134 ;; In case of `rename', we must flush the cache of the source file.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2135 (when (and t1 (eq op 'rename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2136 (with-parsed-tramp-file-name filename v1
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2137 (tramp-flush-file-property v1 (file-name-directory localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2138 (tramp-flush-file-property v1 localname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2139
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2140 ;; When newname did exist, we have wrong cached values.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2141 (when t2
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2142 (with-parsed-tramp-file-name newname v2
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2143 (tramp-flush-file-property v2 (file-name-directory localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2144 (tramp-flush-file-property v2 localname)))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2145
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2146 (defun tramp-do-copy-or-rename-file-via-buffer (op filename newname keep-date)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2147 "Use an Emacs buffer to copy or rename a file.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2148 First arg OP is either `copy' or `rename' and indicates the operation.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2149 FILENAME is the source file, NEWNAME the target file.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2150 KEEP-DATE is non-nil if NEWNAME should have the same timestamp as FILENAME."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2151 (with-temp-buffer
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2152 ;; We must disable multibyte, because binary data shall not be
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2153 ;; converted.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2154 (set-buffer-multibyte nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2155 (let ((coding-system-for-read 'binary)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2156 (jka-compr-inhibit t))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2157 (insert-file-contents-literally filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2158 ;; We don't want the target file to be compressed, so we let-bind
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2159 ;; `jka-compr-inhibit' to t.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2160 (let ((coding-system-for-write 'binary)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2161 (jka-compr-inhibit t))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2162 (write-region (point-min) (point-max) newname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2163 ;; KEEP-DATE handling.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2164 (when keep-date (set-file-times newname (nth 5 (file-attributes filename))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2165 ;; Set the mode.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2166 (set-file-modes newname (tramp-default-file-modes filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2167 ;; If the operation was `rename', delete the original file.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2168 (unless (eq op 'copy) (delete-file filename)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2169
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2170 (defun tramp-do-copy-or-rename-file-directly
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2171 (op filename newname ok-if-already-exists keep-date preserve-uid-gid)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2172 "Invokes `cp' or `mv' on the remote system.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2173 OP must be one of `copy' or `rename', indicating `cp' or `mv',
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2174 respectively. FILENAME specifies the file to copy or rename,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2175 NEWNAME is the name of the new file (for copy) or the new name of
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2176 the file (for rename). Both files must reside on the same host.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2177 KEEP-DATE means to make sure that NEWNAME has the same timestamp
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2178 as FILENAME. PRESERVE-UID-GID, when non-nil, instructs to keep
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2179 the uid and gid from FILENAME."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2180 (let ((t1 (tramp-tramp-file-p filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2181 (t2 (tramp-tramp-file-p newname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2182 (file-times (nth 5 (file-attributes filename)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2183 (file-modes (tramp-default-file-modes filename)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2184 (with-parsed-tramp-file-name (if t1 filename newname) nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2185 (let* ((cmd (cond ((and (eq op 'copy) preserve-uid-gid) "cp -f -p")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2186 ((eq op 'copy) "cp -f")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2187 ((eq op 'rename) "mv -f")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2188 (t (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2189 v 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2190 "Unknown operation `%s', must be `copy' or `rename'"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2191 op))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2192 (localname1
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2193 (if t1
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2194 (tramp-file-name-handler 'file-remote-p filename 'localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2195 filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2196 (localname2
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2197 (if t2
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2198 (tramp-file-name-handler 'file-remote-p newname 'localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2199 newname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2200 (prefix (file-remote-p (if t1 filename newname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2201 cmd-result)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2202
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2203 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2204 ;; Both files are on a remote host, with same user.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2205 ((and t1 t2)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2206 (setq cmd-result
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2207 (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2208 v (format "%s %s %s" cmd
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2209 (tramp-shell-quote-argument localname1)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2210 (tramp-shell-quote-argument localname2))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2211 (with-current-buffer (tramp-get-buffer v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2212 (goto-char (point-min))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2213 (unless
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2214 (or
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2215 (and keep-date
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2216 ;; Mask cp -f error.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2217 (re-search-forward
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2218 tramp-operation-not-permitted-regexp nil t))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2219 cmd-result)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2220 (tramp-error-with-buffer
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2221 nil v 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2222 "Copying directly failed, see buffer `%s' for details."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2223 (buffer-name)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2224
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2225 ;; We are on the local host.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2226 ((or t1 t2)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2227 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2228 ;; We can do it directly.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2229 ((let (file-name-handler-alist)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2230 (and (file-readable-p localname1)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2231 (file-writable-p (file-name-directory localname2))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2232 (or (file-directory-p localname2)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2233 (file-writable-p localname2))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2234 (if (eq op 'copy)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2235 (tramp-compat-copy-file
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2236 localname1 localname2 ok-if-already-exists
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2237 keep-date preserve-uid-gid)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2238 (tramp-run-real-handler
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2239 'rename-file (list localname1 localname2 ok-if-already-exists))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2240
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2241 ;; We can do it directly with `tramp-send-command'
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2242 ((and (file-readable-p (concat prefix localname1))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2243 (file-writable-p
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2244 (file-name-directory (concat prefix localname2)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2245 (or (file-directory-p (concat prefix localname2))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2246 (file-writable-p (concat prefix localname2))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2247 (tramp-do-copy-or-rename-file-directly
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2248 op (concat prefix localname1) (concat prefix localname2)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2249 ok-if-already-exists keep-date t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2250 ;; We must change the ownership to the local user.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2251 (tramp-set-file-uid-gid
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2252 (concat prefix localname2)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2253 (tramp-get-local-uid 'integer)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2254 (tramp-get-local-gid 'integer)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2255
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2256 ;; We need a temporary file in between.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2257 (t
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2258 ;; Create the temporary file.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2259 (let ((tmpfile (tramp-compat-make-temp-file localname1)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2260 (unwind-protect
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2261 (progn
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2262 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2263 (t1
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2264 (tramp-barf-unless-okay
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2265 v (format
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2266 "%s %s %s" cmd
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2267 (tramp-shell-quote-argument localname1)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2268 (tramp-shell-quote-argument tmpfile))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2269 "Copying directly failed, see buffer `%s' for details."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2270 (tramp-get-buffer v))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2271 ;; We must change the ownership as remote user.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2272 ;; Since this does not work reliable, we also
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2273 ;; give read permissions.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2274 (set-file-modes
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2275 (concat prefix tmpfile)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2276 (tramp-compat-octal-to-decimal "0777"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2277 (tramp-set-file-uid-gid
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2278 (concat prefix tmpfile)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2279 (tramp-get-local-uid 'integer)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2280 (tramp-get-local-gid 'integer)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2281 (t2
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2282 (if (eq op 'copy)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2283 (tramp-compat-copy-file
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2284 localname1 tmpfile t
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2285 keep-date preserve-uid-gid)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2286 (tramp-run-real-handler
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2287 'rename-file
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2288 (list localname1 tmpfile t)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2289 ;; We must change the ownership as local user.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2290 ;; Since this does not work reliable, we also
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2291 ;; give read permissions.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2292 (set-file-modes
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2293 tmpfile (tramp-compat-octal-to-decimal "0777"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2294 (tramp-set-file-uid-gid
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2295 tmpfile
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2296 (tramp-get-remote-uid v 'integer)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2297 (tramp-get-remote-gid v 'integer))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2298
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2299 ;; Move the temporary file to its destination.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2300 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2301 (t2
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2302 (tramp-barf-unless-okay
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2303 v (format
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2304 "cp -f -p %s %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2305 (tramp-shell-quote-argument tmpfile)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2306 (tramp-shell-quote-argument localname2))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2307 "Copying directly failed, see buffer `%s' for details."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2308 (tramp-get-buffer v)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2309 (t1
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2310 (tramp-run-real-handler
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2311 'rename-file
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2312 (list tmpfile localname2 ok-if-already-exists)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2313
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2314 ;; Save exit.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2315 (condition-case nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2316 (delete-file tmpfile)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2317 (error)))))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2318
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2319 ;; Set the time and mode. Mask possible errors.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2320 (condition-case nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2321 (when keep-date
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2322 (set-file-times newname file-times)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2323 (set-file-modes newname file-modes))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2324 (error)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2325
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2326 (defun tramp-do-copy-or-rename-file-out-of-band (op filename newname keep-date)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2327 "Invoke rcp program to copy.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2328 The method used must be an out-of-band method."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2329 (let ((t1 (tramp-tramp-file-p filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2330 (t2 (tramp-tramp-file-p newname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2331 copy-program copy-args copy-env copy-keep-date port spec
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2332 source target)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2333
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2334 (with-parsed-tramp-file-name (if t1 filename newname) nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2335 (if (and t1 t2)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2336
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2337 ;; Both are Tramp files. We shall optimize it, when the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2338 ;; methods for filename and newname are the same.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2339 (let* ((dir-flag (file-directory-p filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2340 (tmpfile (tramp-compat-make-temp-file localname dir-flag)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2341 (if dir-flag
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2342 (setq tmpfile
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2343 (expand-file-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2344 (file-name-nondirectory newname) tmpfile)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2345 (unwind-protect
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2346 (progn
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2347 (tramp-do-copy-or-rename-file-out-of-band
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2348 op filename tmpfile keep-date)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2349 (tramp-do-copy-or-rename-file-out-of-band
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2350 'rename tmpfile newname keep-date))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2351 ;; Save exit.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2352 (condition-case nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2353 (if dir-flag
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2354 (tramp-compat-delete-directory
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2355 (expand-file-name ".." tmpfile) 'recursive)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2356 (delete-file tmpfile))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2357 (error))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2358
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2359 ;; Expand hops. Might be necessary for gateway methods.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2360 (setq v (car (tramp-compute-multi-hops v)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2361 (aset v 3 localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2362
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2363 ;; Check which ones of source and target are Tramp files.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2364 (setq source (if t1 (tramp-make-copy-program-file-name v) filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2365 target (funcall
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2366 (if (and (file-directory-p filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2367 (string-equal
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2368 (file-name-nondirectory filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2369 (file-name-nondirectory newname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2370 'file-name-directory
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2371 'identity)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2372 (if t2 (tramp-make-copy-program-file-name v) newname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2373
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2374 ;; Check for port number. Until now, there's no need for handling
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2375 ;; like method, user, host.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2376 (setq host (tramp-file-name-real-host v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2377 port (tramp-file-name-port v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2378 port (or (and port (number-to-string port)) ""))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2379
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2380 ;; Compose copy command.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2381 (setq spec (format-spec-make
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2382 ?h host ?u user ?p port
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2383 ?t (tramp-get-connection-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2384 (tramp-get-connection-process v) "temp-file" "")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2385 ?k (if keep-date " " ""))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2386 copy-program (tramp-get-method-parameter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2387 method 'tramp-copy-program)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2388 copy-keep-date (tramp-get-method-parameter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2389 method 'tramp-copy-keep-date)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2390 copy-args
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2391 (delq
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2392 nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2393 (mapcar
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2394 (lambda (x)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2395 (setq
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2396 x
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2397 ;; " " is indication for keep-date argument.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2398 (delete " " (mapcar (lambda (y) (format-spec y spec)) x)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2399 (unless (member "" x) (mapconcat 'identity x " ")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2400 (tramp-get-method-parameter method 'tramp-copy-args)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2401 copy-env
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2402 (delq
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2403 nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2404 (mapcar
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2405 (lambda (x)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2406 (setq x (mapcar (lambda (y) (format-spec y spec)) x))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2407 (unless (member "" x) (mapconcat 'identity x " ")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2408 (tramp-get-method-parameter method 'tramp-copy-env))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2409
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2410 ;; Check for program.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2411 (when (and (fboundp 'executable-find)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2412 (not (let ((default-directory
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2413 (tramp-compat-temporary-file-directory)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2414 (executable-find copy-program))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2415 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2416 v 'file-error "Cannot find copy program: %s" copy-program))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2417
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2418 ;; Set variables for computing the prompt for reading
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2419 ;; password.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2420 (setq tramp-current-method (tramp-file-name-method v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2421 tramp-current-user (tramp-file-name-user v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2422 tramp-current-host (tramp-file-name-host v))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2423
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2424 (unwind-protect
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2425 (with-temp-buffer
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2426 ;; The default directory must be remote.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2427 (let ((default-directory
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2428 (file-name-directory (if t1 filename newname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2429 (process-environment (copy-sequence process-environment)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2430 ;; Set the transfer process properties.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2431 (tramp-set-connection-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2432 v "process-name" (buffer-name (current-buffer)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2433 (tramp-set-connection-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2434 v "process-buffer" (current-buffer))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2435 (while copy-env
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2436 (tramp-message v 5 "%s=\"%s\"" (car copy-env) (cadr copy-env))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2437 (setenv (pop copy-env) (pop copy-env)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2438
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2439 ;; Use an asynchronous process. By this, password can
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2440 ;; be handled. The default directory must be local, in
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2441 ;; order to apply the correct `copy-program'. We don't
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2442 ;; set a timeout, because the copying of large files can
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2443 ;; last longer than 60 secs.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2444 (let ((p (let ((default-directory
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2445 (tramp-compat-temporary-file-directory)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2446 (apply 'start-process
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2447 (tramp-get-connection-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2448 v "process-name" nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2449 (tramp-get-connection-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2450 v "process-buffer" nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2451 copy-program
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2452 (append copy-args (list source target))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2453 (tramp-message
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2454 v 6 "%s" (mapconcat 'identity (process-command p) " "))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2455 (tramp-set-process-query-on-exit-flag p nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2456 (tramp-process-actions p v tramp-actions-copy-out-of-band))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2457
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2458 ;; Reset the transfer process properties.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2459 (tramp-set-connection-property v "process-name" nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2460 (tramp-set-connection-property v "process-buffer" nil))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2461
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2462 ;; Handle KEEP-DATE argument.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2463 (when (and keep-date (not copy-keep-date))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2464 (set-file-times newname (nth 5 (file-attributes filename))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2465
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2466 ;; Set the mode.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2467 (unless (and keep-date copy-keep-date)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2468 (ignore-errors
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2469 (set-file-modes newname (tramp-default-file-modes filename)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2470
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2471 ;; If the operation was `rename', delete the original file.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2472 (unless (eq op 'copy)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2473 (if (file-regular-p filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2474 (delete-file filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2475 (tramp-compat-delete-directory filename 'recursive))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2476
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2477 (defun tramp-handle-make-directory (dir &optional parents)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2478 "Like `make-directory' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2479 (setq dir (expand-file-name dir))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2480 (with-parsed-tramp-file-name dir nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2481 (tramp-flush-directory-property v (file-name-directory localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2482 (save-excursion
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2483 (tramp-barf-unless-okay
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2484 v (format "%s %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2485 (if parents "mkdir -p" "mkdir")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2486 (tramp-shell-quote-argument localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2487 "Couldn't make directory %s" dir))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2488
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2489 (defun tramp-handle-delete-directory (directory &optional recursive)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2490 "Like `delete-directory' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2491 (setq directory (expand-file-name directory))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2492 (with-parsed-tramp-file-name directory nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2493 (tramp-flush-file-property v (file-name-directory localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2494 (tramp-flush-directory-property v localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2495 (tramp-barf-unless-okay
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2496 v (format "%s %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2497 (if recursive "rm -rf" "rmdir")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2498 (tramp-shell-quote-argument localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2499 "Couldn't delete %s" directory)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2500
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2501 (defun tramp-handle-delete-file (filename &optional trash)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2502 "Like `delete-file' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2503 (setq filename (expand-file-name filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2504 (with-parsed-tramp-file-name filename nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2505 (tramp-flush-file-property v (file-name-directory localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2506 (tramp-flush-file-property v localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2507 (tramp-barf-unless-okay
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2508 v (format "%s %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2509 (or (and trash (tramp-get-remote-trash v)) "rm -f")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2510 (tramp-shell-quote-argument localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2511 "Couldn't delete %s" filename)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2512
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2513 ;; Dired.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2514
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2515 ;; CCC: This does not seem to be enough. Something dies when
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2516 ;; we try and delete two directories under Tramp :/
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2517 (defun tramp-handle-dired-recursive-delete-directory (filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2518 "Recursively delete the directory given.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2519 This is like `dired-recursive-delete-directory' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2520 (with-parsed-tramp-file-name filename nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2521 ;; Run a shell command 'rm -r <localname>'
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2522 ;; Code shamelessly stolen from the dired implementation and, um, hacked :)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2523 (unless (file-exists-p filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2524 (tramp-error v 'file-error "No such directory: %s" filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2525 ;; Which is better, -r or -R? (-r works for me <daniel@danann.net>)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2526 (tramp-send-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2527 v
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2528 (format "rm -rf %s" (tramp-shell-quote-argument localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2529 ;; Don't read the output, do it explicitely.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2530 nil t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2531 ;; Wait for the remote system to return to us...
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2532 ;; This might take a while, allow it plenty of time.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2533 (tramp-wait-for-output (tramp-get-connection-process v) 120)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2534 ;; Make sure that it worked...
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2535 (tramp-flush-file-property v (file-name-directory localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2536 (tramp-flush-directory-property v localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2537 (and (file-exists-p filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2538 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2539 v 'file-error "Failed to recursively delete %s" filename))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2540
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2541 (defun tramp-handle-dired-compress-file (file &rest ok-flag)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2542 "Like `dired-compress-file' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2543 ;; OK-FLAG is valid for XEmacs only, but not implemented.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2544 ;; Code stolen mainly from dired-aux.el.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2545 (with-parsed-tramp-file-name file nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2546 (tramp-flush-file-property v localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2547 (save-excursion
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2548 (let ((suffixes
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2549 (if (not (featurep 'xemacs))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2550 ;; Emacs case
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2551 (symbol-value 'dired-compress-file-suffixes)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2552 ;; XEmacs has `dired-compression-method-alist', which is
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2553 ;; transformed into `dired-compress-file-suffixes' structure.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2554 (mapcar
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2555 (lambda (x)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2556 (list (concat (regexp-quote (nth 1 x)) "\\'")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2557 nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2558 (mapconcat 'identity (nth 3 x) " ")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2559 (symbol-value 'dired-compression-method-alist))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2560 suffix)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2561 ;; See if any suffix rule matches this file name.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2562 (while suffixes
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2563 (let (case-fold-search)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2564 (if (string-match (car (car suffixes)) localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2565 (setq suffix (car suffixes) suffixes nil))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2566 (setq suffixes (cdr suffixes))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2567
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2568 (cond ((file-symlink-p file)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2569 nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2570 ((and suffix (nth 2 suffix))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2571 ;; We found an uncompression rule.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2572 (with-progress-reporter v 0 (format "Uncompressing %s" file)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2573 (when (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2574 v (concat (nth 2 suffix) " "
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2575 (tramp-shell-quote-argument localname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2576 ;; `dired-remove-file' is not defined in XEmacs.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2577 (tramp-compat-funcall 'dired-remove-file file)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2578 (string-match (car suffix) file)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2579 (concat (substring file 0 (match-beginning 0))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2580 (t
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2581 ;; We don't recognize the file as compressed, so compress it.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2582 ;; Try gzip.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2583 (with-progress-reporter v 0 (format "Compressing %s" file)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2584 (when (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2585 v (concat "gzip -f "
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2586 (tramp-shell-quote-argument localname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2587 ;; `dired-remove-file' is not defined in XEmacs.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2588 (tramp-compat-funcall 'dired-remove-file file)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2589 (cond ((file-exists-p (concat file ".gz"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2590 (concat file ".gz"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2591 ((file-exists-p (concat file ".z"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2592 (concat file ".z"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2593 (t nil))))))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2594
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2595 (defun tramp-handle-dired-uncache (dir &optional dir-p)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2596 "Like `dired-uncache' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2597 ;; DIR-P is valid for XEmacs only.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2598 (with-parsed-tramp-file-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2599 (if (or dir-p (file-directory-p dir)) dir (file-name-directory dir)) nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2600 (tramp-flush-directory-property v localname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2601
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2602 (defun tramp-handle-insert-directory
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2603 (filename switches &optional wildcard full-directory-p)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2604 "Like `insert-directory' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2605 (setq filename (expand-file-name filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2606 (with-parsed-tramp-file-name filename nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2607 (if (and (featurep 'ls-lisp)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2608 (not (symbol-value 'ls-lisp-use-insert-directory-program)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2609 (tramp-run-real-handler
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2610 'insert-directory (list filename switches wildcard full-directory-p))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2611 (when (stringp switches)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2612 (setq switches (split-string switches)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2613 (when (and (member "--dired" switches)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2614 (not (tramp-get-ls-command-with-dired v)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2615 (setq switches (delete "--dired" switches)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2616 (when wildcard
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2617 (setq wildcard (tramp-run-real-handler
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2618 'file-name-nondirectory (list localname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2619 (setq localname (tramp-run-real-handler
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2620 'file-name-directory (list localname))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2621 (unless full-directory-p
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2622 (setq switches (add-to-list 'switches "-d" 'append)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2623 (setq switches (mapconcat 'tramp-shell-quote-argument switches " "))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2624 (when wildcard
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2625 (setq switches (concat switches " " wildcard)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2626 (tramp-message
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2627 v 4 "Inserting directory `ls %s %s', wildcard %s, fulldir %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2628 switches filename (if wildcard "yes" "no")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2629 (if full-directory-p "yes" "no"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2630 ;; If `full-directory-p', we just say `ls -l FILENAME'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2631 ;; Else we chdir to the parent directory, then say `ls -ld BASENAME'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2632 (if full-directory-p
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2633 (tramp-send-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2634 v
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2635 (format "%s %s %s 2>/dev/null"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2636 (tramp-get-ls-command v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2637 switches
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2638 (if wildcard
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2639 localname
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2640 (tramp-shell-quote-argument (concat localname ".")))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2641 (tramp-barf-unless-okay
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2642 v
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2643 (format "cd %s" (tramp-shell-quote-argument
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2644 (tramp-run-real-handler
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2645 'file-name-directory (list localname))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2646 "Couldn't `cd %s'"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2647 (tramp-shell-quote-argument
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2648 (tramp-run-real-handler 'file-name-directory (list localname))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2649 (tramp-send-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2650 v
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2651 (format "%s %s %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2652 (tramp-get-ls-command v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2653 switches
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2654 (if (or wildcard
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2655 (zerop (length
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2656 (tramp-run-real-handler
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2657 'file-name-nondirectory (list localname)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2658 ""
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2659 (tramp-shell-quote-argument
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2660 (tramp-run-real-handler
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2661 'file-name-nondirectory (list localname)))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2662 (let ((beg (point)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2663 ;; We cannot use `insert-buffer-substring' because the Tramp
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2664 ;; buffer changes its contents before insertion due to calling
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2665 ;; `expand-file' and alike.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2666 (insert
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2667 (with-current-buffer (tramp-get-buffer v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2668 (buffer-string)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2669
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2670 ;; Check for "--dired" output.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2671 (forward-line -2)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2672 (when (looking-at "//SUBDIRED//")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2673 (forward-line -1))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2674 (when (looking-at "//DIRED//\\s-+")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2675 (let ((databeg (match-end 0))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2676 (end (tramp-compat-line-end-position)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2677 ;; Now read the numeric positions of file names.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2678 (goto-char databeg)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2679 (while (< (point) end)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2680 (let ((start (+ beg (read (current-buffer))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2681 (end (+ beg (read (current-buffer)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2682 (if (memq (char-after end) '(?\n ?\ ))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2683 ;; End is followed by \n or by " -> ".
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2684 (put-text-property start end 'dired-filename t))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2685 ;; Remove trailing lines.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2686 (goto-char (tramp-compat-line-beginning-position))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2687 (while (looking-at "//")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2688 (forward-line 1)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2689 (delete-region (match-beginning 0) (point)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2690
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2691 ;; The inserted file could be from somewhere else.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2692 (when (and (not wildcard) (not full-directory-p))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2693 (goto-char (point-max))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2694 (when (file-symlink-p filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2695 (goto-char (search-backward "->" beg 'noerror)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2696 (search-backward
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2697 (if (zerop (length (file-name-nondirectory filename)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2698 "."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2699 (file-name-nondirectory filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2700 beg 'noerror)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2701 (replace-match (file-relative-name filename) t))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2702
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2703 (goto-char (point-max))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2704
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2705 (defun tramp-handle-unhandled-file-name-directory (filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2706 "Like `unhandled-file-name-directory' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2707 ;; With Emacs 23, we could simply return `nil'. But we must keep it
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2708 ;; for backward compatibility.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2709 (expand-file-name "~/"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2710
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2711 ;; Canonicalization of file names.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2712
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2713 (defun tramp-handle-expand-file-name (name &optional dir)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2714 "Like `expand-file-name' for Tramp files.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2715 If the localname part of the given filename starts with \"/../\" then
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2716 the result will be a local, non-Tramp, filename."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2717 ;; If DIR is not given, use DEFAULT-DIRECTORY or "/".
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2718 (setq dir (or dir default-directory "/"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2719 ;; Unless NAME is absolute, concat DIR and NAME.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2720 (unless (file-name-absolute-p name)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2721 (setq name (concat (file-name-as-directory dir) name)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2722 ;; If NAME is not a Tramp file, run the real handler.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2723 (if (not (tramp-connectable-p name))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2724 (tramp-run-real-handler 'expand-file-name (list name nil))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2725 ;; Dissect NAME.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2726 (with-parsed-tramp-file-name name nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2727 (unless (tramp-run-real-handler 'file-name-absolute-p (list localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2728 (setq localname (concat "~/" localname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2729 ;; Tilde expansion if necessary. This needs a shell which
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2730 ;; groks tilde expansion! The function `tramp-find-shell' is
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2731 ;; supposed to find such a shell on the remote host. Please
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2732 ;; tell me about it when this doesn't work on your system.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2733 (when (string-match "\\`\\(~[^/]*\\)\\(.*\\)\\'" localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2734 (let ((uname (match-string 1 localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2735 (fname (match-string 2 localname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2736 ;; We cannot simply apply "~/", because under sudo "~/" is
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2737 ;; expanded to the local user home directory but to the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2738 ;; root home directory. On the other hand, using always
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2739 ;; the default user name for tilde expansion is not
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2740 ;; appropriate either, because ssh and companions might
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2741 ;; use a user name from the config file.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2742 (when (and (string-equal uname "~")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2743 (string-match "\\`su\\(do\\)?\\'" method))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2744 (setq uname (concat uname user)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2745 (setq uname
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2746 (with-connection-property v uname
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2747 (tramp-send-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2748 v (format "cd %s; pwd" (tramp-shell-quote-argument uname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2749 (with-current-buffer (tramp-get-buffer v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2750 (goto-char (point-min))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2751 (buffer-substring
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2752 (point) (tramp-compat-line-end-position)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2753 (setq localname (concat uname fname))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2754 ;; There might be a double slash, for example when "~/"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2755 ;; expands to "/". Remove this.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2756 (while (string-match "//" localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2757 (setq localname (replace-match "/" t t localname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2758 ;; No tilde characters in file name, do normal
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2759 ;; `expand-file-name' (this does "/./" and "/../"). We bind
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2760 ;; `directory-sep-char' here for XEmacs on Windows, which would
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2761 ;; otherwise use backslash. `default-directory' is bound,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2762 ;; because on Windows there would be problems with UNC shares or
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2763 ;; Cygwin mounts.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2764 (let ((directory-sep-char ?/)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2765 (default-directory (tramp-compat-temporary-file-directory)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2766 (tramp-make-tramp-file-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2767 method user host
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2768 (tramp-drop-volume-letter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2769 (tramp-run-real-handler
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2770 'expand-file-name (list localname))))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2771
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2772 (defun tramp-handle-substitute-in-file-name (filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2773 "Like `substitute-in-file-name' for Tramp files.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2774 \"//\" and \"/~\" substitute only in the local filename part.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2775 If the URL Tramp syntax is chosen, \"//\" as method delimeter and \"/~\" at
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2776 beginning of local filename are not substituted."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2777 ;; First, we must replace environment variables.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2778 (setq filename (tramp-replace-environment-variables filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2779 (with-parsed-tramp-file-name filename nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2780 (if (equal tramp-syntax 'url)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2781 ;; We need to check localname only. The other parts cannot contain
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2782 ;; "//" or "/~".
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2783 (if (and (> (length localname) 1)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2784 (or (string-match "//" localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2785 (string-match "/~" localname 1)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2786 (tramp-run-real-handler 'substitute-in-file-name (list filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2787 (tramp-make-tramp-file-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2788 (when method (substitute-in-file-name method))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2789 (when user (substitute-in-file-name user))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2790 (when host (substitute-in-file-name host))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2791 (when localname
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2792 (tramp-run-real-handler
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2793 'substitute-in-file-name (list localname)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2794 ;; Ignore in LOCALNAME everything before "//" or "/~".
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2795 (when (and (stringp localname) (string-match ".+?/\\(/\\|~\\)" localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2796 (setq filename
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2797 (concat (file-remote-p filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2798 (replace-match "\\1" nil nil localname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2799 ;; "/m:h:~" does not work for completion. We use "/m:h:~/".
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2800 (when (string-match "~$" filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2801 (setq filename (concat filename "/"))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2802 (tramp-run-real-handler 'substitute-in-file-name (list filename)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2803
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2804 ;;; Remote commands:
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2805
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2806 (defun tramp-handle-executable-find (command)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2807 "Like `executable-find' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2808 (with-parsed-tramp-file-name default-directory nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2809 (tramp-find-executable v command (tramp-get-remote-path v) t)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2810
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2811 (defun tramp-process-sentinel (proc event)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2812 "Flush file caches."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2813 (unless (memq (process-status proc) '(run open))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2814 (let ((vec (tramp-get-connection-property proc "vector" nil)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2815 (when vec
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2816 (tramp-message vec 5 "Sentinel called: `%s' `%s'" proc event)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2817 (tramp-flush-directory-property vec "")))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2818
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2819 ;; We use BUFFER also as connection buffer during setup. Because of
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2820 ;; this, its original contents must be saved, and restored once
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2821 ;; connection has been setup.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2822 (defun tramp-handle-start-file-process (name buffer program &rest args)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2823 "Like `start-file-process' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2824 (with-parsed-tramp-file-name default-directory nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2825 (unwind-protect
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2826 ;; When PROGRAM is nil, we just provide a tty.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2827 (let ((command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2828 (when (stringp program)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2829 (format "cd %s; exec %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2830 (tramp-shell-quote-argument localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2831 (mapconcat 'tramp-shell-quote-argument
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2832 (cons program args) " "))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2833 (tramp-process-connection-type
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2834 (or (null program) tramp-process-connection-type))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2835 (name1 name)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2836 (i 0))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2837 (unless buffer
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2838 ;; BUFFER can be nil. We use a temporary buffer.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2839 (setq buffer (generate-new-buffer tramp-temp-buffer-name)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2840 (while (get-process name1)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2841 ;; NAME must be unique as process name.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2842 (setq i (1+ i)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2843 name1 (format "%s<%d>" name i)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2844 (setq name name1)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2845 ;; Set the new process properties.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2846 (tramp-set-connection-property v "process-name" name)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2847 (tramp-set-connection-property v "process-buffer" buffer)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2848 ;; Activate narrowing in order to save BUFFER contents.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2849 ;; Clear also the modification time; otherwise we might be
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2850 ;; interrupted by `verify-visited-file-modtime'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2851 (with-current-buffer (tramp-get-connection-buffer v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2852 (clear-visited-file-modtime)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2853 (narrow-to-region (point-max) (point-max)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2854 (if command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2855 ;; Send the command.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2856 (tramp-send-command v command nil t) ; nooutput
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2857 ;; Check, whether a pty is associated.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2858 (tramp-maybe-open-connection v)
|
110374
|
2859 (unless (tramp-compat-process-get
|
|
2860 (tramp-get-connection-process v) 'remote-tty)
|
110321
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2861 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2862 v 'file-error "pty association is not supported for `%s'" name)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2863 (let ((p (tramp-get-connection-process v)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2864 ;; Set sentinel and query flag for this process.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2865 (tramp-set-connection-property p "vector" v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2866 (set-process-sentinel p 'tramp-process-sentinel)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2867 (tramp-set-process-query-on-exit-flag p t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2868 ;; Return process.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2869 p))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2870 ;; Save exit.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2871 (with-current-buffer (tramp-get-connection-buffer v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2872 (if (string-match tramp-temp-buffer-name (buffer-name))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2873 (progn
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2874 (set-process-buffer (tramp-get-connection-process v) nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2875 (kill-buffer (current-buffer)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2876 (widen)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2877 (goto-char (point-max))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2878 (tramp-set-connection-property v "process-name" nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2879 (tramp-set-connection-property v "process-buffer" nil))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2880
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2881 (defun tramp-handle-process-file
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2882 (program &optional infile destination display &rest args)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2883 "Like `process-file' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2884 ;; The implementation is not complete yet.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2885 (when (and (numberp destination) (zerop destination))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2886 (error "Implementation does not handle immediate return"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2887
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2888 (with-parsed-tramp-file-name default-directory nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2889 (let (command input tmpinput stderr tmpstderr outbuf ret)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2890 ;; Compute command.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2891 (setq command (mapconcat 'tramp-shell-quote-argument
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2892 (cons program args) " "))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2893 ;; Determine input.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2894 (if (null infile)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2895 (setq input "/dev/null")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2896 (setq infile (expand-file-name infile))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2897 (if (tramp-equal-remote default-directory infile)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2898 ;; INFILE is on the same remote host.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2899 (setq input (with-parsed-tramp-file-name infile nil localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2900 ;; INFILE must be copied to remote host.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2901 (setq input (tramp-make-tramp-temp-file v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2902 tmpinput (tramp-make-tramp-file-name method user host input))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2903 (copy-file infile tmpinput t)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2904 (when input (setq command (format "%s <%s" command input)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2905
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2906 ;; Determine output.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2907 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2908 ;; Just a buffer.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2909 ((bufferp destination)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2910 (setq outbuf destination))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2911 ;; A buffer name.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2912 ((stringp destination)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2913 (setq outbuf (get-buffer-create destination)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2914 ;; (REAL-DESTINATION ERROR-DESTINATION)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2915 ((consp destination)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2916 ;; output.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2917 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2918 ((bufferp (car destination))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2919 (setq outbuf (car destination)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2920 ((stringp (car destination))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2921 (setq outbuf (get-buffer-create (car destination))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2922 ((car destination)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2923 (setq outbuf (current-buffer))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2924 ;; stderr.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2925 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2926 ((stringp (cadr destination))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2927 (setcar (cdr destination) (expand-file-name (cadr destination)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2928 (if (tramp-equal-remote default-directory (cadr destination))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2929 ;; stderr is on the same remote host.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2930 (setq stderr (with-parsed-tramp-file-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2931 (cadr destination) nil localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2932 ;; stderr must be copied to remote host. The temporary
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2933 ;; file must be deleted after execution.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2934 (setq stderr (tramp-make-tramp-temp-file v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2935 tmpstderr (tramp-make-tramp-file-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2936 method user host stderr))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2937 ;; stderr to be discarded.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2938 ((null (cadr destination))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2939 (setq stderr "/dev/null"))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2940 ;; 't
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2941 (destination
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2942 (setq outbuf (current-buffer))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2943 (when stderr (setq command (format "%s 2>%s" command stderr)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2944
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2945 ;; Send the command. It might not return in time, so we protect
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2946 ;; it. Call it in a subshell, in order to preserve working
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2947 ;; directory.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2948 (condition-case nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2949 (unwind-protect
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2950 (setq ret
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2951 (if (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2952 v (format "\\cd %s; %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2953 (tramp-shell-quote-argument localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2954 command)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2955 t t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2956 0 1))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2957 ;; We should show the output anyway.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2958 (when outbuf
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2959 (with-current-buffer outbuf
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2960 (insert
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2961 (with-current-buffer (tramp-get-connection-buffer v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2962 (buffer-string))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2963 (when display (display-buffer outbuf))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2964 ;; When the user did interrupt, we should do it also. We use
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2965 ;; return code -1 as marker.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2966 (quit
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2967 (kill-buffer (tramp-get-connection-buffer v))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2968 (setq ret -1))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2969 ;; Handle errors.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2970 (error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2971 (kill-buffer (tramp-get-connection-buffer v))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2972 (setq ret 1)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2973
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2974 ;; Provide error file.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2975 (when tmpstderr (rename-file tmpstderr (cadr destination) t))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2976
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2977 ;; Cleanup. We remove all file cache values for the connection,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2978 ;; because the remote process could have changed them.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2979 (when tmpinput (delete-file tmpinput))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2980
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2981 ;; `process-file-side-effects' has been introduced with GNU
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2982 ;; Emacs 23.2. If set to `nil', no remote file will be changed
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2983 ;; by `program'. If it doesn't exist, we assume its default
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2984 ;; value 't'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2985 (unless (and (boundp 'process-file-side-effects)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2986 (not (symbol-value 'process-file-side-effects)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2987 (tramp-flush-directory-property v ""))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2988
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2989 ;; Return exit status.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2990 (if (equal ret -1)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2991 (keyboard-quit)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2992 ret))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2993
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2994 (defun tramp-handle-call-process-region
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2995 (start end program &optional delete buffer display &rest args)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2996 "Like `call-process-region' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2997 (let ((tmpfile (tramp-compat-make-temp-file "")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2998 (write-region start end tmpfile)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
2999 (when delete (delete-region start end))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3000 (unwind-protect
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3001 (apply 'call-process program tmpfile buffer display args)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3002 (delete-file tmpfile))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3003
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3004 (defun tramp-handle-shell-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3005 (command &optional output-buffer error-buffer)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3006 "Like `shell-command' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3007 (let* ((asynchronous (string-match "[ \t]*&[ \t]*\\'" command))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3008 ;; We cannot use `shell-file-name' and `shell-command-switch',
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3009 ;; they are variables of the local host.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3010 (args (list
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3011 (tramp-get-method-parameter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3012 (tramp-file-name-method
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3013 (tramp-dissect-file-name default-directory))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3014 'tramp-remote-sh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3015 "-c" (substring command 0 asynchronous)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3016 current-buffer-p
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3017 (output-buffer
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3018 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3019 ((bufferp output-buffer) output-buffer)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3020 ((stringp output-buffer) (get-buffer-create output-buffer))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3021 (output-buffer
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3022 (setq current-buffer-p t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3023 (current-buffer))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3024 (t (get-buffer-create
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3025 (if asynchronous
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3026 "*Async Shell Command*"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3027 "*Shell Command Output*")))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3028 (error-buffer
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3029 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3030 ((bufferp error-buffer) error-buffer)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3031 ((stringp error-buffer) (get-buffer-create error-buffer))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3032 (buffer
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3033 (if (and (not asynchronous) error-buffer)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3034 (with-parsed-tramp-file-name default-directory nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3035 (list output-buffer (tramp-make-tramp-temp-file v)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3036 output-buffer))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3037 (p (get-buffer-process output-buffer)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3038
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3039 ;; Check whether there is another process running. Tramp does not
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3040 ;; support 2 (asynchronous) processes in parallel.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3041 (when p
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3042 (if (yes-or-no-p "A command is running. Kill it? ")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3043 (ignore-errors (kill-process p))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3044 (error "Shell command in progress")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3045
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3046 (if current-buffer-p
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3047 (progn
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3048 (barf-if-buffer-read-only)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3049 (push-mark nil t))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3050 (with-current-buffer output-buffer
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3051 (setq buffer-read-only nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3052 (erase-buffer)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3053
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3054 (if (and (not current-buffer-p) (integerp asynchronous))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3055 (prog1
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3056 ;; Run the process.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3057 (apply 'start-file-process "*Async Shell*" buffer args)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3058 ;; Display output.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3059 (pop-to-buffer output-buffer)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3060 (setq mode-line-process '(":%s"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3061 (shell-mode))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3062
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3063 (prog1
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3064 ;; Run the process.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3065 (apply 'process-file (car args) nil buffer nil (cdr args))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3066 ;; Insert error messages if they were separated.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3067 (when (listp buffer)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3068 (with-current-buffer error-buffer
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3069 (insert-file-contents (cadr buffer)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3070 (delete-file (cadr buffer)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3071 (if current-buffer-p
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3072 ;; This is like exchange-point-and-mark, but doesn't
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3073 ;; activate the mark. It is cleaner to avoid activation,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3074 ;; even though the command loop would deactivate the mark
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3075 ;; because we inserted text.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3076 (goto-char (prog1 (mark t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3077 (set-marker (mark-marker) (point)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3078 (current-buffer))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3079 ;; There's some output, display it.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3080 (when (with-current-buffer output-buffer (> (point-max) (point-min)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3081 (if (functionp 'display-message-or-buffer)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3082 (tramp-compat-funcall 'display-message-or-buffer output-buffer)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3083 (pop-to-buffer output-buffer))))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3084
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3085 (defun tramp-handle-file-local-copy (filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3086 "Like `file-local-copy' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3087
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3088 (with-parsed-tramp-file-name filename nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3089 (unless (file-exists-p filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3090 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3091 v 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3092 "Cannot make local copy of non-existing file `%s'" filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3093
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3094 (let* ((size (nth 7 (file-attributes filename)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3095 (rem-enc (tramp-get-inline-coding v "remote-encoding" size))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3096 (loc-dec (tramp-get-inline-coding v "local-decoding" size))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3097 (tmpfile (tramp-compat-make-temp-file filename)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3098
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3099 (condition-case err
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3100 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3101 ;; `copy-file' handles direct copy and out-of-band methods.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3102 ((or (tramp-local-host-p v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3103 (tramp-method-out-of-band-p v size))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3104 (copy-file filename tmpfile t t))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3105
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3106 ;; Use inline encoding for file transfer.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3107 (rem-enc
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3108 (save-excursion
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3109 (with-progress-reporter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3110 v 3 (format "Encoding remote file %s" filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3111 (tramp-barf-unless-okay
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3112 v (format rem-enc (tramp-shell-quote-argument localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3113 "Encoding remote file failed"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3114
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3115 (if (functionp loc-dec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3116 ;; If local decoding is a function, we call it. We
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3117 ;; must disable multibyte, because
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3118 ;; `uudecode-decode-region' doesn't handle it
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3119 ;; correctly.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3120 (with-temp-buffer
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3121 (set-buffer-multibyte nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3122 (insert-buffer-substring (tramp-get-buffer v))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3123 (with-progress-reporter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3124 v 3 (format "Decoding remote file %s with function %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3125 filename loc-dec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3126 (funcall loc-dec (point-min) (point-max))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3127 ;; Unset `file-name-handler-alist'. Otherwise,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3128 ;; epa-file gets confused.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3129 (let (file-name-handler-alist
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3130 (coding-system-for-write 'binary))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3131 (write-region (point-min) (point-max) tmpfile))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3132
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3133 ;; If tramp-decoding-function is not defined for this
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3134 ;; method, we invoke tramp-decoding-command instead.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3135 (let ((tmpfile2 (tramp-compat-make-temp-file filename)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3136 ;; Unset `file-name-handler-alist'. Otherwise,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3137 ;; epa-file gets confused.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3138 (let (file-name-handler-alist
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3139 (coding-system-for-write 'binary))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3140 (write-region (point-min) (point-max) tmpfile2))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3141 (with-progress-reporter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3142 v 3 (format "Decoding remote file %s with command %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3143 filename loc-dec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3144 (unwind-protect
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3145 (tramp-call-local-coding-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3146 loc-dec tmpfile2 tmpfile)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3147 (delete-file tmpfile2)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3148
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3149 ;; Set proper permissions.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3150 (set-file-modes tmpfile (tramp-default-file-modes filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3151 ;; Set local user ownership.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3152 (tramp-set-file-uid-gid tmpfile)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3153
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3154 ;; Oops, I don't know what to do.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3155 (t (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3156 v 'file-error "Wrong method specification for `%s'" method)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3157
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3158 ;; Error handling.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3159 ((error quit)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3160 (delete-file tmpfile)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3161 (signal (car err) (cdr err))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3162
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3163 (run-hooks 'tramp-handle-file-local-copy-hook)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3164 tmpfile)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3165
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3166 (defun tramp-handle-file-remote-p (filename &optional identification connected)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3167 "Like `file-remote-p' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3168 (let ((tramp-verbose 3))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3169 (when (tramp-tramp-file-p filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3170 (let* ((v (tramp-dissect-file-name filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3171 (p (tramp-get-connection-process v))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3172 (c (and p (processp p) (memq (process-status p) '(run open)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3173 ;; We expand the file name only, if there is already a connection.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3174 (with-parsed-tramp-file-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3175 (if c (expand-file-name filename) filename) nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3176 (and (or (not connected) c)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3177 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3178 ((eq identification 'method) method)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3179 ((eq identification 'user) user)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3180 ((eq identification 'host) host)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3181 ((eq identification 'localname) localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3182 (t (tramp-make-tramp-file-name method user host "")))))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3183
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3184 (defun tramp-handle-insert-file-contents
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3185 (filename &optional visit beg end replace)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3186 "Like `insert-file-contents' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3187 (barf-if-buffer-read-only)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3188 (setq filename (expand-file-name filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3189 (let (result local-copy remote-copy)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3190 (with-parsed-tramp-file-name filename nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3191 (unwind-protect
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3192 (if (not (file-exists-p filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3193 ;; We don't raise a Tramp error, because it might be
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3194 ;; suppressed, like in `find-file-noselect-1'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3195 (signal 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3196 (list "File not found on remote host" filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3197
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3198 (if (and (tramp-local-host-p v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3199 (let (file-name-handler-alist)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3200 (file-readable-p localname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3201 ;; Short track: if we are on the local host, we can
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3202 ;; run directly.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3203 (setq result
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3204 (tramp-run-real-handler
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3205 'insert-file-contents
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3206 (list localname visit beg end replace)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3207
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3208 ;; When we shall insert only a part of the file, we copy
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3209 ;; this part.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3210 (when (or beg end)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3211 (setq remote-copy (tramp-make-tramp-temp-file v))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3212 (tramp-send-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3213 v
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3214 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3215 ((and beg end)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3216 (format "tail -c +%d %s | head -c +%d >%s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3217 (1+ beg) (tramp-shell-quote-argument localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3218 (- end beg) remote-copy))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3219 (beg
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3220 (format "tail -c +%d %s >%s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3221 (1+ beg) (tramp-shell-quote-argument localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3222 remote-copy))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3223 (end
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3224 (format "head -c +%d %s >%s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3225 (1+ end) (tramp-shell-quote-argument localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3226 remote-copy)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3227
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3228 ;; `insert-file-contents-literally' takes care to avoid
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3229 ;; calling jka-compr. By let-binding
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3230 ;; `inhibit-file-name-operation', we propagate that care
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3231 ;; to the `file-local-copy' operation.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3232 (setq local-copy
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3233 (let ((inhibit-file-name-operation
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3234 (when (eq inhibit-file-name-operation
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3235 'insert-file-contents)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3236 'file-local-copy)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3237 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3238 ((stringp remote-copy)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3239 (file-local-copy
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3240 (tramp-make-tramp-file-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3241 method user host remote-copy)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3242 ((stringp tramp-temp-buffer-file-name)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3243 (copy-file filename tramp-temp-buffer-file-name 'ok)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3244 tramp-temp-buffer-file-name)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3245 (t (file-local-copy filename)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3246
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3247 ;; When the file is not readable for the owner, it
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3248 ;; cannot be inserted, even it is redable for the group
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3249 ;; or for everybody.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3250 (set-file-modes local-copy (tramp-compat-octal-to-decimal "0600"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3251
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3252 (when (and (null remote-copy)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3253 (tramp-get-method-parameter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3254 method 'tramp-copy-keep-tmpfile))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3255 ;; We keep the local file for performance reasons,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3256 ;; useful for "rsync".
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3257 (setq tramp-temp-buffer-file-name local-copy)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3258 (put 'tramp-temp-buffer-file-name 'permanent-local t))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3259
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3260 (with-progress-reporter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3261 v 3 (format "Inserting local temp file `%s'" local-copy)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3262 ;; We must ensure that `file-coding-system-alist'
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3263 ;; matches `local-copy'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3264 (let ((file-coding-system-alist
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3265 (tramp-find-file-name-coding-system-alist
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3266 filename local-copy)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3267 (setq result
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3268 (insert-file-contents
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3269 local-copy nil nil nil replace))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3270
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3271 ;; Save exit.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3272 (progn
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3273 (when visit
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3274 (setq buffer-file-name filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3275 (setq buffer-read-only (not (file-writable-p filename)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3276 (set-visited-file-modtime)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3277 (set-buffer-modified-p nil))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3278 (when (and (stringp local-copy)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3279 (or remote-copy (null tramp-temp-buffer-file-name)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3280 (delete-file local-copy))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3281 (when (stringp remote-copy)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3282 (delete-file
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3283 (tramp-make-tramp-file-name method user host remote-copy))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3284
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3285 ;; Result.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3286 (list (expand-file-name filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3287 (cadr result))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3288
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3289 ;; This is needed for XEmacs only. Code stolen from files.el.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3290 (defun tramp-handle-insert-file-contents-literally
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3291 (filename &optional visit beg end replace)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3292 "Like `insert-file-contents-literally' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3293 (let ((format-alist nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3294 (after-insert-file-functions nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3295 (coding-system-for-read 'no-conversion)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3296 (coding-system-for-write 'no-conversion)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3297 (find-buffer-file-type-function
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3298 (if (fboundp 'find-buffer-file-type)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3299 (symbol-function 'find-buffer-file-type)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3300 nil))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3301 (inhibit-file-name-handlers '(jka-compr-handler image-file-handler))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3302 (inhibit-file-name-operation 'insert-file-contents))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3303 (unwind-protect
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3304 (progn
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3305 (fset 'find-buffer-file-type (lambda (filename) t))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3306 (insert-file-contents filename visit beg end replace))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3307 ;; Save exit.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3308 (if find-buffer-file-type-function
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3309 (fset 'find-buffer-file-type find-buffer-file-type-function)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3310 (fmakunbound 'find-buffer-file-type)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3311
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3312 (defun tramp-handle-find-backup-file-name (filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3313 "Like `find-backup-file-name' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3314 (with-parsed-tramp-file-name filename nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3315 ;; We set both variables. It doesn't matter whether it is
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3316 ;; Emacs or XEmacs.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3317 (let ((backup-directory-alist
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3318 ;; Emacs case.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3319 (when (boundp 'backup-directory-alist)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3320 (if (symbol-value 'tramp-backup-directory-alist)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3321 (mapcar
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3322 (lambda (x)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3323 (cons
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3324 (car x)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3325 (if (and (stringp (cdr x))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3326 (file-name-absolute-p (cdr x))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3327 (not (tramp-file-name-p (cdr x))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3328 (tramp-make-tramp-file-name method user host (cdr x))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3329 (cdr x))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3330 (symbol-value 'tramp-backup-directory-alist))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3331 (symbol-value 'backup-directory-alist))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3332
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3333 (bkup-backup-directory-info
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3334 ;; XEmacs case.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3335 (when (boundp 'bkup-backup-directory-info)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3336 (if (symbol-value 'tramp-bkup-backup-directory-info)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3337 (mapcar
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3338 (lambda (x)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3339 (nconc
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3340 (list (car x))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3341 (list
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3342 (if (and (stringp (car (cdr x)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3343 (file-name-absolute-p (car (cdr x)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3344 (not (tramp-file-name-p (car (cdr x)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3345 (tramp-make-tramp-file-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3346 method user host (car (cdr x)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3347 (car (cdr x))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3348 (cdr (cdr x))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3349 (symbol-value 'tramp-bkup-backup-directory-info))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3350 (symbol-value 'bkup-backup-directory-info)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3351
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3352 (tramp-run-real-handler 'find-backup-file-name (list filename)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3353
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3354 (defun tramp-handle-make-auto-save-file-name ()
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3355 "Like `make-auto-save-file-name' for Tramp files.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3356 Returns a file name in `tramp-auto-save-directory' for autosaving this file."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3357 (let ((tramp-auto-save-directory tramp-auto-save-directory)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3358 (buffer-file-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3359 (tramp-subst-strs-in-string
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3360 '(("_" . "|")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3361 ("/" . "_a")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3362 (":" . "_b")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3363 ("|" . "__")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3364 ("[" . "_l")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3365 ("]" . "_r"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3366 (buffer-file-name))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3367 ;; File name must be unique. This is ensured with Emacs 22 (see
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3368 ;; UNIQUIFY element of `auto-save-file-name-transforms'); but for
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3369 ;; all other cases we must do it ourselves.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3370 (when (boundp 'auto-save-file-name-transforms)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3371 (mapc
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3372 (lambda (x)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3373 (when (and (string-match (car x) buffer-file-name)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3374 (not (car (cddr x))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3375 (setq tramp-auto-save-directory
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3376 (or tramp-auto-save-directory
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3377 (tramp-compat-temporary-file-directory)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3378 (symbol-value 'auto-save-file-name-transforms)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3379 ;; Create directory.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3380 (when tramp-auto-save-directory
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3381 (setq buffer-file-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3382 (expand-file-name buffer-file-name tramp-auto-save-directory))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3383 (unless (file-exists-p tramp-auto-save-directory)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3384 (make-directory tramp-auto-save-directory t)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3385 ;; Run plain `make-auto-save-file-name'. There might be an advice when
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3386 ;; it is not a magic file name operation (since Emacs 22).
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3387 ;; We must deactivate it temporarily.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3388 (if (not (ad-is-active 'make-auto-save-file-name))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3389 (tramp-run-real-handler 'make-auto-save-file-name nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3390 ;; else
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3391 (ad-deactivate 'make-auto-save-file-name)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3392 (prog1
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3393 (tramp-run-real-handler 'make-auto-save-file-name nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3394 (ad-activate 'make-auto-save-file-name)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3395
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3396 (defvar tramp-handle-write-region-hook nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3397 "Normal hook to be run at the end of `tramp-handle-write-region'.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3398
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3399 ;; CCC grok LOCKNAME
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3400 (defun tramp-handle-write-region
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3401 (start end filename &optional append visit lockname confirm)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3402 "Like `write-region' for Tramp files."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3403 (setq filename (expand-file-name filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3404 (with-parsed-tramp-file-name filename nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3405 ;; Following part commented out because we don't know what to do about
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3406 ;; file locking, and it does not appear to be a problem to ignore it.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3407 ;; Ange-ftp ignores it, too.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3408 ;; (when (and lockname (stringp lockname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3409 ;; (setq lockname (expand-file-name lockname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3410 ;; (unless (or (eq lockname nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3411 ;; (string= lockname filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3412 ;; (error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3413 ;; "tramp-handle-write-region: LOCKNAME must be nil or equal FILENAME"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3414
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3415 ;; XEmacs takes a coding system as the seventh argument, not `confirm'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3416 (when (and (not (featurep 'xemacs)) confirm (file-exists-p filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3417 (unless (y-or-n-p (format "File %s exists; overwrite anyway? " filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3418 (tramp-error v 'file-error "File not overwritten")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3419
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3420 (let ((uid (or (nth 2 (tramp-compat-file-attributes filename 'integer))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3421 (tramp-get-remote-uid v 'integer)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3422 (gid (or (nth 3 (tramp-compat-file-attributes filename 'integer))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3423 (tramp-get-remote-gid v 'integer))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3424
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3425 (if (and (tramp-local-host-p v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3426 ;; `file-writable-p' calls `file-expand-file-name'. We
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3427 ;; cannot use `tramp-run-real-handler' therefore.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3428 (let (file-name-handler-alist)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3429 (and
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3430 (file-writable-p (file-name-directory localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3431 (or (file-directory-p localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3432 (file-writable-p localname)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3433 ;; Short track: if we are on the local host, we can run directly.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3434 (tramp-run-real-handler
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3435 'write-region
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3436 (list start end localname append 'no-message lockname confirm))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3437
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3438 (let ((modes (save-excursion (tramp-default-file-modes filename)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3439 ;; We use this to save the value of
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3440 ;; `last-coding-system-used' after writing the tmp
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3441 ;; file. At the end of the function, we set
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3442 ;; `last-coding-system-used' to this saved value. This
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3443 ;; way, any intermediary coding systems used while
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3444 ;; talking to the remote shell or suchlike won't hose
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3445 ;; this variable. This approach was snarfed from
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3446 ;; ange-ftp.el.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3447 coding-system-used
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3448 ;; Write region into a tmp file. This isn't really
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3449 ;; needed if we use an encoding function, but currently
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3450 ;; we use it always because this makes the logic
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3451 ;; simpler.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3452 (tmpfile (or tramp-temp-buffer-file-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3453 (tramp-compat-make-temp-file filename))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3454
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3455 ;; If `append' is non-nil, we copy the file locally, and let
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3456 ;; the native `write-region' implementation do the job.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3457 (when append (copy-file filename tmpfile 'ok))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3458
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3459 ;; We say `no-message' here because we don't want the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3460 ;; visited file modtime data to be clobbered from the temp
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3461 ;; file. We call `set-visited-file-modtime' ourselves later
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3462 ;; on. We must ensure that `file-coding-system-alist'
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3463 ;; matches `tmpfile'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3464 (let (file-name-handler-alist
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3465 (file-coding-system-alist
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3466 (tramp-find-file-name-coding-system-alist filename tmpfile)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3467 (condition-case err
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3468 (tramp-run-real-handler
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3469 'write-region
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3470 (list start end tmpfile append 'no-message lockname confirm))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3471 ((error quit)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3472 (setq tramp-temp-buffer-file-name nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3473 (delete-file tmpfile)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3474 (signal (car err) (cdr err))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3475
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3476 ;; Now, `last-coding-system-used' has the right value. Remember it.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3477 (when (boundp 'last-coding-system-used)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3478 (setq coding-system-used
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3479 (symbol-value 'last-coding-system-used))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3480
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3481 ;; The permissions of the temporary file should be set. If
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3482 ;; filename does not exist (eq modes nil) it has been
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3483 ;; renamed to the backup file. This case `save-buffer'
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3484 ;; handles permissions.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3485 ;; Ensure, that it is still readable.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3486 (when modes
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3487 (set-file-modes
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3488 tmpfile
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3489 (logior (or modes 0) (tramp-compat-octal-to-decimal "0400"))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3490
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3491 ;; This is a bit lengthy due to the different methods
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3492 ;; possible for file transfer. First, we check whether the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3493 ;; method uses an rcp program. If so, we call it.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3494 ;; Otherwise, both encoding and decoding command must be
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3495 ;; specified. However, if the method _also_ specifies an
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3496 ;; encoding function, then that is used for encoding the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3497 ;; contents of the tmp file.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3498 (let* ((size (nth 7 (file-attributes tmpfile)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3499 (rem-dec (tramp-get-inline-coding v "remote-decoding" size))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3500 (loc-enc (tramp-get-inline-coding v "local-encoding" size)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3501 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3502 ;; `copy-file' handles direct copy and out-of-band methods.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3503 ((or (tramp-local-host-p v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3504 (tramp-method-out-of-band-p v size))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3505 (if (and (not (stringp start))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3506 (= (or end (point-max)) (point-max))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3507 (= (or start (point-min)) (point-min))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3508 (tramp-get-method-parameter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3509 method 'tramp-copy-keep-tmpfile))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3510 (progn
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3511 (setq tramp-temp-buffer-file-name tmpfile)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3512 (condition-case err
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3513 ;; We keep the local file for performance
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3514 ;; reasons, useful for "rsync".
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3515 (copy-file tmpfile filename t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3516 ((error quit)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3517 (setq tramp-temp-buffer-file-name nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3518 (delete-file tmpfile)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3519 (signal (car err) (cdr err)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3520 (setq tramp-temp-buffer-file-name nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3521 ;; Don't rename, in order to keep context in SELinux.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3522 (unwind-protect
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3523 (copy-file tmpfile filename t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3524 (delete-file tmpfile))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3525
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3526 ;; Use inline file transfer.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3527 (rem-dec
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3528 ;; Encode tmpfile.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3529 (unwind-protect
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3530 (with-temp-buffer
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3531 (set-buffer-multibyte nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3532 ;; Use encoding function or command.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3533 (if (functionp loc-enc)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3534 (with-progress-reporter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3535 v 3 (format "Encoding region using function `%s'"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3536 loc-enc)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3537 (let ((coding-system-for-read 'binary))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3538 (insert-file-contents-literally tmpfile))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3539 ;; The following `let' is a workaround for the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3540 ;; base64.el that comes with pgnus-0.84. If
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3541 ;; both of the following conditions are
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3542 ;; satisfied, it tries to write to a local
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3543 ;; file in default-directory, but at this
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3544 ;; point, default-directory is remote.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3545 ;; (`call-process-region' can't write to
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3546 ;; remote files, it seems.) The file in
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3547 ;; question is a tmp file anyway.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3548 (let ((default-directory
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3549 (tramp-compat-temporary-file-directory)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3550 (funcall loc-enc (point-min) (point-max))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3551
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3552 (with-progress-reporter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3553 v 3 (format "Encoding region using command `%s'"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3554 loc-enc)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3555 (unless (zerop (tramp-call-local-coding-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3556 loc-enc tmpfile t))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3557 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3558 v 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3559 (concat "Cannot write to `%s', "
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3560 "local encoding command `%s' failed")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3561 filename loc-enc))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3562
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3563 ;; Send buffer into remote decoding command which
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3564 ;; writes to remote file. Because this happens on
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3565 ;; the remote host, we cannot use the function.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3566 (with-progress-reporter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3567 v 3
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3568 (format "Decoding region into remote file %s" filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3569 (goto-char (point-max))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3570 (unless (bolp) (newline))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3571 (tramp-send-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3572 v
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3573 (format
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3574 (concat rem-dec " <<'EOF'\n%sEOF")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3575 (tramp-shell-quote-argument localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3576 (buffer-string)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3577 (tramp-barf-unless-okay
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3578 v nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3579 "Couldn't write region to `%s', decode using `%s' failed"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3580 filename rem-dec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3581 ;; When `file-precious-flag' is set, the region is
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3582 ;; written to a temporary file. Check that the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3583 ;; checksum is equal to that from the local tmpfile.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3584 (when file-precious-flag
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3585 (erase-buffer)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3586 (and
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3587 ;; cksum runs locally, if possible.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3588 (zerop (tramp-compat-call-process "cksum" tmpfile t))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3589 ;; cksum runs remotely.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3590 (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3591 v
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3592 (format
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3593 "cksum <%s" (tramp-shell-quote-argument localname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3594 ;; ... they are different.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3595 (not
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3596 (string-equal
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3597 (buffer-string)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3598 (with-current-buffer (tramp-get-buffer v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3599 (buffer-string))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3600 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3601 v 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3602 (concat "Couldn't write region to `%s',"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3603 " decode using `%s' failed")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3604 filename rem-dec)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3605
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3606 ;; Save exit.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3607 (delete-file tmpfile)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3608
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3609 ;; That's not expected.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3610 (t
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3611 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3612 v 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3613 (concat "Method `%s' should specify both encoding and "
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3614 "decoding command or an rcp program")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3615 method))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3616
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3617 ;; Make `last-coding-system-used' have the right value.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3618 (when coding-system-used
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3619 (set 'last-coding-system-used coding-system-used))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3620
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3621 (tramp-flush-file-property v (file-name-directory localname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3622 (tramp-flush-file-property v localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3623
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3624 ;; We must protect `last-coding-system-used', now we have set it
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3625 ;; to its correct value.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3626 (let (last-coding-system-used (need-chown t))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3627 ;; Set file modification time.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3628 (when (or (eq visit t) (stringp visit))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3629 (let ((file-attr (file-attributes filename)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3630 (set-visited-file-modtime
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3631 ;; We must pass modtime explicitely, because filename can
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3632 ;; be different from (buffer-file-name), f.e. if
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3633 ;; `file-precious-flag' is set.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3634 (nth 5 file-attr))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3635 (when (and (eq (nth 2 file-attr) uid)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3636 (eq (nth 3 file-attr) gid))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3637 (setq need-chown nil))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3638
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3639 ;; Set the ownership.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3640 (when need-chown
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3641 (tramp-set-file-uid-gid filename uid gid))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3642 (when (or (eq visit t) (null visit) (stringp visit))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3643 (tramp-message v 0 "Wrote %s" filename))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3644 (run-hooks 'tramp-handle-write-region-hook)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3645
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3646 (defvar tramp-vc-registered-file-names nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3647 "List used to collect file names, which are checked during `vc-registered'.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3648
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3649 ;; VC backends check for the existence of various different special
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3650 ;; files. This is very time consuming, because every single check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3651 ;; requires a remote command (the file cache must be invalidated).
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3652 ;; Therefore, we apply a kind of optimization. We install the file
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3653 ;; name handler `tramp-vc-file-name-handler', which does nothing but
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3654 ;; remembers all file names for which `file-exists-p' or
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3655 ;; `file-readable-p' has been applied. A first run of `vc-registered'
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3656 ;; is performed. Afterwards, a script is applied for all collected
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3657 ;; file names, using just one remote command. The result of this
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3658 ;; script is used to fill the file cache with actual values. Now we
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3659 ;; can reset the file name handlers, and we make a second run of
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3660 ;; `vc-registered', which returns the expected result without sending
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3661 ;; any other remote command.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3662 (defun tramp-handle-vc-registered (file)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3663 "Like `vc-registered' for Tramp files."
|
110374
|
3664 (tramp-compat-with-temp-message ""
|
110321
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3665 (with-parsed-tramp-file-name file nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3666 (with-progress-reporter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3667 v 3 (format "Checking `vc-registered' for %s" file)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3668
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3669 ;; There could be new files, created by the vc backend. We
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3670 ;; cannot reuse the old cache entries, therefore.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3671 (let (tramp-vc-registered-file-names
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3672 (tramp-cache-inhibit-cache (current-time))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3673 (file-name-handler-alist
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3674 `((,tramp-file-name-regexp . tramp-vc-file-name-handler))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3675
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3676 ;; Here we collect only file names, which need an operation.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3677 (tramp-run-real-handler 'vc-registered (list file))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3678 (tramp-message v 10 "\n%s" tramp-vc-registered-file-names)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3679
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3680 ;; Send just one command, in order to fill the cache.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3681 (when tramp-vc-registered-file-names
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3682 (tramp-maybe-send-script
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3683 v
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3684 (format tramp-vc-registered-read-file-names
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3685 (tramp-get-file-exists-command v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3686 (format "%s -r" (tramp-get-test-command v)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3687 "tramp_vc_registered_read_file_names")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3688
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3689 (dolist
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3690 (elt
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3691 (tramp-send-command-and-read
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3692 v
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3693 (format
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3694 "tramp_vc_registered_read_file_names <<'EOF'\n%s\nEOF\n"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3695 (mapconcat 'tramp-shell-quote-argument
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3696 tramp-vc-registered-file-names
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3697 "\n"))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3698
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3699 (tramp-set-file-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3700 v (car elt) (cadr elt) (cadr (cdr elt))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3701
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3702 ;; Second run. Now all `file-exists-p' or `file-readable-p'
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3703 ;; calls shall be answered from the file cache. We unset
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3704 ;; `process-file-side-effects' in order to keep the cache when
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3705 ;; `process-file' calls appear.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3706 (let (process-file-side-effects)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3707 (tramp-run-real-handler 'vc-registered (list file)))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3708
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3709 ;;;###tramp-autoload
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3710 (defun tramp-sh-file-name-handler (operation &rest args)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3711 "Invoke remote-shell Tramp file name handler.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3712 Fall back to normal file name handler if no Tramp handler exists."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3713 (when (and tramp-locked (not tramp-locker))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3714 (setq tramp-locked nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3715 (signal 'file-error (list "Forbidden reentrant call of Tramp")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3716 (let ((tl tramp-locked))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3717 (unwind-protect
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3718 (progn
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3719 (setq tramp-locked t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3720 (let ((tramp-locker t))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3721 (save-match-data
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3722 (let ((fn (assoc operation tramp-sh-file-name-handler-alist)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3723 (if fn
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3724 (apply (cdr fn) args)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3725 (tramp-run-real-handler operation args))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3726 (setq tramp-locked tl))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3727
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3728 (defun tramp-vc-file-name-handler (operation &rest args)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3729 "Invoke special file name handler, which collects files to be handled."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3730 (save-match-data
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3731 (let ((filename
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3732 (tramp-replace-environment-variables
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3733 (apply 'tramp-file-name-for-operation operation args)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3734 (fn (assoc operation tramp-sh-file-name-handler-alist)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3735 (with-parsed-tramp-file-name filename nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3736 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3737 ;; That's what we want: file names, for which checks are
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3738 ;; applied. We assume, that VC uses only `file-exists-p' and
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3739 ;; `file-readable-p' checks; otherwise we must extend the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3740 ;; list. We do not perform any action, but return nil, in
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3741 ;; order to keep `vc-registered' running.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3742 ((and fn (memq operation '(file-exists-p file-readable-p)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3743 (add-to-list 'tramp-vc-registered-file-names localname 'append)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3744 nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3745 ;; Tramp file name handlers like `expand-file-name'. They
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3746 ;; must still work.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3747 (fn
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3748 (save-match-data (apply (cdr fn) args)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3749 ;; Default file name handlers, we don't care.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3750 (t (tramp-run-real-handler operation args)))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3751
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3752 ;;; Internal Functions:
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3753
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3754 (defun tramp-maybe-send-script (vec script name)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3755 "Define in remote shell function NAME implemented as SCRIPT.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3756 Only send the definition if it has not already been done."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3757 (let* ((p (tramp-get-connection-process vec))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3758 (scripts (tramp-get-connection-property p "scripts" nil)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3759 (unless (member name scripts)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3760 (with-progress-reporter vec 5 (format "Sending script `%s'" name)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3761 ;; The script could contain a call of Perl. This is masked with `%s'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3762 (tramp-barf-unless-okay
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3763 vec
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3764 (format "%s () {\n%s\n}" name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3765 (format script (tramp-get-remote-perl vec)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3766 "Script %s sending failed" name)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3767 (tramp-set-connection-property p "scripts" (cons name scripts))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3768
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3769 (defun tramp-set-auto-save ()
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3770 (when (and ;; ange-ftp has its own auto-save mechanism
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3771 (eq (tramp-find-foreign-file-name-handler (buffer-file-name))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3772 'tramp-sh-file-name-handler)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3773 auto-save-default)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3774 (auto-save-mode 1)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3775 (add-hook 'find-file-hooks 'tramp-set-auto-save t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3776 (add-hook 'tramp-unload-hook
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3777 (lambda ()
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3778 (remove-hook 'find-file-hooks 'tramp-set-auto-save)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3779
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3780 (defun tramp-run-test (switch filename)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3781 "Run `test' on the remote system, given a SWITCH and a FILENAME.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3782 Returns the exit code of the `test' program."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3783 (with-parsed-tramp-file-name filename nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3784 (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3785 v
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3786 (format
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3787 "%s %s %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3788 (tramp-get-test-command v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3789 switch
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3790 (tramp-shell-quote-argument localname)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3791
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3792 (defun tramp-run-test2 (format-string file1 file2)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3793 "Run `test'-like program on the remote system, given FILE1, FILE2.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3794 FORMAT-STRING contains the program name, switches, and place holders.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3795 Returns the exit code of the `test' program. Barfs if the methods,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3796 hosts, or files, disagree."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3797 (unless (tramp-equal-remote file1 file2)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3798 (with-parsed-tramp-file-name (if (tramp-tramp-file-p file1) file1 file2) nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3799 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3800 v 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3801 "tramp-run-test2 only implemented for same method, user, host")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3802 (with-parsed-tramp-file-name file1 v1
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3803 (with-parsed-tramp-file-name file1 v2
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3804 (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3805 v1
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3806 (format format-string
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3807 (tramp-shell-quote-argument v1-localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3808 (tramp-shell-quote-argument v2-localname))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3809
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3810 (defun tramp-find-executable
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3811 (vec progname dirlist &optional ignore-tilde ignore-path)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3812 "Searches for PROGNAME in $PATH and all directories mentioned in DIRLIST.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3813 First arg VEC specifies the connection, PROGNAME is the program
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3814 to search for, and DIRLIST gives the list of directories to
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3815 search. If IGNORE-TILDE is non-nil, directory names starting
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3816 with `~' will be ignored. If IGNORE-PATH is non-nil, searches
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3817 only in DIRLIST.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3818
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3819 Returns the absolute file name of PROGNAME, if found, and nil otherwise.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3820
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3821 This function expects to be in the right *tramp* buffer."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3822 (with-current-buffer (tramp-get-connection-buffer vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3823 (let (result)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3824 ;; Check whether the executable is in $PATH. "which(1)" does not
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3825 ;; report always a correct error code; therefore we check the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3826 ;; number of words it returns.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3827 (unless ignore-path
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3828 (tramp-send-command vec (format "which \\%s | wc -w" progname))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3829 (goto-char (point-min))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3830 (if (looking-at "^\\s-*1$")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3831 (setq result (concat "\\" progname))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3832 (unless result
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3833 (when ignore-tilde
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3834 ;; Remove all ~/foo directories from dirlist. In XEmacs,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3835 ;; `remove' is in CL, and we want to avoid CL dependencies.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3836 (let (newdl d)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3837 (while dirlist
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3838 (setq d (car dirlist))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3839 (setq dirlist (cdr dirlist))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3840 (unless (char-equal ?~ (aref d 0))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3841 (setq newdl (cons d newdl))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3842 (setq dirlist (nreverse newdl))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3843 (tramp-send-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3844 vec
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3845 (format (concat "while read d; "
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3846 "do if test -x $d/%s -a -f $d/%s; "
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3847 "then echo tramp_executable $d/%s; "
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3848 "break; fi; done <<'EOF'\n"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3849 "%s\nEOF")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3850 progname progname progname (mapconcat 'identity dirlist "\n")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3851 (goto-char (point-max))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3852 (when (search-backward "tramp_executable " nil t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3853 (skip-chars-forward "^ ")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3854 (skip-chars-forward " ")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3855 (setq result (buffer-substring
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3856 (point) (tramp-compat-line-end-position)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3857 result)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3858
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3859 (defun tramp-set-remote-path (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3860 "Sets the remote environment PATH to existing directories.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3861 I.e., for each directory in `tramp-remote-path', it is tested
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3862 whether it exists and if so, it is added to the environment
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3863 variable PATH."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3864 (tramp-message vec 5 (format "Setting $PATH environment variable"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3865 (tramp-send-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3866 vec (format "PATH=%s; export PATH"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3867 (mapconcat 'identity (tramp-get-remote-path vec) ":"))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3868
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3869 ;; ------------------------------------------------------------
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3870 ;; -- Communication with external shell --
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3871 ;; ------------------------------------------------------------
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3872
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3873 (defun tramp-find-file-exists-command (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3874 "Find a command on the remote host for checking if a file exists.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3875 Here, we are looking for a command which has zero exit status if the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3876 file exists and nonzero exit status otherwise."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3877 (let ((existing "/")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3878 (nonexisting
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3879 (tramp-shell-quote-argument "/ this file does not exist "))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3880 result)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3881 ;; The algorithm is as follows: we try a list of several commands.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3882 ;; For each command, we first run `$cmd /' -- this should return
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3883 ;; true, as the root directory always exists. And then we run
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3884 ;; `$cmd /this\ file\ does\ not\ exist ', hoping that the file indeed
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3885 ;; does not exist. This should return false. We use the first
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3886 ;; command we find that seems to work.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3887 ;; The list of commands to try is as follows:
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3888 ;; `ls -d' This works on most systems, but NetBSD 1.4
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3889 ;; has a bug: `ls' always returns zero exit
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3890 ;; status, even for files which don't exist.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3891 ;; `test -e' Some Bourne shells have a `test' builtin
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3892 ;; which does not know the `-e' option.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3893 ;; `/bin/test -e' For those, the `test' binary on disk normally
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3894 ;; provides the option. Alas, the binary
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3895 ;; is sometimes `/bin/test' and sometimes it's
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3896 ;; `/usr/bin/test'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3897 ;; `/usr/bin/test -e' In case `/bin/test' does not exist.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3898 (unless (or
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3899 (and (setq result (format "%s -e" (tramp-get-test-command vec)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3900 (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3901 vec (format "%s %s" result existing))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3902 (not (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3903 vec (format "%s %s" result nonexisting))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3904 (and (setq result "/bin/test -e")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3905 (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3906 vec (format "%s %s" result existing))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3907 (not (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3908 vec (format "%s %s" result nonexisting))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3909 (and (setq result "/usr/bin/test -e")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3910 (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3911 vec (format "%s %s" result existing))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3912 (not (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3913 vec (format "%s %s" result nonexisting))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3914 (and (setq result (format "%s -d" (tramp-get-ls-command vec)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3915 (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3916 vec (format "%s %s" result existing))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3917 (not (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3918 vec (format "%s %s" result nonexisting)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3919 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3920 vec 'file-error "Couldn't find command to check if file exists"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3921 result))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3922
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3923 (defun tramp-open-shell (vec shell)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3924 "Opens shell SHELL."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3925 (with-progress-reporter vec 5 (format "Opening remote shell `%s'" shell)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3926 ;; Find arguments for this shell.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3927 (let ((tramp-end-of-output tramp-initial-end-of-output)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3928 (alist tramp-sh-extra-args)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3929 item extra-args)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3930 (while (and alist (null extra-args))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3931 (setq item (pop alist))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3932 (when (string-match (car item) shell)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3933 (setq extra-args (cdr item))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3934 (when extra-args (setq shell (concat shell " " extra-args)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3935 (tramp-send-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3936 vec (format "exec env ENV='' PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3937 (shell-quote-argument tramp-end-of-output) shell)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3938 t))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3939 ;; Setting prompts.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3940 (tramp-send-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3941 vec (format "PS1=%s" (shell-quote-argument tramp-end-of-output)) t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3942 (tramp-send-command vec "PS2=''" t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3943 (tramp-send-command vec "PS3=''" t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3944 (tramp-send-command vec "PROMPT_COMMAND=''" t)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3945
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3946 (defun tramp-find-shell (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3947 "Opens a shell on the remote host which groks tilde expansion."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3948 (unless (tramp-get-connection-property vec "remote-shell" nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3949 (let (shell)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3950 (with-current-buffer (tramp-get-buffer vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3951 (tramp-send-command vec "echo ~root" t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3952 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3953 ((or (string-match "^~root$" (buffer-string))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3954 ;; The default shell (ksh93) of OpenSolaris is buggy.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3955 (string-equal (tramp-get-connection-property vec "uname" "")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3956 "SunOS 5.11"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3957 (setq shell
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3958 (or (tramp-find-executable
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3959 vec "bash" (tramp-get-remote-path vec) t t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3960 (tramp-find-executable
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3961 vec "ksh" (tramp-get-remote-path vec) t t)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3962 (unless shell
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3963 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3964 vec 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3965 "Couldn't find a shell which groks tilde expansion"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3966 (tramp-message
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3967 vec 5 "Starting remote shell `%s' for tilde expansion" shell)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3968 (tramp-open-shell vec shell))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3969
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3970 (t (tramp-message
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3971 vec 5 "Remote `%s' groks tilde expansion, good"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3972 (tramp-set-connection-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3973 vec "remote-shell"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3974 (tramp-get-method-parameter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3975 (tramp-file-name-method vec) 'tramp-remote-sh)))))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3976
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3977 ;; Utility functions.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3978
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3979 (defun tramp-barf-if-no-shell-prompt (proc timeout &rest error-args)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3980 "Wait for shell prompt and barf if none appears.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3981 Looks at process PROC to see if a shell prompt appears in TIMEOUT
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3982 seconds. If not, it produces an error message with the given ERROR-ARGS."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3983 (unless
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3984 (tramp-wait-for-regexp
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3985 proc timeout
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3986 (format
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3987 "\\(%s\\|%s\\)\\'" shell-prompt-pattern tramp-shell-prompt-pattern))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3988 (apply 'tramp-error-with-buffer nil proc 'file-error error-args)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3989
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3990 (defun tramp-open-connection-setup-interactive-shell (proc vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3991 "Set up an interactive shell.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3992 Mainly sets the prompt and the echo correctly. PROC is the shell
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3993 process to set up. VEC specifies the connection."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3994 (let ((tramp-end-of-output tramp-initial-end-of-output))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3995 ;; It is useful to set the prompt in the following command because
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3996 ;; some people have a setting for $PS1 which /bin/sh doesn't know
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3997 ;; about and thus /bin/sh will display a strange prompt. For
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3998 ;; example, if $PS1 has "${CWD}" in the value, then ksh will
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
3999 ;; display the current working directory but /bin/sh will display
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4000 ;; a dollar sign. The following command line sets $PS1 to a sane
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4001 ;; value, and works under Bourne-ish shells as well as csh-like
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4002 ;; shells. Daniel Pittman reports that the unusual positioning of
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4003 ;; the single quotes makes it work under `rc', too. We also unset
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4004 ;; the variable $ENV because that is read by some sh
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4005 ;; implementations (eg, bash when called as sh) on startup; this
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4006 ;; way, we avoid the startup file clobbering $PS1. $PROMP_COMMAND
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4007 ;; is another way to set the prompt in /bin/bash, it must be
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4008 ;; discarded as well.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4009 (tramp-open-shell
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4010 vec
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4011 (tramp-get-method-parameter (tramp-file-name-method vec) 'tramp-remote-sh))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4012
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4013 ;; Disable echo.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4014 (tramp-message vec 5 "Setting up remote shell environment")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4015 (tramp-send-command vec "stty -inlcr -echo kill '^U' erase '^H'" t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4016 ;; Check whether the echo has really been disabled. Some
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4017 ;; implementations, like busybox of embedded GNU/Linux, don't
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4018 ;; support disabling.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4019 (tramp-send-command vec "echo foo" t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4020 (with-current-buffer (process-buffer proc)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4021 (goto-char (point-min))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4022 (when (looking-at "echo foo")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4023 (tramp-set-connection-property proc "remote-echo" t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4024 (tramp-message vec 5 "Remote echo still on. Ok.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4025 ;; Make sure backspaces and their echo are enabled and no line
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4026 ;; width magic interferes with them.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4027 (tramp-send-command vec "stty icanon erase ^H cols 32767" t))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4028
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4029 (tramp-message vec 5 "Setting shell prompt")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4030 (tramp-send-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4031 vec (format "PS1=%s" (shell-quote-argument tramp-end-of-output)) t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4032 (tramp-send-command vec "PS2=''" t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4033 (tramp-send-command vec "PS3=''" t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4034 (tramp-send-command vec "PROMPT_COMMAND=''" t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4035
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4036 ;; Try to set up the coding system correctly.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4037 ;; CCC this can't be the right way to do it. Hm.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4038 (tramp-message vec 5 "Determining coding system")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4039 (tramp-send-command vec "echo foo ; echo bar" t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4040 (with-current-buffer (process-buffer proc)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4041 (goto-char (point-min))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4042 (if (featurep 'mule)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4043 ;; Use MULE to select the right EOL convention for communicating
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4044 ;; with the process.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4045 (let* ((cs (or (tramp-compat-funcall 'process-coding-system proc)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4046 (cons 'undecided 'undecided)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4047 cs-decode cs-encode)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4048 (when (symbolp cs) (setq cs (cons cs cs)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4049 (setq cs-decode (car cs))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4050 (setq cs-encode (cdr cs))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4051 (unless cs-decode (setq cs-decode 'undecided))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4052 (unless cs-encode (setq cs-encode 'undecided))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4053 (setq cs-encode (tramp-coding-system-change-eol-conversion
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4054 cs-encode 'unix))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4055 (when (search-forward "\r" nil t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4056 (setq cs-decode (tramp-coding-system-change-eol-conversion
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4057 cs-decode 'dos)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4058 (tramp-compat-funcall
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4059 'set-buffer-process-coding-system cs-decode cs-encode)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4060 (tramp-message
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4061 vec 5 "Setting coding system to `%s' and `%s'" cs-decode cs-encode))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4062 ;; Look for ^M and do something useful if found.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4063 (when (search-forward "\r" nil t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4064 ;; We have found a ^M but cannot frob the process coding system
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4065 ;; because we're running on a non-MULE Emacs. Let's try
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4066 ;; stty, instead.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4067 (tramp-send-command vec "stty -onlcr" t))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4068 ;; Dump stty settings in the traces.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4069 (when (>= tramp-verbose 9)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4070 (tramp-send-command vec "stty -a" t))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4071 (tramp-send-command vec "set +o vi +o emacs" t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4072
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4073 ;; Check whether the output of "uname -sr" has been changed. If
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4074 ;; yes, this is a strong indication that we must expire all
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4075 ;; connection properties. We start again with
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4076 ;; `tramp-maybe-open-connection', it will be catched there.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4077 (tramp-message vec 5 "Checking system information")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4078 (let ((old-uname (tramp-get-connection-property vec "uname" nil))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4079 (new-uname
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4080 (tramp-set-connection-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4081 vec "uname"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4082 (tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\""))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4083 (when (and (stringp old-uname) (not (string-equal old-uname new-uname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4084 (with-current-buffer (tramp-get-debug-buffer vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4085 ;; Keep the debug buffer.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4086 (rename-buffer
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4087 (generate-new-buffer-name tramp-temp-buffer-name) 'unique)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4088 (tramp-compat-funcall 'tramp-cleanup-connection vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4089 (if (= (point-min) (point-max))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4090 (kill-buffer nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4091 (rename-buffer (tramp-debug-buffer-name vec) 'unique))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4092 ;; We call `tramp-get-buffer' in order to keep the debug buffer.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4093 (tramp-get-buffer vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4094 (tramp-message
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4095 vec 3
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4096 "Connection reset, because remote host changed from `%s' to `%s'"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4097 old-uname new-uname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4098 (throw 'uname-changed (tramp-maybe-open-connection vec)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4099
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4100 ;; Check whether the remote host suffers from buggy
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4101 ;; `send-process-string'. This is known for FreeBSD (see comment in
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4102 ;; `send_process', file process.c). I've tested sending 624 bytes
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4103 ;; successfully, sending 625 bytes failed. Emacs makes a hack when
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4104 ;; this host type is detected locally. It cannot handle remote
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4105 ;; hosts, though.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4106 (with-connection-property proc "chunksize"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4107 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4108 ((and (integerp tramp-chunksize) (> tramp-chunksize 0))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4109 tramp-chunksize)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4110 (t
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4111 (tramp-message
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4112 vec 5 "Checking remote host type for `send-process-string' bug")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4113 (if (string-match
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4114 "^FreeBSD" (tramp-get-connection-property vec "uname" ""))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4115 500 0))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4116
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4117 ;; Set remote PATH variable.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4118 (tramp-set-remote-path vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4119
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4120 ;; Search for a good shell before searching for a command which
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4121 ;; checks if a file exists. This is done because Tramp wants to use
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4122 ;; "test foo; echo $?" to check if various conditions hold, and
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4123 ;; there are buggy /bin/sh implementations which don't execute the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4124 ;; "echo $?" part if the "test" part has an error. In particular,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4125 ;; the OpenSolaris /bin/sh is a problem. There are also other
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4126 ;; problems with /bin/sh of OpenSolaris, like redirection of stderr
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4127 ;; in function declarations, or changing HISTFILE in place.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4128 ;; Therefore, OpenSolaris' /bin/sh is replaced by bash, when
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4129 ;; detected.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4130 (tramp-find-shell vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4131
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4132 ;; Disable unexpected output.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4133 (tramp-send-command vec "mesg n; biff n" t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4134
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4135 ;; IRIX64 bash expands "!" even when in single quotes. This
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4136 ;; destroys our shell functions, we must disable it. See
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4137 ;; <http://stackoverflow.com/questions/3291692/irix-bash-shell-expands-expression-in-single-quotes-yet-shouldnt>.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4138 (when (string-match "^IRIX64" (tramp-get-connection-property vec "uname" ""))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4139 (tramp-send-command vec "set +H" t))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4140
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4141 ;; Set `remote-tty' process property.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4142 (ignore-errors
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4143 (let ((tty (tramp-send-command-and-read vec "echo \\\"`tty`\\\"")))
|
110374
|
4144 (unless (zerop (length tty))
|
|
4145 (tramp-compat-process-put proc 'remote-tty tty))))
|
110321
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4146
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4147 ;; Set the environment.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4148 (tramp-message vec 5 "Setting default environment")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4149
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4150 (let ((env (copy-sequence tramp-remote-process-environment))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4151 unset item)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4152 (while env
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4153 (setq item (tramp-compat-split-string (car env) "="))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4154 (setcdr item (mapconcat 'identity (cdr item) "="))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4155 (if (and (stringp (cdr item)) (not (string-equal (cdr item) "")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4156 (tramp-send-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4157 vec (format "%s=%s; export %s" (car item) (cdr item) (car item)) t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4158 (push (car item) unset))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4159 (setq env (cdr env)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4160 (when unset
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4161 (tramp-send-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4162 vec (format "unset %s" (mapconcat 'identity unset " ")) t))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4163
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4164 ;; CCC: We should either implement a Perl version of base64 encoding
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4165 ;; and decoding. Then we just use that in the last item. The other
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4166 ;; alternative is to use the Perl version of UU encoding. But then
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4167 ;; we need a Lisp version of uuencode.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4168 ;;
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4169 ;; Old text from documentation of tramp-methods:
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4170 ;; Using a uuencode/uudecode inline method is discouraged, please use one
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4171 ;; of the base64 methods instead since base64 encoding is much more
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4172 ;; reliable and the commands are more standardized between the different
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4173 ;; Unix versions. But if you can't use base64 for some reason, please
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4174 ;; note that the default uudecode command does not work well for some
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4175 ;; Unices, in particular AIX and Irix. For AIX, you might want to use
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4176 ;; the following command for uudecode:
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4177 ;;
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4178 ;; sed '/^begin/d;/^[` ]$/d;/^end/d' | iconv -f uucode -t ISO8859-1
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4179 ;;
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4180 ;; For Irix, no solution is known yet.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4181
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4182 (autoload 'uudecode-decode-region "uudecode")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4183
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4184 (defconst tramp-local-coding-commands
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4185 '((b64 base64-encode-region base64-decode-region)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4186 (uu tramp-uuencode-region uudecode-decode-region)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4187 (pack
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4188 "perl -e 'binmode STDIN; binmode STDOUT; print pack(q{u*}, join q{}, <>)'"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4189 "perl -e 'binmode STDIN; binmode STDOUT; print unpack(q{u*}, join q{}, <>)'"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4190 "List of local coding commands for inline transfer.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4191 Each item is a list that looks like this:
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4192
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4193 \(FORMAT ENCODING DECODING\)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4194
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4195 FORMAT is symbol describing the encoding/decoding format. It can be
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4196 `b64' for base64 encoding, `uu' for uu encoding, or `pack' for simple packing.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4197
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4198 ENCODING and DECODING can be strings, giving commands, or symbols,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4199 giving functions. If they are strings, then they can contain
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4200 the \"%s\" format specifier. If that specifier is present, the input
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4201 filename will be put into the command line at that spot. If the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4202 specifier is not present, the input should be read from standard
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4203 input.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4204
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4205 If they are functions, they will be called with two arguments, start
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4206 and end of region, and are expected to replace the region contents
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4207 with the encoded or decoded results, respectively.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4208
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4209 (defconst tramp-remote-coding-commands
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4210 '((b64 "base64" "base64 -d")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4211 (b64 "mimencode -b" "mimencode -u -b")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4212 (b64 "mmencode -b" "mmencode -u -b")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4213 (b64 "recode data..base64" "recode base64..data")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4214 (b64 tramp-perl-encode-with-module tramp-perl-decode-with-module)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4215 (b64 tramp-perl-encode tramp-perl-decode)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4216 (uu "uuencode xxx" "uudecode -o /dev/stdout")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4217 (uu "uuencode xxx" "uudecode -o -")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4218 (uu "uuencode xxx" "uudecode -p")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4219 (uu "uuencode xxx" tramp-uudecode)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4220 (pack
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4221 "perl -e 'binmode STDIN; binmode STDOUT; print pack(q{u*}, join q{}, <>)'"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4222 "perl -e 'binmode STDIN; binmode STDOUT; print unpack(q{u*}, join q{}, <>)'"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4223 "List of remote coding commands for inline transfer.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4224 Each item is a list that looks like this:
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4225
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4226 \(FORMAT ENCODING DECODING\)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4227
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4228 FORMAT is symbol describing the encoding/decoding format. It can be
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4229 `b64' for base64 encoding, `uu' for uu encoding, or `pack' for simple packing.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4230
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4231 ENCODING and DECODING can be strings, giving commands, or symbols,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4232 giving variables. If they are strings, then they can contain
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4233 the \"%s\" format specifier. If that specifier is present, the input
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4234 filename will be put into the command line at that spot. If the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4235 specifier is not present, the input should be read from standard
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4236 input.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4237
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4238 If they are variables, this variable is a string containing a Perl
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4239 implementation for this functionality. This Perl program will be transferred
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4240 to the remote host, and it is available as shell function with the same name.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4241
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4242 (defun tramp-find-inline-encoding (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4243 "Find an inline transfer encoding that works.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4244 Goes through the list `tramp-local-coding-commands' and
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4245 `tramp-remote-coding-commands'."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4246 (save-excursion
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4247 (let ((local-commands tramp-local-coding-commands)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4248 (magic "xyzzy")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4249 loc-enc loc-dec rem-enc rem-dec litem ritem found)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4250 (while (and local-commands (not found))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4251 (setq litem (pop local-commands))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4252 (catch 'wont-work-local
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4253 (let ((format (nth 0 litem))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4254 (remote-commands tramp-remote-coding-commands))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4255 (setq loc-enc (nth 1 litem))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4256 (setq loc-dec (nth 2 litem))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4257 ;; If the local encoder or decoder is a string, the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4258 ;; corresponding command has to work locally.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4259 (if (not (stringp loc-enc))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4260 (tramp-message
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4261 vec 5 "Checking local encoding function `%s'" loc-enc)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4262 (tramp-message
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4263 vec 5 "Checking local encoding command `%s' for sanity" loc-enc)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4264 (unless (zerop (tramp-call-local-coding-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4265 loc-enc nil nil))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4266 (throw 'wont-work-local nil)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4267 (if (not (stringp loc-dec))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4268 (tramp-message
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4269 vec 5 "Checking local decoding function `%s'" loc-dec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4270 (tramp-message
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4271 vec 5 "Checking local decoding command `%s' for sanity" loc-dec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4272 (unless (zerop (tramp-call-local-coding-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4273 loc-dec nil nil))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4274 (throw 'wont-work-local nil)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4275 ;; Search for remote coding commands with the same format
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4276 (while (and remote-commands (not found))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4277 (setq ritem (pop remote-commands))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4278 (catch 'wont-work-remote
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4279 (when (equal format (nth 0 ritem))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4280 (setq rem-enc (nth 1 ritem))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4281 (setq rem-dec (nth 2 ritem))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4282 ;; Check if remote encoding and decoding commands can be
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4283 ;; called remotely with null input and output. This makes
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4284 ;; sure there are no syntax errors and the command is really
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4285 ;; found. Note that we do not redirect stdout to /dev/null,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4286 ;; for two reasons: when checking the decoding command, we
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4287 ;; actually check the output it gives. And also, when
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4288 ;; redirecting "mimencode" output to /dev/null, then as root
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4289 ;; it might change the permissions of /dev/null!
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4290 (when (not (stringp rem-enc))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4291 (let ((name (symbol-name rem-enc)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4292 (while (string-match (regexp-quote "-") name)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4293 (setq name (replace-match "_" nil t name)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4294 (tramp-maybe-send-script vec (symbol-value rem-enc) name)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4295 (setq rem-enc name)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4296 (tramp-message
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4297 vec 5
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4298 "Checking remote encoding command `%s' for sanity" rem-enc)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4299 (unless (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4300 vec (format "%s </dev/null" rem-enc) t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4301 (throw 'wont-work-remote nil))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4302
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4303 (when (not (stringp rem-dec))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4304 (let ((name (symbol-name rem-dec)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4305 (while (string-match (regexp-quote "-") name)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4306 (setq name (replace-match "_" nil t name)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4307 (tramp-maybe-send-script vec (symbol-value rem-dec) name)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4308 (setq rem-dec name)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4309 (tramp-message
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4310 vec 5
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4311 "Checking remote decoding command `%s' for sanity" rem-dec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4312 (unless (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4313 vec
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4314 (format "echo %s | %s | %s" magic rem-enc rem-dec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4315 t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4316 (throw 'wont-work-remote nil))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4317
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4318 (with-current-buffer (tramp-get-buffer vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4319 (goto-char (point-min))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4320 (unless (looking-at (regexp-quote magic))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4321 (throw 'wont-work-remote nil)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4322
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4323 ;; `rem-enc' and `rem-dec' could be a string meanwhile.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4324 (setq rem-enc (nth 1 ritem))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4325 (setq rem-dec (nth 2 ritem))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4326 (setq found t)))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4327
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4328 ;; Did we find something?
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4329 (unless found
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4330 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4331 vec 'file-error "Couldn't find an inline transfer encoding"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4332
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4333 ;; Set connection properties.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4334 (tramp-message vec 5 "Using local encoding `%s'" loc-enc)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4335 (tramp-set-connection-property vec "local-encoding" loc-enc)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4336 (tramp-message vec 5 "Using local decoding `%s'" loc-dec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4337 (tramp-set-connection-property vec "local-decoding" loc-dec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4338 (tramp-message vec 5 "Using remote encoding `%s'" rem-enc)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4339 (tramp-set-connection-property vec "remote-encoding" rem-enc)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4340 (tramp-message vec 5 "Using remote decoding `%s'" rem-dec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4341 (tramp-set-connection-property vec "remote-decoding" rem-dec))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4342
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4343 (defun tramp-call-local-coding-command (cmd input output)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4344 "Call the local encoding or decoding command.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4345 If CMD contains \"%s\", provide input file INPUT there in command.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4346 Otherwise, INPUT is passed via standard input.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4347 INPUT can also be nil which means `/dev/null'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4348 OUTPUT can be a string (which specifies a filename), or t (which
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4349 means standard output and thus the current buffer), or nil (which
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4350 means discard it)."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4351 (tramp-compat-call-process
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4352 tramp-encoding-shell
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4353 (when (and input (not (string-match "%s" cmd))) input)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4354 (if (eq output t) t nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4355 nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4356 tramp-encoding-command-switch
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4357 (concat
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4358 (if (string-match "%s" cmd) (format cmd input) cmd)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4359 (if (stringp output) (concat "> " output) ""))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4360
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4361 (defconst tramp-inline-compress-commands
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4362 '(("gzip" "gzip -d")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4363 ("bzip2" "bzip2 -d")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4364 ("compress" "compress -d"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4365 "List of compress and decompress commands for inline transfer.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4366 Each item is a list that looks like this:
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4367
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4368 \(COMPRESS DECOMPRESS\)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4369
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4370 COMPRESS or DECOMPRESS are strings with the respective commands.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4371
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4372 (defun tramp-find-inline-compress (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4373 "Find an inline transfer compress command that works.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4374 Goes through the list `tramp-inline-compress-commands'."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4375 (save-excursion
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4376 (let ((commands tramp-inline-compress-commands)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4377 (magic "xyzzy")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4378 item compress decompress
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4379 found)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4380 (while (and commands (not found))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4381 (catch 'next
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4382 (setq item (pop commands)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4383 compress (nth 0 item)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4384 decompress (nth 1 item))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4385 (tramp-message
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4386 vec 5
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4387 "Checking local compress command `%s', `%s' for sanity"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4388 compress decompress)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4389 (unless (zerop (tramp-call-local-coding-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4390 (format "echo %s | %s | %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4391 magic compress decompress) nil nil))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4392 (throw 'next nil))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4393 (tramp-message
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4394 vec 5
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4395 "Checking remote compress command `%s', `%s' for sanity"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4396 compress decompress)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4397 (unless (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4398 vec (format "echo %s | %s | %s" magic compress decompress) t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4399 (throw 'next nil))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4400 (setq found t)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4401
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4402 ;; Did we find something?
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4403 (if found
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4404 (progn
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4405 ;; Set connection properties.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4406 (tramp-message
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4407 vec 5 "Using inline transfer compress command `%s'" compress)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4408 (tramp-set-connection-property vec "inline-compress" compress)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4409 (tramp-message
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4410 vec 5 "Using inline transfer decompress command `%s'" decompress)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4411 (tramp-set-connection-property vec "inline-decompress" decompress))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4412
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4413 (tramp-set-connection-property vec "inline-compress" nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4414 (tramp-set-connection-property vec "inline-decompress" nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4415 (tramp-message
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4416 vec 2 "Couldn't find an inline transfer compress command")))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4417
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4418 (defun tramp-compute-multi-hops (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4419 "Expands VEC according to `tramp-default-proxies-alist'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4420 Gateway hops are already opened."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4421 (let ((target-alist `(,vec))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4422 (choices tramp-default-proxies-alist)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4423 item proxy)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4424
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4425 ;; Look for proxy hosts to be passed.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4426 (while choices
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4427 (setq item (pop choices)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4428 proxy (eval (nth 2 item)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4429 (when (and
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4430 ;; host
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4431 (string-match (or (eval (nth 0 item)) "")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4432 (or (tramp-file-name-host (car target-alist)) ""))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4433 ;; user
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4434 (string-match (or (eval (nth 1 item)) "")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4435 (or (tramp-file-name-user (car target-alist)) "")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4436 (if (null proxy)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4437 ;; No more hops needed.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4438 (setq choices nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4439 ;; Replace placeholders.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4440 (setq proxy
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4441 (format-spec
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4442 proxy
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4443 (format-spec-make
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4444 ?u (or (tramp-file-name-user (car target-alist)) "")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4445 ?h (or (tramp-file-name-host (car target-alist)) ""))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4446 (with-parsed-tramp-file-name proxy l
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4447 ;; Add the hop.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4448 (add-to-list 'target-alist l)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4449 ;; Start next search.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4450 (setq choices tramp-default-proxies-alist)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4451
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4452 ;; Handle gateways.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4453 (when (string-match
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4454 (format
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4455 "^\\(%s\\|%s\\)$" tramp-gw-tunnel-method tramp-gw-socks-method)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4456 (tramp-file-name-method (car target-alist)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4457 (let ((gw (pop target-alist))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4458 (hop (pop target-alist)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4459 ;; Is the method prepared for gateways?
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4460 (unless (tramp-get-method-parameter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4461 (tramp-file-name-method hop) 'tramp-default-port)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4462 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4463 vec 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4464 "Method `%s' is not supported for gateway access."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4465 (tramp-file-name-method hop)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4466 ;; Add default port if needed.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4467 (unless
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4468 (string-match
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4469 tramp-host-with-port-regexp (tramp-file-name-host hop))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4470 (aset hop 2
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4471 (concat
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4472 (tramp-file-name-host hop) tramp-prefix-port-format
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4473 (number-to-string
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4474 (tramp-get-method-parameter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4475 (tramp-file-name-method hop) 'tramp-default-port)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4476 ;; Open the gateway connection.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4477 (add-to-list
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4478 'target-alist
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4479 (vector
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4480 (tramp-file-name-method hop) (tramp-file-name-user hop)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4481 (tramp-compat-funcall 'tramp-gw-open-connection vec gw hop) nil))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4482 ;; For the password prompt, we need the correct values.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4483 ;; Therefore, we must remember the gateway vector. But we
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4484 ;; cannot do it as connection property, because it shouldn't
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4485 ;; be persistent. And we have no started process yet either.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4486 (tramp-set-file-property (car target-alist) "" "gateway" hop)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4487
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4488 ;; Foreign and out-of-band methods are not supported for multi-hops.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4489 (when (cdr target-alist)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4490 (setq choices target-alist)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4491 (while choices
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4492 (setq item (pop choices))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4493 (when
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4494 (or
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4495 (not
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4496 (tramp-get-method-parameter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4497 (tramp-file-name-method item) 'tramp-login-program))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4498 (tramp-get-method-parameter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4499 (tramp-file-name-method item) 'tramp-copy-program))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4500 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4501 vec 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4502 "Method `%s' is not supported for multi-hops."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4503 (tramp-file-name-method item)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4504
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4505 ;; In case the host name is not used for the remote shell
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4506 ;; command, the user could be misguided by applying a random
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4507 ;; hostname.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4508 (let* ((v (car target-alist))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4509 (method (tramp-file-name-method v))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4510 (host (tramp-file-name-host v)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4511 (unless
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4512 (or
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4513 ;; There are multi-hops.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4514 (cdr target-alist)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4515 ;; The host name is used for the remote shell command.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4516 (member
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4517 '("%h") (tramp-get-method-parameter method 'tramp-login-args))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4518 ;; The host is local. We cannot use `tramp-local-host-p'
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4519 ;; here, because it opens a connection as well.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4520 (string-match tramp-local-host-regexp host))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4521 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4522 v 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4523 "Host `%s' looks like a remote host, `%s' can only use the local host"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4524 host method)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4525
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4526 ;; Result.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4527 target-alist))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4528
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4529 (defun tramp-maybe-open-connection (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4530 "Maybe open a connection VEC.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4531 Does not do anything if a connection is already open, but re-opens the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4532 connection if a previous connection has died for some reason."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4533 (catch 'uname-changed
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4534 (let ((p (tramp-get-connection-process vec))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4535 (process-name (tramp-get-connection-property vec "process-name" nil))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4536 (process-environment (copy-sequence process-environment)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4537
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4538 ;; If too much time has passed since last command was sent, look
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4539 ;; whether process is still alive. If it isn't, kill it. When
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4540 ;; using ssh, it can sometimes happen that the remote end has
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4541 ;; hung up but the local ssh client doesn't recognize this until
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4542 ;; it tries to send some data to the remote end. So that's why
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4543 ;; we try to send a command from time to time, then look again
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4544 ;; whether the process is really alive.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4545 (condition-case nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4546 (when (and (> (tramp-time-diff
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4547 (current-time)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4548 (tramp-get-connection-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4549 p "last-cmd-time" '(0 0 0)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4550 60)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4551 p (processp p) (memq (process-status p) '(run open)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4552 (tramp-send-command vec "echo are you awake" t t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4553 (unless (and (memq (process-status p) '(run open))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4554 (tramp-wait-for-output p 10))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4555 ;; The error will be catched locally.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4556 (tramp-error vec 'file-error "Awake did fail")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4557 (file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4558 (tramp-flush-connection-property vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4559 (tramp-flush-connection-property p)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4560 (delete-process p)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4561 (setq p nil)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4562
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4563 ;; New connection must be opened.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4564 (unless (and p (processp p) (memq (process-status p) '(run open)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4565
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4566 ;; We call `tramp-get-buffer' in order to get a debug buffer for
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4567 ;; messages from the beginning.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4568 (tramp-get-buffer vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4569 (with-progress-reporter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4570 vec 3
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4571 (if (zerop (length (tramp-file-name-user vec)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4572 (format "Opening connection for %s using %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4573 (tramp-file-name-host vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4574 (tramp-file-name-method vec))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4575 (format "Opening connection for %s@%s using %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4576 (tramp-file-name-user vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4577 (tramp-file-name-host vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4578 (tramp-file-name-method vec)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4579
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4580 ;; Start new process.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4581 (when (and p (processp p))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4582 (delete-process p))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4583 (setenv "TERM" tramp-terminal-type)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4584 (setenv "LC_ALL" "C")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4585 (setenv "PROMPT_COMMAND")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4586 (setenv "PS1" tramp-initial-end-of-output)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4587 (let* ((target-alist (tramp-compute-multi-hops vec))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4588 (process-connection-type tramp-process-connection-type)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4589 (process-adaptive-read-buffering nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4590 (coding-system-for-read nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4591 ;; This must be done in order to avoid our file name handler.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4592 (p (let ((default-directory
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4593 (tramp-compat-temporary-file-directory)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4594 (start-process
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4595 (or process-name (tramp-buffer-name vec))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4596 (tramp-get-connection-buffer vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4597 tramp-encoding-shell))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4598
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4599 (tramp-message
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4600 vec 6 "%s" (mapconcat 'identity (process-command p) " "))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4601
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4602 ;; Check whether process is alive.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4603 (tramp-set-process-query-on-exit-flag p nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4604 (tramp-barf-if-no-shell-prompt
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4605 p 60 "Couldn't find local shell prompt %s" tramp-encoding-shell)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4606
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4607 ;; Now do all the connections as specified.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4608 (while target-alist
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4609 (let* ((hop (car target-alist))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4610 (l-method (tramp-file-name-method hop))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4611 (l-user (tramp-file-name-user hop))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4612 (l-host (tramp-file-name-host hop))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4613 (l-port nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4614 (login-program
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4615 (tramp-get-method-parameter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4616 l-method 'tramp-login-program))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4617 (login-args
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4618 (tramp-get-method-parameter l-method 'tramp-login-args))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4619 (async-args
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4620 (tramp-get-method-parameter l-method 'tramp-async-args))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4621 (gw-args
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4622 (tramp-get-method-parameter l-method 'tramp-gw-args))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4623 (gw (tramp-get-file-property hop "" "gateway" nil))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4624 (g-method (and gw (tramp-file-name-method gw)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4625 (g-user (and gw (tramp-file-name-user gw)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4626 (g-host (and gw (tramp-file-name-host gw)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4627 (command login-program)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4628 ;; We don't create the temporary file. In fact,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4629 ;; it is just a prefix for the ControlPath option
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4630 ;; of ssh; the real temporary file has another
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4631 ;; name, and it is created and protected by ssh.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4632 ;; It is also removed by ssh, when the connection
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4633 ;; is closed.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4634 (tmpfile
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4635 (tramp-set-connection-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4636 p "temp-file"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4637 (make-temp-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4638 (expand-file-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4639 tramp-temp-name-prefix
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4640 (tramp-compat-temporary-file-directory)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4641 spec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4642
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4643 ;; Add arguments for asynchrononous processes.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4644 (when (and process-name async-args)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4645 (setq login-args (append async-args login-args)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4646
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4647 ;; Add gateway arguments if necessary.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4648 (when (and gw gw-args)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4649 (setq login-args (append gw-args login-args)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4650
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4651 ;; Check for port number. Until now, there's no need
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4652 ;; for handling like method, user, host.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4653 (when (string-match tramp-host-with-port-regexp l-host)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4654 (setq l-port (match-string 2 l-host)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4655 l-host (match-string 1 l-host)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4656
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4657 ;; Set variables for computing the prompt for reading
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4658 ;; password. They can also be derived from a gateway.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4659 (setq tramp-current-method (or g-method l-method)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4660 tramp-current-user (or g-user l-user)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4661 tramp-current-host (or g-host l-host))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4662
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4663 ;; Replace login-args place holders.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4664 (setq
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4665 l-host (or l-host "")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4666 l-user (or l-user "")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4667 l-port (or l-port "")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4668 spec (format-spec-make
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4669 ?h l-host ?u l-user ?p l-port ?t tmpfile)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4670 command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4671 (concat
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4672 ;; We do not want to see the trailing local prompt in
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4673 ;; `start-file-process'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4674 (unless (memq system-type '(windows-nt)) "exec ")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4675 command " "
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4676 (mapconcat
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4677 (lambda (x)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4678 (setq x (mapcar (lambda (y) (format-spec y spec)) x))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4679 (unless (member "" x) (mapconcat 'identity x " ")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4680 login-args " ")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4681 ;; Local shell could be a Windows COMSPEC. It
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4682 ;; doesn't know the ";" syntax, but we must exit
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4683 ;; always for `start-file-process'. "exec" does not
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4684 ;; work either.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4685 (if (memq system-type '(windows-nt)) " && exit || exit")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4686
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4687 ;; Send the command.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4688 (tramp-message vec 3 "Sending command `%s'" command)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4689 (tramp-send-command vec command t t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4690 (tramp-process-actions p vec tramp-actions-before-shell 60)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4691 (tramp-message
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4692 vec 3 "Found remote shell prompt on `%s'" l-host))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4693 ;; Next hop.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4694 (setq target-alist (cdr target-alist)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4695
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4696 ;; Make initial shell settings.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4697 (tramp-open-connection-setup-interactive-shell p vec)))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4698
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4699 (defun tramp-send-command (vec command &optional neveropen nooutput)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4700 "Send the COMMAND to connection VEC.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4701 Erases temporary buffer before sending the command. If optional
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4702 arg NEVEROPEN is non-nil, never try to open the connection. This
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4703 is meant to be used from `tramp-maybe-open-connection' only. The
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4704 function waits for output unless NOOUTPUT is set."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4705 (unless neveropen (tramp-maybe-open-connection vec))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4706 (let ((p (tramp-get-connection-process vec)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4707 (when (tramp-get-connection-property p "remote-echo" nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4708 ;; We mark the command string that it can be erased in the output buffer.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4709 (tramp-set-connection-property p "check-remote-echo" t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4710 (setq command (format "%s%s%s" tramp-echo-mark command tramp-echo-mark)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4711 (tramp-message vec 6 "%s" command)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4712 (tramp-send-string vec command)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4713 (unless nooutput (tramp-wait-for-output p))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4714
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4715 (defun tramp-wait-for-output (proc &optional timeout)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4716 "Wait for output from remote command."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4717 (unless (buffer-live-p (process-buffer proc))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4718 (delete-process proc)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4719 (tramp-error proc 'file-error "Process `%s' not available, try again" proc))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4720 (with-current-buffer (process-buffer proc)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4721 (let* (;; Initially, `tramp-end-of-output' is "#$ ". There might
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4722 ;; be leading escape sequences, which must be ignored.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4723 (regexp (format "[^#$\n]*%s\r?$" (regexp-quote tramp-end-of-output)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4724 ;; Sometimes, the commands do not return a newline but a
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4725 ;; null byte before the shell prompt, for example "git
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4726 ;; ls-files -c -z ...".
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4727 (regexp1 (format "\\(^\\|\000\\)%s" regexp))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4728 (found (tramp-wait-for-regexp proc timeout regexp1)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4729 (if found
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4730 (let (buffer-read-only)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4731 ;; A simple-minded busybox has sent " ^H" sequences.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4732 ;; Delete them.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4733 (goto-char (point-min))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4734 (when (re-search-forward
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4735 "^\\(.\b\\)+$" (tramp-compat-line-end-position) t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4736 (forward-line 1)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4737 (delete-region (point-min) (point)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4738 ;; Delete the prompt.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4739 (goto-char (point-max))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4740 (re-search-backward regexp nil t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4741 (delete-region (point) (point-max)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4742 (if timeout
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4743 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4744 proc 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4745 "[[Remote prompt `%s' not found in %d secs]]"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4746 tramp-end-of-output timeout)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4747 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4748 proc 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4749 "[[Remote prompt `%s' not found]]" tramp-end-of-output)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4750 ;; Return value is whether end-of-output sentinel was found.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4751 found)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4752
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4753 (defun tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4754 (vec command &optional subshell dont-suppress-err)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4755 "Run COMMAND and check its exit status.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4756 Sends `echo $?' along with the COMMAND for checking the exit status. If
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4757 COMMAND is nil, just sends `echo $?'. Returns the exit status found.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4758
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4759 If the optional argument SUBSHELL is non-nil, the command is
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4760 executed in a subshell, ie surrounded by parentheses. If
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4761 DONT-SUPPRESS-ERR is non-nil, stderr won't be sent to /dev/null."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4762 (tramp-send-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4763 vec
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4764 (concat (if subshell "( " "")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4765 command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4766 (if command (if dont-suppress-err "; " " 2>/dev/null; ") "")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4767 "echo tramp_exit_status $?"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4768 (if subshell " )" "")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4769 (with-current-buffer (tramp-get-connection-buffer vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4770 (goto-char (point-max))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4771 (unless (re-search-backward "tramp_exit_status [0-9]+" nil t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4772 (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4773 vec 'file-error "Couldn't find exit status of `%s'" command))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4774 (skip-chars-forward "^ ")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4775 (prog1
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4776 (zerop (read (current-buffer)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4777 (let (buffer-read-only)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4778 (delete-region (match-beginning 0) (point-max))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4779
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4780 (defun tramp-barf-unless-okay (vec command fmt &rest args)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4781 "Run COMMAND, check exit status, throw error if exit status not okay.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4782 Similar to `tramp-send-command-and-check' but accepts two more arguments
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4783 FMT and ARGS which are passed to `error'."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4784 (unless (tramp-send-command-and-check vec command)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4785 (apply 'tramp-error vec 'file-error fmt args)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4786
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4787 (defun tramp-send-command-and-read (vec command)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4788 "Run COMMAND and return the output, which must be a Lisp expression.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4789 In case there is no valid Lisp expression, it raises an error"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4790 (tramp-barf-unless-okay vec command "`%s' returns with error" command)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4791 (with-current-buffer (tramp-get-connection-buffer vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4792 ;; Read the expression.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4793 (goto-char (point-min))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4794 (condition-case nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4795 (prog1 (read (current-buffer))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4796 ;; Error handling.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4797 (when (re-search-forward "\\S-" (tramp-compat-line-end-position) t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4798 (error nil)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4799 (error (tramp-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4800 vec 'file-error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4801 "`%s' does not return a valid Lisp expression: `%s'"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4802 command (buffer-string))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4803
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4804 (defun tramp-mode-string-to-int (mode-string)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4805 "Converts a ten-letter `drwxrwxrwx'-style mode string into mode bits."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4806 (let* (case-fold-search
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4807 (mode-chars (string-to-vector mode-string))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4808 (owner-read (aref mode-chars 1))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4809 (owner-write (aref mode-chars 2))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4810 (owner-execute-or-setid (aref mode-chars 3))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4811 (group-read (aref mode-chars 4))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4812 (group-write (aref mode-chars 5))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4813 (group-execute-or-setid (aref mode-chars 6))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4814 (other-read (aref mode-chars 7))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4815 (other-write (aref mode-chars 8))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4816 (other-execute-or-sticky (aref mode-chars 9)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4817 (save-match-data
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4818 (logior
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4819 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4820 ((char-equal owner-read ?r) (tramp-compat-octal-to-decimal "00400"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4821 ((char-equal owner-read ?-) 0)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4822 (t (error "Second char `%c' must be one of `r-'" owner-read)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4823 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4824 ((char-equal owner-write ?w) (tramp-compat-octal-to-decimal "00200"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4825 ((char-equal owner-write ?-) 0)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4826 (t (error "Third char `%c' must be one of `w-'" owner-write)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4827 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4828 ((char-equal owner-execute-or-setid ?x)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4829 (tramp-compat-octal-to-decimal "00100"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4830 ((char-equal owner-execute-or-setid ?S)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4831 (tramp-compat-octal-to-decimal "04000"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4832 ((char-equal owner-execute-or-setid ?s)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4833 (tramp-compat-octal-to-decimal "04100"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4834 ((char-equal owner-execute-or-setid ?-) 0)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4835 (t (error "Fourth char `%c' must be one of `xsS-'"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4836 owner-execute-or-setid)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4837 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4838 ((char-equal group-read ?r) (tramp-compat-octal-to-decimal "00040"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4839 ((char-equal group-read ?-) 0)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4840 (t (error "Fifth char `%c' must be one of `r-'" group-read)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4841 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4842 ((char-equal group-write ?w) (tramp-compat-octal-to-decimal "00020"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4843 ((char-equal group-write ?-) 0)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4844 (t (error "Sixth char `%c' must be one of `w-'" group-write)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4845 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4846 ((char-equal group-execute-or-setid ?x)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4847 (tramp-compat-octal-to-decimal "00010"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4848 ((char-equal group-execute-or-setid ?S)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4849 (tramp-compat-octal-to-decimal "02000"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4850 ((char-equal group-execute-or-setid ?s)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4851 (tramp-compat-octal-to-decimal "02010"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4852 ((char-equal group-execute-or-setid ?-) 0)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4853 (t (error "Seventh char `%c' must be one of `xsS-'"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4854 group-execute-or-setid)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4855 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4856 ((char-equal other-read ?r)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4857 (tramp-compat-octal-to-decimal "00004"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4858 ((char-equal other-read ?-) 0)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4859 (t (error "Eighth char `%c' must be one of `r-'" other-read)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4860 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4861 ((char-equal other-write ?w) (tramp-compat-octal-to-decimal "00002"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4862 ((char-equal other-write ?-) 0)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4863 (t (error "Nineth char `%c' must be one of `w-'" other-write)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4864 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4865 ((char-equal other-execute-or-sticky ?x)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4866 (tramp-compat-octal-to-decimal "00001"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4867 ((char-equal other-execute-or-sticky ?T)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4868 (tramp-compat-octal-to-decimal "01000"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4869 ((char-equal other-execute-or-sticky ?t)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4870 (tramp-compat-octal-to-decimal "01001"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4871 ((char-equal other-execute-or-sticky ?-) 0)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4872 (t (error "Tenth char `%c' must be one of `xtT-'"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4873 other-execute-or-sticky)))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4874
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4875 (defun tramp-convert-file-attributes (vec attr)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4876 "Convert file-attributes ATTR generated by perl script, stat or ls.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4877 Convert file mode bits to string and set virtual device number.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4878 Return ATTR."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4879 (when attr
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4880 ;; Convert last access time.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4881 (unless (listp (nth 4 attr))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4882 (setcar (nthcdr 4 attr)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4883 (list (floor (nth 4 attr) 65536)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4884 (floor (mod (nth 4 attr) 65536)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4885 ;; Convert last modification time.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4886 (unless (listp (nth 5 attr))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4887 (setcar (nthcdr 5 attr)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4888 (list (floor (nth 5 attr) 65536)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4889 (floor (mod (nth 5 attr) 65536)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4890 ;; Convert last status change time.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4891 (unless (listp (nth 6 attr))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4892 (setcar (nthcdr 6 attr)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4893 (list (floor (nth 6 attr) 65536)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4894 (floor (mod (nth 6 attr) 65536)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4895 ;; Convert file size.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4896 (when (< (nth 7 attr) 0)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4897 (setcar (nthcdr 7 attr) -1))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4898 (when (and (floatp (nth 7 attr))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4899 (<= (nth 7 attr) (tramp-compat-most-positive-fixnum)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4900 (setcar (nthcdr 7 attr) (round (nth 7 attr))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4901 ;; Convert file mode bits to string.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4902 (unless (stringp (nth 8 attr))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4903 (setcar (nthcdr 8 attr) (tramp-file-mode-from-int (nth 8 attr)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4904 (when (stringp (car attr))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4905 (aset (nth 8 attr) 0 ?l)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4906 ;; Convert directory indication bit.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4907 (when (string-match "^d" (nth 8 attr))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4908 (setcar attr t))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4909 ;; Convert symlink from `tramp-do-file-attributes-with-stat'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4910 (when (consp (car attr))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4911 (if (and (stringp (caar attr))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4912 (string-match ".+ -> .\\(.+\\)." (caar attr)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4913 (setcar attr (match-string 1 (caar attr)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4914 (setcar attr nil)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4915 ;; Set file's gid change bit.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4916 (setcar (nthcdr 9 attr)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4917 (if (numberp (nth 3 attr))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4918 (not (= (nth 3 attr)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4919 (tramp-get-remote-gid vec 'integer)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4920 (not (string-equal
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4921 (nth 3 attr)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4922 (tramp-get-remote-gid vec 'string)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4923 ;; Convert inode.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4924 (unless (listp (nth 10 attr))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4925 (setcar (nthcdr 10 attr)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4926 (condition-case nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4927 (cons (floor (nth 10 attr) 65536)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4928 (floor (mod (nth 10 attr) 65536)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4929 ;; Inodes can be incredible huge. We must hide this.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4930 (error (tramp-get-inode vec)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4931 ;; Set virtual device number.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4932 (setcar (nthcdr 11 attr)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4933 (tramp-get-device vec))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4934 attr))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4935
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4936 (defun tramp-check-cached-permissions (vec access)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4937 "Check `file-attributes' caches for VEC.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4938 Return t if according to the cache access type ACCESS is known to
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4939 be granted."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4940 (let ((result nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4941 (offset (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4942 ((eq ?r access) 1)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4943 ((eq ?w access) 2)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4944 ((eq ?x access) 3))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4945 (dolist (suffix '("string" "integer") result)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4946 (setq
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4947 result
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4948 (or
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4949 result
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4950 (let ((file-attr
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4951 (tramp-get-file-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4952 vec (tramp-file-name-localname vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4953 (concat "file-attributes-" suffix) nil))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4954 (remote-uid
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4955 (tramp-get-connection-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4956 vec (concat "uid-" suffix) nil))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4957 (remote-gid
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4958 (tramp-get-connection-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4959 vec (concat "gid-" suffix) nil)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4960 (and
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4961 file-attr
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4962 (or
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4963 ;; Not a symlink
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4964 (eq t (car file-attr))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4965 (null (car file-attr)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4966 (or
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4967 ;; World accessible.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4968 (eq access (aref (nth 8 file-attr) (+ offset 6)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4969 ;; User accessible and owned by user.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4970 (and
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4971 (eq access (aref (nth 8 file-attr) offset))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4972 (equal remote-uid (nth 2 file-attr)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4973 ;; Group accessible and owned by user's
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4974 ;; principal group.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4975 (and
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4976 (eq access (aref (nth 8 file-attr) (+ offset 3)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4977 (equal remote-gid (nth 3 file-attr)))))))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4978
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4979 (defun tramp-file-mode-from-int (mode)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4980 "Turn an integer representing a file mode into an ls(1)-like string."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4981 (let ((type (cdr
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4982 (assoc (logand (lsh mode -12) 15) tramp-file-mode-type-map)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4983 (user (logand (lsh mode -6) 7))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4984 (group (logand (lsh mode -3) 7))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4985 (other (logand (lsh mode -0) 7))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4986 (suid (> (logand (lsh mode -9) 4) 0))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4987 (sgid (> (logand (lsh mode -9) 2) 0))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4988 (sticky (> (logand (lsh mode -9) 1) 0)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4989 (setq user (tramp-file-mode-permissions user suid "s"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4990 (setq group (tramp-file-mode-permissions group sgid "s"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4991 (setq other (tramp-file-mode-permissions other sticky "t"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4992 (concat type user group other)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4993
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4994 (defun tramp-file-mode-permissions (perm suid suid-text)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4995 "Convert a permission bitset into a string.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4996 This is used internally by `tramp-file-mode-from-int'."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4997 (let ((r (> (logand perm 4) 0))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4998 (w (> (logand perm 2) 0))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
4999 (x (> (logand perm 1) 0)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5000 (concat (or (and r "r") "-")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5001 (or (and w "w") "-")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5002 (or (and suid x suid-text) ; suid, execute
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5003 (and suid (upcase suid-text)) ; suid, !execute
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5004 (and x "x") "-")))) ; !suid
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5005
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5006 (defun tramp-shell-case-fold (string)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5007 "Converts STRING to shell glob pattern which ignores case."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5008 (mapconcat
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5009 (lambda (c)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5010 (if (equal (downcase c) (upcase c))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5011 (vector c)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5012 (format "[%c%c]" (downcase c) (upcase c))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5013 string
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5014 ""))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5015
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5016 (defun tramp-make-copy-program-file-name (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5017 "Create a file name suitable to be passed to `rcp' and workalikes."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5018 (let ((user (tramp-file-name-user vec))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5019 (host (tramp-file-name-real-host vec))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5020 (localname (tramp-shell-quote-argument
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5021 (tramp-file-name-localname vec))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5022 (if (not (zerop (length user)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5023 (format "%s@%s:%s" user host localname)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5024 (format "%s:%s" host localname))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5025
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5026 (defun tramp-method-out-of-band-p (vec size)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5027 "Return t if this is an out-of-band method, nil otherwise."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5028 (and
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5029 ;; It shall be an out-of-band method.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5030 (tramp-get-method-parameter (tramp-file-name-method vec) 'tramp-copy-program)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5031 ;; Either the file size is large enough, or (in rare cases) there
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5032 ;; does not exist a remote encoding.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5033 (or (null tramp-copy-size-limit)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5034 (> size tramp-copy-size-limit)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5035 (null (tramp-get-inline-coding vec "remote-encoding" size)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5036
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5037 (defun tramp-local-host-p (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5038 "Return t if this points to the local host, nil otherwise."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5039 ;; We cannot use `tramp-file-name-real-host'. A port is an
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5040 ;; indication for an ssh tunnel or alike.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5041 (let ((host (tramp-file-name-host vec)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5042 (and
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5043 (stringp host)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5044 (string-match tramp-local-host-regexp host)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5045 ;; The method shall be applied to one of the shell file name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5046 ;; handler. `tramp-local-host-p' is also called for "smb" and
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5047 ;; alike, where it must fail.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5048 (tramp-get-method-parameter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5049 (tramp-file-name-method vec) 'tramp-login-program)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5050 ;; The local temp directory must be writable for the other user.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5051 (file-writable-p
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5052 (tramp-make-tramp-file-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5053 (tramp-file-name-method vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5054 (tramp-file-name-user vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5055 host
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5056 (tramp-compat-temporary-file-directory)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5057 ;; On some systems, chown runs only for root.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5058 (or (zerop (user-uid))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5059 (zerop (tramp-get-remote-uid vec 'integer))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5060
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5061 ;; Variables local to connection.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5062
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5063 (defun tramp-get-remote-path (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5064 (with-connection-property
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5065 ;; When `tramp-own-remote-path' is in `tramp-remote-path', we
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5066 ;; cache the result for the session only. Otherwise, the result
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5067 ;; is cached persistently.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5068 (if (memq 'tramp-own-remote-path tramp-remote-path)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5069 (tramp-get-connection-process vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5070 vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5071 "remote-path"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5072 (let* ((remote-path (copy-tree tramp-remote-path))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5073 (elt1 (memq 'tramp-default-remote-path remote-path))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5074 (elt2 (memq 'tramp-own-remote-path remote-path))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5075 (default-remote-path
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5076 (when elt1
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5077 (condition-case nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5078 (tramp-send-command-and-read
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5079 vec "echo \\\"`getconf PATH`\\\"")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5080 ;; Default if "getconf" is not available.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5081 (error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5082 (tramp-message
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5083 vec 3
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5084 "`getconf PATH' not successful, using default value \"%s\"."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5085 "/bin:/usr/bin")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5086 "/bin:/usr/bin"))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5087 (own-remote-path
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5088 (when elt2
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5089 (condition-case nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5090 (tramp-send-command-and-read vec "echo \\\"$PATH\\\"")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5091 ;; Default if "getconf" is not available.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5092 (error
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5093 (tramp-message
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5094 vec 3 "$PATH not set, ignoring `tramp-own-remote-path'.")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5095 nil)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5096
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5097 ;; Replace place holder `tramp-default-remote-path'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5098 (when elt1
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5099 (setcdr elt1
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5100 (append
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5101 (tramp-compat-split-string default-remote-path ":")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5102 (cdr elt1)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5103 (setq remote-path (delq 'tramp-default-remote-path remote-path)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5104
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5105 ;; Replace place holder `tramp-own-remote-path'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5106 (when elt2
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5107 (setcdr elt2
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5108 (append
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5109 (tramp-compat-split-string own-remote-path ":")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5110 (cdr elt2)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5111 (setq remote-path (delq 'tramp-own-remote-path remote-path)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5112
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5113 ;; Remove double entries.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5114 (setq elt1 remote-path)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5115 (while (consp elt1)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5116 (while (and (car elt1) (setq elt2 (member (car elt1) (cdr elt1))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5117 (setcar elt2 nil))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5118 (setq elt1 (cdr elt1)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5119
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5120 ;; Remove non-existing directories.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5121 (delq
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5122 nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5123 (mapcar
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5124 (lambda (x)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5125 (and
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5126 (stringp x)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5127 (file-directory-p
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5128 (tramp-make-tramp-file-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5129 (tramp-file-name-method vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5130 (tramp-file-name-user vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5131 (tramp-file-name-host vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5132 x))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5133 x))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5134 remote-path)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5135
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5136 (defun tramp-get-remote-tmpdir (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5137 (with-connection-property vec "tmp-directory"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5138 (let ((dir (tramp-shell-quote-argument "/tmp")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5139 (if (and (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5140 vec (format "%s -d %s" (tramp-get-test-command vec) dir))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5141 (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5142 vec (format "%s -w %s" (tramp-get-test-command vec) dir)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5143 dir
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5144 (tramp-error vec 'file-error "Directory %s not accessible" dir)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5145
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5146 (defun tramp-make-tramp-temp-file (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5147 "Create a temporary file on the remote host identified by VEC.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5148 Return the local name of the temporary file."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5149 (let ((prefix
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5150 (tramp-make-tramp-file-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5151 (tramp-file-name-method vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5152 (tramp-file-name-user vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5153 (tramp-file-name-host vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5154 (tramp-drop-volume-letter
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5155 (expand-file-name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5156 tramp-temp-name-prefix (tramp-get-remote-tmpdir vec)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5157 result)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5158 (while (not result)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5159 ;; `make-temp-file' would be the natural choice for
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5160 ;; implementation. But it calls `write-region' internally,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5161 ;; which also needs a temporary file - we would end in an
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5162 ;; infinite loop.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5163 (setq result (make-temp-name prefix))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5164 (if (file-exists-p result)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5165 (setq result nil)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5166 ;; This creates the file by side effect.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5167 (set-file-times result)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5168 (set-file-modes result (tramp-compat-octal-to-decimal "0700"))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5169
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5170 ;; Return the local part.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5171 (with-parsed-tramp-file-name result nil localname)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5172
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5173 (defun tramp-get-ls-command (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5174 (with-connection-property vec "ls"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5175 (tramp-message vec 5 "Finding a suitable `ls' command")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5176 (or
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5177 (catch 'ls-found
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5178 (dolist (cmd '("ls" "gnuls" "gls"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5179 (let ((dl (tramp-get-remote-path vec))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5180 result)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5181 (while (and dl (setq result (tramp-find-executable vec cmd dl t t)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5182 ;; Check parameters. On busybox, "ls" output coloring is
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5183 ;; enabled by default sometimes. So we try to disable it
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5184 ;; when possible. $LS_COLORING is not supported there.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5185 ;; Some "ls" versions are sensible wrt the order of
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5186 ;; arguments, they fail when "-al" is after the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5187 ;; "--color=never" argument (for example on FreeBSD).
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5188 (when (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5189 vec (format "%s -lnd /" result))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5190 (when (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5191 vec (format
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5192 "%s --color=never -al /dev/null" result))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5193 (setq result (concat result " --color=never")))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5194 (throw 'ls-found result))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5195 (setq dl (cdr dl))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5196 (tramp-error vec 'file-error "Couldn't find a proper `ls' command"))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5197
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5198 (defun tramp-get-ls-command-with-dired (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5199 (save-match-data
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5200 (with-connection-property vec "ls-dired"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5201 (tramp-message vec 5 "Checking, whether `ls --dired' works")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5202 ;; Some "ls" versions are sensible wrt the order of arguments,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5203 ;; they fail when "-al" is after the "--dired" argument (for
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5204 ;; example on FreeBSD).
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5205 (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5206 vec (format "%s --dired -al /dev/null" (tramp-get-ls-command vec))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5207
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5208 (defun tramp-get-test-command (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5209 (with-connection-property vec "test"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5210 (tramp-message vec 5 "Finding a suitable `test' command")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5211 (if (tramp-send-command-and-check vec "test 0")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5212 "test"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5213 (tramp-find-executable vec "test" (tramp-get-remote-path vec)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5214
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5215 (defun tramp-get-test-nt-command (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5216 ;; Does `test A -nt B' work? Use abominable `find' construct if it
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5217 ;; doesn't. BSD/OS 4.0 wants the parentheses around the command,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5218 ;; for otherwise the shell crashes.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5219 (with-connection-property vec "test-nt"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5220 (or
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5221 (progn
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5222 (tramp-send-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5223 vec (format "( %s / -nt / )" (tramp-get-test-command vec)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5224 (with-current-buffer (tramp-get-buffer vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5225 (goto-char (point-min))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5226 (when (looking-at (regexp-quote tramp-end-of-output))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5227 (format "%s %%s -nt %%s" (tramp-get-test-command vec)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5228 (progn
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5229 (tramp-send-command
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5230 vec
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5231 (format
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5232 "tramp_test_nt () {\n%s -n \"`find $1 -prune -newer $2 -print`\"\n}"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5233 (tramp-get-test-command vec)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5234 "tramp_test_nt %s %s"))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5235
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5236 (defun tramp-get-file-exists-command (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5237 (with-connection-property vec "file-exists"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5238 (tramp-message vec 5 "Finding command to check if file exists")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5239 (tramp-find-file-exists-command vec)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5240
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5241 (defun tramp-get-remote-ln (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5242 (with-connection-property vec "ln"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5243 (tramp-message vec 5 "Finding a suitable `ln' command")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5244 (tramp-find-executable vec "ln" (tramp-get-remote-path vec))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5245
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5246 (defun tramp-get-remote-perl (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5247 (with-connection-property vec "perl"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5248 (tramp-message vec 5 "Finding a suitable `perl' command")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5249 (let ((result
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5250 (or (tramp-find-executable vec "perl5" (tramp-get-remote-path vec))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5251 (tramp-find-executable
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5252 vec "perl" (tramp-get-remote-path vec)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5253 ;; We must check also for some Perl modules.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5254 (when result
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5255 (with-connection-property vec "perl-file-spec"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5256 (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5257 vec (format "%s -e 'use File::Spec;'" result)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5258 (with-connection-property vec "perl-cwd-realpath"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5259 (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5260 vec (format "%s -e 'use Cwd \"realpath\";'" result))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5261 result)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5262
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5263 (defun tramp-get-remote-stat (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5264 (with-connection-property vec "stat"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5265 (tramp-message vec 5 "Finding a suitable `stat' command")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5266 (let ((result (tramp-find-executable
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5267 vec "stat" (tramp-get-remote-path vec)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5268 tmp)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5269 ;; Check whether stat(1) returns usable syntax. %s does not
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5270 ;; work on older AIX systems.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5271 (when result
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5272 (setq tmp
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5273 ;; We don't want to display an error message.
|
110374
|
5274 (tramp-compat-with-temp-message (or (current-message) "")
|
110321
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5275 (ignore-errors
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5276 (tramp-send-command-and-read
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5277 vec (format "%s -c '(\"%%N\" %%s)' /" result)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5278 (unless (and (listp tmp) (stringp (car tmp))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5279 (string-match "^./.$" (car tmp))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5280 (integerp (cadr tmp)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5281 (setq result nil)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5282 result)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5283
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5284 (defun tramp-get-remote-readlink (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5285 (with-connection-property vec "readlink"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5286 (tramp-message vec 5 "Finding a suitable `readlink' command")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5287 (let ((result (tramp-find-executable
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5288 vec "readlink" (tramp-get-remote-path vec))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5289 (when (and result
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5290 ;; We don't want to display an error message.
|
110374
|
5291 (tramp-compat-with-temp-message (or (current-message) "")
|
110321
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5292 (ignore-errors
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5293 (tramp-send-command-and-check
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5294 vec (format "%s --canonicalize-missing /" result)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5295 result))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5296
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5297 (defun tramp-get-remote-trash (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5298 (with-connection-property vec "trash"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5299 (tramp-message vec 5 "Finding a suitable `trash' command")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5300 (tramp-find-executable vec "trash" (tramp-get-remote-path vec))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5301
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5302 (defun tramp-get-remote-id (vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5303 (with-connection-property vec "id"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5304 (tramp-message vec 5 "Finding POSIX `id' command")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5305 (or
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5306 (catch 'id-found
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5307 (let ((dl (tramp-get-remote-path vec))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5308 result)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5309 (while (and dl (setq result (tramp-find-executable vec "id" dl t t)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5310 ;; Check POSIX parameter.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5311 (when (tramp-send-command-and-check vec (format "%s -u" result))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5312 (throw 'id-found result))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5313 (setq dl (cdr dl)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5314 (tramp-error vec 'file-error "Couldn't find a POSIX `id' command"))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5315
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5316 (defun tramp-get-remote-uid (vec id-format)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5317 (with-connection-property vec (format "uid-%s" id-format)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5318 (let ((res (tramp-send-command-and-read
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5319 vec
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5320 (format "%s -u%s %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5321 (tramp-get-remote-id vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5322 (if (equal id-format 'integer) "" "n")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5323 (if (equal id-format 'integer)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5324 "" "| sed -e s/^/\\\"/ -e s/\$/\\\"/")))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5325 ;; The command might not always return a number.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5326 (if (and (equal id-format 'integer) (not (integerp res))) -1 res))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5327
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5328 (defun tramp-get-remote-gid (vec id-format)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5329 (with-connection-property vec (format "gid-%s" id-format)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5330 (let ((res (tramp-send-command-and-read
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5331 vec
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5332 (format "%s -g%s %s"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5333 (tramp-get-remote-id vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5334 (if (equal id-format 'integer) "" "n")
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5335 (if (equal id-format 'integer)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5336 "" "| sed -e s/^/\\\"/ -e s/\$/\\\"/")))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5337 ;; The command might not always return a number.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5338 (if (and (equal id-format 'integer) (not (integerp res))) -1 res))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5339
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5340 (defun tramp-get-local-uid (id-format)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5341 (if (equal id-format 'integer) (user-uid) (user-login-name)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5342
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5343 (defun tramp-get-local-gid (id-format)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5344 (nth 3 (tramp-compat-file-attributes "~/" id-format)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5345
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5346 ;; Some predefined connection properties.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5347 (defun tramp-get-inline-compress (vec prop size)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5348 "Return the compress command related to PROP.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5349 PROP is either `inline-compress' or `inline-decompress'. SIZE is
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5350 the length of the file to be compressed.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5351
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5352 If no corresponding command is found, nil is returned."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5353 (when (and (integerp tramp-inline-compress-start-size)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5354 (> size tramp-inline-compress-start-size))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5355 (with-connection-property vec prop
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5356 (tramp-find-inline-compress vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5357 (tramp-get-connection-property vec prop nil))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5358
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5359 (defun tramp-get-inline-coding (vec prop size)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5360 "Return the coding command related to PROP.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5361 PROP is either `remote-encoding', `remode-decoding',
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5362 `local-encoding' or `local-decoding'.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5363
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5364 SIZE is the length of the file to be coded. Depending on SIZE,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5365 compression might be applied.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5366
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5367 If no corresponding command is found, nil is returned.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5368 Otherwise, either a string is returned which contains a `%s' mark
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5369 to be used for the respective input or output file; or a Lisp
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5370 function cell is returned to be applied on a buffer."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5371 (let ((coding
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5372 (with-connection-property vec prop
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5373 (tramp-find-inline-encoding vec)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5374 (tramp-get-connection-property vec prop nil)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5375 (prop1 (if (string-match "encoding" prop)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5376 "inline-compress" "inline-decompress"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5377 compress)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5378 ;; The connection property might have been cached. So we must send
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5379 ;; the script to the remote side - maybe.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5380 (when (and coding (symbolp coding) (string-match "remote" prop))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5381 (let ((name (symbol-name coding)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5382 (while (string-match (regexp-quote "-") name)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5383 (setq name (replace-match "_" nil t name)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5384 (tramp-maybe-send-script vec (symbol-value coding) name)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5385 (setq coding name)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5386 (when coding
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5387 ;; Check for the `compress' command.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5388 (setq compress (tramp-get-inline-compress vec prop1 size))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5389 ;; Return the value.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5390 (cond
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5391 ((and compress (symbolp coding))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5392 (if (string-match "decompress" prop1)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5393 `(lambda (beg end)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5394 (,coding beg end)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5395 (let ((coding-system-for-write 'binary)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5396 (coding-system-for-read 'binary))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5397 (apply
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5398 'call-process-region (point-min) (point-max)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5399 (car (split-string ,compress)) t t nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5400 (cdr (split-string ,compress)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5401 `(lambda (beg end)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5402 (let ((coding-system-for-write 'binary)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5403 (coding-system-for-read 'binary))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5404 (apply
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5405 'call-process-region beg end
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5406 (car (split-string ,compress)) t t nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5407 (cdr (split-string ,compress))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5408 (,coding (point-min) (point-max)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5409 ((symbolp coding)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5410 coding)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5411 ((and compress (string-match "decoding" prop))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5412 (format "(%s | %s >%%s)" coding compress))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5413 (compress
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5414 (format "(%s <%%s | %s)" compress coding))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5415 ((string-match "decoding" prop)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5416 (format "%s >%%s" coding))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5417 (t
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5418 (format "%s <%%s" coding))))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5419
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5420 ;;; Integration of eshell.el:
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5421
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5422 (eval-when-compile
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5423 (defvar eshell-path-env))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5424
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5425 ;; eshell.el keeps the path in `eshell-path-env'. We must change it
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5426 ;; when `default-directory' points to another host.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5427 (defun tramp-eshell-directory-change ()
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5428 "Set `eshell-path-env' to $PATH of the host related to `default-directory'."
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5429 (setq eshell-path-env
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5430 (if (file-remote-p default-directory)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5431 (with-parsed-tramp-file-name default-directory nil
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5432 (mapconcat
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5433 'identity
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5434 (tramp-get-remote-path v)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5435 ":"))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5436 (getenv "PATH"))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5437
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5438 (eval-after-load "esh-util"
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5439 '(progn
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5440 (tramp-eshell-directory-change)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5441 (add-hook 'eshell-directory-change-hook
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5442 'tramp-eshell-directory-change)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5443 (add-hook 'tramp-unload-hook
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5444 (lambda ()
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5445 (remove-hook 'eshell-directory-change-hook
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5446 'tramp-eshell-directory-change)))))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5447
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5448 (add-hook 'tramp-unload-hook
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5449 (lambda ()
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5450 (unload-feature 'tramp-sh 'force)))
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5451
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5452 (provide 'tramp-sh)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5453
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5454 ;;; TODO:
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5455
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5456 ;; * Don't use globbing for directories with many files, as this is
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5457 ;; likely to produce long command lines, and some shells choke on
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5458 ;; long command lines.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5459 ;; * Make it work for different encodings, and for different file name
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5460 ;; encodings, too. (Daniel Pittman)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5461 ;; * Don't search for perl5 and perl. Instead, only search for perl and
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5462 ;; then look if it's the right version (with `perl -v').
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5463 ;; * When editing a remote CVS controlled file as a different user, VC
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5464 ;; gets confused about the file locking status. Try to find out why
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5465 ;; the workaround doesn't work.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5466 ;; * Allow out-of-band methods as _last_ multi-hop. Open a connection
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5467 ;; until the last but one hop via `start-file-process'. Apply it
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5468 ;; also for ftp and smb.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5469 ;; * WIBNI if we had a command "trampclient"? If I was editing in
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5470 ;; some shell with root priviledges, it would be nice if I could
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5471 ;; just call
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5472 ;; trampclient filename.c
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5473 ;; as an editor, and the _current_ shell would connect to an Emacs
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5474 ;; server and would be used in an existing non-priviledged Emacs
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5475 ;; session for doing the editing in question.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5476 ;; That way, I need not tell Emacs my password again and be afraid
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5477 ;; that it makes it into core dumps or other ugly stuff (I had Emacs
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5478 ;; once display a just typed password in the context of a keyboard
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5479 ;; sequence prompt for a question immediately following in a shell
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5480 ;; script run within Emacs -- nasty).
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5481 ;; And if I have some ssh session running to a different computer,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5482 ;; having the possibility of passing a local file there to a local
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5483 ;; Emacs session (in case I can arrange for a connection back) would
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5484 ;; be nice.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5485 ;; Likely the corresponding Tramp server should not allow the
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5486 ;; equivalent of the emacsclient -eval option in order to make this
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5487 ;; reasonably unproblematic. And maybe trampclient should have some
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5488 ;; way of passing credentials, like by using an SSL socket or
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5489 ;; something. (David Kastrup)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5490 ;; * Reconnect directly to a compliant shell without first going
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5491 ;; through the user's default shell. (Pete Forman)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5492 ;; * How can I interrupt the remote process with a signal
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5493 ;; (interrupt-process seems not to work)? (Markus Triska)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5494 ;; * Avoid the local shell entirely for starting remote processes. If
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5495 ;; so, I think even a signal, when delivered directly to the local
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5496 ;; SSH instance, would correctly be propagated to the remote process
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5497 ;; automatically; possibly SSH would have to be started with
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5498 ;; "-t". (Markus Triska)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5499 ;; * It makes me wonder if tramp couldn't fall back to ssh when scp
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5500 ;; isn't on the remote host. (Mark A. Hershberger)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5501 ;; * Use lsh instead of ssh. (Alfred M. Szmidt)
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5502 ;; * Optimize out-of-band copying, when both methods are scp-like (not
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5503 ;; rsync).
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5504 ;; * Keep a second connection open for out-of-band methods like scp or
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5505 ;; rsync.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5506 ;; * Try telnet+curl as new method. It might be useful for busybox,
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5507 ;; without built-in uuencode/uudecode.
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5508
|
4b26adbef9a2
Major code cleanup. Split tramp.el into tramp.el and tramp-sh.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
diff
changeset
|
5509 ;;; tramp-sh.el ends here
|