annotate lisp/net/tramp.el @ 109449:333d4b14e6cb

* net/tramp.el (tramp-get-ls-command-with-dired): Make test for "--dired" stronger.
author Michael Albinus <albinus@detlef>
date Sat, 17 Jul 2010 10:44:59 +0200
parents 9e514d1076b4
children 0366d395e7e6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
50338
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1 ;;; tramp.el --- Transparent Remote Access, Multiple Protocol
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2
64701
34bd8e434dd7 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64559
diff changeset
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 106643
diff changeset
4 ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5
75361
9cc44485654f (tramp-perl-encode, tramp-perl-decode): Update copyrights.
Glenn Morris <rgm@gnu.org>
parents: 75194
diff changeset
6 ;; (copyright statements below in code to be updated with the above notice)
9cc44485654f (tramp-perl-encode, tramp-perl-decode): Update copyrights.
Glenn Morris <rgm@gnu.org>
parents: 75194
diff changeset
7
93103
19a32f437b65 Fix up encoding.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 93082
diff changeset
8 ;; Author: Kai Großjohann <kai.grossjohann@gmx.net>
64772
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
9 ;; Michael Albinus <michael.albinus@gmx.de>
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
10 ;; Keywords: comm, processes
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
11
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
12 ;; This file is part of GNU Emacs.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
13
94677
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94436
diff changeset
14 ;; GNU Emacs is free software: you can redistribute it and/or modify
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
15 ;; it under the terms of the GNU General Public License as published by
94677
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94436
diff changeset
16 ;; the Free Software Foundation, either version 3 of the License, or
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94436
diff changeset
17 ;; (at your option) any later version.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
18
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
19 ;; GNU Emacs is distributed in the hope that it will be useful,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
22 ;; GNU General Public License for more details.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
23
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
24 ;; You should have received a copy of the GNU General Public License
94677
91e5880a36c1 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94436
diff changeset
25 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
26
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
27 ;;; Commentary:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
28
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
29 ;; This package provides remote file editing, similar to ange-ftp.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
30 ;; The difference is that ange-ftp uses FTP to transfer files between
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
31 ;; the local and the remote host, whereas tramp.el uses a combination
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
32 ;; of rsh and rcp or other work-alike programs, such as ssh/scp.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
33 ;;
50338
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
34 ;; For more detailed instructions, please see the info file.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
35 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
36 ;; Notes:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
37 ;; -----
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
38 ;;
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
39 ;; This package only works for Emacs 22.1 and higher, and for XEmacs 21.4
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
40 ;; and higher. For XEmacs 21, you need the package `fsf-compat' for
106643
9e3bbd77797c * net/tramp.el (tramp-handle-insert-directory): Quote "'" in the
Michael Albinus <michael.albinus@gmx.de>
parents: 106613
diff changeset
41 ;; the `with-timeout' macro.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
42 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
43 ;; Also see the todo list at the bottom of this file.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
44 ;;
50338
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
45 ;; The current version of Tramp can be retrieved from the following URL:
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
46 ;; http://ftp.gnu.org/gnu/tramp/
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
47 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
48 ;; There's a mailing list for this, as well. Its name is:
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
49 ;; tramp-devel@gnu.org
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
50 ;; You can use the Web to subscribe, under the following URL:
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
51 ;; http://lists.gnu.org/mailman/listinfo/tramp-devel
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
52 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
53 ;; For the adventurous, the current development sources are available
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
54 ;; via CVS. You can find instructions about this at the following URL:
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
55 ;; http://savannah.gnu.org/projects/tramp/
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
56 ;; Click on "CVS" in the navigation bar near the top.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
57 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
58 ;; Don't forget to put on your asbestos longjohns, first!
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
59
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
60 ;;; Code:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
61
100216
9c5b974a0a5b * net/tramp.el (top): Write a message, when loading Tramp.
Michael Albinus <michael.albinus@gmx.de>
parents: 99950
diff changeset
62 ;; Since Emacs 23.1, loading messages have been disabled during
9c5b974a0a5b * net/tramp.el (top): Write a message, when loading Tramp.
Michael Albinus <michael.albinus@gmx.de>
parents: 99950
diff changeset
63 ;; autoload. However, loading Tramp takes a while, and it could
9c5b974a0a5b * net/tramp.el (top): Write a message, when loading Tramp.
Michael Albinus <michael.albinus@gmx.de>
parents: 99950
diff changeset
64 ;; happen while typing a filename in the minibuffer. Therefore, Tramp
9c5b974a0a5b * net/tramp.el (top): Write a message, when loading Tramp.
Michael Albinus <michael.albinus@gmx.de>
parents: 99950
diff changeset
65 ;; shall inform about.
9c5b974a0a5b * net/tramp.el (top): Write a message, when loading Tramp.
Michael Albinus <michael.albinus@gmx.de>
parents: 99950
diff changeset
66 (when (and load-in-progress (null (current-message)))
9c5b974a0a5b * net/tramp.el (top): Write a message, when loading Tramp.
Michael Albinus <michael.albinus@gmx.de>
parents: 99950
diff changeset
67 (message "Loading tramp..."))
9c5b974a0a5b * net/tramp.el (top): Write a message, when loading Tramp.
Michael Albinus <michael.albinus@gmx.de>
parents: 99950
diff changeset
68
50338
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
69 ;; The Tramp version number and bug report address, as prepared by configure.
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
70 (require 'trampver)
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
71 (add-hook 'tramp-unload-hook
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
72 (lambda ()
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
73 (when (featurep 'trampver)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
74 (unload-feature 'trampver 'force))))
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
75
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
76 (require 'tramp-compat)
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
77 (add-hook 'tramp-unload-hook
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
78 (lambda ()
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
79 (when (featurep 'tramp-compat)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
80 (unload-feature 'tramp-compat 'force))))
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
81
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
82 (require 'format-spec)
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
83 ;; As long as password.el is not part of (X)Emacs, it shouldn't
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
84 ;; be mandatory
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
85 (if (featurep 'xemacs)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
86 (load "password" 'noerror)
87040
dcdf399ba8a4 Require password-cache or password.
Glenn Morris <rgm@gnu.org>
parents: 86241
diff changeset
87 (or (require 'password-cache nil 'noerror)
dcdf399ba8a4 Require password-cache or password.
Glenn Morris <rgm@gnu.org>
parents: 86241
diff changeset
88 (require 'password nil 'noerror))) ; from No Gnus, also in tar ball
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
89
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
90 (require 'shell)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
91 (require 'advice)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
92
95067
e29bfedb7864 (top-level): Load auth-source when compiling.
Glenn Morris <rgm@gnu.org>
parents: 95050
diff changeset
93 (eval-and-compile
e29bfedb7864 (top-level): Load auth-source when compiling.
Glenn Morris <rgm@gnu.org>
parents: 95050
diff changeset
94 (if (featurep 'xemacs)
e29bfedb7864 (top-level): Load auth-source when compiling.
Glenn Morris <rgm@gnu.org>
parents: 95050
diff changeset
95 (load "auth-source" 'noerror)
e29bfedb7864 (top-level): Load auth-source when compiling.
Glenn Morris <rgm@gnu.org>
parents: 95050
diff changeset
96 (require 'auth-source nil 'noerror)))
95025
bdaea36b81dd * net/tramp.el: Load auth-source library.
Michael Albinus <michael.albinus@gmx.de>
parents: 94975
diff changeset
97
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
98 ;; Requiring 'tramp-cache results in an endless loop.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
99 (autoload 'tramp-get-file-property "tramp-cache")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
100 (autoload 'tramp-set-file-property "tramp-cache")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
101 (autoload 'tramp-flush-file-property "tramp-cache")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
102 (autoload 'tramp-flush-directory-property "tramp-cache")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
103 (autoload 'tramp-get-connection-property "tramp-cache")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
104 (autoload 'tramp-set-connection-property "tramp-cache")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
105 (autoload 'tramp-flush-connection-property "tramp-cache")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
106 (autoload 'tramp-parse-connection-properties "tramp-cache")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
107 (add-hook 'tramp-unload-hook
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
108 (lambda ()
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
109 (when (featurep 'tramp-cache)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
110 (unload-feature 'tramp-cache 'force))))
78887
8faf94b6c420 * net/tramp.el (tramp-completion-mode-p): Rename from
Michael Albinus <michael.albinus@gmx.de>
parents: 78489
diff changeset
111
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
112 (autoload 'tramp-uuencode-region "tramp-uu"
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
113 "Implementation of `uuencode' in Lisp.")
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
114 (add-hook 'tramp-unload-hook
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
115 (lambda ()
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
116 (when (featurep 'tramp-uu)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
117 (unload-feature 'tramp-uu 'force))))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
118
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
119 (autoload 'uudecode-decode-region "uudecode")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
120
87648
7ae99e295dfd * vc-git.el (vc-git--call): Apply `process-file' instead of
Michael Albinus <michael.albinus@gmx.de>
parents: 87368
diff changeset
121 ;; The following Tramp packages must be loaded after tramp.el, because
7ae99e295dfd * vc-git.el (vc-git--call): Apply `process-file' instead of
Michael Albinus <michael.albinus@gmx.de>
parents: 87368
diff changeset
122 ;; they require it as well.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
123 (eval-after-load "tramp"
85508
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
124 '(dolist
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
125 (feature
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
126 (list
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
127
87648
7ae99e295dfd * vc-git.el (vc-git--call): Apply `process-file' instead of
Michael Albinus <michael.albinus@gmx.de>
parents: 87368
diff changeset
128 ;; Tramp interactive commands.
85508
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
129 'tramp-cmds
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
130
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
131 ;; Load foreign FTP method.
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
132 (if (featurep 'xemacs) 'tramp-efs 'tramp-ftp)
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
133
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
134 ;; tramp-smb uses "smbclient" from Samba. Not available
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
135 ;; under Cygwin and Windows, because they don't offer
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
136 ;; "smbclient". And even not necessary there, because Emacs
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
137 ;; supports UNC file names like "//host/share/localname".
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
138 (unless (memq system-type '(cygwin windows-nt)) 'tramp-smb)
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
139
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
140 ;; Load foreign FISH method.
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
141 'tramp-fish
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
142
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
143 ;; tramp-gvfs needs D-Bus messages. Available since Emacs 23
104216
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
144 ;; on some system types. We don't call `dbus-ping', because
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
145 ;; this would load dbus.el.
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
146 (when (and (featurep 'dbusbind)
104143
49b412e99f1e * net/tramp.el (top): Make check for tramp-gvfs loading more
Michael Albinus <michael.albinus@gmx.de>
parents: 104137
diff changeset
147 (condition-case nil
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
148 (tramp-compat-funcall 'dbus-get-unique-name :session)
104143
49b412e99f1e * net/tramp.el (top): Make check for tramp-gvfs loading more
Michael Albinus <michael.albinus@gmx.de>
parents: 104137
diff changeset
149 (error nil))
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
150 (tramp-compat-process-running-p "gvfs-fuse-daemon"))
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
151 'tramp-gvfs)
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
152
85508
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
153 ;; Load gateways. It needs `make-network-process' from Emacs 22.
105248
ebd8445069df *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 104866
diff changeset
154 (when (functionp 'make-network-process) 'tramp-gw)
ebd8445069df *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 104866
diff changeset
155
ebd8445069df *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 104866
diff changeset
156 ;; tramp-imap needs both epa (from Emacs 23.1) and imap-hash
ebd8445069df *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 104866
diff changeset
157 ;; (from Emacs 23.2).
ebd8445069df *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 104866
diff changeset
158 (when (and (locate-library "epa") (locate-library "imap-hash"))
ebd8445069df *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 104866
diff changeset
159 'tramp-imap)))
85508
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
160
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
161 (when feature
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
162 ;; We have used just some basic tests, whether a package shall
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
163 ;; be added. There might still be other errors during loading,
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
164 ;; which we will catch here.
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
165 (catch 'tramp-loading
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
166 (require feature)
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
167 (add-hook 'tramp-unload-hook
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
168 `(lambda ()
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
169 (when (featurep (quote ,feature))
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
170 (unload-feature (quote ,feature) 'force)))))
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
171 (unless (featurep feature)
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
172 (message "Loading %s failed, ignoring this package" feature)))))
77986
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
173
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
174 ;;; User Customizable Internal Variables:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
175
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
176 (defgroup tramp nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
177 "Edit remote files with a combination of rsh and rcp or similar programs."
58005
f15a720d0f24 (tramp group): Add :version.
Richard M. Stallman <rms@gnu.org>
parents: 57995
diff changeset
178 :group 'files
107379
3c0cd76e49ff Fix last change to use existing comm Custom group instead of `net'.
Chong Yidong <cyd@stupidchicken.com>
parents: 107378
diff changeset
179 :group 'comm
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
180 :version "22.1")
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
181
94436
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
182 ;; Maybe we need once a real Tramp mode, with key bindings etc.
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
183 ;;;###autoload
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
184 (defcustom tramp-mode t
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
185 "*Whether Tramp is enabled.
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
186 If it is set to nil, all remote file names are used literally."
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
187 :group 'tramp
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
188 :type 'boolean)
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
189
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
190 (defcustom tramp-verbose 3
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
191 "*Verbosity level for Tramp messages.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
192 Any level x includes messages for all levels 1 .. x-1. The levels are
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
193
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
194 0 silent (no tramp messages at all)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
195 1 errors
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
196 2 warnings
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
197 3 connection to remote hosts (default level)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
198 4 activities
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
199 5 internal
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
200 6 sent and received strings
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
201 7 file caching
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
202 8 connection properties
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
203 10 traces (huge)."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
204 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
205 :type 'integer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
206
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
207 ;; Emacs case.
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
208 (eval-and-compile
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
209 (when (boundp 'backup-directory-alist)
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
210 (defcustom tramp-backup-directory-alist nil
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
211 "Alist of filename patterns and backup directory names.
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
212 Each element looks like (REGEXP . DIRECTORY), with the same meaning like
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
213 in `backup-directory-alist'. If a Tramp file is backed up, and DIRECTORY
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
214 is a local file name, the backup directory is prepended with Tramp file
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
215 name prefix \(method, user, host\) of file.
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
216
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
217 \(setq tramp-backup-directory-alist backup-directory-alist\)
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
218
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
219 gives the same backup policy for Tramp files on their hosts like the
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
220 policy for local files."
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
221 :group 'tramp
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
222 :type '(repeat (cons (regexp :tag "Regexp matching filename")
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
223 (directory :tag "Backup directory name"))))))
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
224
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
225 ;; XEmacs case. We cannot check for `bkup-backup-directory-info', because
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
226 ;; the package "backup-dir" might not be loaded yet.
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
227 (eval-and-compile
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
228 (when (featurep 'xemacs)
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
229 (defcustom tramp-bkup-backup-directory-info nil
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
230 "*Alist of (FILE-REGEXP BACKUP-DIR OPTIONS ...))
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
231 It has the same meaning like `bkup-backup-directory-info' from package
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
232 `backup-dir'. If a Tramp file is backed up, and BACKUP-DIR is a local
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
233 file name, the backup directory is prepended with Tramp file name prefix
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
234 \(method, user, host\) of file.
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
235
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
236 \(setq tramp-bkup-backup-directory-info bkup-backup-directory-info\)
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
237
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
238 gives the same backup policy for Tramp files on their hosts like the
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
239 policy for local files."
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
240 :type '(repeat
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
241 (list (regexp :tag "File regexp")
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
242 (string :tag "Backup Dir")
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
243 (set :inline t
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
244 (const ok-create)
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
245 (const full-path)
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
246 (const prepend-name)
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
247 (const search-upward))))
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
248 :group 'tramp)))
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
249
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
250 (defcustom tramp-auto-save-directory nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
251 "*Put auto-save files in this directory, if set.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
252 The idea is to use a local directory so that auto-saving is faster."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
253 :group 'tramp
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
254 :type '(choice (const nil) string))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
255
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
256 (defcustom tramp-encoding-shell
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
257 (if (memq system-type '(windows-nt))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
258 (getenv "COMSPEC")
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
259 "/bin/sh")
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
260 "*Use this program for encoding and decoding commands on the local host.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
261 This shell is used to execute the encoding and decoding command on the
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
262 local host, so if you want to use `~' in those commands, you should
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
263 choose a shell here which groks tilde expansion. `/bin/sh' normally
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
264 does not understand tilde expansion.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
265
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
266 For encoding and deocding, commands like the following are executed:
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
267
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
268 /bin/sh -c COMMAND < INPUT > OUTPUT
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
269
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
270 This variable can be used to change the \"/bin/sh\" part. See the
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
271 variable `tramp-encoding-command-switch' for the \"-c\" part.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
272
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
273 Note that this variable is not used for remote commands. There are
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
274 mechanisms in tramp.el which automatically determine the right shell to
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
275 use for the remote host."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
276 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
277 :type '(file :must-match t))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
278
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
279 (defcustom tramp-encoding-command-switch
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
280 (if (string-match "cmd\\.exe" tramp-encoding-shell)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
281 "/c"
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
282 "-c")
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
283 "*Use this switch together with `tramp-encoding-shell' for local commands.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
284 See the variable `tramp-encoding-shell' for more information."
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
285 :group 'tramp
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
286 :type 'string)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
287
108186
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
288 (defcustom tramp-inline-compress-start-size 4096
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
289 "*The minimum size of compressing where inline transfer.
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
290 When inline transfer, compress transfered data of file
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
291 whose size is this value or above (up to `tramp-copy-size-limit').
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
292 If it is nil, no compression at all will be applied."
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
293 :group 'tramp
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
294 :type '(choice (const nil) integer))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
295
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
296 (defcustom tramp-copy-size-limit 10240
108186
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
297 "*The maximum file size where inline copying is preferred over an out-of-the-band copy.
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
298 If it is nil, inline out-of-the-band copy will be used without a check."
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
299 :group 'tramp
108186
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
300 :type '(choice (const nil) integer))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
301
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
302 (defcustom tramp-terminal-type "dumb"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
303 "*Value of TERM environment variable for logging in to remote host.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
304 Because Tramp wants to parse the output of the remote shell, it is easily
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
305 confused by ANSI color escape sequences and suchlike. Often, shell init
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
306 files conditionalize this setup based on the TERM environment variable."
46584
f548d7d0c651 Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46347
diff changeset
307 :group 'tramp
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
308 :type 'string)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
309
106470
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
310 ;; ksh on OpenBSD 4.5 requires, that PS1 contains a `#' character for
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
311 ;; root users. It uses the `$' character for other users. In order
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
312 ;; to guarantee a proper prompt, we use "#$" for the prompt.
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
313
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
314 (defvar tramp-end-of-output
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
315 (format
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
316 "///%s#$"
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
317 (md5 (concat (prin1-to-string process-environment) (current-time-string))))
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
318 "String used to recognize end of output.
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
319 The '$' character at the end is quoted; the string cannot be
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
320 detected as prompt when being sent on echoing hosts, therefore.")
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
321
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
322 (defconst tramp-initial-end-of-output "#$ "
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
323 "Prompt when establishing a connection.")
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
324
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
325 (defvar tramp-methods
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
326 `(("rcp" (tramp-login-program "rsh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
327 (tramp-login-args (("%h") ("-l" "%u")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
328 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
329 (tramp-copy-program "rcp")
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
330 (tramp-copy-args (("-p" "%k") ("-r")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
331 (tramp-copy-keep-date t)
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
332 (tramp-copy-recursive t)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
333 (tramp-password-end-of-line nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
334 ("scp" (tramp-login-program "ssh")
108236
9fd9b1a102cd * net/tramp.el (tramp-methods): Remove "-q" from `tramp-login-args'
Michael Albinus <michael.albinus@gmx.de>
parents: 108186
diff changeset
335 (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p")
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
336 ("-e" "none")))
108702
a0b236a315d5 * net/tramp.el (tramp-methods): Add `tramp-async-args' attribute
Michael Albinus <albinus@detlef>
parents: 108540
diff changeset
337 (tramp-async-args (("-q")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
338 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
339 (tramp-copy-program "scp")
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
340 (tramp-copy-args (("-P" "%p") ("-p" "%k")
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
341 ("-q") ("-r")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
342 (tramp-copy-keep-date t)
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
343 (tramp-copy-recursive t)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
344 (tramp-password-end-of-line nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
345 (tramp-gw-args (("-o"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
346 "GlobalKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
347 ("-o" "UserKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
348 ("-o" "StrictHostKeyChecking=no")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
349 (tramp-default-port 22))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
350 ("scp1" (tramp-login-program "ssh")
108236
9fd9b1a102cd * net/tramp.el (tramp-methods): Remove "-q" from `tramp-login-args'
Michael Albinus <michael.albinus@gmx.de>
parents: 108186
diff changeset
351 (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p")
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
352 ("-1" "-e" "none")))
108702
a0b236a315d5 * net/tramp.el (tramp-methods): Add `tramp-async-args' attribute
Michael Albinus <albinus@detlef>
parents: 108540
diff changeset
353 (tramp-async-args (("-q")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
354 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
355 (tramp-copy-program "scp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
356 (tramp-copy-args (("-1") ("-P" "%p") ("-p" "%k")
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
357 ("-q") ("-r")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
358 (tramp-copy-keep-date t)
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
359 (tramp-copy-recursive t)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
360 (tramp-password-end-of-line nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
361 (tramp-gw-args (("-o"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
362 "GlobalKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
363 ("-o" "UserKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
364 ("-o" "StrictHostKeyChecking=no")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
365 (tramp-default-port 22))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
366 ("scp2" (tramp-login-program "ssh")
108236
9fd9b1a102cd * net/tramp.el (tramp-methods): Remove "-q" from `tramp-login-args'
Michael Albinus <michael.albinus@gmx.de>
parents: 108186
diff changeset
367 (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p")
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
368 ("-2" "-e" "none")))
108702
a0b236a315d5 * net/tramp.el (tramp-methods): Add `tramp-async-args' attribute
Michael Albinus <albinus@detlef>
parents: 108540
diff changeset
369 (tramp-async-args (("-q")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
370 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
371 (tramp-copy-program "scp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
372 (tramp-copy-args (("-2") ("-P" "%p") ("-p" "%k")
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
373 ("-q") ("-r")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
374 (tramp-copy-keep-date t)
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
375 (tramp-copy-recursive t)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
376 (tramp-password-end-of-line nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
377 (tramp-gw-args (("-o"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
378 "GlobalKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
379 ("-o" "UserKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
380 ("-o" "StrictHostKeyChecking=no")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
381 (tramp-default-port 22))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
382 ("scp1_old"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
383 (tramp-login-program "ssh1")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
384 (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
385 ("-e" "none")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
386 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
387 (tramp-copy-program "scp1")
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
388 (tramp-copy-args (("-p" "%k") ("-r")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
389 (tramp-copy-keep-date t)
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
390 (tramp-copy-recursive t)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
391 (tramp-password-end-of-line nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
392 ("scp2_old"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
393 (tramp-login-program "ssh2")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
394 (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
395 ("-e" "none")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
396 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
397 (tramp-copy-program "scp2")
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
398 (tramp-copy-args (("-p" "%k") ("-r")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
399 (tramp-copy-keep-date t)
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
400 (tramp-copy-recursive t)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
401 (tramp-password-end-of-line nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
402 ("sftp" (tramp-login-program "ssh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
403 (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
404 ("-e" "none")))
108702
a0b236a315d5 * net/tramp.el (tramp-methods): Add `tramp-async-args' attribute
Michael Albinus <albinus@detlef>
parents: 108540
diff changeset
405 (tramp-async-args (("-q")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
406 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
407 (tramp-copy-program "sftp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
408 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
409 (tramp-copy-keep-date nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
410 (tramp-password-end-of-line nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
411 ("rsync" (tramp-login-program "ssh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
412 (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
413 ("-e" "none")))
108702
a0b236a315d5 * net/tramp.el (tramp-methods): Add `tramp-async-args' attribute
Michael Albinus <albinus@detlef>
parents: 108540
diff changeset
414 (tramp-async-args (("-q")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
415 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
416 (tramp-copy-program "rsync")
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
417 (tramp-copy-args (("-e" "ssh") ("-t" "%k") ("-r")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
418 (tramp-copy-keep-date t)
105718
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
419 (tramp-copy-keep-tmpfile t)
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
420 (tramp-copy-recursive t)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
421 (tramp-password-end-of-line nil))
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
422 ("rsyncc"
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
423 (tramp-login-program "ssh")
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
424 (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p")
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
425 ("-o" "ControlPath=%t.%%r@%%h:%%p")
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
426 ("-o" "ControlMaster=yes")
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
427 ("-e" "none")))
108702
a0b236a315d5 * net/tramp.el (tramp-methods): Add `tramp-async-args' attribute
Michael Albinus <albinus@detlef>
parents: 108540
diff changeset
428 (tramp-async-args (("-q")))
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
429 (tramp-remote-sh "/bin/sh")
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
430 (tramp-copy-program "rsync")
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
431 (tramp-copy-args (("-t" "%k") ("-r")))
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
432 (tramp-copy-env (("RSYNC_RSH")
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
433 (,(concat
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
434 "ssh"
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
435 " -o ControlPath=%t.%%r@%%h:%%p"
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
436 " -o ControlMaster=auto"))))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
437 (tramp-copy-keep-date t)
105718
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
438 (tramp-copy-keep-tmpfile t)
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
439 (tramp-copy-recursive t)
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
440 (tramp-password-end-of-line nil))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
441 ("remcp" (tramp-login-program "remsh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
442 (tramp-login-args (("%h") ("-l" "%u")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
443 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
444 (tramp-copy-program "rcp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
445 (tramp-copy-args (("-p" "%k")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
446 (tramp-copy-keep-date t)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
447 (tramp-password-end-of-line nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
448 ("rsh" (tramp-login-program "rsh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
449 (tramp-login-args (("%h") ("-l" "%u")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
450 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
451 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
452 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
453 (tramp-copy-keep-date nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
454 (tramp-password-end-of-line nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
455 ("ssh" (tramp-login-program "ssh")
108236
9fd9b1a102cd * net/tramp.el (tramp-methods): Remove "-q" from `tramp-login-args'
Michael Albinus <michael.albinus@gmx.de>
parents: 108186
diff changeset
456 (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p")
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
457 ("-e" "none")))
108702
a0b236a315d5 * net/tramp.el (tramp-methods): Add `tramp-async-args' attribute
Michael Albinus <albinus@detlef>
parents: 108540
diff changeset
458 (tramp-async-args (("-q")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
459 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
460 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
461 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
462 (tramp-copy-keep-date nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
463 (tramp-password-end-of-line nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
464 (tramp-gw-args (("-o"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
465 "GlobalKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
466 ("-o" "UserKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
467 ("-o" "StrictHostKeyChecking=no")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
468 (tramp-default-port 22))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
469 ("ssh1" (tramp-login-program "ssh")
108236
9fd9b1a102cd * net/tramp.el (tramp-methods): Remove "-q" from `tramp-login-args'
Michael Albinus <michael.albinus@gmx.de>
parents: 108186
diff changeset
470 (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p")
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
471 ("-1" "-e" "none")))
108702
a0b236a315d5 * net/tramp.el (tramp-methods): Add `tramp-async-args' attribute
Michael Albinus <albinus@detlef>
parents: 108540
diff changeset
472 (tramp-async-args (("-q")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
473 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
474 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
475 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
476 (tramp-copy-keep-date nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
477 (tramp-password-end-of-line nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
478 (tramp-gw-args (("-o"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
479 "GlobalKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
480 ("-o" "UserKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
481 ("-o" "StrictHostKeyChecking=no")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
482 (tramp-default-port 22))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
483 ("ssh2" (tramp-login-program "ssh")
108236
9fd9b1a102cd * net/tramp.el (tramp-methods): Remove "-q" from `tramp-login-args'
Michael Albinus <michael.albinus@gmx.de>
parents: 108186
diff changeset
484 (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p")
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
485 ("-2" "-e" "none")))
108702
a0b236a315d5 * net/tramp.el (tramp-methods): Add `tramp-async-args' attribute
Michael Albinus <albinus@detlef>
parents: 108540
diff changeset
486 (tramp-async-args (("-q")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
487 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
488 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
489 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
490 (tramp-copy-keep-date nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
491 (tramp-password-end-of-line nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
492 (tramp-gw-args (("-o"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
493 "GlobalKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
494 ("-o" "UserKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
495 ("-o" "StrictHostKeyChecking=no")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
496 (tramp-default-port 22))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
497 ("ssh1_old"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
498 (tramp-login-program "ssh1")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
499 (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
500 ("-e" "none")))
108702
a0b236a315d5 * net/tramp.el (tramp-methods): Add `tramp-async-args' attribute
Michael Albinus <albinus@detlef>
parents: 108540
diff changeset
501 (tramp-async-args (("-q")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
502 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
503 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
504 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
505 (tramp-copy-keep-date nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
506 (tramp-password-end-of-line nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
507 ("ssh2_old"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
508 (tramp-login-program "ssh2")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
509 (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
510 ("-e" "none")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
511 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
512 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
513 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
514 (tramp-copy-keep-date nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
515 (tramp-password-end-of-line nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
516 ("remsh" (tramp-login-program "remsh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
517 (tramp-login-args (("%h") ("-l" "%u")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
518 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
519 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
520 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
521 (tramp-copy-keep-date nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
522 (tramp-password-end-of-line nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
523 ("telnet"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
524 (tramp-login-program "telnet")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
525 (tramp-login-args (("%h") ("%p")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
526 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
527 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
528 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
529 (tramp-copy-keep-date nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
530 (tramp-password-end-of-line nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
531 (tramp-default-port 23))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
532 ("su" (tramp-login-program "su")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
533 (tramp-login-args (("-") ("%u")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
534 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
535 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
536 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
537 (tramp-copy-keep-date nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
538 (tramp-password-end-of-line nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
539 ("sudo" (tramp-login-program "sudo")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
540 (tramp-login-args (("-u" "%u")
88072
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
541 ("-s") ("-H") ("-p" "Password:")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
542 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
543 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
544 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
545 (tramp-copy-keep-date nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
546 (tramp-password-end-of-line nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
547 ("scpc" (tramp-login-program "ssh")
108236
9fd9b1a102cd * net/tramp.el (tramp-methods): Remove "-q" from `tramp-login-args'
Michael Albinus <michael.albinus@gmx.de>
parents: 108186
diff changeset
548 (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p")
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
549 ("-o" "ControlPath=%t.%%r@%%h:%%p")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
550 ("-o" "ControlMaster=yes")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
551 ("-e" "none")))
108702
a0b236a315d5 * net/tramp.el (tramp-methods): Add `tramp-async-args' attribute
Michael Albinus <albinus@detlef>
parents: 108540
diff changeset
552 (tramp-async-args (("-q")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
553 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
554 (tramp-copy-program "scp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
555 (tramp-copy-args (("-P" "%p") ("-p" "%k") ("-q")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
556 ("-o" "ControlPath=%t.%%r@%%h:%%p")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
557 ("-o" "ControlMaster=auto")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
558 (tramp-copy-keep-date t)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
559 (tramp-password-end-of-line nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
560 (tramp-gw-args (("-o"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
561 "GlobalKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
562 ("-o" "UserKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
563 ("-o" "StrictHostKeyChecking=no")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
564 (tramp-default-port 22))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
565 ("scpx" (tramp-login-program "ssh")
108236
9fd9b1a102cd * net/tramp.el (tramp-methods): Remove "-q" from `tramp-login-args'
Michael Albinus <michael.albinus@gmx.de>
parents: 108186
diff changeset
566 (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p")
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
567 ("-e" "none" "-t" "-t" "/bin/sh")))
108702
a0b236a315d5 * net/tramp.el (tramp-methods): Add `tramp-async-args' attribute
Michael Albinus <albinus@detlef>
parents: 108540
diff changeset
568 (tramp-async-args (("-q")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
569 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
570 (tramp-copy-program "scp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
571 (tramp-copy-args (("-p" "%k")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
572 (tramp-copy-keep-date t)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
573 (tramp-password-end-of-line nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
574 (tramp-gw-args (("-o"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
575 "GlobalKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
576 ("-o" "UserKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
577 ("-o" "StrictHostKeyChecking=no")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
578 (tramp-default-port 22))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
579 ("sshx" (tramp-login-program "ssh")
108236
9fd9b1a102cd * net/tramp.el (tramp-methods): Remove "-q" from `tramp-login-args'
Michael Albinus <michael.albinus@gmx.de>
parents: 108186
diff changeset
580 (tramp-login-args (("%h") ("-l" "%u") ("-p" "%p")
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
581 ("-e" "none" "-t" "-t" "/bin/sh")))
108702
a0b236a315d5 * net/tramp.el (tramp-methods): Add `tramp-async-args' attribute
Michael Albinus <albinus@detlef>
parents: 108540
diff changeset
582 (tramp-async-args (("-q")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
583 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
584 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
585 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
586 (tramp-copy-keep-date nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
587 (tramp-password-end-of-line nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
588 (tramp-gw-args (("-o"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
589 "GlobalKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
590 ("-o" "UserKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
591 ("-o" "StrictHostKeyChecking=no")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
592 (tramp-default-port 22))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
593 ("krlogin"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
594 (tramp-login-program "krlogin")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
595 (tramp-login-args (("%h") ("-l" "%u") ("-x")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
596 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
597 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
598 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
599 (tramp-copy-keep-date nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
600 (tramp-password-end-of-line nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
601 ("plink" (tramp-login-program "plink")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
602 (tramp-login-args (("%h") ("-l" "%u") ("-P" "%p")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
603 ("-ssh")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
604 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
605 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
606 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
607 (tramp-copy-keep-date nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
608 (tramp-password-end-of-line "xy") ;see docstring for "xy"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
609 (tramp-default-port 22))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
610 ("plink1"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
611 (tramp-login-program "plink")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
612 (tramp-login-args (("%h") ("-l" "%u") ("-P" "%p")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
613 ("-1" "-ssh")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
614 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
615 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
616 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
617 (tramp-copy-keep-date nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
618 (tramp-password-end-of-line "xy") ;see docstring for "xy"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
619 (tramp-default-port 22))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
620 ("plinkx"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
621 (tramp-login-program "plink")
88072
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
622 ;; ("%h") must be a single element, see
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
623 ;; `tramp-compute-multi-hops'.
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
624 (tramp-login-args (("-load") ("%h") ("-t")
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
625 (,(format
106470
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
626 "env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'"
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
627 tramp-terminal-type
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
628 tramp-initial-end-of-output))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
629 ("/bin/sh")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
630 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
631 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
632 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
633 (tramp-copy-keep-date nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
634 (tramp-password-end-of-line nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
635 ("pscp" (tramp-login-program "plink")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
636 (tramp-login-args (("%h") ("-l" "%u") ("-P" "%p")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
637 ("-ssh")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
638 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
639 (tramp-copy-program "pscp")
93829
11d77c788381 * net/tramp.el (tramp-methods): Fix again tramp-copy-args of
Michael Albinus <michael.albinus@gmx.de>
parents: 93666
diff changeset
640 (tramp-copy-args (("-P" "%p") ("-scp") ("-p" "%k")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
641 (tramp-copy-keep-date t)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
642 (tramp-password-end-of-line "xy") ;see docstring for "xy"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
643 (tramp-default-port 22))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
644 ("psftp" (tramp-login-program "plink")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
645 (tramp-login-args (("%h") ("-l" "%u") ("-P" "%p")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
646 ("-ssh")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
647 (tramp-remote-sh "/bin/sh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
648 (tramp-copy-program "pscp")
93829
11d77c788381 * net/tramp.el (tramp-methods): Fix again tramp-copy-args of
Michael Albinus <michael.albinus@gmx.de>
parents: 93666
diff changeset
649 (tramp-copy-args (("-P" "%p") ("-sftp") ("-p" "%k")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
650 (tramp-copy-keep-date t)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
651 (tramp-password-end-of-line "xy")) ;see docstring for "xy"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
652 ("fcp" (tramp-login-program "fsh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
653 (tramp-login-args (("%h") ("-l" "%u") ("sh" "-i")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
654 (tramp-remote-sh "/bin/sh -i")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
655 (tramp-copy-program "fcp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
656 (tramp-copy-args (("-p" "%k")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
657 (tramp-copy-keep-date t)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
658 (tramp-password-end-of-line nil)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
659 "*Alist of methods for remote files.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
660 This is a list of entries of the form (NAME PARAM1 PARAM2 ...).
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
661 Each NAME stands for a remote access method. Each PARAM is a
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
662 pair of the form (KEY VALUE). The following KEYs are defined:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
663 * `tramp-remote-sh'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
664 This specifies the Bourne shell to use on the remote host. This
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
665 MUST be a Bourne-like shell. It is normally not necessary to set
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
666 this to any value other than \"/bin/sh\": Tramp wants to use a shell
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
667 which groks tilde expansion, but it can search for it. Also note
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
668 that \"/bin/sh\" exists on all Unixen, this might not be true for
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
669 the value that you decide to use. You Have Been Warned.
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
670 * `tramp-login-program'
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
671 This specifies the name of the program to use for logging in to the
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
672 remote host. This may be the name of rsh or a workalike program,
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
673 or the name of telnet or a workalike, or the name of su or a workalike.
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
674 * `tramp-login-args'
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
675 This specifies the list of arguments to pass to the above
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
676 mentioned program. Please note that this is a list of list of arguments,
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
677 that is, normally you don't want to put \"-a -b\" or \"-f foo\"
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
678 here. Instead, you want a list (\"-a\" \"-b\"), or (\"-f\" \"foo\").
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
679 There are some patterns: \"%h\" in this list is replaced by the host
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
680 name, \"%u\" is replaced by the user name, \"%p\" is replaced by the
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
681 port number, and \"%%\" can be used to obtain a literal percent character.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
682 If a list containing \"%h\", \"%u\" or \"%p\" is unchanged during
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
683 expansion (i.e. no host or no user specified), this list is not used as
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
684 argument. By this, arguments like (\"-l\" \"%u\") are optional.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
685 \"%t\" is replaced by the temporary file name produced with
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
686 `tramp-make-tramp-temp-file'. \"%k\" indicates the keep-date
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
687 parameter of a program, if exists.
108702
a0b236a315d5 * net/tramp.el (tramp-methods): Add `tramp-async-args' attribute
Michael Albinus <albinus@detlef>
parents: 108540
diff changeset
688 * `tramp-async-args'
a0b236a315d5 * net/tramp.el (tramp-methods): Add `tramp-async-args' attribute
Michael Albinus <albinus@detlef>
parents: 108540
diff changeset
689 When an asynchronous process is started, we know already that
a0b236a315d5 * net/tramp.el (tramp-methods): Add `tramp-async-args' attribute
Michael Albinus <albinus@detlef>
parents: 108540
diff changeset
690 the connection works. Therefore, we can pass additional
a0b236a315d5 * net/tramp.el (tramp-methods): Add `tramp-async-args' attribute
Michael Albinus <albinus@detlef>
parents: 108540
diff changeset
691 parameters to suppress diagnostic messages, in order not to
a0b236a315d5 * net/tramp.el (tramp-methods): Add `tramp-async-args' attribute
Michael Albinus <albinus@detlef>
parents: 108540
diff changeset
692 tamper the process output.
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
693 * `tramp-copy-program'
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
694 This specifies the name of the program to use for remotely copying
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
695 the file; this might be the absolute filename of rcp or the name of
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
696 a workalike program.
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
697 * `tramp-copy-args'
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
698 This specifies the list of parameters to pass to the above mentioned
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
699 program, the hints for `tramp-login-args' also apply here.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
700 * `tramp-copy-keep-date'
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
701 This specifies whether the copying program when the preserves the
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
702 timestamp of the original file.
105718
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
703 * `tramp-copy-keep-tmpfile'
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
704 This specifies whether a temporary local file shall be kept
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
705 for optimization reasons (useful for \"rsync\" methods).
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
706 * `tramp-copy-recursive'
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
707 Whether the operation copies directories recursively.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
708 * `tramp-default-port'
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
709 The default port of a method is needed in case of gateway connections.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
710 Additionally, it is used as indication which method is prepared for
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
711 passing gateways.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
712 * `tramp-gw-args'
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
713 As the attribute name says, additional arguments are specified here
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
714 when a method is applied via a gateway.
51968
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
715 * `tramp-password-end-of-line'
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
716 This specifies the string to use for terminating the line after
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
717 submitting the password. If this method parameter is nil, then the
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
718 value of the normal variable `tramp-default-password-end-of-line'
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
719 is used. This parameter is necessary because the \"plink\" program
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
720 requires any two characters after sending the password. These do
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
721 not have to be newline or carriage return characters. Other login
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
722 programs are happy with just one character, the newline character.
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
723 We use \"xy\" as the value for methods using \"plink\".
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
724
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
725 What does all this mean? Well, you should specify `tramp-login-program'
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
726 for all methods; this program is used to log in to the remote site. Then,
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
727 there are two ways to actually transfer the files between the local and the
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
728 remote side. One way is using an additional rcp-like program. If you want
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
729 to do this, set `tramp-copy-program' in the method.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
730
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
731 Another possibility for file transfer is inline transfer, i.e. the
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
732 file is passed through the same buffer used by `tramp-login-program'. In
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
733 this case, the file contents need to be protected since the
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
734 `tramp-login-program' might use escape codes or the connection might not
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
735 be eight-bit clean. Therefore, file contents are encoded for transit.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
736 See the variables `tramp-local-coding-commands' and
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
737 `tramp-remote-coding-commands' for details.
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
738
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
739 So, to summarize: if the method is an out-of-band method, then you
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
740 must specify `tramp-copy-program' and `tramp-copy-args'. If it is an
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
741 inline method, then these two parameters should be nil. Methods which
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
742 are fit for gateways must have `tramp-default-port' at least.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
743
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
744 Notes:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
745
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
746 When using `su' or `sudo' the phrase `open connection to a remote
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
747 host' sounds strange, but it is used nevertheless, for consistency.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
748 No connection is opened to a remote host, but `su' or `sudo' is
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
749 started on the local host. You should specify a remote host
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
750 `localhost' or the name of the local host. Another host name is
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
751 useful only in combination with `tramp-default-proxies-alist'.")
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
752
108065
186cf99d4122 Detect ssh 'ControlMaster' argument automatically in some cases.
Michael Albinus <michael.albinus@gmx.de>
parents: 108064
diff changeset
753 (defun tramp-detect-ssh-controlmaster ()
186cf99d4122 Detect ssh 'ControlMaster' argument automatically in some cases.
Michael Albinus <michael.albinus@gmx.de>
parents: 108064
diff changeset
754 "Call ssh to detect whether it supports the ControlMaster argument.
186cf99d4122 Detect ssh 'ControlMaster' argument automatically in some cases.
Michael Albinus <michael.albinus@gmx.de>
parents: 108064
diff changeset
755 This function may return nil when the argument is supported, but
186cf99d4122 Detect ssh 'ControlMaster' argument automatically in some cases.
Michael Albinus <michael.albinus@gmx.de>
parents: 108064
diff changeset
756 shouldn't return t when it isn't."
186cf99d4122 Detect ssh 'ControlMaster' argument automatically in some cases.
Michael Albinus <michael.albinus@gmx.de>
parents: 108064
diff changeset
757 (ignore-errors
186cf99d4122 Detect ssh 'ControlMaster' argument automatically in some cases.
Michael Albinus <michael.albinus@gmx.de>
parents: 108064
diff changeset
758 (with-temp-buffer
186cf99d4122 Detect ssh 'ControlMaster' argument automatically in some cases.
Michael Albinus <michael.albinus@gmx.de>
parents: 108064
diff changeset
759 (call-process "ssh" nil t nil "-o" "ControlMaster")
186cf99d4122 Detect ssh 'ControlMaster' argument automatically in some cases.
Michael Albinus <michael.albinus@gmx.de>
parents: 108064
diff changeset
760 (goto-char (point-min))
186cf99d4122 Detect ssh 'ControlMaster' argument automatically in some cases.
Michael Albinus <michael.albinus@gmx.de>
parents: 108064
diff changeset
761 (search-forward-regexp "Missing ControlMaster argument" nil t))))
186cf99d4122 Detect ssh 'ControlMaster' argument automatically in some cases.
Michael Albinus <michael.albinus@gmx.de>
parents: 108064
diff changeset
762
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
763 (defcustom tramp-default-method
74777
948c86bf6396 * net/tramp.el (tramp-default-method): We still need to check for
Michael Albinus <michael.albinus@gmx.de>
parents: 74766
diff changeset
764 ;; An external copy method seems to be preferred, because it is much
948c86bf6396 * net/tramp.el (tramp-default-method): We still need to check for
Michael Albinus <michael.albinus@gmx.de>
parents: 74766
diff changeset
765 ;; more performant for large files, and it hasn't too serious delays
948c86bf6396 * net/tramp.el (tramp-default-method): We still need to check for
Michael Albinus <michael.albinus@gmx.de>
parents: 74766
diff changeset
766 ;; for small files. But it must be ensured that there aren't
948c86bf6396 * net/tramp.el (tramp-default-method): We still need to check for
Michael Albinus <michael.albinus@gmx.de>
parents: 74766
diff changeset
767 ;; permanent password queries. Either a password agent like
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
768 ;; "ssh-agent" or "Pageant" shall run, or the optional
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
769 ;; password-cache.el or auth-sources.el packages shall be active for
108065
186cf99d4122 Detect ssh 'ControlMaster' argument automatically in some cases.
Michael Albinus <michael.albinus@gmx.de>
parents: 108064
diff changeset
770 ;; password caching. "scpc" is chosen if we detect that the user is
186cf99d4122 Detect ssh 'ControlMaster' argument automatically in some cases.
Michael Albinus <michael.albinus@gmx.de>
parents: 108064
diff changeset
771 ;; running OpenSSH 4.0 or newer.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
772 (cond
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
773 ;; PuTTY is installed.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
774 ((executable-find "pscp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
775 (if (or (fboundp 'password-read)
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
776 (fboundp 'auth-source-user-or-password)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
777 ;; Pageant is running.
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
778 (tramp-compat-process-running-p "Pageant"))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
779 "pscp"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
780 "plink"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
781 ;; There is an ssh installation.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
782 ((executable-find "scp")
108065
186cf99d4122 Detect ssh 'ControlMaster' argument automatically in some cases.
Michael Albinus <michael.albinus@gmx.de>
parents: 108064
diff changeset
783 (cond
186cf99d4122 Detect ssh 'ControlMaster' argument automatically in some cases.
Michael Albinus <michael.albinus@gmx.de>
parents: 108064
diff changeset
784 ((tramp-detect-ssh-controlmaster) "scpc")
186cf99d4122 Detect ssh 'ControlMaster' argument automatically in some cases.
Michael Albinus <michael.albinus@gmx.de>
parents: 108064
diff changeset
785 ((or (fboundp 'password-read)
186cf99d4122 Detect ssh 'ControlMaster' argument automatically in some cases.
Michael Albinus <michael.albinus@gmx.de>
parents: 108064
diff changeset
786 (fboundp 'auth-source-user-or-password)
186cf99d4122 Detect ssh 'ControlMaster' argument automatically in some cases.
Michael Albinus <michael.albinus@gmx.de>
parents: 108064
diff changeset
787 ;; ssh-agent is running.
186cf99d4122 Detect ssh 'ControlMaster' argument automatically in some cases.
Michael Albinus <michael.albinus@gmx.de>
parents: 108064
diff changeset
788 (getenv "SSH_AUTH_SOCK")
186cf99d4122 Detect ssh 'ControlMaster' argument automatically in some cases.
Michael Albinus <michael.albinus@gmx.de>
parents: 108064
diff changeset
789 (getenv "SSH_AGENT_PID"))
186cf99d4122 Detect ssh 'ControlMaster' argument automatically in some cases.
Michael Albinus <michael.albinus@gmx.de>
parents: 108064
diff changeset
790 "scp")
186cf99d4122 Detect ssh 'ControlMaster' argument automatically in some cases.
Michael Albinus <michael.albinus@gmx.de>
parents: 108064
diff changeset
791 (t "ssh")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
792 ;; Fallback.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
793 (t "ftp"))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
794 "*Default method to use for transferring files.
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
795 See `tramp-methods' for possibilities.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
796 Also see `tramp-default-method-alist'."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
797 :group 'tramp
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
798 :type 'string)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
799
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
800 (defcustom tramp-default-method-alist
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
801 '(("\\`localhost\\'" "\\`root\\'" "su"))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
802 "*Default method to use for specific host/user pairs.
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
803 This is an alist of items (HOST USER METHOD). The first matching item
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
804 specifies the method to use for a file name which does not specify a
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
805 method. HOST and USER are regular expressions or nil, which is
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
806 interpreted as a regular expression which always matches. If no entry
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
807 matches, the variable `tramp-default-method' takes effect.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
808
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
809 If the file name does not specify the user, lookup is done using the
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
810 empty string for the user name.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
811
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
812 See `tramp-methods' for a list of possibilities for METHOD."
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
813 :group 'tramp
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
814 :type '(repeat (list (regexp :tag "Host regexp")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
815 (regexp :tag "User regexp")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
816 (string :tag "Method"))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
817
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
818 (defcustom tramp-default-user
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
819 nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
820 "*Default user to use for transferring files.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
821 It is nil by default; otherwise settings in configuration files like
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
822 \"~/.ssh/config\" would be overwritten. Also see `tramp-default-user-alist'.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
823
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
824 This variable is regarded as obsolete, and will be removed soon."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
825 :group 'tramp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
826 :type '(choice (const nil) string))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
827
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
828 (defcustom tramp-default-user-alist
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
829 `(("\\`su\\(do\\)?\\'" nil "root")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
830 ("\\`r\\(em\\)?\\(cp\\|sh\\)\\|telnet\\|plink1?\\'"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
831 nil ,(user-login-name)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
832 "*Default user to use for specific method/host pairs.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
833 This is an alist of items (METHOD HOST USER). The first matching item
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
834 specifies the user to use for a file name which does not specify a
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
835 user. METHOD and USER are regular expressions or nil, which is
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
836 interpreted as a regular expression which always matches. If no entry
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
837 matches, the variable `tramp-default-user' takes effect.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
838
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
839 If the file name does not specify the method, lookup is done using the
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
840 empty string for the method name."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
841 :group 'tramp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
842 :type '(repeat (list (regexp :tag "Method regexp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
843 (regexp :tag "Host regexp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
844 (string :tag "User"))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
845
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
846 (defcustom tramp-default-host
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
847 (system-name)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
848 "*Default host to use for transferring files.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
849 Useful for su and sudo methods mostly."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
850 :group 'tramp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
851 :type 'string)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
852
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
853 (defcustom tramp-default-proxies-alist nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
854 "*Route to be followed for specific host/user pairs.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
855 This is an alist of items (HOST USER PROXY). The first matching
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
856 item specifies the proxy to be passed for a file name located on
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
857 a remote target matching USER@HOST. HOST and USER are regular
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
858 expressions. PROXY must be a Tramp filename without a localname
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
859 part. Method and user name on PROXY are optional, which is
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
860 interpreted with the default values. PROXY can contain the
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
861 patterns %h and %u, which are replaced by the strings matching
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
862 HOST or USER, respectively.
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
863
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
864 HOST, USER or PROXY could also be Lisp forms, which will be
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
865 evaluated. The result must be a string or nil, which is
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
866 interpreted as a regular expression which always matches."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
867 :group 'tramp
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
868 :type '(repeat (list (choice :tag "Host regexp" regexp sexp)
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
869 (choice :tag "User regexp" regexp sexp)
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
870 (choice :tag "Proxy remote name" string (const nil)))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
871
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
872 (defconst tramp-local-host-regexp
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
873 (concat
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
874 "^" (regexp-opt (list "localhost" (system-name) "127\.0\.0\.1" "::1") t) "$")
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
875 "*Host names which are regarded as local host.")
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
876
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
877 (defconst tramp-completion-function-alist-rsh
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
878 '((tramp-parse-rhosts "/etc/hosts.equiv")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
879 (tramp-parse-rhosts "~/.rhosts"))
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
880 "Default list of (FUNCTION FILE) pairs to be examined for rsh methods.")
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
881
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
882 (defconst tramp-completion-function-alist-ssh
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
883 '((tramp-parse-rhosts "/etc/hosts.equiv")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
884 (tramp-parse-rhosts "/etc/shosts.equiv")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
885 (tramp-parse-shosts "/etc/ssh_known_hosts")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
886 (tramp-parse-sconfig "/etc/ssh_config")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
887 (tramp-parse-shostkeys "/etc/ssh2/hostkeys")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
888 (tramp-parse-sknownhosts "/etc/ssh2/knownhosts")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
889 (tramp-parse-rhosts "~/.rhosts")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
890 (tramp-parse-rhosts "~/.shosts")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
891 (tramp-parse-shosts "~/.ssh/known_hosts")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
892 (tramp-parse-sconfig "~/.ssh/config")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
893 (tramp-parse-shostkeys "~/.ssh2/hostkeys")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
894 (tramp-parse-sknownhosts "~/.ssh2/knownhosts"))
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
895 "Default list of (FUNCTION FILE) pairs to be examined for ssh methods.")
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
896
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
897 (defconst tramp-completion-function-alist-telnet
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
898 '((tramp-parse-hosts "/etc/hosts"))
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
899 "Default list of (FUNCTION FILE) pairs to be examined for telnet methods.")
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
900
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
901 (defconst tramp-completion-function-alist-su
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
902 '((tramp-parse-passwd "/etc/passwd"))
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
903 "Default list of (FUNCTION FILE) pairs to be examined for su methods.")
47578
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
904
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
905 (defconst tramp-completion-function-alist-putty
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
906 '((tramp-parse-putty
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
907 "HKEY_CURRENT_USER\\Software\\SimonTatham\\PuTTY\\Sessions"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
908 "Default list of (FUNCTION REGISTRY) pairs to be examined for putty methods.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
909
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
910 (defvar tramp-completion-function-alist nil
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
911 "*Alist of methods for remote files.
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
912 This is a list of entries of the form \(NAME PAIR1 PAIR2 ...\).
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
913 Each NAME stands for a remote access method. Each PAIR is of the form
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
914 \(FUNCTION FILE\). FUNCTION is responsible to extract user names and host
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
915 names from FILE for completion. The following predefined FUNCTIONs exists:
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
916
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
917 * `tramp-parse-rhosts' for \"~/.rhosts\" like files,
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
918 * `tramp-parse-shosts' for \"~/.ssh/known_hosts\" like files,
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
919 * `tramp-parse-sconfig' for \"~/.ssh/config\" like files,
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
920 * `tramp-parse-shostkeys' for \"~/.ssh2/hostkeys/*\" like files,
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
921 * `tramp-parse-sknownhosts' for \"~/.ssh2/knownhosts/*\" like files,
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
922 * `tramp-parse-hosts' for \"/etc/hosts\" like files,
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
923 * `tramp-parse-passwd' for \"/etc/passwd\" like files.
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
924 * `tramp-parse-netrc' for \"~/.netrc\" like files.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
925 * `tramp-parse-putty' for PuTTY registry keys.
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
926
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
927 FUNCTION can also be a customer defined function. For more details see
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
928 the info pages.")
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
929
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
930 (eval-after-load "tramp"
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
931 '(progn
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
932 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
933 "rcp" tramp-completion-function-alist-rsh)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
934 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
935 "scp" tramp-completion-function-alist-ssh)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
936 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
937 "scp1" tramp-completion-function-alist-ssh)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
938 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
939 "scp2" tramp-completion-function-alist-ssh)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
940 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
941 "scp1_old" tramp-completion-function-alist-ssh)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
942 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
943 "scp2_old" tramp-completion-function-alist-ssh)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
944 (tramp-set-completion-function
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
945 "rsync" tramp-completion-function-alist-ssh)
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
946 (tramp-set-completion-function
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
947 "rsyncc" tramp-completion-function-alist-ssh)
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
948 (tramp-set-completion-function
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
949 "remcp" tramp-completion-function-alist-rsh)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
950 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
951 "rsh" tramp-completion-function-alist-rsh)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
952 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
953 "ssh" tramp-completion-function-alist-ssh)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
954 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
955 "ssh1" tramp-completion-function-alist-ssh)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
956 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
957 "ssh2" tramp-completion-function-alist-ssh)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
958 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
959 "ssh1_old" tramp-completion-function-alist-ssh)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
960 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
961 "ssh2_old" tramp-completion-function-alist-ssh)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
962 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
963 "remsh" tramp-completion-function-alist-rsh)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
964 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
965 "telnet" tramp-completion-function-alist-telnet)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
966 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
967 "su" tramp-completion-function-alist-su)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
968 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
969 "sudo" tramp-completion-function-alist-su)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
970 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
971 "scpx" tramp-completion-function-alist-ssh)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
972 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
973 "sshx" tramp-completion-function-alist-ssh)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
974 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
975 "krlogin" tramp-completion-function-alist-rsh)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
976 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
977 "plink" tramp-completion-function-alist-ssh)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
978 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
979 "plink1" tramp-completion-function-alist-ssh)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
980 (tramp-set-completion-function
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
981 "plinkx" tramp-completion-function-alist-putty)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
982 (tramp-set-completion-function
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
983 "pscp" tramp-completion-function-alist-ssh)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
984 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
985 "fcp" tramp-completion-function-alist-ssh)))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
986
94975
5bb8f7b3f835 * net/tramp.el (tramp-echo-mark): Update docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 94677
diff changeset
987 (defconst tramp-echo-mark-marker "_echo"
5bb8f7b3f835 * net/tramp.el (tramp-echo-mark): Update docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 94677
diff changeset
988 "String marker to surround echoed commands.")
5bb8f7b3f835 * net/tramp.el (tramp-echo-mark): Update docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 94677
diff changeset
989
106597
b0e5aae20733 * net/tramp.el (tramp-echo-mark-marker-length): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 106508
diff changeset
990 (defconst tramp-echo-mark-marker-length (length tramp-echo-mark-marker)
b0e5aae20733 * net/tramp.el (tramp-echo-mark-marker-length): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 106508
diff changeset
991 "String length of `tramp-echo-mark-marker'.")
b0e5aae20733 * net/tramp.el (tramp-echo-mark-marker-length): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 106508
diff changeset
992
b0e5aae20733 * net/tramp.el (tramp-echo-mark-marker-length): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 106508
diff changeset
993 (defconst tramp-echo-mark
b0e5aae20733 * net/tramp.el (tramp-echo-mark-marker-length): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 106508
diff changeset
994 (concat tramp-echo-mark-marker
b0e5aae20733 * net/tramp.el (tramp-echo-mark-marker-length): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 106508
diff changeset
995 (make-string tramp-echo-mark-marker-length ?\b))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
996 "String mark to be transmitted around shell commands.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
997 Used to separate their echo from the output they produce. This
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
998 will only be used if we cannot disable remote echo via stty.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
999 This string must have no effect on the remote shell except for
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1000 producing some echo which can later be detected by
94975
5bb8f7b3f835 * net/tramp.el (tramp-echo-mark): Update docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 94677
diff changeset
1001 `tramp-echoed-echo-mark-regexp'. Using `tramp-echo-mark-marker',
5bb8f7b3f835 * net/tramp.el (tramp-echo-mark): Update docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 94677
diff changeset
1002 followed by an equal number of backspaces to erase them will
5bb8f7b3f835 * net/tramp.el (tramp-echo-mark): Update docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 94677
diff changeset
1003 usually suffice.")
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1004
106597
b0e5aae20733 * net/tramp.el (tramp-echo-mark-marker-length): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 106508
diff changeset
1005 (defconst tramp-echoed-echo-mark-regexp
b0e5aae20733 * net/tramp.el (tramp-echo-mark-marker-length): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 106508
diff changeset
1006 (format "%s\\(\b\\( \b\\)?\\)\\{%d\\}"
b0e5aae20733 * net/tramp.el (tramp-echo-mark-marker-length): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 106508
diff changeset
1007 tramp-echo-mark-marker tramp-echo-mark-marker-length)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1008 "Regexp which matches `tramp-echo-mark' as it gets echoed by
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1009 the remote shell.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1010
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1011 (defcustom tramp-rsh-end-of-line "\n"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1012 "*String used for end of line in rsh connections.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1013 I don't think this ever needs to be changed, so please tell me about it
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1014 if you need to change this.
51968
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
1015 Also see the method parameter `tramp-password-end-of-line' and the normal
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
1016 variable `tramp-default-password-end-of-line'."
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1017 :group 'tramp
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1018 :type 'string)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1019
51968
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
1020 (defcustom tramp-default-password-end-of-line
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
1021 tramp-rsh-end-of-line
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1022 "*String used for end of line after sending a password.
51968
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
1023 This variable provides the default value for the method parameter
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
1024 `tramp-password-end-of-line', see `tramp-methods' for more details.
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
1025
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1026 It seems that people using plink under Windows need to send
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1027 \"\\r\\n\" (carriage-return, then newline) after a password, but just
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1028 \"\\n\" after all other lines. This variable can be used for the
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1029 password, see `tramp-rsh-end-of-line' for the other cases.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1030
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1031 The default value is to use the same value as `tramp-rsh-end-of-line'."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1032 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1033 :type 'string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1034
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1035 ;; "getconf PATH" yields:
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1036 ;; HP-UX: /usr/bin:/usr/ccs/bin:/opt/ansic/bin:/opt/langtools/bin:/opt/fortran/bin
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1037 ;; Solaris: /usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin
87648
7ae99e295dfd * vc-git.el (vc-git--call): Apply `process-file' instead of
Michael Albinus <michael.albinus@gmx.de>
parents: 87368
diff changeset
1038 ;; GNU/Linux (Debian, Suse): /bin:/usr/bin
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1039 ;; FreeBSD: /usr/bin:/bin:/usr/sbin:/sbin: - beware trailing ":"!
109449
333d4b14e6cb * net/tramp.el (tramp-get-ls-command-with-dired): Make test for
Michael Albinus <albinus@detlef>
parents: 109443
diff changeset
1040 ;; IRIX64: /usr/bin
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1041 (defcustom tramp-remote-path
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1042 '(tramp-default-remote-path "/usr/sbin" "/usr/local/bin"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1043 "/local/bin" "/local/freeware/bin" "/local/gnu/bin"
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1044 "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1045 "*List of directories to search for executables on remote host.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1046 For every remote host, this variable will be set buffer local,
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1047 keeping the list of existing directories on that host.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1048
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1049 You can use `~' in this list, but when searching for a shell which groks
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1050 tilde expansion, all directory names starting with `~' will be ignored.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1051
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1052 `Default Directories' represent the list of directories given by
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1053 the command \"getconf PATH\". It is recommended to use this
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1054 entry on top of this list, because these are the default
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
1055 directories for POSIX compatible commands.
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
1056
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
1057 `Private Directories' are the settings of the $PATH environment,
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
1058 as given in your `~/.profile'."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1059 :group 'tramp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1060 :type '(repeat (choice
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1061 (const :tag "Default Directories" tramp-default-remote-path)
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
1062 (const :tag "Private Directories" tramp-own-remote-path)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1063 (string :tag "Directory"))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1064
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1065 (defcustom tramp-remote-process-environment
87921
c49bc2860fd0 * net/tramp.el (tramp-remote-process-environment): Set "LC_ALL=C".
Michael Albinus <michael.albinus@gmx.de>
parents: 87748
diff changeset
1066 `("HISTFILE=$HOME/.tramp_history" "HISTSIZE=1" "LC_ALL=C"
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
1067 ,(format "TERM=%s" tramp-terminal-type)
97613
d78633cfcc28 * net/tramp.el (tramp-remote-process-environment): Add "EMACS=t"
Michael Albinus <michael.albinus@gmx.de>
parents: 97445
diff changeset
1068 "EMACS=t" ;; Deprecated.
108975
c4552014bea2 * net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents: 108817
diff changeset
1069 ,(format "INSIDE_EMACS='%s,tramp:%s'" emacs-version tramp-version)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1070 "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH="
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1071 "autocorrect=" "correct=")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1072
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1073 "*List of environment variables to be set on the remote host.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1074
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1075 Each element should be a string of the form ENVVARNAME=VALUE. An
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1076 entry ENVVARNAME= diables the corresponding environment variable,
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1077 which might have been set in the init files like ~/.profile.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1078
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1079 Special handling is applied to the PATH environment, which should
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1080 not be set here. Instead of, it should be set via `tramp-remote-path'."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1081 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1082 :type '(repeat string))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1083
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1084 (defcustom tramp-login-prompt-regexp
65605
efa862a76bc2 * net/tramp.el (tramp-login-prompt-regexp): Expand regexp in order to
Michael Albinus <michael.albinus@gmx.de>
parents: 65359
diff changeset
1085 ".*ogin\\( .*\\)?: *"
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1086 "*Regexp matching login-like prompts.
65605
efa862a76bc2 * net/tramp.el (tramp-login-prompt-regexp): Expand regexp in order to
Michael Albinus <michael.albinus@gmx.de>
parents: 65359
diff changeset
1087 The regexp should match at end of buffer.
efa862a76bc2 * net/tramp.el (tramp-login-prompt-regexp): Expand regexp in order to
Michael Albinus <michael.albinus@gmx.de>
parents: 65359
diff changeset
1088
efa862a76bc2 * net/tramp.el (tramp-login-prompt-regexp): Expand regexp in order to
Michael Albinus <michael.albinus@gmx.de>
parents: 65359
diff changeset
1089 Sometimes the prompt is reported to look like \"login as:\"."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1090 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1091 :type 'regexp)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1092
46998
9d6aef07c793 Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46992
diff changeset
1093 (defcustom tramp-shell-prompt-pattern
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
1094 ;; Allow a prompt to start right after a ^M since it indeed would be
108975
c4552014bea2 * net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents: 108817
diff changeset
1095 ;; displayed at the beginning of the line (and Zsh uses it). This
c4552014bea2 * net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents: 108817
diff changeset
1096 ;; regexp works only for GNU Emacs.
c4552014bea2 * net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents: 108817
diff changeset
1097 (concat (if (featurep 'xemacs) "" "\\(?:^\\|\r\\)")
c4552014bea2 * net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents: 108817
diff changeset
1098 "[^#$%>\n]*#?[#$%>] *\\(\e\\[[0-9;]*[a-zA-Z] *\\)*")
46998
9d6aef07c793 Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46992
diff changeset
1099 "Regexp to match prompts from remote shell.
9d6aef07c793 Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46992
diff changeset
1100 Normally, Tramp expects you to configure `shell-prompt-pattern'
9d6aef07c793 Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46992
diff changeset
1101 correctly, but sometimes it happens that you are connecting to a
9d6aef07c793 Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46992
diff changeset
1102 remote host which sends a different kind of shell prompt. Therefore,
9d6aef07c793 Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46992
diff changeset
1103 Tramp recognizes things matched by `shell-prompt-pattern' as prompt,
9d6aef07c793 Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46992
diff changeset
1104 and also things matched by this variable. The default value of this
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
1105 variable is similar to the default value of `shell-prompt-pattern',
106470
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
1106 which should work well in many cases.
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
1107
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
1108 This regexp must match both `tramp-initial-end-of-output' and
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
1109 `tramp-end-of-output'."
46998
9d6aef07c793 Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46992
diff changeset
1110 :group 'tramp
9d6aef07c793 Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46992
diff changeset
1111 :type 'regexp)
9d6aef07c793 Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46992
diff changeset
1112
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1113 (defcustom tramp-password-prompt-regexp
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1114 "^.*\\([pP]assword\\|[pP]assphrase\\).*:\^@? *"
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1115 "*Regexp matching password-like prompts.
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1116 The regexp should match at end of buffer.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1117
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1118 The `sudo' program appears to insert a `^@' character into the prompt."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1119 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1120 :type 'regexp)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1121
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1122 (defcustom tramp-wrong-passwd-regexp
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1123 (concat "^.*"
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1124 ;; These strings should be on the last line
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
1125 (regexp-opt '("Permission denied"
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1126 "Login incorrect"
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1127 "Login Incorrect"
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1128 "Connection refused"
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1129 "Connection closed"
107021
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
1130 "Timeout, server not responding."
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1131 "Sorry, try again."
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1132 "Name or service not known"
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1133 "Host key verification failed."
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
1134 "No supported authentication methods left to try!") t)
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1135 ".*"
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1136 "\\|"
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1137 "^.*\\("
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1138 ;; Here comes a list of regexes, separated by \\|
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1139 "Received signal [0-9]+"
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1140 "\\).*")
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1141 "*Regexp matching a `login failed' message.
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1142 The regexp should match at end of buffer."
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1143 :group 'tramp
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1144 :type 'regexp)
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1145
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1146 (defcustom tramp-yesno-prompt-regexp
46992
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
1147 (concat
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
1148 (regexp-opt '("Are you sure you want to continue connecting (yes/no)?") t)
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
1149 "\\s-*")
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
1150 "Regular expression matching all yes/no queries which need to be confirmed.
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1151 The confirmation should be done with yes or no.
46992
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
1152 The regexp should match at end of buffer.
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
1153 See also `tramp-yn-prompt-regexp'."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1154 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1155 :type 'regexp)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1156
46992
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
1157 (defcustom tramp-yn-prompt-regexp
74985
155a8e75cd11 Sync with Tramp 2.0.55.
Michael Albinus <michael.albinus@gmx.de>
parents: 74777
diff changeset
1158 (concat
155a8e75cd11 Sync with Tramp 2.0.55.
Michael Albinus <michael.albinus@gmx.de>
parents: 74777
diff changeset
1159 (regexp-opt '("Store key in cache? (y/n)"
155a8e75cd11 Sync with Tramp 2.0.55.
Michael Albinus <michael.albinus@gmx.de>
parents: 74777
diff changeset
1160 "Update cached key? (y/n, Return cancels connection)") t)
155a8e75cd11 Sync with Tramp 2.0.55.
Michael Albinus <michael.albinus@gmx.de>
parents: 74777
diff changeset
1161 "\\s-*")
46992
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
1162 "Regular expression matching all y/n queries which need to be confirmed.
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
1163 The confirmation should be done with y or n.
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
1164 The regexp should match at end of buffer.
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
1165 See also `tramp-yesno-prompt-regexp'."
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
1166 :group 'tramp
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
1167 :type 'regexp)
47771
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
1168
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
1169 (defcustom tramp-terminal-prompt-regexp
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
1170 (concat "\\("
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
1171 "TERM = (.*)"
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
1172 "\\|"
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
1173 "Terminal type\\? \\[.*\\]"
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
1174 "\\)\\s-*")
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
1175 "Regular expression matching all terminal setting prompts.
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
1176 The regexp should match at end of buffer.
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
1177 The answer will be provided by `tramp-action-terminal', which see."
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
1178 :group 'tramp
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
1179 :type 'regexp)
46992
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
1180
59582
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
1181 (defcustom tramp-operation-not-permitted-regexp
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
1182 (concat "\\(" "preserving times.*" "\\|" "set mode" "\\)" ":\\s-*"
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
1183 (regexp-opt '("Operation not permitted") t))
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
1184 "Regular expression matching keep-date problems in (s)cp operations.
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
1185 Copying has been performed successfully already, so this message can
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
1186 be ignored safely."
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
1187 :group 'tramp
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
1188 :type 'regexp)
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
1189
74166
5b973e5dc882 (tramp-default-method): Under Windows, change from plink to pscp.
Lars Hansen <larsh@soem.dk>
parents: 74052
diff changeset
1190 (defcustom tramp-copy-failed-regexp
5b973e5dc882 (tramp-default-method): Under Windows, change from plink to pscp.
Lars Hansen <larsh@soem.dk>
parents: 74052
diff changeset
1191 (concat "\\(.+: "
5b973e5dc882 (tramp-default-method): Under Windows, change from plink to pscp.
Lars Hansen <larsh@soem.dk>
parents: 74052
diff changeset
1192 (regexp-opt '("Permission denied"
5b973e5dc882 (tramp-default-method): Under Windows, change from plink to pscp.
Lars Hansen <larsh@soem.dk>
parents: 74052
diff changeset
1193 "not a regular file"
5b973e5dc882 (tramp-default-method): Under Windows, change from plink to pscp.
Lars Hansen <larsh@soem.dk>
parents: 74052
diff changeset
1194 "is a directory"
5b973e5dc882 (tramp-default-method): Under Windows, change from plink to pscp.
Lars Hansen <larsh@soem.dk>
parents: 74052
diff changeset
1195 "No such file or directory") t)
5b973e5dc882 (tramp-default-method): Under Windows, change from plink to pscp.
Lars Hansen <larsh@soem.dk>
parents: 74052
diff changeset
1196 "\\)\\s-*")
5b973e5dc882 (tramp-default-method): Under Windows, change from plink to pscp.
Lars Hansen <larsh@soem.dk>
parents: 74052
diff changeset
1197 "Regular expression matching copy problems in (s)cp operations."
5b973e5dc882 (tramp-default-method): Under Windows, change from plink to pscp.
Lars Hansen <larsh@soem.dk>
parents: 74052
diff changeset
1198 :group 'tramp
5b973e5dc882 (tramp-default-method): Under Windows, change from plink to pscp.
Lars Hansen <larsh@soem.dk>
parents: 74052
diff changeset
1199 :type 'regexp)
5b973e5dc882 (tramp-default-method): Under Windows, change from plink to pscp.
Lars Hansen <larsh@soem.dk>
parents: 74052
diff changeset
1200
55844
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
1201 (defcustom tramp-process-alive-regexp
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
1202 ""
55844
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
1203 "Regular expression indicating a process has finished.
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
1204 In fact this expression is empty by intention, it will be used only to
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
1205 check regularly the status of the associated process.
56460
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
1206 The answer will be provided by `tramp-action-process-alive',
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1207 `tramp-action-out-of-band', which see."
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
1208 :group 'tramp
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
1209 :type 'regexp)
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
1210
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1211 (defcustom tramp-temp-name-prefix "tramp."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1212 "*Prefix to use for temporary files.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1213 If this is a relative file name (such as \"tramp.\"), it is considered
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1214 relative to the directory name returned by the function
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
1215 `tramp-compat-temporary-file-directory' (which see). It may also be an
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1216 absolute file name; don't forget to include a prefix for the filename
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1217 part, though."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1218 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1219 :type 'string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1220
96941
940a290a5646 * net/tramp.el (tramp-methods): Add "-q" for "scp", "scp1",
Michael Albinus <michael.albinus@gmx.de>
parents: 96392
diff changeset
1221 (defconst tramp-temp-buffer-name " *tramp temp*"
940a290a5646 * net/tramp.el (tramp-methods): Add "-q" for "scp", "scp1",
Michael Albinus <michael.albinus@gmx.de>
parents: 96392
diff changeset
1222 "Buffer name for a temporary buffer.
940a290a5646 * net/tramp.el (tramp-methods): Add "-q" for "scp", "scp1",
Michael Albinus <michael.albinus@gmx.de>
parents: 96392
diff changeset
1223 It shall be used in combination with `generate-new-buffer-name'.")
940a290a5646 * net/tramp.el (tramp-methods): Add "-q" for "scp", "scp1",
Michael Albinus <michael.albinus@gmx.de>
parents: 96392
diff changeset
1224
105718
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
1225 (defvar tramp-temp-buffer-file-name nil
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
1226 "File name of a persistent local temporary file.
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
1227 Useful for \"rsync\" like methods.")
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
1228 (make-variable-buffer-local 'tramp-temp-buffer-file-name)
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
1229
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
1230 (defcustom tramp-sh-extra-args '(("/bash\\'" . "-norc -noprofile"))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1231 "*Alist specifying extra arguments to pass to the remote shell.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1232 Entries are (REGEXP . ARGS) where REGEXP is a regular expression
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1233 matching the shell file name and ARGS is a string specifying the
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1234 arguments.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1235
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1236 This variable is only used when Tramp needs to start up another shell
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1237 for tilde expansion. The extra arguments should typically prevent the
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1238 shell from reading its init file."
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1239 :group 'tramp
51968
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
1240 ;; This might be the wrong way to test whether the widget type
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
1241 ;; `alist' is available. Who knows the right way to test it?
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
1242 :type (if (get 'alist 'widget-type)
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
1243 '(alist :key-type string :value-type string)
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
1244 '(repeat (cons string string))))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1245
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1246 ;; XEmacs is distributed with few Lisp packages. Further packages are
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1247 ;; installed using EFS. If we use a unified filename format, then
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1248 ;; Tramp is required in addition to EFS. (But why can't Tramp just
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1249 ;; disable EFS when Tramp is loaded? Then XEmacs can ship with EFS
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1250 ;; just like before.) Another reason for using a separate filename
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1251 ;; syntax on XEmacs is that EFS hooks into XEmacs in many places, but
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1252 ;; Tramp only knows how to deal with `file-name-handler-alist', not
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1253 ;; the other places.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1254
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1255 ;; Currently, we have the choice between 'ftp, 'sep, and 'url.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1256 ;;;###autoload
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1257 (defcustom tramp-syntax
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1258 (if (featurep 'xemacs) 'sep 'ftp)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1259 "Tramp filename syntax to be used.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1260
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1261 It can have the following values:
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1262
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1263 'ftp -- Ange-FTP respective EFS like syntax (GNU Emacs default)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1264 'sep -- Syntax as defined for XEmacs (not available yet for GNU Emacs)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1265 'url -- URL-like syntax."
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1266 :group 'tramp
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1267 :type (if (featurep 'xemacs)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1268 '(choice (const :tag "EFS" ftp)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1269 (const :tag "XEmacs" sep)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1270 (const :tag "URL" url))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1271 '(choice (const :tag "Ange-FTP" ftp)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1272 (const :tag "URL" url))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1273
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1274 (defconst tramp-prefix-format
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1275 (cond ((equal tramp-syntax 'ftp) "/")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1276 ((equal tramp-syntax 'sep) "/[")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1277 ((equal tramp-syntax 'url) "/")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1278 (t (error "Wrong `tramp-syntax' defined")))
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
1279 "*String matching the very beginning of Tramp file names.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1280 Used in `tramp-make-tramp-file-name'.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1281
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1282 (defconst tramp-prefix-regexp
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1283 (concat "^" (regexp-quote tramp-prefix-format))
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
1284 "*Regexp matching the very beginning of Tramp file names.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1285 Should always start with \"^\". Derived from `tramp-prefix-format'.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1286
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1287 (defconst tramp-method-regexp
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1288 "[a-zA-Z_0-9-]+"
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1289 "*Regexp matching methods identifiers.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1290
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1291 (defconst tramp-postfix-method-format
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1292 (cond ((equal tramp-syntax 'ftp) ":")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1293 ((equal tramp-syntax 'sep) "/")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1294 ((equal tramp-syntax 'url) "://")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1295 (t (error "Wrong `tramp-syntax' defined")))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1296 "*String matching delimeter between method and user or host names.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1297 Used in `tramp-make-tramp-file-name'.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1298
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1299 (defconst tramp-postfix-method-regexp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1300 (regexp-quote tramp-postfix-method-format)
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1301 "*Regexp matching delimeter between method and user or host names.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1302 Derived from `tramp-postfix-method-format'.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1303
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1304 (defconst tramp-user-regexp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1305 "[^:/ \t]+"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1306 "*Regexp matching user names.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1307
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1308 (defconst tramp-prefix-domain-format "%"
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1309 "*String matching delimeter between user and domain names.")
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1310
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1311 (defconst tramp-prefix-domain-regexp
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1312 (regexp-quote tramp-prefix-domain-format)
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1313 "*Regexp matching delimeter between user and domain names.
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1314 Derived from `tramp-prefix-domain-format'.")
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1315
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1316 (defconst tramp-domain-regexp
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
1317 "[-a-zA-Z0-9_.]+"
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1318 "*Regexp matching domain names.")
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1319
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1320 (defconst tramp-user-with-domain-regexp
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1321 (concat "\\(" tramp-user-regexp "\\)"
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1322 tramp-prefix-domain-regexp
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1323 "\\(" tramp-domain-regexp "\\)")
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1324 "*Regexp matching user names with domain names.")
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1325
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1326 (defconst tramp-postfix-user-format
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1327 "@"
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1328 "*String matching delimeter between user and host names.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1329 Used in `tramp-make-tramp-file-name'.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1330
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1331 (defconst tramp-postfix-user-regexp
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1332 (regexp-quote tramp-postfix-user-format)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1333 "*Regexp matching delimeter between user and host names.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1334 Derived from `tramp-postfix-user-format'.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1335
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1336 (defconst tramp-host-regexp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1337 "[a-zA-Z0-9_.-]+"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1338 "*Regexp matching host names.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1339
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1340 (defconst tramp-prefix-ipv6-format
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1341 (cond ((equal tramp-syntax 'ftp) "[")
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1342 ((equal tramp-syntax 'sep) "")
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1343 ((equal tramp-syntax 'url) "[")
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1344 (t (error "Wrong `tramp-syntax' defined")))
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1345 "*String matching left hand side of IPv6 addresses.
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1346 Used in `tramp-make-tramp-file-name'.")
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1347
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1348 (defconst tramp-prefix-ipv6-regexp
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1349 (regexp-quote tramp-prefix-ipv6-format)
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1350 "*Regexp matching left hand side of IPv6 addresses.
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1351 Derived from `tramp-prefix-ipv6-format'.")
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1352
101282
986acdda4aac * net/tramp.el (tramp-ipv6-regexp): The regexp shall cover also
Michael Albinus <michael.albinus@gmx.de>
parents: 101020
diff changeset
1353 ;; The following regexp is a bit sloppy. But it shall serve our
986acdda4aac * net/tramp.el (tramp-ipv6-regexp): The regexp shall cover also
Michael Albinus <michael.albinus@gmx.de>
parents: 101020
diff changeset
1354 ;; purposes. It covers also IPv4 mapped IPv6 addresses, like in
986acdda4aac * net/tramp.el (tramp-ipv6-regexp): The regexp shall cover also
Michael Albinus <michael.albinus@gmx.de>
parents: 101020
diff changeset
1355 ;; "::ffff:192.168.0.1".
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1356 (defconst tramp-ipv6-regexp
101282
986acdda4aac * net/tramp.el (tramp-ipv6-regexp): The regexp shall cover also
Michael Albinus <michael.albinus@gmx.de>
parents: 101020
diff changeset
1357 "\\(?:\\(?:[a-zA-Z0-9]+\\)?:\\)+[a-zA-Z0-9.]+"
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1358 "*Regexp matching IPv6 addresses.")
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1359
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1360 (defconst tramp-postfix-ipv6-format
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1361 (cond ((equal tramp-syntax 'ftp) "]")
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1362 ((equal tramp-syntax 'sep) "")
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1363 ((equal tramp-syntax 'url) "]")
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1364 (t (error "Wrong `tramp-syntax' defined")))
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1365 "*String matching right hand side of IPv6 addresses.
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1366 Used in `tramp-make-tramp-file-name'.")
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1367
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1368 (defconst tramp-postfix-ipv6-regexp
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1369 (regexp-quote tramp-postfix-ipv6-format)
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1370 "*Regexp matching right hand side of IPv6 addresses.
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1371 Derived from `tramp-postfix-ipv6-format'.")
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1372
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1373 (defconst tramp-prefix-port-format
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1374 (cond ((equal tramp-syntax 'ftp) "#")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1375 ((equal tramp-syntax 'sep) "#")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1376 ((equal tramp-syntax 'url) ":")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1377 (t (error "Wrong `tramp-syntax' defined")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1378 "*String matching delimeter between host names and port numbers.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1379
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1380 (defconst tramp-prefix-port-regexp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1381 (regexp-quote tramp-prefix-port-format)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1382 "*Regexp matching delimeter between host names and port numbers.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1383 Derived from `tramp-prefix-port-format'.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1384
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1385 (defconst tramp-port-regexp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1386 "[0-9]+"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1387 "*Regexp matching port numbers.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1388
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1389 (defconst tramp-host-with-port-regexp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1390 (concat "\\(" tramp-host-regexp "\\)"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1391 tramp-prefix-port-regexp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1392 "\\(" tramp-port-regexp "\\)")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1393 "*Regexp matching host names with port numbers.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1394
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1395 (defconst tramp-postfix-host-format
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1396 (cond ((equal tramp-syntax 'ftp) ":")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1397 ((equal tramp-syntax 'sep) "]")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1398 ((equal tramp-syntax 'url) "")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1399 (t (error "Wrong `tramp-syntax' defined")))
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1400 "*String matching delimeter between host names and localnames.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1401 Used in `tramp-make-tramp-file-name'.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1402
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1403 (defconst tramp-postfix-host-regexp
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1404 (regexp-quote tramp-postfix-host-format)
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1405 "*Regexp matching delimeter between host names and localnames.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1406 Derived from `tramp-postfix-host-format'.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1407
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1408 (defconst tramp-localname-regexp
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1409 ".*$"
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1410 "*Regexp matching localnames.")
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1411
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1412 ;; File name format.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1413
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1414 (defconst tramp-file-name-structure
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1415 (list
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1416 (concat
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1417 tramp-prefix-regexp
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1418 "\\(" "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp "\\)?"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1419 "\\(" "\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp "\\)?"
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1420 "\\(" "\\(" tramp-host-regexp
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1421 "\\|"
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1422 tramp-prefix-ipv6-regexp tramp-ipv6-regexp
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1423 tramp-postfix-ipv6-regexp "\\)"
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1424 "\\(" tramp-prefix-port-regexp tramp-port-regexp "\\)?" "\\)?"
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1425 tramp-postfix-host-regexp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1426 "\\(" tramp-localname-regexp "\\)")
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1427 2 4 5 8)
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1428
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1429 "*List of five elements (REGEXP METHOD USER HOST FILE), detailing \
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
1430 the Tramp file name structure.
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
1431
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
1432 The first element REGEXP is a regular expression matching a Tramp file
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1433 name. The regex should contain parentheses around the method name,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1434 the user name, the host name, and the file name parts.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1435
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1436 The second element METHOD is a number, saying which pair of
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1437 parentheses matches the method name. The third element USER is
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1438 similar, but for the user name. The fourth element HOST is similar,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1439 but for the host name. The fifth element FILE is for the file name.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1440 These numbers are passed directly to `match-string', which see. That
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1441 means the opening parentheses are counted to identify the pair.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1442
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1443 See also `tramp-file-name-regexp'.")
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1444
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1445 ;;;###autoload
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1446 (defconst tramp-file-name-regexp-unified
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
1447 "\\`/\\([^[/:]+\\|[^/]+]\\):"
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1448 "Value for `tramp-file-name-regexp' for unified remoting.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1449 Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1450 Tramp. See `tramp-file-name-structure' for more explanations.")
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1451
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1452 ;;;###autoload
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1453 (defconst tramp-file-name-regexp-separate
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1454 "\\`/\\[.*\\]"
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1455 "Value for `tramp-file-name-regexp' for separate remoting.
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1456 XEmacs uses a separate filename syntax for Tramp and EFS.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1457 See `tramp-file-name-structure' for more explanations.")
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1458
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1459 ;;;###autoload
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1460 (defconst tramp-file-name-regexp-url
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1461 "\\`/[^/:]+://"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1462 "Value for `tramp-file-name-regexp' for URL-like remoting.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1463 See `tramp-file-name-structure' for more explanations.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1464
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1465 ;;;###autoload
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1466 (defconst tramp-file-name-regexp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1467 (cond ((equal tramp-syntax 'ftp) tramp-file-name-regexp-unified)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1468 ((equal tramp-syntax 'sep) tramp-file-name-regexp-separate)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1469 ((equal tramp-syntax 'url) tramp-file-name-regexp-url)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1470 (t (error "Wrong `tramp-syntax' defined")))
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
1471 "*Regular expression matching file names handled by Tramp.
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
1472 This regexp should match Tramp file names but no other file names.
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
1473 When tramp.el is loaded, this regular expression is prepended to
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1474 `file-name-handler-alist', and that is searched sequentially. Thus,
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
1475 if the Tramp entry appears rather early in the `file-name-handler-alist'
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
1476 and is a bit too general, then some files might be considered Tramp
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1477 files which are not really Tramp files.
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1478
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1479 Please note that the entry in `file-name-handler-alist' is made when
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
1480 this file \(tramp.el\) is loaded. This means that this variable must be set
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1481 before loading tramp.el. Alternatively, `file-name-handler-alist' can be
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1482 updated after changing this variable.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1483
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1484 Also see `tramp-file-name-structure'.")
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1485
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1486 ;;;###autoload
92982
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
1487 (defconst tramp-root-regexp
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1488 (if (memq system-type '(cygwin windows-nt))
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
1489 "\\`\\([a-zA-Z]:\\)?/"
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
1490 "\\`/")
92982
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
1491 "Beginning of an incomplete Tramp file name.
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
1492 Usually, it is just \"\\\\`/\". On W32 systems, there might be a
93040
ba82da0cb626 * net/tramp.el (tramp-root-regexp): Simplify.
Michael Albinus <michael.albinus@gmx.de>
parents: 93036
diff changeset
1493 volume letter, which will be removed by `tramp-drop-volume-letter'.")
92982
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
1494
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
1495 ;;;###autoload
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
1496 (defconst tramp-completion-file-name-regexp-unified
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
1497 (concat tramp-root-regexp "[^/]*\\'")
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1498 "Value for `tramp-completion-file-name-regexp' for unified remoting.
92982
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
1499 GNU Emacs uses a unified filename syntax for Tramp and Ange-FTP.
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
1500 See `tramp-file-name-structure' for more explanations.")
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1501
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1502 ;;;###autoload
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1503 (defconst tramp-completion-file-name-regexp-separate
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
1504 (concat tramp-root-regexp "\\([[][^]]*\\)?\\'")
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1505 "Value for `tramp-completion-file-name-regexp' for separate remoting.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1506 XEmacs uses a separate filename syntax for Tramp and EFS.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1507 See `tramp-file-name-structure' for more explanations.")
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1508
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1509 ;;;###autoload
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1510 (defconst tramp-completion-file-name-regexp-url
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
1511 (concat tramp-root-regexp "[^/:]+\\(:\\(/\\(/[^/]*\\)?\\)?\\)?\\'")
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1512 "Value for `tramp-completion-file-name-regexp' for URL-like remoting.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1513 See `tramp-file-name-structure' for more explanations.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1514
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1515 ;;;###autoload
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1516 (defconst tramp-completion-file-name-regexp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1517 (cond ((equal tramp-syntax 'ftp) tramp-completion-file-name-regexp-unified)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1518 ((equal tramp-syntax 'sep) tramp-completion-file-name-regexp-separate)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1519 ((equal tramp-syntax 'url) tramp-completion-file-name-regexp-url)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1520 (t (error "Wrong `tramp-syntax' defined")))
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
1521 "*Regular expression matching file names handled by Tramp completion.
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
1522 This regexp should match partial Tramp file names only.
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1523
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1524 Please note that the entry in `file-name-handler-alist' is made when
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1525 this file (tramp.el) is loaded. This means that this variable must be set
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1526 before loading tramp.el. Alternatively, `file-name-handler-alist' can be
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1527 updated after changing this variable.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1528
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1529 Also see `tramp-file-name-structure'.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1530
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1531 (defconst tramp-actions-before-shell
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1532 '((tramp-login-prompt-regexp tramp-action-login)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1533 (tramp-password-prompt-regexp tramp-action-password)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1534 (tramp-wrong-passwd-regexp tramp-action-permission-denied)
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1535 (shell-prompt-pattern tramp-action-succeed)
46998
9d6aef07c793 Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46992
diff changeset
1536 (tramp-shell-prompt-pattern tramp-action-succeed)
46992
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
1537 (tramp-yesno-prompt-regexp tramp-action-yesno)
47771
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
1538 (tramp-yn-prompt-regexp tramp-action-yn)
55844
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
1539 (tramp-terminal-prompt-regexp tramp-action-terminal)
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
1540 (tramp-process-alive-regexp tramp-action-process-alive))
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1541 "List of pattern/action pairs.
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1542 Whenever a pattern matches, the corresponding action is performed.
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1543 Each item looks like (PATTERN ACTION).
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1544
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1545 The PATTERN should be a symbol, a variable. The value of this
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1546 variable gives the regular expression to search for. Note that the
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1547 regexp must match at the end of the buffer, \"\\'\" is implicitly
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1548 appended to it.
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1549
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1550 The ACTION should also be a symbol, but a function. When the
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1551 corresponding PATTERN matches, the ACTION function is called.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1552
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1553 (defconst tramp-actions-copy-out-of-band
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
1554 '((tramp-password-prompt-regexp tramp-action-password)
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
1555 (tramp-wrong-passwd-regexp tramp-action-permission-denied)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1556 (tramp-copy-failed-regexp tramp-action-permission-denied)
55844
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
1557 (tramp-process-alive-regexp tramp-action-out-of-band))
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
1558 "List of pattern/action pairs.
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
1559 This list is used for copying/renaming with out-of-band methods.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1560
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1561 See `tramp-actions-before-shell' for more info.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1562
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1563 ;; Chunked sending kludge. We set this to 500 for black-listed constellations
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1564 ;; known to have a bug in `process-send-string'; some ssh connections appear
62344
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
1565 ;; to drop bytes when data is sent too quickly. There is also a connection
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
1566 ;; buffer local variable, which is computed depending on remote host properties
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
1567 ;; when `tramp-chunksize' is zero or nil.
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1568 (defcustom tramp-chunksize
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1569 (when (and (not (featurep 'xemacs))
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1570 (memq system-type '(hpux)))
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1571 500)
66561
742e40a6bf3c * net/tramp.el (tramp-chunksize): Escape parentheses in docstring
Michael Albinus <michael.albinus@gmx.de>
parents: 66496
diff changeset
1572 ;; Parentheses in docstring starting at beginning of line are escaped.
742e40a6bf3c * net/tramp.el (tramp-chunksize): Escape parentheses in docstring
Michael Albinus <michael.albinus@gmx.de>
parents: 66496
diff changeset
1573 ;; Fontification is messed up when
742e40a6bf3c * net/tramp.el (tramp-chunksize): Escape parentheses in docstring
Michael Albinus <michael.albinus@gmx.de>
parents: 66496
diff changeset
1574 ;; `open-paren-in-column-0-is-defun-start' set to t.
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1575 "*If non-nil, chunksize for sending input to local process.
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1576 It is necessary only on systems which have a buggy `process-send-string'
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1577 implementation. The necessity, whether this variable must be set, can be
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1578 checked via the following code:
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1579
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1580 (with-temp-buffer
65925
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1581 (let* ((user \"xxx\") (host \"yyy\")
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1582 (init 0) (step 50)
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1583 (sent init) (received init))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1584 (while (= sent received)
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1585 (setq sent (+ sent step))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1586 (erase-buffer)
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1587 (let ((proc (start-process (buffer-name) (current-buffer)
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1588 \"ssh\" \"-l\" user host \"wc\" \"-c\")))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1589 (when (memq (process-status proc) '(run open))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1590 (process-send-string proc (make-string sent ?\\ ))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1591 (process-send-eof proc)
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1592 (process-send-eof proc))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1593 (while (not (progn (goto-char (point-min))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1594 (re-search-forward \"\\\\w+\" (point-max) t)))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1595 (accept-process-output proc 1))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1596 (when (memq (process-status proc) '(run open))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1597 (setq received (string-to-number (match-string 0)))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1598 (delete-process proc)
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1599 (message \"Bytes sent: %s\\tBytes received: %s\" sent received)
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1600 (sit-for 0))))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1601 (if (> sent (+ init step))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1602 (message \"You should set `tramp-chunksize' to a maximum of %s\"
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1603 (- sent step))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1604 (message \"Test does not work\")
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1605 (display-buffer (current-buffer))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1606 (sit-for 30))))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1607
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1608 In the Emacs normally running Tramp, evaluate the above code
66561
742e40a6bf3c * net/tramp.el (tramp-chunksize): Escape parentheses in docstring
Michael Albinus <michael.albinus@gmx.de>
parents: 66496
diff changeset
1609 \(replace \"xxx\" and \"yyy\" by the remote user and host name,
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
1610 respectively\). You can do this, for example, by pasting it into
65925
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1611 the `*scratch*' buffer and then hitting C-j with the cursor after the
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1612 last closing parenthesis. Note that it works only if you have configured
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
1613 \"ssh\" to run without password query, see ssh-agent\(1\).
65925
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1614
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1615 You will see the number of bytes sent successfully to the remote host.
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1616 If that number exceeds 1000, you can stop the execution by hitting
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1617 C-g, because your Emacs is likely clean.
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1618
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1619 When it is necessary to set `tramp-chunksize', you might consider to
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
1620 use an out-of-the-band method \(like \"scp\"\) instead of an internal one
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
1621 \(like \"ssh\"\), because setting `tramp-chunksize' to non-nil decreases
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1622 performance.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1623
65925
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1624 If your Emacs is buggy, the code stops and gives you an indication
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1625 about the value `tramp-chunksize' should be set. Maybe you could just
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1626 experiment a bit, e.g. changing the values of `init' and `step'
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1627 in the third line of the code.
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1628
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1629 Please raise a bug report via \"M-x tramp-bug\" if your system needs
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1630 this variable to be set as well."
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1631 :group 'tramp
50338
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1632 :type '(choice (const nil) integer))
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1633
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
1634 ;; Logging in to a remote host normally requires obtaining a pty. But
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
1635 ;; Emacs on MacOS X has process-connection-type set to nil by default,
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
1636 ;; so on those systems Tramp doesn't obtain a pty. Here, we allow
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
1637 ;; for an override of the system default.
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
1638 (defcustom tramp-process-connection-type t
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
1639 "Overrides `process-connection-type' for connections from Tramp.
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
1640 Tramp binds process-connection-type to the value given here before
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
1641 opening a connection to a remote host."
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
1642 :group 'tramp
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
1643 :type '(choice (const nil) (const t) (const pty)))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
1644
86204
7d7472ea9c0a * net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents: 86048
diff changeset
1645 (defcustom tramp-completion-reread-directory-timeout 10
7d7472ea9c0a * net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents: 86048
diff changeset
1646 "Defines seconds since last remote command before rereading a directory.
7d7472ea9c0a * net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents: 86048
diff changeset
1647 A remote directory might have changed its contents. In order to
7d7472ea9c0a * net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents: 86048
diff changeset
1648 make it visible during file name completion in the minibuffer,
7d7472ea9c0a * net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents: 86048
diff changeset
1649 Tramp flushes its cache and rereads the directory contents when
7d7472ea9c0a * net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents: 86048
diff changeset
1650 more than `tramp-completion-reread-directory-timeout' seconds
7d7472ea9c0a * net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents: 86048
diff changeset
1651 have been gone since last remote command execution. A value of 0
7d7472ea9c0a * net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents: 86048
diff changeset
1652 would require an immediate reread during filename completion, nil
7d7472ea9c0a * net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents: 86048
diff changeset
1653 means to use always cached values for the directory contents."
7d7472ea9c0a * net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents: 86048
diff changeset
1654 :group 'tramp
7d7472ea9c0a * net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents: 86048
diff changeset
1655 :type '(choice (const nil) integer))
7d7472ea9c0a * net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents: 86048
diff changeset
1656
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1657 ;;; Internal Variables:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1658
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1659 (defvar tramp-current-method nil
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1660 "Connection method for this *tramp* buffer.")
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1661
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1662 (defvar tramp-current-user nil
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1663 "Remote login name for this *tramp* buffer.")
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1664
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1665 (defvar tramp-current-host nil
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1666 "Remote host for this *tramp* buffer.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1667
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1668 (defconst tramp-uudecode
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1669 "(echo begin 600 /tmp/tramp.$$; tail +2) | uudecode
46802
10aa49b3d28a Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46801
diff changeset
1670 cat /tmp/tramp.$$
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1671 rm -f /tmp/tramp.$$"
46802
10aa49b3d28a Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46801
diff changeset
1672 "Shell function to implement `uudecode' to standard output.
59031
1fbbe0bcfaac Sync with Tramp 2.0.46.
Michael Albinus <michael.albinus@gmx.de>
parents: 58776
diff changeset
1673 Many systems support `uudecode -o /dev/stdout' or `uudecode -o -'
1fbbe0bcfaac Sync with Tramp 2.0.46.
Michael Albinus <michael.albinus@gmx.de>
parents: 58776
diff changeset
1674 for this or `uudecode -p', but some systems don't, and for them
1fbbe0bcfaac Sync with Tramp 2.0.46.
Michael Albinus <michael.albinus@gmx.de>
parents: 58776
diff changeset
1675 we have this shell function.")
46802
10aa49b3d28a Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46801
diff changeset
1676
105767
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1677 (defconst tramp-perl-file-truename
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1678 "%s -e '
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1679 use File::Spec;
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1680 use Cwd \"realpath\";
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1681
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1682 sub recursive {
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1683 my ($volume, @dirs) = @_;
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1684 my $real = realpath(File::Spec->catpath(
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1685 $volume, File::Spec->catdir(@dirs), \"\"));
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1686 if ($real) {
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1687 my ($vol, $dir) = File::Spec->splitpath($real, 1);
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1688 return ($vol, File::Spec->splitdir($dir));
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1689 }
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1690 else {
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1691 my $last = pop(@dirs);
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1692 ($volume, @dirs) = recursive($volume, @dirs);
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1693 push(@dirs, $last);
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1694 return ($volume, @dirs);
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1695 }
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1696 }
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1697
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1698 $result = realpath($ARGV[0]);
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1699 if (!$result) {
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1700 my ($vol, $dir) = File::Spec->splitpath($ARGV[0], 1);
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1701 ($vol, @dirs) = recursive($vol, File::Spec->splitdir($dir));
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1702
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1703 $result = File::Spec->catpath($vol, File::Spec->catdir(@dirs), \"\");
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1704 }
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1705
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1706 if ($ARGV[0] =~ /\\/$/) {
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1707 $result = $result . \"/\";
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1708 }
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1709
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1710 print \"\\\"$result\\\"\\n\";
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1711 ' \"$1\" 2>/dev/null"
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1712 "Perl script to produce output suitable for use with `file-truename'
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1713 on the remote file system.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1714 Escape sequence %s is replaced with name of Perl binary.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1715 This string is passed to `format', so percent characters need to be doubled.")
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1716
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1717 (defconst tramp-perl-file-name-all-completions
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1718 "%s -e 'sub case {
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1719 my $str = shift;
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1720 if ($ARGV[2]) {
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1721 return lc($str);
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1722 }
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1723 else {
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1724 return $str;
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1725 }
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1726 }
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1727 opendir(d, $ARGV[0]) || die(\"$ARGV[0]: $!\\nfail\\n\");
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1728 @files = readdir(d); closedir(d);
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1729 foreach $f (@files) {
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1730 if (case(substr($f, 0, length($ARGV[1]))) eq case($ARGV[1])) {
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1731 if (-d \"$ARGV[0]/$f\") {
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1732 print \"$f/\\n\";
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1733 }
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1734 else {
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1735 print \"$f\\n\";
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1736 }
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1737 }
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1738 }
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1739 print \"ok\\n\"
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1740 ' \"$1\" \"$2\" \"$3\" 2>/dev/null"
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1741 "Perl script to produce output suitable for use with
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1742 `file-name-all-completions' on the remote file system. Escape
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1743 sequence %s is replaced with name of Perl binary. This string is
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1744 passed to `format', so percent characters need to be doubled.")
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
1745
46802
10aa49b3d28a Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46801
diff changeset
1746 ;; Perl script to implement `file-attributes' in a Lisp `read'able
10aa49b3d28a Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46801
diff changeset
1747 ;; output. If you are hacking on this, note that you get *no* output
10aa49b3d28a Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46801
diff changeset
1748 ;; unless this spits out a complete line, including the '\n' at the
10aa49b3d28a Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46801
diff changeset
1749 ;; end.
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
1750 ;; The device number is returned as "-1", because there will be a virtual
97052
bed318e44ebd * net/tramp.el (tramp-perl-directory-files-and-attributes)
Michael Albinus <michael.albinus@gmx.de>
parents: 97035
diff changeset
1751 ;; device number set in `tramp-handle-file-attributes'.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1752 (defconst tramp-perl-file-attributes
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1753 "%s -e '
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1754 @stat = lstat($ARGV[0]);
104866
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
1755 if (!@stat) {
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
1756 print \"nil\\n\";
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
1757 exit 0;
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
1758 }
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1759 if (($stat[2] & 0170000) == 0120000)
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1760 {
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1761 $type = readlink($ARGV[0]);
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1762 $type = \"\\\"$type\\\"\";
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1763 }
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1764 elsif (($stat[2] & 0170000) == 040000)
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1765 {
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1766 $type = \"t\";
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1767 }
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1768 else
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1769 {
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1770 $type = \"nil\"
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1771 };
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1772 $uid = ($ARGV[1] eq \"integer\") ? $stat[4] : \"\\\"\" . getpwuid($stat[4]) . \"\\\"\";
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1773 $gid = ($ARGV[1] eq \"integer\") ? $stat[5] : \"\\\"\" . getgrgid($stat[5]) . \"\\\"\";
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1774 printf(
82064
07bb0658401d * net/tramp.el (tramp-perl-file-attributes)
Michael Albinus <michael.albinus@gmx.de>
parents: 82025
diff changeset
1775 \"(%%s %%u %%s %%s (%%u %%u) (%%u %%u) (%%u %%u) %%u.0 %%u t (%%u . %%u) -1)\\n\",
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1776 $type,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1777 $stat[3],
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1778 $uid,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1779 $gid,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1780 $stat[8] >> 16 & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1781 $stat[8] & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1782 $stat[9] >> 16 & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1783 $stat[9] & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1784 $stat[10] >> 16 & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1785 $stat[10] & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1786 $stat[7],
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1787 $stat[2],
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1788 $stat[1] >> 16 & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1789 $stat[1] & 0xffff
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1790 );' \"$1\" \"$2\" \"$3\" 2>/dev/null"
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1791 "Perl script to produce output suitable for use with `file-attributes'
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1792 on the remote file system.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1793 Escape sequence %s is replaced with name of Perl binary.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1794 This string is passed to `format', so percent characters need to be doubled.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1795
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1796 (defconst tramp-perl-directory-files-and-attributes
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1797 "%s -e '
65926
e465f3508fd5 (tramp-perl-directory-files-and-attributes): Add error handling.
Lars Hansen <larsh@soem.dk>
parents: 65925
diff changeset
1798 chdir($ARGV[0]) or printf(\"\\\"Cannot change to $ARGV[0]: $''!''\\\"\\n\"), exit();
e465f3508fd5 (tramp-perl-directory-files-and-attributes): Add error handling.
Lars Hansen <larsh@soem.dk>
parents: 65925
diff changeset
1799 opendir(DIR,\".\") or printf(\"\\\"Cannot open directory $ARGV[0]: $''!''\\\"\\n\"), exit();
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1800 @list = readdir(DIR);
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1801 closedir(DIR);
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1802 $n = scalar(@list);
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1803 printf(\"(\\n\");
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1804 for($i = 0; $i < $n; $i++)
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1805 {
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1806 $filename = $list[$i];
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1807 @stat = lstat($filename);
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1808 if (($stat[2] & 0170000) == 0120000)
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1809 {
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1810 $type = readlink($filename);
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1811 $type = \"\\\"$type\\\"\";
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1812 }
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1813 elsif (($stat[2] & 0170000) == 040000)
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1814 {
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1815 $type = \"t\";
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1816 }
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1817 else
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1818 {
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1819 $type = \"nil\"
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1820 };
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1821 $uid = ($ARGV[1] eq \"integer\") ? $stat[4] : \"\\\"\" . getpwuid($stat[4]) . \"\\\"\";
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1822 $gid = ($ARGV[1] eq \"integer\") ? $stat[5] : \"\\\"\" . getgrgid($stat[5]) . \"\\\"\";
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1823 printf(
97052
bed318e44ebd * net/tramp.el (tramp-perl-directory-files-and-attributes)
Michael Albinus <michael.albinus@gmx.de>
parents: 97035
diff changeset
1824 \"(\\\"%%s\\\" %%s %%u %%s %%s (%%u %%u) (%%u %%u) (%%u %%u) %%u.0 %%u t (%%u . %%u) (%%u . %%u))\\n\",
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1825 $filename,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1826 $type,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1827 $stat[3],
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1828 $uid,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1829 $gid,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1830 $stat[8] >> 16 & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1831 $stat[8] & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1832 $stat[9] >> 16 & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1833 $stat[9] & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1834 $stat[10] >> 16 & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1835 $stat[10] & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1836 $stat[7],
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1837 $stat[2],
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1838 $stat[1] >> 16 & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1839 $stat[1] & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1840 $stat[0] >> 16 & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1841 $stat[0] & 0xffff);
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1842 }
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1843 printf(\")\\n\");' \"$1\" \"$2\" \"$3\" 2>/dev/null"
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1844 "Perl script implementing `directory-files-attributes' as Lisp `read'able
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1845 output.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1846 Escape sequence %s is replaced with name of Perl binary.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1847 This string is passed to `format', so percent characters need to be doubled.")
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1848
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1849 ;; ;; These two use uu encoding.
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1850 ;; (defvar tramp-perl-encode "%s -e'\
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1851 ;; print qq(begin 644 xxx\n);
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1852 ;; my $s = q();
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1853 ;; my $res = q();
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1854 ;; while (read(STDIN, $s, 45)) {
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1855 ;; print pack(q(u), $s);
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1856 ;; }
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1857 ;; print qq(`\n);
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1858 ;; print qq(end\n);
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1859 ;; '"
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1860 ;; "Perl program to use for encoding a file.
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1861 ;; Escape sequence %s is replaced with name of Perl binary.")
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1862
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1863 ;; (defvar tramp-perl-decode "%s -ne '
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1864 ;; print unpack q(u), $_;
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1865 ;; '"
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1866 ;; "Perl program to use for decoding a file.
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1867 ;; Escape sequence %s is replaced with name of Perl binary.")
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1868
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1869 ;; These two use base64 encoding.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1870 (defconst tramp-perl-encode-with-module
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1871 "%s -MMIME::Base64 -0777 -ne 'print encode_base64($_)' 2>/dev/null"
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1872 "Perl program to use for encoding a file.
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1873 Escape sequence %s is replaced with name of Perl binary.
46801
3fafc6fca8a8 Version 2.0.9 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46799
diff changeset
1874 This string is passed to `format', so percent characters need to be doubled.
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1875 This implementation requires the MIME::Base64 Perl module to be installed
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1876 on the remote host.")
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1877
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1878 (defconst tramp-perl-decode-with-module
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1879 "%s -MMIME::Base64 -0777 -ne 'print decode_base64($_)' 2>/dev/null"
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1880 "Perl program to use for decoding a file.
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1881 Escape sequence %s is replaced with name of Perl binary.
46801
3fafc6fca8a8 Version 2.0.9 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46799
diff changeset
1882 This string is passed to `format', so percent characters need to be doubled.
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1883 This implementation requires the MIME::Base64 Perl module to be installed
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1884 on the remote host.")
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1885
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1886 (defconst tramp-perl-encode
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1887 "%s -e '
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1888 # This script contributed by Juanma Barranquero <lektu@terra.es>.
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 106643
diff changeset
1889 # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
75361
9cc44485654f (tramp-perl-encode, tramp-perl-decode): Update copyrights.
Glenn Morris <rgm@gnu.org>
parents: 75194
diff changeset
1890 # Free Software Foundation, Inc.
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1891 use strict;
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1892
46795
305403dc91a3 Version 2.0.7.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46790
diff changeset
1893 my %%trans = do {
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1894 my $i = 0;
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1895 map {(substr(unpack(q(B8), chr $i++), 2, 6), $_)}
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1896 split //, q(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/);
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1897 };
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1898
46797
1c4af44cad8c Version 2.0.8.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46795
diff changeset
1899 binmode(\\*STDIN);
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1900
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1901 # We read in chunks of 54 bytes, to generate output lines
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1902 # of 72 chars (plus end of line)
46797
1c4af44cad8c Version 2.0.8.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46795
diff changeset
1903 $/ = \\54;
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1904
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1905 while (my $data = <STDIN>) {
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1906 my $pad = q();
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1907
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1908 # Only for the last chunk, and only if did not fill the last three-byte packet
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1909 if (eof) {
46795
305403dc91a3 Version 2.0.7.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46790
diff changeset
1910 my $mod = length($data) %% 3;
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1911 $pad = q(=) x (3 - $mod) if $mod;
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1912 }
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1913
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1914 # Not the fastest method, but it is simple: unpack to binary string, split
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1915 # by groups of 6 bits and convert back from binary to byte; then map into
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1916 # the translation table
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1917 print
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1918 join q(),
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1919 map($trans{$_},
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1920 (substr(unpack(q(B*), $data) . q(00000), 0, 432) =~ /....../g)),
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1921 $pad,
46797
1c4af44cad8c Version 2.0.8.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46795
diff changeset
1922 qq(\\n);
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1923 }' 2>/dev/null"
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1924 "Perl program to use for encoding a file.
46795
305403dc91a3 Version 2.0.7.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46790
diff changeset
1925 Escape sequence %s is replaced with name of Perl binary.
46799
c9fab7d532d1 (tramp-perl-encode, tramp-perl-decode): Doc fix.
Andreas Schwab <schwab@suse.de>
parents: 46797
diff changeset
1926 This string is passed to `format', so percent characters need to be doubled.")
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1927
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1928 (defconst tramp-perl-decode
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1929 "%s -e '
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1930 # This script contributed by Juanma Barranquero <lektu@terra.es>.
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 106643
diff changeset
1931 # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
75361
9cc44485654f (tramp-perl-encode, tramp-perl-decode): Update copyrights.
Glenn Morris <rgm@gnu.org>
parents: 75194
diff changeset
1932 # Free Software Foundation, Inc.
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1933 use strict;
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1934
46795
305403dc91a3 Version 2.0.7.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46790
diff changeset
1935 my %%trans = do {
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1936 my $i = 0;
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1937 map {($_, substr(unpack(q(B8), chr $i++), 2, 6))}
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1938 split //, q(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/)
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1939 };
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1940
46795
305403dc91a3 Version 2.0.7.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46790
diff changeset
1941 my %%bytes = map {(unpack(q(B8), chr $_), chr $_)} 0 .. 255;
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1942
46797
1c4af44cad8c Version 2.0.8.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46795
diff changeset
1943 binmode(\\*STDOUT);
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1944
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1945 # We are going to accumulate into $pending to accept any line length
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1946 # (we do not check they are <= 76 chars as the RFC says)
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1947 my $pending = q();
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1948
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1949 while (my $data = <STDIN>) {
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1950 chomp $data;
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1951
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1952 # If we find one or two =, we have reached the end and
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1953 # any following data is to be discarded
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1954 my $finished = $data =~ s/(==?).*/$1/;
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1955 $pending .= $data;
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1956
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1957 my $len = length($pending);
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1958 my $chunk = substr($pending, 0, $len & ~3);
57463
40298ea4d83f Sync with Tramp 2.0.45.
Michael Albinus <michael.albinus@gmx.de>
parents: 56644
diff changeset
1959 $pending = substr($pending, $len & ~3 + 1);
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1960
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1961 # Easy method: translate from chars to (pregenerated) six-bit packets, join,
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1962 # split in 8-bit chunks and convert back to char.
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1963 print join q(),
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1964 map $bytes{$_},
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1965 ((join q(), map {$trans{$_} || q()} split //, $chunk) =~ /......../g);
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1966
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1967 last if $finished;
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1968 }' 2>/dev/null"
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1969 "Perl program to use for decoding a file.
46795
305403dc91a3 Version 2.0.7.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46790
diff changeset
1970 Escape sequence %s is replaced with name of Perl binary.
46799
c9fab7d532d1 (tramp-perl-encode, tramp-perl-decode): Doc fix.
Andreas Schwab <schwab@suse.de>
parents: 46797
diff changeset
1971 This string is passed to `format', so percent characters need to be doubled.")
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1972
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
1973 (defconst tramp-vc-registered-read-file-names
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
1974 "echo \"(\"
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
1975 for file in \"$@\"; do
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
1976 if %s $file; then
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
1977 echo \"(\\\"$file\\\" \\\"file-exists-p\\\" t)\"
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
1978 else
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
1979 echo \"(\\\"$file\\\" \\\"file-exists-p\\\" nil)\"
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
1980 fi
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
1981 if %s $file; then
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
1982 echo \"(\\\"$file\\\" \\\"file-readable-p\\\" t)\"
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
1983 else
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
1984 echo \"(\\\"$file\\\" \\\"file-readable-p\\\" nil)\"
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
1985 fi
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
1986 done
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
1987 echo \")\""
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
1988 "Script to check existence of VC related files.
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
1989 It must be send formatted with two strings; the tests for file
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
1990 existence, and file readability.")
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
1991
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
1992 (defconst tramp-file-mode-type-map
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
1993 '((0 . "-") ; Normal file (SVID-v2 and XPG2)
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
1994 (1 . "p") ; fifo
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
1995 (2 . "c") ; character device
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
1996 (3 . "m") ; multiplexed character device (v7)
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
1997 (4 . "d") ; directory
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
1998 (5 . "?") ; Named special file (XENIX)
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
1999 (6 . "b") ; block device
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
2000 (7 . "?") ; multiplexed block device (v7)
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
2001 (8 . "-") ; regular file
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
2002 (9 . "n") ; network special file (HP-UX)
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
2003 (10 . "l") ; symlink
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
2004 (11 . "?") ; ACL shadow inode (Solaris, not userspace)
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
2005 (12 . "s") ; socket
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
2006 (13 . "D") ; door special (Solaris)
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
2007 (14 . "w")) ; whiteout (BSD)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2008 "A list of file types returned from the `stat' system call.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2009 This is used to map a mode number to a permission string.")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2010
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2011 ;; New handlers should be added here. The following operations can be
99615
6808df5428f7 * net/tramp.el (tramp-handle-file-name-as-directory): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 99540
diff changeset
2012 ;; handled using the normal primitives: file-name-sans-versions,
6808df5428f7 * net/tramp.el (tramp-handle-file-name-as-directory): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 99540
diff changeset
2013 ;; get-file-buffer.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2014 (defconst tramp-file-name-handler-alist
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2015 '((load . tramp-handle-load)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2016 (make-symbolic-link . tramp-handle-make-symbolic-link)
99615
6808df5428f7 * net/tramp.el (tramp-handle-file-name-as-directory): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 99540
diff changeset
2017 (file-name-as-directory . tramp-handle-file-name-as-directory)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2018 (file-name-directory . tramp-handle-file-name-directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2019 (file-name-nondirectory . tramp-handle-file-name-nondirectory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2020 (file-truename . tramp-handle-file-truename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2021 (file-exists-p . tramp-handle-file-exists-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2022 (file-directory-p . tramp-handle-file-directory-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2023 (file-executable-p . tramp-handle-file-executable-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2024 (file-readable-p . tramp-handle-file-readable-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2025 (file-regular-p . tramp-handle-file-regular-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2026 (file-symlink-p . tramp-handle-file-symlink-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2027 (file-writable-p . tramp-handle-file-writable-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2028 (file-ownership-preserved-p . tramp-handle-file-ownership-preserved-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2029 (file-newer-than-file-p . tramp-handle-file-newer-than-file-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2030 (file-attributes . tramp-handle-file-attributes)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2031 (file-modes . tramp-handle-file-modes)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2032 (directory-files . tramp-handle-directory-files)
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
2033 (directory-files-and-attributes . tramp-handle-directory-files-and-attributes)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2034 (file-name-all-completions . tramp-handle-file-name-all-completions)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2035 (file-name-completion . tramp-handle-file-name-completion)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2036 (add-name-to-file . tramp-handle-add-name-to-file)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2037 (copy-file . tramp-handle-copy-file)
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
2038 (copy-directory . tramp-handle-copy-directory)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2039 (rename-file . tramp-handle-rename-file)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2040 (set-file-modes . tramp-handle-set-file-modes)
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
2041 (set-file-times . tramp-handle-set-file-times)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2042 (make-directory . tramp-handle-make-directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2043 (delete-directory . tramp-handle-delete-directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2044 (delete-file . tramp-handle-delete-file)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2045 (directory-file-name . tramp-handle-directory-file-name)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2046 ;; `executable-find' is not official yet.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2047 (executable-find . tramp-handle-executable-find)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2048 (start-file-process . tramp-handle-start-file-process)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2049 (process-file . tramp-handle-process-file)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2050 (shell-command . tramp-handle-shell-command)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2051 (insert-directory . tramp-handle-insert-directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2052 (expand-file-name . tramp-handle-expand-file-name)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2053 (substitute-in-file-name . tramp-handle-substitute-in-file-name)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2054 (file-local-copy . tramp-handle-file-local-copy)
55844
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
2055 (file-remote-p . tramp-handle-file-remote-p)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2056 (insert-file-contents . tramp-handle-insert-file-contents)
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
2057 (insert-file-contents-literally
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
2058 . tramp-handle-insert-file-contents-literally)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2059 (write-region . tramp-handle-write-region)
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
2060 (find-backup-file-name . tramp-handle-find-backup-file-name)
65248
0f994edbec5e Make `make-auto-save-file-name' a magic operation.
Michael Albinus <michael.albinus@gmx.de>
parents: 64772
diff changeset
2061 (make-auto-save-file-name . tramp-handle-make-auto-save-file-name)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2062 (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory)
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2063 (dired-compress-file . tramp-handle-dired-compress-file)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2064 (dired-recursive-delete-directory
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2065 . tramp-handle-dired-recursive-delete-directory)
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
2066 (dired-uncache . tramp-handle-dired-uncache)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2067 (set-visited-file-modtime . tramp-handle-set-visited-file-modtime)
102907
5055f4ba592b * net/tramp.el (tramp-file-name-handler-alist): Add
Michael Albinus <michael.albinus@gmx.de>
parents: 102851
diff changeset
2068 (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
108077
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
2069 (file-selinux-context . tramp-handle-file-selinux-context)
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
2070 (set-file-selinux-context . tramp-handle-set-file-selinux-context)
102907
5055f4ba592b * net/tramp.el (tramp-file-name-handler-alist): Add
Michael Albinus <michael.albinus@gmx.de>
parents: 102851
diff changeset
2071 (vc-registered . tramp-handle-vc-registered))
65248
0f994edbec5e Make `make-auto-save-file-name' a magic operation.
Michael Albinus <michael.albinus@gmx.de>
parents: 64772
diff changeset
2072 "Alist of handler functions.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2073 Operations not mentioned here will be handled by the normal Emacs functions.")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2074
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
2075 ;; Handlers for partial Tramp file names. For Emacs just
70276
32b384911b4f tramp-file-name-handler-alist): Delete expand-file-name and other
Richard M. Stallman <rms@gnu.org>
parents: 70255
diff changeset
2076 ;; `file-name-all-completions' is needed.
70318
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
2077 ;;;###autoload
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2078 (defconst tramp-completion-file-name-handler-alist
70318
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
2079 '((file-name-all-completions . tramp-completion-handle-file-name-all-completions)
70276
32b384911b4f tramp-file-name-handler-alist): Delete expand-file-name and other
Richard M. Stallman <rms@gnu.org>
parents: 70255
diff changeset
2080 (file-name-completion . tramp-completion-handle-file-name-completion))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2081 "Alist of completion handler functions.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2082 Used for file names matching `tramp-file-name-regexp'. Operations not
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2083 mentioned here will be handled by `tramp-file-name-handler-alist' or the
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2084 normal Emacs functions.")
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2085
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
2086 ;; Handlers for foreign methods, like FTP or SMB, shall be plugged here.
51603
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
2087 (defvar tramp-foreign-file-name-handler-alist
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
2088 ;; (identity . tramp-sh-file-name-handler) should always be the last
105718
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
2089 ;; entry, because `identity' always matches.
51603
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
2090 '((identity . tramp-sh-file-name-handler))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
2091 "Alist of elements (FUNCTION . HANDLER) for foreign methods handled specially.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
2092 If (FUNCTION FILENAME) returns non-nil, then all I/O on that file is done by
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
2093 calling HANDLER.")
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
2094
87648
7ae99e295dfd * vc-git.el (vc-git--call): Apply `process-file' instead of
Michael Albinus <michael.albinus@gmx.de>
parents: 87368
diff changeset
2095 ;;; Internal functions which must come first:
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2096
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2097 (defsubst tramp-debug-message (vec fmt-string &rest args)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2098 "Append message to debug buffer.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2099 Message is formatted with FMT-STRING as control string and the remaining
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2100 ARGS to actually emit the message (if applicable)."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2101 (when (get-buffer (tramp-buffer-name vec))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2102 (with-current-buffer (tramp-get-debug-buffer vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2103 (goto-char (point-max))
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
2104 ;; Headline.
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
2105 (when (bobp)
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
2106 (insert
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
2107 (format
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
2108 ";; %sEmacs: %s Tramp: %s -*- mode: outline; -*-"
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
2109 (if (featurep 'sxemacs) "SX" (if (featurep 'xemacs) "X" "GNU "))
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
2110 emacs-version tramp-version)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2111 (unless (bolp)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2112 (insert "\n"))
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
2113 ;; Timestamp.
104125
fd4d8124e329 * net/tramp.el (tramp-debug-message): Print also microseconds.
Michael Albinus <michael.albinus@gmx.de>
parents: 104097
diff changeset
2114 (let ((now (current-time)))
fd4d8124e329 * net/tramp.el (tramp-debug-message): Print also microseconds.
Michael Albinus <michael.albinus@gmx.de>
parents: 104097
diff changeset
2115 (insert (format-time-string "%T." now))
fd4d8124e329 * net/tramp.el (tramp-debug-message): Print also microseconds.
Michael Albinus <michael.albinus@gmx.de>
parents: 104097
diff changeset
2116 (insert (format "%06d " (nth 2 now))))
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
2117 ;; Calling function.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2118 (let ((btn 1) btf fn)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2119 (while (not fn)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2120 (setq btf (nth 1 (backtrace-frame btn)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2121 (if (not btf)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2122 (setq fn "")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2123 (when (symbolp btf)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2124 (setq fn (symbol-name btf))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2125 (unless (and (string-match "^tramp" fn)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2126 (not (string-match
108817
a90103f99eea * net/tramp.el (tramp-debug-message): Add `tramp-compat-funcall'
Michael Albinus <michael.albinus@gmx.de>
parents: 108816
diff changeset
2127 "^tramp\\(-debug\\)?\\(-message\\|-error\\|-compat-funcall\\)$"
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2128 fn)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2129 (setq fn nil)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2130 (setq btn (1+ btn))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2131 ;; The following code inserts filename and line number.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2132 ;; Should be deactivated by default, because it is time
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2133 ;; consuming.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2134 ; (let ((ffn (find-function-noselect (intern fn))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2135 ; (insert
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2136 ; (format
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2137 ; "%s:%d: "
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2138 ; (file-name-nondirectory (buffer-file-name (car ffn)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2139 ; (with-current-buffer (car ffn)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2140 ; (1+ (count-lines (point-min) (cdr ffn)))))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2141 (insert (format "%s " fn)))
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
2142 ;; The message.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2143 (insert (apply 'format fmt-string args)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2144
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
2145 (defvar tramp-message-show-message t
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
2146 "Show Tramp message in the minibuffer.
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
2147 This variable is used to disable messages from `tramp-error'.
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
2148 The messages are visible anyway, because an error is raised.")
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
2149
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2150 (defsubst tramp-message (vec-or-proc level fmt-string &rest args)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2151 "Emit a message depending on verbosity level.
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
2152 VEC-OR-PROC identifies the Tramp buffer to use. It can be either a
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2153 vector or a process. LEVEL says to be quiet if `tramp-verbose' is
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2154 less than LEVEL. The message is emitted only if `tramp-verbose' is
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2155 greater than or equal to LEVEL.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2156
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2157 The message is also logged into the debug buffer when `tramp-verbose'
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2158 is greater than or equal 4.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2159
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2160 Calls functions `message' and `tramp-debug-message' with FMT-STRING as
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2161 control string and the remaining ARGS to actually emit the message (if
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2162 applicable)."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2163 (condition-case nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2164 (when (<= level tramp-verbose)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2165 ;; Match data must be preserved!
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2166 (save-match-data
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2167 ;; Display only when there is a minimum level.
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
2168 (when (and tramp-message-show-message (<= level 3))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2169 (apply 'message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2170 (concat
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2171 (cond
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2172 ((= level 0) "")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2173 ((= level 1) "")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2174 ((= level 2) "Warning: ")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2175 (t "Tramp: "))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2176 fmt-string)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2177 args))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2178 ;; Log only when there is a minimum level.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2179 (when (>= tramp-verbose 4)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2180 (when (and vec-or-proc
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2181 (processp vec-or-proc)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2182 (buffer-name (process-buffer vec-or-proc)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2183 (with-current-buffer (process-buffer vec-or-proc)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2184 ;; Translate proc to vec.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2185 (setq vec-or-proc (tramp-dissect-file-name default-directory))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2186 (when (and vec-or-proc (vectorp vec-or-proc))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2187 (apply 'tramp-debug-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2188 vec-or-proc
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2189 (concat (format "(%d) # " level) fmt-string)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2190 args)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2191 ;; Suppress all errors.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2192 (error nil)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2193
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2194 (defsubst tramp-error (vec-or-proc signal fmt-string &rest args)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2195 "Emit an error.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2196 VEC-OR-PROC identifies the connection to use, SIGNAL is the
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2197 signal identifier to be raised, remaining args passed to
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2198 `tramp-message'. Finally, signal SIGNAL is raised."
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
2199 (let (tramp-message-show-message)
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
2200 (tramp-message
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
2201 vec-or-proc 1 "%s"
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
2202 (error-message-string
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
2203 (list signal
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
2204 (get signal 'error-message)
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
2205 (apply 'format fmt-string args))))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
2206 (signal signal (list (apply 'format fmt-string args)))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2207
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2208 (defsubst tramp-error-with-buffer
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2209 (buffer vec-or-proc signal fmt-string &rest args)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2210 "Emit an error, and show BUFFER.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2211 If BUFFER is nil, show the connection buffer. Wait for 30\", or until
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2212 an input event arrives. The other arguments are passed to `tramp-error'."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2213 (save-window-excursion
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2214 (unwind-protect
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2215 (apply 'tramp-error vec-or-proc signal fmt-string args)
107870
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
2216 (when (and vec-or-proc
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
2217 (not (zerop tramp-verbose))
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
2218 (not (tramp-completion-mode-p)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2219 (let ((enable-recursive-minibuffers t))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2220 (pop-to-buffer
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2221 (or (and (bufferp buffer) buffer)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2222 (and (processp vec-or-proc) (process-buffer vec-or-proc))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2223 (tramp-get-buffer vec-or-proc)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2224 (sit-for 30))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2225
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2226 (defmacro with-parsed-tramp-file-name (filename var &rest body)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2227 "Parse a Tramp filename and make components available in the body.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2228
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2229 First arg FILENAME is evaluated and dissected into its components.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2230 Second arg VAR is a symbol. It is used as a variable name to hold
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2231 the filename structure. It is also used as a prefix for the variables
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2232 holding the components. For example, if VAR is the symbol `foo', then
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2233 `foo' will be bound to the whole structure, `foo-method' will be bound to
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2234 the method component, and so on for `foo-user', `foo-host', `foo-localname'.
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2235
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2236 Remaining args are Lisp expressions to be evaluated (inside an implicit
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2237 `progn').
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2238
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2239 If VAR is nil, then we bind `v' to the structure and `method', `user',
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2240 `host', `localname' to the components."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2241 `(let* ((,(or var 'v) (tramp-dissect-file-name ,filename))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2242 (,(if var (intern (concat (symbol-name var) "-method")) 'method)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2243 (tramp-file-name-method ,(or var 'v)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2244 (,(if var (intern (concat (symbol-name var) "-user")) 'user)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2245 (tramp-file-name-user ,(or var 'v)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2246 (,(if var (intern (concat (symbol-name var) "-host")) 'host)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2247 (tramp-file-name-host ,(or var 'v)))
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
2248 (,(if var (intern (concat (symbol-name var) "-localname")) 'localname)
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
2249 (tramp-file-name-localname ,(or var 'v))))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2250 ,@body))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2251
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2252 (put 'with-parsed-tramp-file-name 'lisp-indent-function 2)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2253 (put 'with-parsed-tramp-file-name 'edebug-form-spec '(form symbolp body))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2254 (font-lock-add-keywords 'emacs-lisp-mode '("\\<with-parsed-tramp-file-name\\>"))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2255
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2256 (defmacro with-file-property (vec file property &rest body)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2257 "Check in Tramp cache for PROPERTY, otherwise execute BODY and set cache.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2258 FILE must be a local file name on a connection identified via VEC."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2259 `(if (file-name-absolute-p ,file)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2260 (let ((value (tramp-get-file-property ,vec ,file ,property 'undef)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2261 (when (eq value 'undef)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2262 ;; We cannot pass @body as parameter to
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2263 ;; `tramp-set-file-property' because it mangles our
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2264 ;; debug messages.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2265 (setq value (progn ,@body))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2266 (tramp-set-file-property ,vec ,file ,property value))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2267 value)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2268 ,@body))
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
2269
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2270 (put 'with-file-property 'lisp-indent-function 3)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2271 (put 'with-file-property 'edebug-form-spec t)
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2272 (font-lock-add-keywords 'emacs-lisp-mode '("\\<with-file-property\\>"))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2273
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2274 (defmacro with-connection-property (key property &rest body)
108066
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
2275 "Check in Tramp for property PROPERTY, otherwise executes BODY and set."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2276 `(let ((value (tramp-get-connection-property ,key ,property 'undef)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2277 (when (eq value 'undef)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2278 ;; We cannot pass ,@body as parameter to
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2279 ;; `tramp-set-connection-property' because it mangles our debug
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2280 ;; messages.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2281 (setq value (progn ,@body))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2282 (tramp-set-connection-property ,key ,property value))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2283 value))
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
2284
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2285 (put 'with-connection-property 'lisp-indent-function 2)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2286 (put 'with-connection-property 'edebug-form-spec t)
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2287 (font-lock-add-keywords 'emacs-lisp-mode '("\\<with-connection-property\\>"))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2288
108775
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
2289 (defun tramp-progress-reporter-update (reporter &optional value)
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
2290 (let* ((parameters (cdr reporter))
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
2291 (message (aref parameters 3)))
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
2292 (when (string-match message (or (current-message) ""))
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
2293 (funcall 'progress-reporter-update reporter value))))
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
2294
108066
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
2295 (defmacro with-progress-reporter (vec level message &rest body)
108817
a90103f99eea * net/tramp.el (tramp-debug-message): Add `tramp-compat-funcall'
Michael Albinus <michael.albinus@gmx.de>
parents: 108816
diff changeset
2296 "Executes BODY, spinning a progress reporter with MESSAGE.
a90103f99eea * net/tramp.el (tramp-debug-message): Add `tramp-compat-funcall'
Michael Albinus <michael.albinus@gmx.de>
parents: 108816
diff changeset
2297 If LEVEL does not fit for visible messages, or if this is a
a90103f99eea * net/tramp.el (tramp-debug-message): Add `tramp-compat-funcall'
Michael Albinus <michael.albinus@gmx.de>
parents: 108816
diff changeset
2298 nested call of the macro, there are only traces without a visible
a90103f99eea * net/tramp.el (tramp-debug-message): Add `tramp-compat-funcall'
Michael Albinus <michael.albinus@gmx.de>
parents: 108816
diff changeset
2299 progress reporter."
108066
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
2300 `(let (pr tm)
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
2301 (tramp-message ,vec ,level "%s..." ,message)
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
2302 ;; We start a pulsing progress reporter after 3 seconds. Feature
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
2303 ;; introduced in Emacs 24.1.
108540
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
2304 (when (and tramp-message-show-message
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
2305 ;; Display only when there is a minimum level.
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
2306 (<= ,level (min tramp-verbose 3)))
108066
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
2307 (condition-case nil
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
2308 (setq pr (tramp-compat-funcall 'make-progress-reporter ,message)
108775
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
2309 tm (when pr
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
2310 (run-at-time 3 0.1 'tramp-progress-reporter-update pr)))
108066
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
2311 (error nil)))
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
2312 (unwind-protect
108817
a90103f99eea * net/tramp.el (tramp-debug-message): Add `tramp-compat-funcall'
Michael Albinus <michael.albinus@gmx.de>
parents: 108816
diff changeset
2313 ;; Execute the body. Unset `tramp-message-show-message' when
a90103f99eea * net/tramp.el (tramp-debug-message): Add `tramp-compat-funcall'
Michael Albinus <michael.albinus@gmx.de>
parents: 108816
diff changeset
2314 ;; the timer object is created, in order to suppress
a90103f99eea * net/tramp.el (tramp-debug-message): Add `tramp-compat-funcall'
Michael Albinus <michael.albinus@gmx.de>
parents: 108816
diff changeset
2315 ;; concurrent timers.
108540
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
2316 (let ((tramp-message-show-message
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
2317 (and tramp-message-show-message (not tm))))
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
2318 ,@body)
108066
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
2319 ;; Stop progress reporter.
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
2320 (if tm (tramp-compat-funcall 'cancel-timer tm))
108066
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
2321 (tramp-message ,vec ,level "%s...done" ,message))))
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
2322
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
2323 (put 'with-progress-reporter 'lisp-indent-function 3)
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
2324 (put 'with-progress-reporter 'edebug-form-spec t)
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
2325 (font-lock-add-keywords 'emacs-lisp-mode '("\\<with-progress-reporter\\>"))
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
2326
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
2327 (eval-and-compile ;; Silence compiler.
93566
61bf6b37b78d (tramp-drop-volume-letter): Move definition before use.
Glenn Morris <rgm@gnu.org>
parents: 93539
diff changeset
2328 (if (memq system-type '(cygwin windows-nt))
61bf6b37b78d (tramp-drop-volume-letter): Move definition before use.
Glenn Morris <rgm@gnu.org>
parents: 93539
diff changeset
2329 (defun tramp-drop-volume-letter (name)
61bf6b37b78d (tramp-drop-volume-letter): Move definition before use.
Glenn Morris <rgm@gnu.org>
parents: 93539
diff changeset
2330 "Cut off unnecessary drive letter from file NAME.
61bf6b37b78d (tramp-drop-volume-letter): Move definition before use.
Glenn Morris <rgm@gnu.org>
parents: 93539
diff changeset
2331 The function `tramp-handle-expand-file-name' calls `expand-file-name'
61bf6b37b78d (tramp-drop-volume-letter): Move definition before use.
Glenn Morris <rgm@gnu.org>
parents: 93539
diff changeset
2332 locally on a remote file name. When the local system is a W32 system
61bf6b37b78d (tramp-drop-volume-letter): Move definition before use.
Glenn Morris <rgm@gnu.org>
parents: 93539
diff changeset
2333 but the remote system is Unix, this introduces a superfluous drive
61bf6b37b78d (tramp-drop-volume-letter): Move definition before use.
Glenn Morris <rgm@gnu.org>
parents: 93539
diff changeset
2334 letter into the file name. This function removes it."
61bf6b37b78d (tramp-drop-volume-letter): Move definition before use.
Glenn Morris <rgm@gnu.org>
parents: 93539
diff changeset
2335 (save-match-data
61bf6b37b78d (tramp-drop-volume-letter): Move definition before use.
Glenn Morris <rgm@gnu.org>
parents: 93539
diff changeset
2336 (if (string-match tramp-root-regexp name)
61bf6b37b78d (tramp-drop-volume-letter): Move definition before use.
Glenn Morris <rgm@gnu.org>
parents: 93539
diff changeset
2337 (replace-match "/" nil t name)
61bf6b37b78d (tramp-drop-volume-letter): Move definition before use.
Glenn Morris <rgm@gnu.org>
parents: 93539
diff changeset
2338 name)))
61bf6b37b78d (tramp-drop-volume-letter): Move definition before use.
Glenn Morris <rgm@gnu.org>
parents: 93539
diff changeset
2339
61bf6b37b78d (tramp-drop-volume-letter): Move definition before use.
Glenn Morris <rgm@gnu.org>
parents: 93539
diff changeset
2340 (defalias 'tramp-drop-volume-letter 'identity)))
61bf6b37b78d (tramp-drop-volume-letter): Move definition before use.
Glenn Morris <rgm@gnu.org>
parents: 93539
diff changeset
2341
85508
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
2342 (defsubst tramp-make-tramp-temp-file (vec)
85067
4636000015c5 * net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
2343 "Create a temporary file on the remote host identified by VEC.
85508
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
2344 Return the local name of the temporary file."
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
2345 (let ((prefix
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
2346 (tramp-make-tramp-file-name
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
2347 (tramp-file-name-method vec)
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
2348 (tramp-file-name-user vec)
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
2349 (tramp-file-name-host vec)
93539
7fd0d929f732 * net/tramp.el (tramp-make-tramp-temp-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents: 93430
diff changeset
2350 (tramp-drop-volume-letter
7fd0d929f732 * net/tramp.el (tramp-make-tramp-temp-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents: 93430
diff changeset
2351 (expand-file-name
7fd0d929f732 * net/tramp.el (tramp-make-tramp-temp-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents: 93430
diff changeset
2352 tramp-temp-name-prefix (tramp-get-remote-tmpdir vec)))))
85508
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
2353 result)
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
2354 (while (not result)
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
2355 ;; `make-temp-file' would be the natural choice for
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
2356 ;; implementation. But it calls `write-region' internally,
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
2357 ;; which also needs a temporary file - we would end in an
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
2358 ;; infinite loop.
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
2359 (setq result (make-temp-name prefix))
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
2360 (if (file-exists-p result)
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
2361 (setq result nil)
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
2362 ;; This creates the file by side effect.
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
2363 (set-file-times result)
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
2364 (set-file-modes result (tramp-octal-to-decimal "0700"))))
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
2365
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
2366 ;; Return the local part.
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
2367 (with-parsed-tramp-file-name result nil localname)))
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
2368
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
2369
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2370 ;;; Config Manipulation Functions:
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2371
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2372 (defun tramp-set-completion-function (method function-list)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2373 "Sets the list of completion functions for METHOD.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2374 FUNCTION-LIST is a list of entries of the form (FUNCTION FILE).
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2375 The FUNCTION is intended to parse FILE according its syntax.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2376 It might be a predefined FUNCTION, or a user defined FUNCTION.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2377 Predefined FUNCTIONs are `tramp-parse-rhosts', `tramp-parse-shosts',
99540
c5c8f07bc47c * w32-fns.el (w32-shell-dos-semantics):
Juanma Barranquero <lekktu@gmail.com>
parents: 98699
diff changeset
2378 `tramp-parse-sconfig', `tramp-parse-hosts', `tramp-parse-passwd',
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
2379 and `tramp-parse-netrc'.
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
2380
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2381 Example:
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2382
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2383 (tramp-set-completion-function
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2384 \"ssh\"
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
2385 '((tramp-parse-sconfig \"/etc/ssh_config\")
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
2386 (tramp-parse-sconfig \"~/.ssh/config\")))"
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2387
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2388 (let ((r function-list)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2389 (v function-list))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2390 (setq tramp-completion-function-alist
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2391 (delete (assoc method tramp-completion-function-alist)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2392 tramp-completion-function-alist))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2393
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2394 (while v
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2395 ;; Remove double entries.
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2396 (when (member (car v) (cdr v))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2397 (setcdr v (delete (car v) (cdr v))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2398 ;; Check for function and file or registry key.
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2399 (unless (and (functionp (nth 0 (car v)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2400 (if (string-match "^HKEY_CURRENT_USER" (nth 1 (car v)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2401 ;; Windows registry.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2402 (and (memq system-type '(cygwin windows-nt))
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
2403 (zerop
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
2404 (tramp-local-call-process
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
2405 "reg" nil nil nil "query" (nth 1 (car v)))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2406 ;; Configuration file.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2407 (file-exists-p (nth 1 (car v)))))
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2408 (setq r (delete (car v) r)))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2409 (setq v (cdr v)))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2410
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2411 (when r
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
2412 (add-to-list 'tramp-completion-function-alist
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2413 (cons method r)))))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2414
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2415 (defun tramp-get-completion-function (method)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2416 "Returns a list of completion functions for METHOD.
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2417 For definition of that list see `tramp-set-completion-function'."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2418 (cons
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2419 ;; Hosts visited once shall be remembered.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2420 `(tramp-parse-connection-properties ,method)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2421 ;; The method related defaults.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2422 (cdr (assoc method tramp-completion-function-alist))))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2423
84739
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2424
87648
7ae99e295dfd * vc-git.el (vc-git--call): Apply `process-file' instead of
Michael Albinus <michael.albinus@gmx.de>
parents: 87368
diff changeset
2425 ;;; Fontification of `read-file-name':
7ae99e295dfd * vc-git.el (vc-git--call): Apply `process-file' instead of
Michael Albinus <michael.albinus@gmx.de>
parents: 87368
diff changeset
2426
7ae99e295dfd * vc-git.el (vc-git--call): Apply `process-file' instead of
Michael Albinus <michael.albinus@gmx.de>
parents: 87368
diff changeset
2427 ;; rfn-eshadow.el is part of Emacs 22. It is autoloaded.
84739
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2428 (defvar tramp-rfn-eshadow-overlay)
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2429 (make-variable-buffer-local 'tramp-rfn-eshadow-overlay)
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2430
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2431 (defun tramp-rfn-eshadow-setup-minibuffer ()
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2432 "Set up a minibuffer for `file-name-shadow-mode'.
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2433 Adds another overlay hiding filename parts according to Tramp's
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2434 special handling of `substitute-in-file-name'."
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
2435 (when (symbol-value 'minibuffer-completing-file-name)
84739
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2436 (setq tramp-rfn-eshadow-overlay
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
2437 (tramp-compat-funcall
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
2438 'make-overlay
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
2439 (tramp-compat-funcall 'minibuffer-prompt-end)
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
2440 (tramp-compat-funcall 'minibuffer-prompt-end)))
84739
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2441 ;; Copy rfn-eshadow-overlay properties.
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
2442 (let ((props (tramp-compat-funcall
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
2443 'overlay-properties (symbol-value 'rfn-eshadow-overlay))))
84739
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2444 (while props
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
2445 (tramp-compat-funcall
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
2446 'overlay-put tramp-rfn-eshadow-overlay (pop props) (pop props))))))
84739
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2447
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2448 (when (boundp 'rfn-eshadow-setup-minibuffer-hook)
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2449 (add-hook 'rfn-eshadow-setup-minibuffer-hook
95659
926453fe3d68 * net/tramp.el (top): Quote feature names. Remove
Michael Albinus <michael.albinus@gmx.de>
parents: 95067
diff changeset
2450 'tramp-rfn-eshadow-setup-minibuffer)
926453fe3d68 * net/tramp.el (top): Quote feature names. Remove
Michael Albinus <michael.albinus@gmx.de>
parents: 95067
diff changeset
2451 (add-hook 'tramp-unload-hook
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
2452 (lambda ()
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
2453 (remove-hook 'rfn-eshadow-setup-minibuffer-hook
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
2454 'tramp-rfn-eshadow-setup-minibuffer))))
84739
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2455
104137
974fca280203 * net/tramp.el (tramp-rfn-eshadow-update-overlay-regexp) New
Michael Albinus <michael.albinus@gmx.de>
parents: 104125
diff changeset
2456 (defconst tramp-rfn-eshadow-update-overlay-regexp
974fca280203 * net/tramp.el (tramp-rfn-eshadow-update-overlay-regexp) New
Michael Albinus <michael.albinus@gmx.de>
parents: 104125
diff changeset
2457 (format "[^%s/~]*\\(/\\|~\\)" tramp-postfix-host-format))
974fca280203 * net/tramp.el (tramp-rfn-eshadow-update-overlay-regexp) New
Michael Albinus <michael.albinus@gmx.de>
parents: 104125
diff changeset
2458
84739
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2459 (defun tramp-rfn-eshadow-update-overlay ()
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2460 "Update `rfn-eshadow-overlay' to cover shadowed part of minibuffer input.
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2461 This is intended to be used as a minibuffer `post-command-hook' for
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2462 `file-name-shadow-mode'; the minibuffer should have already
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2463 been set up by `rfn-eshadow-setup-minibuffer'."
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2464 ;; In remote files name, there is a shadowing just for the local part.
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
2465 (let ((end (or (tramp-compat-funcall
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
2466 'overlay-end (symbol-value 'rfn-eshadow-overlay))
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
2467 (tramp-compat-funcall 'minibuffer-prompt-end))))
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
2468 (when
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
2469 (file-remote-p
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
2470 (tramp-compat-funcall 'buffer-substring-no-properties end (point-max)))
85428
ad84adc0e027 From_ Johan Bockgrd, <http://article.gmane.org/gmane.emacs.devel/81056>
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 85126
diff changeset
2471 (save-excursion
ad84adc0e027 From_ Johan Bockgrd, <http://article.gmane.org/gmane.emacs.devel/81056>
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 85126
diff changeset
2472 (save-restriction
ad84adc0e027 From_ Johan Bockgrd, <http://article.gmane.org/gmane.emacs.devel/81056>
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 85126
diff changeset
2473 (narrow-to-region
104137
974fca280203 * net/tramp.el (tramp-rfn-eshadow-update-overlay-regexp) New
Michael Albinus <michael.albinus@gmx.de>
parents: 104125
diff changeset
2474 (1+ (or (string-match
974fca280203 * net/tramp.el (tramp-rfn-eshadow-update-overlay-regexp) New
Michael Albinus <michael.albinus@gmx.de>
parents: 104125
diff changeset
2475 tramp-rfn-eshadow-update-overlay-regexp (buffer-string) end)
974fca280203 * net/tramp.el (tramp-rfn-eshadow-update-overlay-regexp) New
Michael Albinus <michael.albinus@gmx.de>
parents: 104125
diff changeset
2476 end))
974fca280203 * net/tramp.el (tramp-rfn-eshadow-update-overlay-regexp) New
Michael Albinus <michael.albinus@gmx.de>
parents: 104125
diff changeset
2477 (point-max))
85428
ad84adc0e027 From_ Johan Bockgrd, <http://article.gmane.org/gmane.emacs.devel/81056>
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 85126
diff changeset
2478 (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay)
ad84adc0e027 From_ Johan Bockgrd, <http://article.gmane.org/gmane.emacs.devel/81056>
Katsumi Yamaoka <yamaoka@jpl.org>
parents: 85126
diff changeset
2479 (rfn-eshadow-update-overlay-hook nil))
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
2480 (tramp-compat-funcall
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
2481 'move-overlay rfn-eshadow-overlay (point-max) (point-max))
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
2482 (tramp-compat-funcall 'rfn-eshadow-update-overlay)))))))
84739
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2483
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2484 (when (boundp 'rfn-eshadow-update-overlay-hook)
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2485 (add-hook 'rfn-eshadow-update-overlay-hook
105718
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
2486 'tramp-rfn-eshadow-update-overlay)
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
2487 (add-hook 'tramp-unload-hook
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
2488 (lambda ()
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
2489 (remove-hook 'rfn-eshadow-update-overlay-hook
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
2490 'tramp-rfn-eshadow-update-overlay))))
84739
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2491
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2492
106219
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2493 ;;; Integration of eshell.el:
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2494
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2495 (eval-when-compile
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2496 (defvar eshell-path-env))
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2497
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2498 ;; eshell.el keeps the path in `eshell-path-env'. We must change it
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2499 ;; when `default-directory' points to another host.
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2500 (defun tramp-eshell-directory-change ()
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2501 "Set `eshell-path-env' to $PATH of the host related to `default-directory'."
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2502 (setq eshell-path-env
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2503 (if (file-remote-p default-directory)
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2504 (with-parsed-tramp-file-name default-directory nil
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2505 (mapconcat
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2506 'identity
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2507 (tramp-get-remote-path v)
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2508 ":"))
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2509 (getenv "PATH"))))
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2510
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2511 (eval-after-load "esh-util"
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2512 '(progn
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2513 (tramp-eshell-directory-change)
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2514 (add-hook 'eshell-directory-change-hook
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2515 'tramp-eshell-directory-change)
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2516 (add-hook 'tramp-unload-hook
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2517 (lambda ()
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2518 (remove-hook 'eshell-directory-change-hook
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2519 'tramp-eshell-directory-change)))))
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2520
16b061d2742d Improve handling of processes on remote hosts.
Michael Albinus <michael.albinus@gmx.de>
parents: 106204
diff changeset
2521
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2522 ;;; File Name Handler Functions:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2523
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2524 (defun tramp-handle-make-symbolic-link
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2525 (filename linkname &optional ok-if-already-exists)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2526 "Like `make-symbolic-link' for Tramp files.
46307
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
2527 If LINKNAME is a non-Tramp file, it is used verbatim as the target of
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
2528 the symlink. If LINKNAME is a Tramp file, only the localname component is
46307
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
2529 used as the target of the symlink.
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
2530
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
2531 If LINKNAME is a Tramp file and the localname component is relative, then
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
2532 it is expanded first, before the localname component is taken. Note that
46307
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
2533 this can give surprising results if the user/host for the source and
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
2534 target of the symlink differ."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2535 (with-parsed-tramp-file-name linkname l
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2536 (let ((ln (tramp-get-remote-ln l))
94401
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
2537 (cwd (tramp-run-real-handler
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
2538 'file-name-directory (list l-localname))))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2539 (unless ln
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2540 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2541 l 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2542 "Making a symbolic link. ln(1) does not exist on the remote host."))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2543
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2544 ;; Do the 'confirm if exists' thing.
46307
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
2545 (when (file-exists-p linkname)
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2546 ;; What to do?
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2547 (if (or (null ok-if-already-exists) ; not allowed to exist
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2548 (and (numberp ok-if-already-exists)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2549 (not (yes-or-no-p
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2550 (format
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2551 "File %s already exists; make it a link anyway? "
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
2552 l-localname)))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2553 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2554 l 'file-already-exists "File %s already exists" l-localname)
108816
94d1d8a6dcfd * net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents: 108806
diff changeset
2555 (delete-file linkname)))
46307
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
2556
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
2557 ;; If FILENAME is a Tramp name, use just the localname component.
46307
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
2558 (when (tramp-tramp-file-p filename)
85089
8fb95bcda144 * net/tramp.el (tramp-find-foreign-file-name-handler): Check also
Michael Albinus <michael.albinus@gmx.de>
parents: 85067
diff changeset
2559 (setq filename
8fb95bcda144 * net/tramp.el (tramp-find-foreign-file-name-handler): Check also
Michael Albinus <michael.albinus@gmx.de>
parents: 85067
diff changeset
2560 (tramp-file-name-localname
8fb95bcda144 * net/tramp.el (tramp-find-foreign-file-name-handler): Check also
Michael Albinus <michael.albinus@gmx.de>
parents: 85067
diff changeset
2561 (tramp-dissect-file-name (expand-file-name filename)))))
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
2562
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2563 ;; Right, they are on the same host, regardless of user, method, etc.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2564 ;; We now make the link on the remote machine. This will occur as the user
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2565 ;; that FILENAME belongs to.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2566 (zerop
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2567 (tramp-send-command-and-check
106204
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
2568 l
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
2569 (format
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
2570 "cd %s && %s -sf %s %s"
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
2571 (tramp-shell-quote-argument cwd)
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
2572 ln
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
2573 (tramp-shell-quote-argument filename)
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
2574 (tramp-shell-quote-argument l-localname))
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
2575 t)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2576
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2577 (defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2578 "Like `load' for Tramp files."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2579 (with-parsed-tramp-file-name (expand-file-name file) nil
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2580 (unless nosuffix
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2581 (cond ((file-exists-p (concat file ".elc"))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2582 (setq file (concat file ".elc")))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2583 ((file-exists-p (concat file ".el"))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2584 (setq file (concat file ".el")))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2585 (when must-suffix
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2586 ;; The first condition is always true for absolute file names.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2587 ;; Included for safety's sake.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2588 (unless (or (file-name-directory file)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2589 (string-match "\\.elc?\\'" file))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2590 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2591 v 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2592 "File `%s' does not include a `.el' or `.elc' suffix" file)))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2593 (unless noerror
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2594 (when (not (file-exists-p file))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2595 (tramp-error v 'file-error "Cannot load nonexistent file `%s'" file)))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2596 (if (not (file-exists-p file))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2597 nil
108540
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
2598 (let ((tramp-message-show-message (not nomessage)))
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
2599 (with-progress-reporter v 0 (format "Loading %s" file)
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
2600 (let ((local-copy (file-local-copy file)))
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
2601 ;; MUST-SUFFIX doesn't exist on XEmacs, so let it default to nil.
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
2602 (unwind-protect
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
2603 (load local-copy noerror t t)
108816
94d1d8a6dcfd * net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents: 108806
diff changeset
2604 (delete-file local-copy)))))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2605 t)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2606
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
2607 ;; Localname manipulation functions that grok Tramp localnames...
99615
6808df5428f7 * net/tramp.el (tramp-handle-file-name-as-directory): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 99540
diff changeset
2608 (defun tramp-handle-file-name-as-directory (file)
6808df5428f7 * net/tramp.el (tramp-handle-file-name-as-directory): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 99540
diff changeset
2609 "Like `file-name-as-directory' but aware of Tramp files."
6808df5428f7 * net/tramp.el (tramp-handle-file-name-as-directory): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 99540
diff changeset
2610 ;; `file-name-as-directory' would be sufficient except localname is
6808df5428f7 * net/tramp.el (tramp-handle-file-name-as-directory): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 99540
diff changeset
2611 ;; the empty string.
6808df5428f7 * net/tramp.el (tramp-handle-file-name-as-directory): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 99540
diff changeset
2612 (let ((v (tramp-dissect-file-name file t)))
6808df5428f7 * net/tramp.el (tramp-handle-file-name-as-directory): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 99540
diff changeset
2613 ;; Run the command on the localname portion only.
6808df5428f7 * net/tramp.el (tramp-handle-file-name-as-directory): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 99540
diff changeset
2614 (tramp-make-tramp-file-name
6808df5428f7 * net/tramp.el (tramp-handle-file-name-as-directory): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 99540
diff changeset
2615 (tramp-file-name-method v)
6808df5428f7 * net/tramp.el (tramp-handle-file-name-as-directory): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 99540
diff changeset
2616 (tramp-file-name-user v)
6808df5428f7 * net/tramp.el (tramp-handle-file-name-as-directory): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 99540
diff changeset
2617 (tramp-file-name-host v)
6808df5428f7 * net/tramp.el (tramp-handle-file-name-as-directory): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 99540
diff changeset
2618 (tramp-run-real-handler
6808df5428f7 * net/tramp.el (tramp-handle-file-name-as-directory): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 99540
diff changeset
2619 'file-name-as-directory (list (or (tramp-file-name-localname v) ""))))))
6808df5428f7 * net/tramp.el (tramp-handle-file-name-as-directory): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 99540
diff changeset
2620
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2621 (defun tramp-handle-file-name-directory (file)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2622 "Like `file-name-directory' but aware of Tramp files."
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
2623 ;; Everything except the last filename thing is the directory. We
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
2624 ;; cannot apply `with-parsed-tramp-file-name', because this expands
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
2625 ;; the remote file name parts. This is a problem when we are in
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
2626 ;; file name completion.
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
2627 (let ((v (tramp-dissect-file-name file t)))
70318
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
2628 ;; Run the command on the localname portion only.
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
2629 (tramp-make-tramp-file-name
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
2630 (tramp-file-name-method v)
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
2631 (tramp-file-name-user v)
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
2632 (tramp-file-name-host v)
94401
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
2633 (tramp-run-real-handler
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
2634 'file-name-directory (list (or (tramp-file-name-localname v) ""))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2635
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2636 (defun tramp-handle-file-name-nondirectory (file)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2637 "Like `file-name-nondirectory' but aware of Tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2638 (with-parsed-tramp-file-name file nil
94401
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
2639 (tramp-run-real-handler 'file-name-nondirectory (list localname))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2640
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2641 (defun tramp-handle-file-truename (filename &optional counter prev-dirs)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2642 "Like `file-truename' for Tramp files."
56644
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2643 (with-parsed-tramp-file-name (expand-file-name filename) nil
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2644 (with-file-property v localname "file-truename"
105767
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2645 (let ((result nil)) ; result steps in reverse order
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2646 (tramp-message v 4 "Finding true name for `%s'" filename)
105767
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2647 (cond
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2648 ;; Use GNU readlink --canonicalize-missing where available.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2649 ((tramp-get-remote-readlink v)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2650 (setq result
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2651 (tramp-send-command-and-read
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2652 v
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2653 (format "echo \"\\\"`%s --canonicalize-missing %s`\\\"\""
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2654 (tramp-get-remote-readlink v)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2655 (tramp-shell-quote-argument localname)))))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2656
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2657 ;; Use Perl implementation.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2658 ((and (tramp-get-remote-perl v)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2659 (tramp-get-connection-property v "perl-file-spec" nil)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2660 (tramp-get-connection-property v "perl-cwd-realpath" nil))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2661 (tramp-maybe-send-script
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2662 v tramp-perl-file-truename "tramp_perl_file_truename")
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2663 (setq result
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2664 (tramp-send-command-and-read
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2665 v
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2666 (format "tramp_perl_file_truename %s"
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2667 (tramp-shell-quote-argument localname)))))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2668
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2669 ;; Do it yourself. We bind `directory-sep-char' here for
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2670 ;; XEmacs on Windows, which would otherwise use backslash.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2671 (t (let* ((directory-sep-char ?/)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2672 (steps (tramp-compat-split-string localname "/"))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2673 (localnamedir (tramp-run-real-handler
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2674 'file-name-as-directory (list localname)))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2675 (is-dir (string= localname localnamedir))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2676 (thisstep nil)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2677 (numchase 0)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2678 ;; Don't make the following value larger than
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2679 ;; necessary. People expect an error message in a
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2680 ;; timely fashion when something is wrong;
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2681 ;; otherwise they might think that Emacs is hung.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2682 ;; Of course, correctness has to come first.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2683 (numchase-limit 20)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2684 symlink-target)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2685 (while (and steps (< numchase numchase-limit))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2686 (setq thisstep (pop steps))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2687 (tramp-message
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2688 v 5 "Check %s"
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2689 (mapconcat 'identity
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2690 (append '("") (reverse result) (list thisstep))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2691 "/"))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2692 (setq symlink-target
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2693 (nth 0 (file-attributes
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2694 (tramp-make-tramp-file-name
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2695 method user host
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2696 (mapconcat 'identity
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2697 (append '("")
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2698 (reverse result)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2699 (list thisstep))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2700 "/")))))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2701 (cond ((string= "." thisstep)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2702 (tramp-message v 5 "Ignoring step `.'"))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2703 ((string= ".." thisstep)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2704 (tramp-message v 5 "Processing step `..'")
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2705 (pop result))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2706 ((stringp symlink-target)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2707 ;; It's a symlink, follow it.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2708 (tramp-message v 5 "Follow symlink to %s" symlink-target)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2709 (setq numchase (1+ numchase))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2710 (when (file-name-absolute-p symlink-target)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2711 (setq result nil))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2712 ;; If the symlink was absolute, we'll get a string like
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2713 ;; "/user@host:/some/target"; extract the
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2714 ;; "/some/target" part from it.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2715 (when (tramp-tramp-file-p symlink-target)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2716 (unless (tramp-equal-remote filename symlink-target)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2717 (tramp-error
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2718 v 'file-error
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2719 "Symlink target `%s' on wrong host" symlink-target))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2720 (setq symlink-target localname))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2721 (setq steps
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2722 (append (tramp-compat-split-string
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2723 symlink-target "/")
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2724 steps)))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2725 (t
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2726 ;; It's a file.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2727 (setq result (cons thisstep result)))))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2728 (when (>= numchase numchase-limit)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2729 (tramp-error
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2730 v 'file-error
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2731 "Maximum number (%d) of symlinks exceeded" numchase-limit))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2732 (setq result (reverse result))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2733 ;; Combine list to form string.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2734 (setq result
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2735 (if result
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2736 (mapconcat 'identity (cons "" result) "/")
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2737 "/"))
105767
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2738 (when (and is-dir (or (string= "" result)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2739 (not (string= (substring result -1) "/"))))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2740 (setq result (concat result "/"))))))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2741
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2742 (tramp-message v 4 "True name of `%s' is `%s'" filename result)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2743 (tramp-make-tramp-file-name method user host result)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2744
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2745 ;; Basic functions.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2746
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2747 (defun tramp-handle-file-exists-p (filename)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2748 "Like `file-exists-p' for Tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2749 (with-parsed-tramp-file-name filename nil
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2750 (with-file-property v localname "file-exists-p"
105767
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2751 (or (not (null (tramp-get-file-property
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2752 v localname "file-attributes-integer" nil)))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2753 (not (null (tramp-get-file-property
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2754 v localname "file-attributes-string" nil)))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2755 (zerop (tramp-send-command-and-check
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2756 v
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2757 (format
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2758 "%s %s"
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2759 (tramp-get-file-exists-command v)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
2760 (tramp-shell-quote-argument localname))))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2761
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2762 ;; Inodes don't exist for some file systems. Therefore we must
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2763 ;; generate virtual ones. Used in `find-buffer-visiting'. The method
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2764 ;; applied might be not so efficient (Ange-FTP uses hashes). But
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2765 ;; performance isn't the major issue given that file transfer will
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2766 ;; take time.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2767 (defvar tramp-inodes nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2768 "Keeps virtual inodes numbers.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2769
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
2770 ;; Devices must distinguish physical file systems. The device numbers
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
2771 ;; provided by "lstat" aren't unique, because we operate on different hosts.
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
2772 ;; So we use virtual device numbers, generated by Tramp. Both Ange-FTP and
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
2773 ;; EFS use device number "-1". In order to be different, we use device number
97052
bed318e44ebd * net/tramp.el (tramp-perl-directory-files-and-attributes)
Michael Albinus <michael.albinus@gmx.de>
parents: 97035
diff changeset
2774 ;; (-1 . x), whereby "x" is unique for a given (method user host).
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
2775 (defvar tramp-devices nil
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
2776 "Keeps virtual device numbers.")
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
2777
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2778 ;; CCC: This should check for an error condition and signal failure
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2779 ;; when something goes wrong.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2780 ;; Daniel Pittman <daniel@danann.net>
53206
0c19f1a19b2b (tramp-chunksize): Extend docstring. Suggested by
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 52401
diff changeset
2781 (defun tramp-handle-file-attributes (filename &optional id-format)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2782 "Like `file-attributes' for Tramp files."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2783 (unless id-format (setq id-format 'integer))
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
2784 ;; Don't modify `last-coding-system-used' by accident.
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
2785 (let ((last-coding-system-used last-coding-system-used))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
2786 (with-parsed-tramp-file-name (expand-file-name filename) nil
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
2787 (with-file-property v localname (format "file-attributes-%s" id-format)
104807
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
2788 (save-excursion
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
2789 (tramp-convert-file-attributes
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
2790 v
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
2791 (cond
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
2792 ((tramp-get-remote-stat v)
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
2793 (tramp-do-file-attributes-with-stat v localname id-format))
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
2794 ((tramp-get-remote-perl v)
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
2795 (tramp-do-file-attributes-with-perl v localname id-format))
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
2796 (t
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
2797 (tramp-do-file-attributes-with-ls v localname id-format)))))))))
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
2798
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
2799 (defun tramp-do-file-attributes-with-ls (vec localname &optional id-format)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2800 "Implement `file-attributes' for Tramp files using the ls(1) command."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2801 (let (symlinkp dirp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2802 res-inode res-filemodes res-numlinks
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2803 res-uid res-gid res-size res-symlink-target)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2804 (tramp-message vec 5 "file attributes with ls: %s" localname)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2805 (tramp-send-command
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2806 vec
104866
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2807 (format "(%s %s || %s -h %s) && %s %s %s"
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2808 (tramp-get-file-exists-command vec)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2809 (tramp-shell-quote-argument localname)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2810 (tramp-get-test-command vec)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2811 (tramp-shell-quote-argument localname)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2812 (tramp-get-ls-command vec)
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
2813 (if (eq id-format 'integer) "-ildn" "-ild")
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
2814 (tramp-shell-quote-argument localname)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2815 ;; parse `ls -l' output ...
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2816 (with-current-buffer (tramp-get-buffer vec)
104866
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2817 (when (> (buffer-size) 0)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2818 (goto-char (point-min))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2819 ;; ... inode
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2820 (setq res-inode
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2821 (condition-case err
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2822 (read (current-buffer))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2823 (invalid-read-syntax
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2824 (when (and (equal (cadr err)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2825 "Integer constant overflow in reader")
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2826 (string-match
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2827 "^[0-9]+\\([0-9][0-9][0-9][0-9][0-9]\\)\\'"
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2828 (car (cddr err))))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2829 (let* ((big (read (substring (car (cddr err)) 0
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2830 (match-beginning 1))))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2831 (small (read (match-string 1 (car (cddr err)))))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2832 (twiddle (/ small 65536)))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2833 (cons (+ big twiddle)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2834 (- small (* twiddle 65536))))))))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2835 ;; ... file mode flags
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2836 (setq res-filemodes (symbol-name (read (current-buffer))))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2837 ;; ... number links
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2838 (setq res-numlinks (read (current-buffer)))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2839 ;; ... uid and gid
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2840 (setq res-uid (read (current-buffer)))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2841 (setq res-gid (read (current-buffer)))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2842 (if (eq id-format 'integer)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2843 (progn
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2844 (unless (numberp res-uid) (setq res-uid -1))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2845 (unless (numberp res-gid) (setq res-gid -1)))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2846 (progn
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2847 (unless (stringp res-uid) (setq res-uid (symbol-name res-uid)))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2848 (unless (stringp res-gid) (setq res-gid (symbol-name res-gid)))))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2849 ;; ... size
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2850 (setq res-size (read (current-buffer)))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2851 ;; From the file modes, figure out other stuff.
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2852 (setq symlinkp (eq ?l (aref res-filemodes 0)))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2853 (setq dirp (eq ?d (aref res-filemodes 0)))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2854 ;; if symlink, find out file name pointed to
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2855 (when symlinkp
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2856 (search-forward "-> ")
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2857 (setq res-symlink-target
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2858 (buffer-substring (point) (tramp-compat-line-end-position))))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2859 ;; return data gathered
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2860 (list
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2861 ;; 0. t for directory, string (name linked to) for symbolic
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2862 ;; link, or nil.
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2863 (or dirp res-symlink-target)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2864 ;; 1. Number of links to file.
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2865 res-numlinks
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2866 ;; 2. File uid.
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2867 res-uid
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2868 ;; 3. File gid.
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2869 res-gid
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2870 ;; 4. Last access time, as a list of two integers. First
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2871 ;; integer has high-order 16 bits of time, second has low 16
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2872 ;; bits.
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2873 ;; 5. Last modification time, likewise.
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2874 ;; 6. Last status change time, likewise.
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2875 '(0 0) '(0 0) '(0 0) ;CCC how to find out?
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2876 ;; 7. Size in bytes (-1, if number is out of range).
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2877 res-size
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2878 ;; 8. File modes, as a string of ten letters or dashes as in ls -l.
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2879 res-filemodes
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2880 ;; 9. t if file's gid would change if file were deleted and
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2881 ;; recreated. Will be set in `tramp-convert-file-attributes'
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2882 t
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2883 ;; 10. inode number.
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2884 res-inode
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2885 ;; 11. Device number. Will be replaced by a virtual device number.
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2886 -1
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2887 )))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2888
104807
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
2889 (defun tramp-do-file-attributes-with-perl
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2890 (vec localname &optional id-format)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2891 "Implement `file-attributes' for Tramp files using a Perl script."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2892 (tramp-message vec 5 "file attributes with perl: %s" localname)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2893 (tramp-maybe-send-script
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2894 vec tramp-perl-file-attributes "tramp_perl_file_attributes")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2895 (tramp-send-command-and-read
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2896 vec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2897 (format "tramp_perl_file_attributes %s %s"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2898 (tramp-shell-quote-argument localname) id-format)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2899
104807
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
2900 (defun tramp-do-file-attributes-with-stat
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2901 (vec localname &optional id-format)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2902 "Implement `file-attributes' for Tramp files using stat(1) command."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2903 (tramp-message vec 5 "file attributes with stat: %s" localname)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2904 (tramp-send-command-and-read
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2905 vec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2906 (format
108469
acaefbe07157 * net/tramp.el (tramp-do-file-attributes-with-stat): Add space in
Michael Albinus <michael.albinus@gmx.de>
parents: 108377
diff changeset
2907 ;; On Opsware, pdksh (which is the true name of ksh there) doesn't
acaefbe07157 * net/tramp.el (tramp-do-file-attributes-with-stat): Add space in
Michael Albinus <michael.albinus@gmx.de>
parents: 108377
diff changeset
2908 ;; parse correctly the sequence "((". Therefore, we add a space.
acaefbe07157 * net/tramp.el (tramp-do-file-attributes-with-stat): Add space in
Michael Albinus <michael.albinus@gmx.de>
parents: 108377
diff changeset
2909 "( (%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)"
104866
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2910 (tramp-get-file-exists-command vec)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2911 (tramp-shell-quote-argument localname)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2912 (tramp-get-test-command vec)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
2913 (tramp-shell-quote-argument localname)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2914 (tramp-get-remote-stat vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2915 (if (eq id-format 'integer) "%u" "\"%U\"")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2916 (if (eq id-format 'integer) "%g" "\"%G\"")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2917 (tramp-shell-quote-argument localname))))
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
2918
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2919 (defun tramp-handle-set-visited-file-modtime (&optional time-list)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2920 "Like `set-visited-file-modtime' for Tramp files."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2921 (unless (buffer-file-name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2922 (error "Can't set-visited-file-modtime: buffer `%s' not visiting a file"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2923 (buffer-name)))
56644
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2924 (if time-list
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2925 (tramp-run-real-handler 'set-visited-file-modtime (list time-list))
65925
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
2926 (let ((f (buffer-file-name))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
2927 coding-system-used)
56644
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2928 (with-parsed-tramp-file-name f nil
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2929 (let* ((attr (file-attributes f))
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2930 ;; '(-1 65535) means file doesn't exists yet.
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2931 (modtime (or (nth 5 attr) '(-1 65535))))
65925
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
2932 (when (boundp 'last-coding-system-used)
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
2933 (setq coding-system-used (symbol-value 'last-coding-system-used)))
56644
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2934 ;; We use '(0 0) as a don't-know value. See also
104807
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
2935 ;; `tramp-do-file-attributes-with-ls'.
56644
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2936 (if (not (equal modtime '(0 0)))
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2937 (tramp-run-real-handler 'set-visited-file-modtime (list modtime))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2938 (progn
56644
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2939 (tramp-send-command
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2940 v
56644
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2941 (format "%s -ild %s"
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2942 (tramp-get-ls-command v)
56644
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2943 (tramp-shell-quote-argument localname)))
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2944 (setq attr (buffer-substring (point)
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2945 (progn (end-of-line) (point)))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2946 (tramp-set-file-property
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2947 v localname "visited-file-modtime-ild" attr))
65925
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
2948 (when (boundp 'last-coding-system-used)
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
2949 (set 'last-coding-system-used coding-system-used))
64772
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
2950 nil)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2951
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2952 ;; This function makes the same assumption as
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2953 ;; `tramp-handle-set-visited-file-modtime'.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2954 (defun tramp-handle-verify-visited-file-modtime (buf)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2955 "Like `verify-visited-file-modtime' for Tramp files.
59031
1fbbe0bcfaac Sync with Tramp 2.0.46.
Michael Albinus <michael.albinus@gmx.de>
parents: 58776
diff changeset
2956 At the time `verify-visited-file-modtime' calls this function, we
1fbbe0bcfaac Sync with Tramp 2.0.46.
Michael Albinus <michael.albinus@gmx.de>
parents: 58776
diff changeset
2957 already know that the buffer is visiting a file and that
1fbbe0bcfaac Sync with Tramp 2.0.46.
Michael Albinus <michael.albinus@gmx.de>
parents: 58776
diff changeset
2958 `visited-file-modtime' does not return 0. Do not call this
1fbbe0bcfaac Sync with Tramp 2.0.46.
Michael Albinus <michael.albinus@gmx.de>
parents: 58776
diff changeset
2959 function directly, unless those two cases are already taken care
1fbbe0bcfaac Sync with Tramp 2.0.46.
Michael Albinus <michael.albinus@gmx.de>
parents: 58776
diff changeset
2960 of."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2961 (with-current-buffer buf
108469
acaefbe07157 * net/tramp.el (tramp-do-file-attributes-with-stat): Add space in
Michael Albinus <michael.albinus@gmx.de>
parents: 108377
diff changeset
2962 (let ((f (buffer-file-name)))
acaefbe07157 * net/tramp.el (tramp-do-file-attributes-with-stat): Add space in
Michael Albinus <michael.albinus@gmx.de>
parents: 108377
diff changeset
2963 ;; There is no file visiting the buffer, or the buffer has no
acaefbe07157 * net/tramp.el (tramp-do-file-attributes-with-stat): Add space in
Michael Albinus <michael.albinus@gmx.de>
parents: 108377
diff changeset
2964 ;; recorded last modification time, or there is no established
acaefbe07157 * net/tramp.el (tramp-do-file-attributes-with-stat): Add space in
Michael Albinus <michael.albinus@gmx.de>
parents: 108377
diff changeset
2965 ;; connection.
acaefbe07157 * net/tramp.el (tramp-do-file-attributes-with-stat): Add space in
Michael Albinus <michael.albinus@gmx.de>
parents: 108377
diff changeset
2966 (if (or (not f)
acaefbe07157 * net/tramp.el (tramp-do-file-attributes-with-stat): Add space in
Michael Albinus <michael.albinus@gmx.de>
parents: 108377
diff changeset
2967 (eq (visited-file-modtime) 0)
acaefbe07157 * net/tramp.el (tramp-do-file-attributes-with-stat): Add space in
Michael Albinus <michael.albinus@gmx.de>
parents: 108377
diff changeset
2968 (not (tramp-file-name-handler 'file-remote-p f nil 'connected)))
acaefbe07157 * net/tramp.el (tramp-do-file-attributes-with-stat): Add space in
Michael Albinus <michael.albinus@gmx.de>
parents: 108377
diff changeset
2969 t
57559
07791c7d465b * net/tramp.el: Redo sync with Tramp 2.0.45. Last commit did not
Michael Albinus <michael.albinus@gmx.de>
parents: 57463
diff changeset
2970 (with-parsed-tramp-file-name f nil
82201
b3182f0c969c * net/tramp.el:
Michael Albinus <michael.albinus@gmx.de>
parents: 82140
diff changeset
2971 (tramp-flush-file-property v localname)
57559
07791c7d465b * net/tramp.el: Redo sync with Tramp 2.0.45. Last commit did not
Michael Albinus <michael.albinus@gmx.de>
parents: 57463
diff changeset
2972 (let* ((attr (file-attributes f))
07791c7d465b * net/tramp.el: Redo sync with Tramp 2.0.45. Last commit did not
Michael Albinus <michael.albinus@gmx.de>
parents: 57463
diff changeset
2973 (modtime (nth 5 attr))
07791c7d465b * net/tramp.el: Redo sync with Tramp 2.0.45. Last commit did not
Michael Albinus <michael.albinus@gmx.de>
parents: 57463
diff changeset
2974 (mt (visited-file-modtime)))
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
2975
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
2976 (cond
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
2977 ;; File exists, and has a known modtime.
57559
07791c7d465b * net/tramp.el: Redo sync with Tramp 2.0.45. Last commit did not
Michael Albinus <michael.albinus@gmx.de>
parents: 57463
diff changeset
2978 ((and attr (not (equal modtime '(0 0))))
07791c7d465b * net/tramp.el: Redo sync with Tramp 2.0.45. Last commit did not
Michael Albinus <michael.albinus@gmx.de>
parents: 57463
diff changeset
2979 (< (abs (tramp-time-diff
07791c7d465b * net/tramp.el: Redo sync with Tramp 2.0.45. Last commit did not
Michael Albinus <michael.albinus@gmx.de>
parents: 57463
diff changeset
2980 modtime
07791c7d465b * net/tramp.el: Redo sync with Tramp 2.0.45. Last commit did not
Michael Albinus <michael.albinus@gmx.de>
parents: 57463
diff changeset
2981 ;; For compatibility, deal with both the old
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
2982 ;; (HIGH . LOW) and the new (HIGH LOW) return
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
2983 ;; values of `visited-file-modtime'.
57559
07791c7d465b * net/tramp.el: Redo sync with Tramp 2.0.45. Last commit did not
Michael Albinus <michael.albinus@gmx.de>
parents: 57463
diff changeset
2984 (if (atom (cdr mt))
07791c7d465b * net/tramp.el: Redo sync with Tramp 2.0.45. Last commit did not
Michael Albinus <michael.albinus@gmx.de>
parents: 57463
diff changeset
2985 (list (car mt) (cdr mt))
07791c7d465b * net/tramp.el: Redo sync with Tramp 2.0.45. Last commit did not
Michael Albinus <michael.albinus@gmx.de>
parents: 57463
diff changeset
2986 mt)))
07791c7d465b * net/tramp.el: Redo sync with Tramp 2.0.45. Last commit did not
Michael Albinus <michael.albinus@gmx.de>
parents: 57463
diff changeset
2987 2))
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
2988 ;; Modtime has the don't know value.
57559
07791c7d465b * net/tramp.el: Redo sync with Tramp 2.0.45. Last commit did not
Michael Albinus <michael.albinus@gmx.de>
parents: 57463
diff changeset
2989 (attr
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2990 (tramp-send-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2991 v
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2992 (format "%s -ild %s"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2993 (tramp-get-ls-command v)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2994 (tramp-shell-quote-argument localname)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2995 (with-current-buffer (tramp-get-buffer v)
57559
07791c7d465b * net/tramp.el: Redo sync with Tramp 2.0.45. Last commit did not
Michael Albinus <michael.albinus@gmx.de>
parents: 57463
diff changeset
2996 (setq attr (buffer-substring
07791c7d465b * net/tramp.el: Redo sync with Tramp 2.0.45. Last commit did not
Michael Albinus <michael.albinus@gmx.de>
parents: 57463
diff changeset
2997 (point) (progn (end-of-line) (point)))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2998 (equal
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2999 attr
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3000 (tramp-get-file-property
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3001 v localname "visited-file-modtime-ild" "")))
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
3002 ;; If file does not exist, say it is not modified if and
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
3003 ;; only if that agrees with the buffer's record.
57559
07791c7d465b * net/tramp.el: Redo sync with Tramp 2.0.45. Last commit did not
Michael Albinus <michael.albinus@gmx.de>
parents: 57463
diff changeset
3004 (t (equal mt '(-1 65535))))))))))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3005
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3006 (defun tramp-handle-set-file-modes (filename mode)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3007 "Like `set-file-modes' for Tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3008 (with-parsed-tramp-file-name filename nil
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3009 (tramp-flush-file-property v localname)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3010 (unless (zerop (tramp-send-command-and-check
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3011 v
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3012 (format "chmod %s %s"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3013 (tramp-decimal-to-octal mode)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3014 (tramp-shell-quote-argument localname))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3015 ;; FIXME: extract the proper text from chmod's stderr.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3016 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3017 v 'file-error "Error while changing file's mode %s" filename))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3018
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3019 (defun tramp-handle-set-file-times (filename &optional time)
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3020 "Like `set-file-times' for Tramp files."
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3021 (zerop
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3022 (if (file-remote-p filename)
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3023 (with-parsed-tramp-file-name filename nil
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3024 (tramp-flush-file-property v localname)
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3025 (let ((time (if (or (null time) (equal time '(0 0)))
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3026 (current-time)
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3027 time))
108469
acaefbe07157 * net/tramp.el (tramp-do-file-attributes-with-stat): Add space in
Michael Albinus <michael.albinus@gmx.de>
parents: 108377
diff changeset
3028 ;; With GNU Emacs, `format-time-string' has an optional
acaefbe07157 * net/tramp.el (tramp-do-file-attributes-with-stat): Add space in
Michael Albinus <michael.albinus@gmx.de>
parents: 108377
diff changeset
3029 ;; parameter UNIVERSAL. This is preferred, because we
acaefbe07157 * net/tramp.el (tramp-do-file-attributes-with-stat): Add space in
Michael Albinus <michael.albinus@gmx.de>
parents: 108377
diff changeset
3030 ;; could handle the case when the remote host is
acaefbe07157 * net/tramp.el (tramp-do-file-attributes-with-stat): Add space in
Michael Albinus <michael.albinus@gmx.de>
parents: 108377
diff changeset
3031 ;; located in a different time zone as the local host.
acaefbe07157 * net/tramp.el (tramp-do-file-attributes-with-stat): Add space in
Michael Albinus <michael.albinus@gmx.de>
parents: 108377
diff changeset
3032 (utc (not (featurep 'xemacs))))
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3033 (tramp-send-command-and-check
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3034 v (format "%s touch -t %s %s"
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3035 (if utc "TZ=UTC; export TZ;" "")
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3036 (if utc
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3037 (format-time-string "%Y%m%d%H%M.%S" time t)
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3038 (format-time-string "%Y%m%d%H%M.%S" time))
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3039 (tramp-shell-quote-argument localname)))))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3040
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3041 ;; We handle also the local part, because in older Emacsen,
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3042 ;; without `set-file-times', this function is an alias for this.
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3043 ;; We are local, so we don't need the UTC settings.
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
3044 (tramp-local-call-process
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3045 "touch" nil nil nil "-t"
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3046 (format-time-string "%Y%m%d%H%M.%S" time)
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3047 (tramp-shell-quote-argument filename)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3048
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3049 (defun tramp-set-file-uid-gid (filename &optional uid gid)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3050 "Set the ownership for FILENAME.
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3051 If UID and GID are provided, these values are used; otherwise uid
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3052 and gid of the corresponding user is taken. Both parameters must be integers."
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
3053 ;; Modern Unices allow chown only for root. So we might need
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
3054 ;; another implementation, see `dired-do-chown'. OTOH, it is mostly
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
3055 ;; working with su(do)? when it is needed, so it shall succeed in
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
3056 ;; the majority of cases.
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3057 ;; Don't modify `last-coding-system-used' by accident.
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3058 (let ((last-coding-system-used last-coding-system-used))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3059 (if (file-remote-p filename)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3060 (with-parsed-tramp-file-name filename nil
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3061 (if (and (zerop (user-uid)) (tramp-local-host-p v))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3062 ;; If we are root on the local host, we can do it directly.
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3063 (tramp-set-file-uid-gid localname uid gid)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3064 (let ((uid (or (and (integerp uid) uid)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3065 (tramp-get-remote-uid v 'integer)))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3066 (gid (or (and (integerp gid) gid)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3067 (tramp-get-remote-gid v 'integer))))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3068 (tramp-send-command
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3069 v (format
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3070 "chown %d:%d %s" uid gid
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3071 (tramp-shell-quote-argument localname))))))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3072
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3073 ;; We handle also the local part, because there doesn't exist
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3074 ;; `set-file-uid-gid'. On W32 "chown" might not work.
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3075 (let ((uid (or (and (integerp uid) uid) (tramp-get-local-uid 'integer)))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3076 (gid (or (and (integerp gid) gid) (tramp-get-local-gid 'integer))))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3077 (tramp-local-call-process
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3078 "chown" nil nil nil
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3079 (format "%d:%d" uid gid) (tramp-shell-quote-argument filename))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3080
108158
94e4a7a7cadf * net/tramp.el (tramp-remote-selinux-p): New defun.
Michael Albinus <albinus@detlef>
parents: 108077
diff changeset
3081 (defun tramp-remote-selinux-p (vec)
94e4a7a7cadf * net/tramp.el (tramp-remote-selinux-p): New defun.
Michael Albinus <albinus@detlef>
parents: 108077
diff changeset
3082 "Check, whether SELINUX is enabled on the remote host."
94e4a7a7cadf * net/tramp.el (tramp-remote-selinux-p): New defun.
Michael Albinus <albinus@detlef>
parents: 108077
diff changeset
3083 (with-connection-property (tramp-get-connection-process vec) "selinux-p"
94e4a7a7cadf * net/tramp.el (tramp-remote-selinux-p): New defun.
Michael Albinus <albinus@detlef>
parents: 108077
diff changeset
3084 (let ((result (tramp-find-executable
94e4a7a7cadf * net/tramp.el (tramp-remote-selinux-p): New defun.
Michael Albinus <albinus@detlef>
parents: 108077
diff changeset
3085 vec "getenforce" (tramp-get-remote-path vec) t t)))
94e4a7a7cadf * net/tramp.el (tramp-remote-selinux-p): New defun.
Michael Albinus <albinus@detlef>
parents: 108077
diff changeset
3086 (and result
94e4a7a7cadf * net/tramp.el (tramp-remote-selinux-p): New defun.
Michael Albinus <albinus@detlef>
parents: 108077
diff changeset
3087 (string-equal
94e4a7a7cadf * net/tramp.el (tramp-remote-selinux-p): New defun.
Michael Albinus <albinus@detlef>
parents: 108077
diff changeset
3088 (tramp-send-command-and-read
94e4a7a7cadf * net/tramp.el (tramp-remote-selinux-p): New defun.
Michael Albinus <albinus@detlef>
parents: 108077
diff changeset
3089 vec (format "echo \\\"`%S`\\\"" result))
94e4a7a7cadf * net/tramp.el (tramp-remote-selinux-p): New defun.
Michael Albinus <albinus@detlef>
parents: 108077
diff changeset
3090 "Enforcing")))))
94e4a7a7cadf * net/tramp.el (tramp-remote-selinux-p): New defun.
Michael Albinus <albinus@detlef>
parents: 108077
diff changeset
3091
108077
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3092 (defun tramp-handle-file-selinux-context (filename)
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3093 "Like `file-selinux-context' for Tramp files."
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3094 (with-parsed-tramp-file-name filename nil
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3095 (with-file-property v localname "file-selinux-context"
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3096 (let ((context '(nil nil nil nil))
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3097 (regexp (concat "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\):"
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3098 "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\)")))
108158
94e4a7a7cadf * net/tramp.el (tramp-remote-selinux-p): New defun.
Michael Albinus <albinus@detlef>
parents: 108077
diff changeset
3099 (when (and (tramp-remote-selinux-p v)
94e4a7a7cadf * net/tramp.el (tramp-remote-selinux-p): New defun.
Michael Albinus <albinus@detlef>
parents: 108077
diff changeset
3100 (zerop (tramp-send-command-and-check
94e4a7a7cadf * net/tramp.el (tramp-remote-selinux-p): New defun.
Michael Albinus <albinus@detlef>
parents: 108077
diff changeset
3101 v (format
94e4a7a7cadf * net/tramp.el (tramp-remote-selinux-p): New defun.
Michael Albinus <albinus@detlef>
parents: 108077
diff changeset
3102 "%s -d -Z %s"
94e4a7a7cadf * net/tramp.el (tramp-remote-selinux-p): New defun.
Michael Albinus <albinus@detlef>
parents: 108077
diff changeset
3103 (tramp-get-ls-command v)
94e4a7a7cadf * net/tramp.el (tramp-remote-selinux-p): New defun.
Michael Albinus <albinus@detlef>
parents: 108077
diff changeset
3104 (tramp-shell-quote-argument localname)))))
108077
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3105 (with-current-buffer (tramp-get-connection-buffer v)
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3106 (goto-char (point-min))
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3107 (when (re-search-forward regexp (tramp-compat-line-end-position) t)
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3108 (setq context (list (match-string 1) (match-string 2)
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3109 (match-string 3) (match-string 4))))))
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3110 ;; Return the context.
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3111 context))))
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3112
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3113 (defun tramp-handle-set-file-selinux-context (filename context)
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3114 "Like `set-file-selinux-context' for Tramp files."
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3115 (with-parsed-tramp-file-name filename nil
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3116 (if (and (consp context)
108158
94e4a7a7cadf * net/tramp.el (tramp-remote-selinux-p): New defun.
Michael Albinus <albinus@detlef>
parents: 108077
diff changeset
3117 (tramp-remote-selinux-p v)
108077
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3118 (zerop (tramp-send-command-and-check
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3119 v (format "chcon %s %s %s %s %s"
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3120 (if (stringp (nth 0 context))
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3121 (format "--user=%s" (nth 0 context)) "")
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3122 (if (stringp (nth 1 context))
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3123 (format "--role=%s" (nth 1 context)) "")
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3124 (if (stringp (nth 2 context))
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3125 (format "--type=%s" (nth 2 context)) "")
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3126 (if (stringp (nth 3 context))
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3127 (format "--range=%s" (nth 3 context)) "")
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3128 (tramp-shell-quote-argument localname)))))
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3129 (tramp-set-file-property v localname "file-selinux-context" context)
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3130 (tramp-set-file-property v localname "file-selinux-context" 'undef)))
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3131 ;; We always return nil.
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3132 nil)
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3133
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3134 ;; Simple functions using the `test' command.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3135
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3136 (defun tramp-handle-file-executable-p (filename)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3137 "Like `file-executable-p' for Tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3138 (with-parsed-tramp-file-name filename nil
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3139 (with-file-property v localname "file-executable-p"
105767
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3140 ;; Examine `file-attributes' cache to see if request can be
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3141 ;; satisfied without remote operation.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3142 (or (tramp-check-cached-permissions v ?x)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3143 (zerop (tramp-run-test "-x" filename))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3144
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3145 (defun tramp-handle-file-readable-p (filename)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3146 "Like `file-readable-p' for Tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3147 (with-parsed-tramp-file-name filename nil
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3148 (with-file-property v localname "file-readable-p"
105767
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3149 ;; Examine `file-attributes' cache to see if request can be
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3150 ;; satisfied without remote operation.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3151 (or (tramp-check-cached-permissions v ?r)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3152 (zerop (tramp-run-test "-r" filename))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3153
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3154 ;; When the remote shell is started, it looks for a shell which groks
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3155 ;; tilde expansion. Here, we assume that all shells which grok tilde
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3156 ;; expansion will also provide a `test' command which groks `-nt' (for
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3157 ;; newer than). If this breaks, tell me about it and I'll try to do
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3158 ;; something smarter about it.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3159 (defun tramp-handle-file-newer-than-file-p (file1 file2)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3160 "Like `file-newer-than-file-p' for Tramp files."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3161 (cond ((not (file-exists-p file1))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3162 nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3163 ((not (file-exists-p file2))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3164 t)
47577
20336ef6b20a Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47576
diff changeset
3165 ;; We are sure both files exist at this point.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3166 (t
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3167 (save-excursion
47577
20336ef6b20a Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47576
diff changeset
3168 ;; We try to get the mtime of both files. If they are not
20336ef6b20a Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47576
diff changeset
3169 ;; equal to the "dont-know" value, then we subtract the times
20336ef6b20a Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47576
diff changeset
3170 ;; and obtain the result.
20336ef6b20a Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47576
diff changeset
3171 (let ((fa1 (file-attributes file1))
20336ef6b20a Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47576
diff changeset
3172 (fa2 (file-attributes file2)))
20336ef6b20a Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47576
diff changeset
3173 (if (and (not (equal (nth 5 fa1) '(0 0)))
20336ef6b20a Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47576
diff changeset
3174 (not (equal (nth 5 fa2) '(0 0))))
59582
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
3175 (> 0 (tramp-time-diff (nth 5 fa2) (nth 5 fa1)))
47577
20336ef6b20a Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47576
diff changeset
3176 ;; If one of them is the dont-know value, then we can
20336ef6b20a Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47576
diff changeset
3177 ;; still try to run a shell command on the remote host.
20336ef6b20a Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47576
diff changeset
3178 ;; However, this only works if both files are Tramp
20336ef6b20a Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47576
diff changeset
3179 ;; files and both have the same method, same user, same
20336ef6b20a Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47576
diff changeset
3180 ;; host.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3181 (unless (tramp-equal-remote file1 file2)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3182 (with-parsed-tramp-file-name
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3183 (if (tramp-tramp-file-p file1) file1 file2) nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3184 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3185 v 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3186 "Files %s and %s must have same method, user, host"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3187 file1 file2)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3188 (with-parsed-tramp-file-name file1 nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3189 (zerop (tramp-run-test2
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3190 (tramp-get-test-nt-command v) file1 file2)))))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3191
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3192 ;; Functions implemented using the basic functions above.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3193
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3194 (defun tramp-handle-file-modes (filename)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3195 "Like `file-modes' for Tramp files."
96392
61ba354c1338 * net/tramp.el (tramp-handle-file-modes): Handle symlinks.
Michael Albinus <michael.albinus@gmx.de>
parents: 96361
diff changeset
3196 (let ((truename (or (file-truename filename) filename)))
61ba354c1338 * net/tramp.el (tramp-handle-file-modes): Handle symlinks.
Michael Albinus <michael.albinus@gmx.de>
parents: 96361
diff changeset
3197 (when (file-exists-p truename)
61ba354c1338 * net/tramp.el (tramp-handle-file-modes): Handle symlinks.
Michael Albinus <michael.albinus@gmx.de>
parents: 96361
diff changeset
3198 (tramp-mode-string-to-int (nth 8 (file-attributes truename))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3199
102851
5cc9a4c776e8 * net/tramp.el (tramp-default-file-modes) New defun. Replace all
Michael Albinus <michael.albinus@gmx.de>
parents: 102287
diff changeset
3200 (defun tramp-default-file-modes (filename)
5cc9a4c776e8 * net/tramp.el (tramp-default-file-modes) New defun. Replace all
Michael Albinus <michael.albinus@gmx.de>
parents: 102287
diff changeset
3201 "Return file modes of FILENAME as integer.
5cc9a4c776e8 * net/tramp.el (tramp-default-file-modes) New defun. Replace all
Michael Albinus <michael.albinus@gmx.de>
parents: 102287
diff changeset
3202 If the file modes of FILENAME cannot be determined, return the
103639
6be9692e90bf * net/tramp.el (tramp-default-file-modes) Remove execute permissions.
Michael Albinus <michael.albinus@gmx.de>
parents: 103635
diff changeset
3203 value of `default-file-modes', without execute permissions."
6be9692e90bf * net/tramp.el (tramp-default-file-modes) Remove execute permissions.
Michael Albinus <michael.albinus@gmx.de>
parents: 103635
diff changeset
3204 (or (file-modes filename)
6be9692e90bf * net/tramp.el (tramp-default-file-modes) Remove execute permissions.
Michael Albinus <michael.albinus@gmx.de>
parents: 103635
diff changeset
3205 (logand (default-file-modes) (tramp-octal-to-decimal "0666"))))
102851
5cc9a4c776e8 * net/tramp.el (tramp-default-file-modes) New defun. Replace all
Michael Albinus <michael.albinus@gmx.de>
parents: 102287
diff changeset
3206
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3207 (defun tramp-handle-file-directory-p (filename)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3208 "Like `file-directory-p' for Tramp files."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3209 ;; Care must be taken that this function returns `t' for symlinks
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3210 ;; pointing to directories. Surely the most obvious implementation
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3211 ;; would be `test -d', but that returns false for such symlinks.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3212 ;; CCC: Stefan Monnier says that `test -d' follows symlinks. And
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3213 ;; I now think he's right. So we could be using `test -d', couldn't
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3214 ;; we?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3215 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3216 ;; Alternatives: `cd %s', `test -d %s'
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3217 (with-parsed-tramp-file-name filename nil
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3218 (with-file-property v localname "file-directory-p"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3219 (zerop (tramp-run-test "-d" filename)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3220
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3221 (defun tramp-handle-file-regular-p (filename)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3222 "Like `file-regular-p' for Tramp files."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3223 (and (file-exists-p filename)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3224 (eq ?- (aref (nth 8 (file-attributes filename)) 0))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3225
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3226 (defun tramp-handle-file-symlink-p (filename)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3227 "Like `file-symlink-p' for Tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3228 (with-parsed-tramp-file-name filename nil
53206
0c19f1a19b2b (tramp-chunksize): Extend docstring. Suggested by
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 52401
diff changeset
3229 (let ((x (car (file-attributes filename))))
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
3230 (when (stringp x)
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
3231 ;; When Tramp is running on VMS, then `file-name-absolute-p'
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
3232 ;; might do weird things.
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
3233 (if (file-name-absolute-p x)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3234 (tramp-make-tramp-file-name method user host x)
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
3235 x)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3236
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3237 (defun tramp-handle-file-writable-p (filename)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3238 "Like `file-writable-p' for Tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3239 (with-parsed-tramp-file-name filename nil
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3240 (with-file-property v localname "file-writable-p"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3241 (if (file-exists-p filename)
105767
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3242 ;; Examine `file-attributes' cache to see if request can be
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3243 ;; satisfied without remote operation.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3244 (or (tramp-check-cached-permissions v ?w)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3245 (zerop (tramp-run-test "-w" filename)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3246 ;; If file doesn't exist, check if directory is writable.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3247 (and (zerop (tramp-run-test
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3248 "-d" (file-name-directory filename)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3249 (zerop (tramp-run-test
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3250 "-w" (file-name-directory filename))))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3251
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3252 (defun tramp-handle-file-ownership-preserved-p (filename)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3253 "Like `file-ownership-preserved-p' for Tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3254 (with-parsed-tramp-file-name filename nil
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3255 (with-file-property v localname "file-ownership-preserved-p"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3256 (let ((attributes (file-attributes filename)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3257 ;; Return t if the file doesn't exist, since it's true that no
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3258 ;; information would be lost by an (attempted) delete and create.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3259 (or (null attributes)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3260 (= (nth 2 attributes) (tramp-get-remote-uid v 'integer)))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3261
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3262 ;; Other file name ops.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3263
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3264 (defun tramp-handle-directory-file-name (directory)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3265 "Like `directory-file-name' for Tramp files."
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
3266 ;; If localname component of filename is "/", leave it unchanged.
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
3267 ;; Otherwise, remove any trailing slash from localname component.
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
3268 ;; Method, host, etc, are unchanged. Does it make sense to try
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
3269 ;; to avoid parsing the filename?
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3270 (with-parsed-tramp-file-name directory nil
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
3271 (if (and (not (zerop (length localname)))
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
3272 (eq (aref localname (1- (length localname))) ?/)
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
3273 (not (string= localname "/")))
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
3274 (substring directory 0 -1)
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
3275 directory)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3276
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3277 ;; Directory listings.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3278
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3279 (defun tramp-handle-directory-files
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3280 (directory &optional full match nosort files-only)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3281 "Like `directory-files' for Tramp files."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3282 ;; FILES-ONLY is valid for XEmacs only.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3283 (when (file-directory-p directory)
107190
21bb664bb922 (tramp-handle-directory-files): When FULL, do not expand "." and "..".
Michael Albinus <michael.albinus@gmx.de>
parents: 107189
diff changeset
3284 (setq directory (file-name-as-directory (expand-file-name directory)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3285 (let ((temp (nreverse (file-name-all-completions "" directory)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3286 result item)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3287
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3288 (while temp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3289 (setq item (directory-file-name (pop temp)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3290 (when (and (or (null match) (string-match match item))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3291 (or (null files-only)
107190
21bb664bb922 (tramp-handle-directory-files): When FULL, do not expand "." and "..".
Michael Albinus <michael.albinus@gmx.de>
parents: 107189
diff changeset
3292 ;; Files only.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3293 (and (equal files-only t) (file-regular-p item))
107190
21bb664bb922 (tramp-handle-directory-files): When FULL, do not expand "." and "..".
Michael Albinus <michael.albinus@gmx.de>
parents: 107189
diff changeset
3294 ;; Directories only.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3295 (file-directory-p item)))
107190
21bb664bb922 (tramp-handle-directory-files): When FULL, do not expand "." and "..".
Michael Albinus <michael.albinus@gmx.de>
parents: 107189
diff changeset
3296 (push (if full (concat directory item) item)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3297 result)))
107190
21bb664bb922 (tramp-handle-directory-files): When FULL, do not expand "." and "..".
Michael Albinus <michael.albinus@gmx.de>
parents: 107189
diff changeset
3298 (if nosort result (sort result 'string<)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3299
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
3300 (defun tramp-handle-directory-files-and-attributes
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
3301 (directory &optional full match nosort id-format)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3302 "Like `directory-files-and-attributes' for Tramp files."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3303 (unless id-format (setq id-format 'integer))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3304 (when (file-directory-p directory)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3305 (setq directory (expand-file-name directory))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3306 (let* ((temp
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
3307 (copy-tree
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3308 (with-parsed-tramp-file-name directory nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3309 (with-file-property
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3310 v localname
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3311 (format "directory-files-and-attributes-%s" id-format)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3312 (save-excursion
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3313 (mapcar
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3314 (lambda (x)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3315 (cons (car x)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
3316 (tramp-convert-file-attributes v (cdr x))))
104807
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
3317 (cond
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
3318 ((tramp-get-remote-stat v)
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
3319 (tramp-do-directory-files-and-attributes-with-stat
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
3320 v localname id-format))
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
3321 ((tramp-get-remote-perl v)
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
3322 (tramp-do-directory-files-and-attributes-with-perl
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
3323 v localname id-format)))))))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3324 result item)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3325
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3326 (while temp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3327 (setq item (pop temp))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3328 (when (or (null match) (string-match match (car item)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3329 (when full
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3330 (setcar item (expand-file-name (car item) directory)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3331 (push item result)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3332
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3333 (if nosort
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3334 result
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3335 (sort result (lambda (x y) (string< (car x) (car y))))))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3336
104807
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
3337 (defun tramp-do-directory-files-and-attributes-with-perl
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3338 (vec localname &optional id-format)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3339 "Implement `directory-files-and-attributes' for Tramp files using a Perl script."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3340 (tramp-message vec 5 "directory-files-and-attributes with perl: %s" localname)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3341 (tramp-maybe-send-script
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3342 vec tramp-perl-directory-files-and-attributes
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3343 "tramp_perl_directory_files_and_attributes")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3344 (let ((object
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3345 (tramp-send-command-and-read
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3346 vec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3347 (format "tramp_perl_directory_files_and_attributes %s %s"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3348 (tramp-shell-quote-argument localname) id-format))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3349 (when (stringp object) (tramp-error vec 'file-error object))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3350 object))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3351
104807
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
3352 (defun tramp-do-directory-files-and-attributes-with-stat
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3353 (vec localname &optional id-format)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3354 "Implement `directory-files-and-attributes' for Tramp files using stat(1) command."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3355 (tramp-message vec 5 "directory-files-and-attributes with stat: %s" localname)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3356 (tramp-send-command-and-read
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3357 vec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3358 (format
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3359 (concat
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
3360 ;; We must care about filenames with spaces, or starting with
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
3361 ;; "-"; this would confuse xargs. "ls -aQ" might be a solution,
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
3362 ;; but it does not work on all remote systems. Therefore, we
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
3363 ;; quote the filenames via sed.
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
3364 "cd %s; echo \"(\"; (%s -a | sed -e s/\\$/\\\"/g -e s/^/\\\"/g | xargs "
82064
07bb0658401d * net/tramp.el (tramp-perl-file-attributes)
Michael Albinus <michael.albinus@gmx.de>
parents: 82025
diff changeset
3365 "%s -c '(\"%%n\" (\"%%N\") %%h %s %s %%X.0 %%Y.0 %%Z.0 %%s.0 \"%%A\" t %%i.0 -1)'); "
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3366 "echo \")\"")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3367 (tramp-shell-quote-argument localname)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3368 (tramp-get-ls-command vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3369 (tramp-get-remote-stat vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3370 (if (eq id-format 'integer) "%u" "\"%U\"")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3371 (if (eq id-format 'integer) "%g" "\"%G\""))))
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
3372
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3373 ;; This function should return "foo/" for directories and "bar" for
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3374 ;; files.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3375 (defun tramp-handle-file-name-all-completions (filename directory)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3376 "Like `file-name-all-completions' for Tramp files."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3377 (unless (save-match-data (string-match "/" filename))
85508
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
3378 (with-parsed-tramp-file-name (expand-file-name directory) nil
86204
7d7472ea9c0a * net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents: 86048
diff changeset
3379
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3380 (all-completions
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3381 filename
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3382 (mapcar
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3383 'list
105767
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3384 (or
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3385 ;; Try cache first
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3386 (and
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3387 ;; Ignore if expired
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3388 (or (not (integerp tramp-completion-reread-directory-timeout))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3389 (<= (tramp-time-diff
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3390 (current-time)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3391 (tramp-get-file-property
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3392 v localname "last-completion" '(0 0 0)))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3393 tramp-completion-reread-directory-timeout))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3394
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3395 ;; Try cache entries for filename, filename with last
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3396 ;; character removed, filename with last two characters
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3397 ;; removed, ..., and finally the empty string - all
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3398 ;; concatenated to the local directory name
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3399
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3400 ;; This is inefficient for very long filenames, pity
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3401 ;; `reduce' is not available...
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3402 (car
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3403 (apply
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3404 'append
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3405 (mapcar
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3406 (lambda (x)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3407 (let ((cache-hit
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3408 (tramp-get-file-property
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3409 v
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3410 (concat localname (substring filename 0 x))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3411 "file-name-all-completions"
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3412 nil)))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3413 (when cache-hit (list cache-hit))))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3414 (tramp-compat-number-sequence (length filename) 0 -1)))))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3415
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3416 ;; Cache expired or no matching cache entry found so we need
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3417 ;; to perform a remote operation
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3418 (let (result)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3419 ;; Get a list of directories and files, including reliably
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3420 ;; tagging the directories with a trailing '/'. Because I
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3421 ;; rock. --daniel@danann.net
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3422
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3423 ;; Changed to perform `cd' in the same remote op and only
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3424 ;; get entries starting with `filename'. Capture any `cd'
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3425 ;; error messages. Ensure any `cd' and `echo' aliases are
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3426 ;; ignored.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3427 (tramp-send-command
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3428 v
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3429 (if (tramp-get-remote-perl v)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3430 (progn
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3431 (tramp-maybe-send-script
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3432 v tramp-perl-file-name-all-completions
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3433 "tramp_perl_file_name_all_completions")
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3434 (format "tramp_perl_file_name_all_completions %s %s %d"
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3435 (tramp-shell-quote-argument localname)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3436 (tramp-shell-quote-argument filename)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3437 (if (symbol-value
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
3438 ;; `read-file-name-completion-ignore-case'
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
3439 ;; is introduced with Emacs 22.1.
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
3440 (if (boundp
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
3441 'read-file-name-completion-ignore-case)
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
3442 'read-file-name-completion-ignore-case
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
3443 'completion-ignore-case))
105767
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3444 1 0)))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3445
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3446 (format (concat
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3447 "(\\cd %s 2>&1 && (%s %s -a 2>/dev/null"
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3448 ;; `ls' with wildcard might fail with `Argument
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3449 ;; list too long' error in some corner cases; if
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3450 ;; `ls' fails after `cd' succeeded, chances are
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3451 ;; that's the case, so let's retry without
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3452 ;; wildcard. This will return "too many" entries
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3453 ;; but that isn't harmful.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3454 " || %s -a 2>/dev/null)"
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3455 " | while read f; do"
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3456 " if %s -d \"$f\" 2>/dev/null;"
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3457 " then \\echo \"$f/\"; else \\echo \"$f\"; fi; done"
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3458 " && \\echo ok) || \\echo fail")
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3459 (tramp-shell-quote-argument localname)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3460 (tramp-get-ls-command v)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3461 ;; When `filename' is empty, just `ls' without
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3462 ;; filename argument is more efficient than `ls *'
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3463 ;; for very large directories and might avoid the
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3464 ;; `Argument list too long' error.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3465 ;;
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3466 ;; With and only with wildcard, we need to add
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3467 ;; `-d' to prevent `ls' from descending into
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3468 ;; sub-directories.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3469 (if (zerop (length filename))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3470 "."
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3471 (concat (tramp-shell-quote-argument filename) "* -d"))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3472 (tramp-get-ls-command v)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3473 (tramp-get-test-command v))))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3474
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3475 ;; Now grab the output.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3476 (with-current-buffer (tramp-get-buffer v)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3477 (goto-char (point-max))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3478
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3479 ;; Check result code, found in last line of output
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3480 (forward-line -1)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3481 (if (looking-at "^fail$")
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3482 (progn
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3483 ;; Grab error message from line before last line
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3484 ;; (it was put there by `cd 2>&1')
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3485 (forward-line -1)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3486 (tramp-error
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3487 v 'file-error
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3488 "tramp-handle-file-name-all-completions: %s"
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3489 (buffer-substring
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3490 (point) (tramp-compat-line-end-position))))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3491 ;; For peace of mind, if buffer doesn't end in `fail'
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3492 ;; then it should end in `ok'. If neither are in the
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3493 ;; buffer something went seriously wrong on the remote
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3494 ;; side.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3495 (unless (looking-at "^ok$")
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3496 (tramp-error
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3497 v 'file-error
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3498 "\
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3499 tramp-handle-file-name-all-completions: internal error accessing `%s': `%s'"
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3500 (tramp-shell-quote-argument localname) (buffer-string))))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3501
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3502 (while (zerop (forward-line -1))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3503 (push (buffer-substring
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3504 (point) (tramp-compat-line-end-position))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3505 result)))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3506
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3507 ;; Because the remote op went through OK we know the
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3508 ;; directory we `cd'-ed to exists
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3509 (tramp-set-file-property
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3510 v localname "file-exists-p" t)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3511
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3512 ;; Because the remote op went through OK we know every
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3513 ;; file listed by `ls' exists.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3514 (mapc (lambda (entry)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3515 (tramp-set-file-property
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3516 v (concat localname entry) "file-exists-p" t))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3517 result)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3518
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3519 (tramp-set-file-property
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3520 v localname "last-completion" (current-time))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3521
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3522 ;; Store result in the cache
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3523 (tramp-set-file-property
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3524 v (concat localname filename)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3525 "file-name-all-completions"
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3526 result))))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3527
74766
ca4412906dbd * net/ange-ftp.el (ange-ftp-file-name-completion): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 74739
diff changeset
3528 (defun tramp-handle-file-name-completion
ca4412906dbd * net/ange-ftp.el (ange-ftp-file-name-completion): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 74739
diff changeset
3529 (filename directory &optional predicate)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3530 "Like `file-name-completion' for Tramp files."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3531 (unless (tramp-tramp-file-p directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3532 (error
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3533 "tramp-handle-file-name-completion invoked on non-tramp directory `%s'"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3534 directory))
74777
948c86bf6396 * net/tramp.el (tramp-default-method): We still need to check for
Michael Albinus <michael.albinus@gmx.de>
parents: 74766
diff changeset
3535 (try-completion
948c86bf6396 * net/tramp.el (tramp-default-method): We still need to check for
Michael Albinus <michael.albinus@gmx.de>
parents: 74766
diff changeset
3536 filename
948c86bf6396 * net/tramp.el (tramp-default-method): We still need to check for
Michael Albinus <michael.albinus@gmx.de>
parents: 74766
diff changeset
3537 (mapcar 'list (file-name-all-completions filename directory))
948c86bf6396 * net/tramp.el (tramp-default-method): We still need to check for
Michael Albinus <michael.albinus@gmx.de>
parents: 74766
diff changeset
3538 (when predicate
948c86bf6396 * net/tramp.el (tramp-default-method): We still need to check for
Michael Albinus <michael.albinus@gmx.de>
parents: 74766
diff changeset
3539 (lambda (x) (funcall predicate (expand-file-name (car x) directory))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3540
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3541 ;; cp, mv and ln
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3542
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3543 (defun tramp-handle-add-name-to-file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3544 (filename newname &optional ok-if-already-exists)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3545 "Like `add-name-to-file' for Tramp files."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3546 (unless (tramp-equal-remote filename newname)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3547 (with-parsed-tramp-file-name
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3548 (if (tramp-tramp-file-p filename) filename newname) nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3549 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3550 v 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3551 "add-name-to-file: %s"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3552 "only implemented for same method, same user, same host")))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3553 (with-parsed-tramp-file-name filename v1
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3554 (with-parsed-tramp-file-name newname v2
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3555 (let ((ln (when v1 (tramp-get-remote-ln v1))))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3556 (when (and (not ok-if-already-exists)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3557 (file-exists-p newname)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3558 (not (numberp ok-if-already-exists))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3559 (y-or-n-p
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3560 (format
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3561 "File %s already exists; make it a new name anyway? "
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3562 newname)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3563 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3564 v2 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3565 "add-name-to-file: file %s already exists" newname))
107170
1f564d6c5e1d * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix
Michael Albinus <michael.albinus@gmx.de>
parents: 107151
diff changeset
3566 (tramp-flush-file-property v2 (file-name-directory v2-localname))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3567 (tramp-flush-file-property v2 v2-localname)
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3568 (tramp-barf-unless-okay
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3569 v1
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
3570 (format "%s %s %s" ln (tramp-shell-quote-argument v1-localname)
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
3571 (tramp-shell-quote-argument v2-localname))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3572 "error with add-name-to-file, see buffer `%s' for details"
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3573 (buffer-name))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3574
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3575 (defun tramp-handle-copy-file
108064
589643be353e * net/tramp.el (tramp-handle-copy-file): Add new optional
Michael Albinus <michael.albinus@gmx.de>
parents: 108059
diff changeset
3576 (filename newname &optional ok-if-already-exists keep-date
589643be353e * net/tramp.el (tramp-handle-copy-file): Add new optional
Michael Albinus <michael.albinus@gmx.de>
parents: 108059
diff changeset
3577 preserve-uid-gid preserve-selinux-context)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3578 "Like `copy-file' for Tramp files."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3579 (setq filename (expand-file-name filename))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3580 (setq newname (expand-file-name newname))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3581 (cond
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
3582 ;; At least one file a Tramp file?
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3583 ((or (tramp-tramp-file-p filename)
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3584 (tramp-tramp-file-p newname))
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3585 (tramp-do-copy-or-rename-file
108077
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3586 'copy filename newname ok-if-already-exists keep-date
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3587 preserve-uid-gid preserve-selinux-context))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3588 ;; Compat section.
108077
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3589 (preserve-selinux-context
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3590 (tramp-run-real-handler
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3591 'copy-file
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3592 (list filename newname ok-if-already-exists keep-date
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3593 preserve-uid-gid preserve-selinux-context)))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3594 (preserve-uid-gid
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3595 (tramp-run-real-handler
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3596 'copy-file
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3597 (list filename newname ok-if-already-exists keep-date preserve-uid-gid)))
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3598 (t
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3599 (tramp-run-real-handler
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3600 'copy-file (list filename newname ok-if-already-exists keep-date)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3601
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3602 (defun tramp-handle-copy-directory (dirname newname &optional keep-date parents)
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3603 "Like `copy-directory' for Tramp files."
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3604 (let ((t1 (tramp-tramp-file-p dirname))
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3605 (t2 (tramp-tramp-file-p newname)))
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3606 (with-parsed-tramp-file-name (if t1 dirname newname) nil
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3607 (if (and (tramp-get-method-parameter method 'tramp-copy-recursive)
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3608 ;; When DIRNAME and NEWNAME are remote, they must have
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3609 ;; the same method.
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3610 (or (null t1) (null t2)
105893
535ef0fe1689 * net/tramp.el (tramp-handle-copy-directory): Don't use
Michael Albinus <michael.albinus@gmx.de>
parents: 105767
diff changeset
3611 (string-equal
535ef0fe1689 * net/tramp.el (tramp-handle-copy-directory): Don't use
Michael Albinus <michael.albinus@gmx.de>
parents: 105767
diff changeset
3612 (tramp-file-name-method (tramp-dissect-file-name dirname))
535ef0fe1689 * net/tramp.el (tramp-handle-copy-directory): Don't use
Michael Albinus <michael.albinus@gmx.de>
parents: 105767
diff changeset
3613 (tramp-file-name-method (tramp-dissect-file-name newname)))))
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3614 ;; scp or rsync DTRT.
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3615 (progn
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3616 (setq dirname (directory-file-name (expand-file-name dirname))
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3617 newname (directory-file-name (expand-file-name newname)))
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3618 (if (and (file-directory-p newname)
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3619 (not (string-equal (file-name-nondirectory dirname)
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3620 (file-name-nondirectory newname))))
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3621 (setq newname
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3622 (expand-file-name
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3623 (file-name-nondirectory dirname) newname)))
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3624 (if (not (file-directory-p (file-name-directory newname)))
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3625 (make-directory (file-name-directory newname) parents))
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3626 (tramp-do-copy-or-rename-file-out-of-band
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3627 'copy dirname newname keep-date))
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3628 ;; We must do it file-wise.
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3629 (tramp-run-real-handler
107170
1f564d6c5e1d * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix
Michael Albinus <michael.albinus@gmx.de>
parents: 107151
diff changeset
3630 'copy-directory (list dirname newname keep-date parents)))
1f564d6c5e1d * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix
Michael Albinus <michael.albinus@gmx.de>
parents: 107151
diff changeset
3631
1f564d6c5e1d * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix
Michael Albinus <michael.albinus@gmx.de>
parents: 107151
diff changeset
3632 ;; When newname did exist, we have wrong cached values.
1f564d6c5e1d * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix
Michael Albinus <michael.albinus@gmx.de>
parents: 107151
diff changeset
3633 (when t2
1f564d6c5e1d * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix
Michael Albinus <michael.albinus@gmx.de>
parents: 107151
diff changeset
3634 (with-parsed-tramp-file-name newname nil
1f564d6c5e1d * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix
Michael Albinus <michael.albinus@gmx.de>
parents: 107151
diff changeset
3635 (tramp-flush-file-property v (file-name-directory localname))
1f564d6c5e1d * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix
Michael Albinus <michael.albinus@gmx.de>
parents: 107151
diff changeset
3636 (tramp-flush-file-property v localname))))))
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3637
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3638 (defun tramp-handle-rename-file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3639 (filename newname &optional ok-if-already-exists)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3640 "Like `rename-file' for Tramp files."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3641 ;; Check if both files are local -- invoke normal rename-file.
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
3642 ;; Otherwise, use Tramp from local system.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3643 (setq filename (expand-file-name filename))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3644 (setq newname (expand-file-name newname))
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
3645 ;; At least one file a Tramp file?
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3646 (if (or (tramp-tramp-file-p filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3647 (tramp-tramp-file-p newname))
59582
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
3648 (tramp-do-copy-or-rename-file
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3649 'rename filename newname ok-if-already-exists t t)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3650 (tramp-run-real-handler
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3651 'rename-file (list filename newname ok-if-already-exists))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3652
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3653 (defun tramp-do-copy-or-rename-file
108077
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3654 (op filename newname &optional ok-if-already-exists keep-date
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3655 preserve-uid-gid preserve-selinux-context)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3656 "Copy or rename a remote file.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3657 OP must be `copy' or `rename' and indicates the operation to perform.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3658 FILENAME specifies the file to copy or rename, NEWNAME is the name of
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3659 the new file (for copy) or the new name of the file (for rename).
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3660 OK-IF-ALREADY-EXISTS means don't barf if NEWNAME exists already.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3661 KEEP-DATE means to make sure that NEWNAME has the same timestamp
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3662 as FILENAME. PRESERVE-UID-GID, when non-nil, instructs to keep
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3663 the uid and gid if both files are on the same host.
108077
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3664 PRESERVE-SELINUX-CONTEXT activates selinux commands.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3665
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3666 This function is invoked by `tramp-handle-copy-file' and
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3667 `tramp-handle-rename-file'. It is an error if OP is neither of `copy'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3668 and `rename'. FILENAME and NEWNAME must be absolute file names."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3669 (unless (memq op '(copy rename))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3670 (error "Unknown operation `%s', must be `copy' or `rename'" op))
46584
f548d7d0c651 Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46347
diff changeset
3671 (let ((t1 (tramp-tramp-file-p filename))
107822
02b5fe4a01fe * net/tramp.el (tramp-do-copy-or-rename-file): Add progress reporter.
Michael Albinus <albinus@detlef>
parents: 107820
diff changeset
3672 (t2 (tramp-tramp-file-p newname))
108077
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3673 (context (and preserve-selinux-context
93125d6fab29 Implement SELINUX backends.
Michael Albinus <michael.albinus@gmx.de>
parents: 108066
diff changeset
3674 (apply 'file-selinux-context (list filename))))
107822
02b5fe4a01fe * net/tramp.el (tramp-do-copy-or-rename-file): Add progress reporter.
Michael Albinus <albinus@detlef>
parents: 107820
diff changeset
3675 pr tm)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3676
108739
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3677 (with-parsed-tramp-file-name (if t1 filename newname) nil
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3678 (when (and (not ok-if-already-exists) (file-exists-p newname))
93430
45fdb0c49e2f * net/tramp.el (tramp-do-copy-or-rename-file): Fix check for
Michael Albinus <michael.albinus@gmx.de>
parents: 93127
diff changeset
3679 (tramp-error
108739
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3680 v 'file-already-exists "File %s already exists" newname))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3681
108066
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
3682 (with-progress-reporter
108739
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3683 v 0 (format "%s %s to %s"
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3684 (if (eq op 'copy) "Copying" "Renaming")
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3685 filename newname)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3686
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3687 (cond
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3688 ;; Both are Tramp files.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3689 ((and t1 t2)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3690 (with-parsed-tramp-file-name filename v1
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3691 (with-parsed-tramp-file-name newname v2
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3692 (cond
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3693 ;; Shortcut: if method, host, user are the same for
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3694 ;; both files, we invoke `cp' or `mv' on the remote
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3695 ;; host directly.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3696 ((tramp-equal-remote filename newname)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3697 (tramp-do-copy-or-rename-file-directly
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3698 op filename newname
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3699 ok-if-already-exists keep-date preserve-uid-gid))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3700
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3701 ;; Try out-of-band operation.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3702 ((tramp-method-out-of-band-p
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3703 v1 (nth 7 (file-attributes filename)))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3704 (tramp-do-copy-or-rename-file-out-of-band
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3705 op filename newname keep-date))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3706
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3707 ;; No shortcut was possible. So we copy the file
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3708 ;; first. If the operation was `rename', we go back
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3709 ;; and delete the original file (if the copy was
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3710 ;; successful). The approach is simple-minded: we
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3711 ;; create a new buffer, insert the contents of the
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3712 ;; source file into it, then write out the buffer to
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3713 ;; the target file. The advantage is that it doesn't
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3714 ;; matter which filename handlers are used for the
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3715 ;; source and target file.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3716 (t
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3717 (tramp-do-copy-or-rename-file-via-buffer
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3718 op filename newname keep-date))))))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3719
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3720 ;; One file is a Tramp file, the other one is local.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3721 ((or t1 t2)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3722 (cond
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3723 ;; Fast track on local machine.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3724 ((tramp-local-host-p v)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3725 (tramp-do-copy-or-rename-file-directly
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3726 op filename newname
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3727 ok-if-already-exists keep-date preserve-uid-gid))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3728
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3729 ;; If the Tramp file has an out-of-band method, the
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3730 ;; corresponding copy-program can be invoked.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3731 ((tramp-method-out-of-band-p v (nth 7 (file-attributes filename)))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3732 (tramp-do-copy-or-rename-file-out-of-band
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3733 op filename newname keep-date))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3734
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3735 ;; Use the inline method via a Tramp buffer.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3736 (t (tramp-do-copy-or-rename-file-via-buffer
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3737 op filename newname keep-date))))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3738
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3739 (t
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3740 ;; One of them must be a Tramp file.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3741 (error "Tramp implementation says this cannot happen")))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3742
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3743 ;; Handle `preserve-selinux-context'.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3744 (when context (apply 'set-file-selinux-context (list newname context)))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3745
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3746 ;; In case of `rename', we must flush the cache of the source file.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3747 (when (and t1 (eq op 'rename))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3748 (with-parsed-tramp-file-name filename v1
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3749 (tramp-flush-file-property v1 (file-name-directory localname))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3750 (tramp-flush-file-property v1 localname)))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3751
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3752 ;; When newname did exist, we have wrong cached values.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3753 (when t2
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3754 (with-parsed-tramp-file-name newname v2
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3755 (tramp-flush-file-property v2 (file-name-directory localname))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
3756 (tramp-flush-file-property v2 localname)))))))
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
3757
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
3758 (defun tramp-do-copy-or-rename-file-via-buffer (op filename newname keep-date)
46584
f548d7d0c651 Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46347
diff changeset
3759 "Use an Emacs buffer to copy or rename a file.
f548d7d0c651 Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46347
diff changeset
3760 First arg OP is either `copy' or `rename' and indicates the operation.
f548d7d0c651 Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46347
diff changeset
3761 FILENAME is the source file, NEWNAME the target file.
f548d7d0c651 Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46347
diff changeset
3762 KEEP-DATE is non-nil if NEWNAME should have the same timestamp as FILENAME."
92982
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
3763 (with-temp-buffer
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
3764 ;; We must disable multibyte, because binary data shall not be
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
3765 ;; converted.
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
3766 (set-buffer-multibyte nil)
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
3767 (let ((coding-system-for-read 'binary)
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
3768 (jka-compr-inhibit t))
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
3769 (insert-file-contents-literally filename))
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
3770 ;; We don't want the target file to be compressed, so we let-bind
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
3771 ;; `jka-compr-inhibit' to t.
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
3772 (let ((coding-system-for-write 'binary)
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
3773 (jka-compr-inhibit t))
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
3774 (write-region (point-min) (point-max) newname)))
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
3775 ;; KEEP-DATE handling.
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
3776 (when keep-date (set-file-times newname (nth 5 (file-attributes filename))))
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
3777 ;; Set the mode.
102851
5cc9a4c776e8 * net/tramp.el (tramp-default-file-modes) New defun. Replace all
Michael Albinus <michael.albinus@gmx.de>
parents: 102287
diff changeset
3778 (set-file-modes newname (tramp-default-file-modes filename))
92982
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
3779 ;; If the operation was `rename', delete the original file.
108816
94d1d8a6dcfd * net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents: 108806
diff changeset
3780 (unless (eq op 'copy) (delete-file filename)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3781
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3782 (defun tramp-do-copy-or-rename-file-directly
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3783 (op filename newname ok-if-already-exists keep-date preserve-uid-gid)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3784 "Invokes `cp' or `mv' on the remote system.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3785 OP must be one of `copy' or `rename', indicating `cp' or `mv',
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3786 respectively. FILENAME specifies the file to copy or rename,
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3787 NEWNAME is the name of the new file (for copy) or the new name of
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3788 the file (for rename). Both files must reside on the same host.
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3789 KEEP-DATE means to make sure that NEWNAME has the same timestamp
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3790 as FILENAME. PRESERVE-UID-GID, when non-nil, instructs to keep
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3791 the uid and gid from FILENAME."
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3792 (let ((t1 (tramp-tramp-file-p filename))
103635
11f316dfa4b5 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Handle
Michael Albinus <michael.albinus@gmx.de>
parents: 103627
diff changeset
3793 (t2 (tramp-tramp-file-p newname))
11f316dfa4b5 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Handle
Michael Albinus <michael.albinus@gmx.de>
parents: 103627
diff changeset
3794 (file-times (nth 5 (file-attributes filename)))
11f316dfa4b5 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Handle
Michael Albinus <michael.albinus@gmx.de>
parents: 103627
diff changeset
3795 (file-modes (tramp-default-file-modes filename)))
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3796 (with-parsed-tramp-file-name (if t1 filename newname) nil
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3797 (let* ((cmd (cond ((and (eq op 'copy) preserve-uid-gid) "cp -f -p")
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3798 ((eq op 'copy) "cp -f")
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3799 ((eq op 'rename) "mv -f")
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3800 (t (tramp-error
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3801 v 'file-error
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3802 "Unknown operation `%s', must be `copy' or `rename'"
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3803 op))))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3804 (localname1
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
3805 (if t1
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
3806 (tramp-file-name-handler 'file-remote-p filename 'localname)
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
3807 filename))
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3808 (localname2
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
3809 (if t2
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
3810 (tramp-file-name-handler 'file-remote-p newname 'localname)
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
3811 newname))
105767
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3812 (prefix (file-remote-p (if t1 filename newname)))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3813 cmd-result)
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3814
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3815 (cond
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3816 ;; Both files are on a remote host, with same user.
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3817 ((and t1 t2)
105767
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3818 (setq cmd-result
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3819 (tramp-send-command-and-check
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3820 v
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3821 (format "%s %s %s" cmd
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3822 (tramp-shell-quote-argument localname1)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3823 (tramp-shell-quote-argument localname2))))
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3824 (with-current-buffer (tramp-get-buffer v)
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3825 (goto-char (point-min))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3826 (unless
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3827 (or
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3828 (and keep-date
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3829 ;; Mask cp -f error.
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3830 (re-search-forward
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3831 tramp-operation-not-permitted-regexp nil t))
105767
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
3832 (zerop cmd-result))
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3833 (tramp-error-with-buffer
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3834 nil v 'file-error
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3835 "Copying directly failed, see buffer `%s' for details."
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3836 (buffer-name)))))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3837
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3838 ;; We are on the local host.
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3839 ((or t1 t2)
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3840 (cond
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3841 ;; We can do it directly.
94401
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
3842 ((let (file-name-handler-alist)
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
3843 (and (file-readable-p localname1)
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
3844 (file-writable-p (file-name-directory localname2))
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
3845 (or (file-directory-p localname2)
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
3846 (file-writable-p localname2))))
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3847 (if (eq op 'copy)
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3848 (tramp-compat-copy-file
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3849 localname1 localname2 ok-if-already-exists
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3850 keep-date preserve-uid-gid)
94401
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
3851 (tramp-run-real-handler
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
3852 'rename-file (list localname1 localname2 ok-if-already-exists))))
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3853
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3854 ;; We can do it directly with `tramp-send-command'
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
3855 ((and (file-readable-p (concat prefix localname1))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
3856 (file-writable-p
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
3857 (file-name-directory (concat prefix localname2)))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
3858 (or (file-directory-p (concat prefix localname2))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
3859 (file-writable-p (concat prefix localname2))))
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3860 (tramp-do-copy-or-rename-file-directly
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3861 op (concat prefix localname1) (concat prefix localname2)
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3862 ok-if-already-exists keep-date t)
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3863 ;; We must change the ownership to the local user.
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3864 (tramp-set-file-uid-gid
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3865 (concat prefix localname2)
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3866 (tramp-get-local-uid 'integer)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3867 (tramp-get-local-gid 'integer)))
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3868
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3869 ;; We need a temporary file in between.
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3870 (t
100933
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3871 ;; Create the temporary file.
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3872 (let ((tmpfile (tramp-compat-make-temp-file localname1)))
103333
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3873 (unwind-protect
100933
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3874 (progn
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3875 (cond
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3876 (t1
103333
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3877 (or
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3878 (zerop
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3879 (tramp-send-command-and-check
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3880 v (format
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3881 "%s %s %s" cmd
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3882 (tramp-shell-quote-argument localname1)
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3883 (tramp-shell-quote-argument tmpfile))))
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3884 (tramp-error-with-buffer
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3885 nil v 'file-error
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3886 "Copying directly failed, see buffer `%s' for details."
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3887 (tramp-get-buffer v)))
100933
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3888 ;; We must change the ownership as remote user.
103333
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3889 ;; Since this does not work reliable, we also
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3890 ;; give read permissions.
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3891 (set-file-modes
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3892 (concat prefix tmpfile) (tramp-octal-to-decimal "0777"))
100933
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3893 (tramp-set-file-uid-gid
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3894 (concat prefix tmpfile)
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3895 (tramp-get-local-uid 'integer)
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3896 (tramp-get-local-gid 'integer)))
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3897 (t2
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3898 (if (eq op 'copy)
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3899 (tramp-compat-copy-file
102940
c9dbbc9ce416 * tramp.el (tramp-do-copy-or-rename-file-directly): Overwrite
Michael Albinus <michael.albinus@gmx.de>
parents: 102907
diff changeset
3900 localname1 tmpfile t
100933
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3901 keep-date preserve-uid-gid)
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3902 (tramp-run-real-handler
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3903 'rename-file
102940
c9dbbc9ce416 * tramp.el (tramp-do-copy-or-rename-file-directly): Overwrite
Michael Albinus <michael.albinus@gmx.de>
parents: 102907
diff changeset
3904 (list localname1 tmpfile t)))
100933
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3905 ;; We must change the ownership as local user.
103333
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3906 ;; Since this does not work reliable, we also
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3907 ;; give read permissions.
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3908 (set-file-modes tmpfile (tramp-octal-to-decimal "0777"))
100933
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3909 (tramp-set-file-uid-gid
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3910 tmpfile
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3911 (tramp-get-remote-uid v 'integer)
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3912 (tramp-get-remote-gid v 'integer))))
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3913
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3914 ;; Move the temporary file to its destination.
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3915 (cond
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3916 (t2
103333
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3917 (or
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3918 (zerop
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3919 (tramp-send-command-and-check
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3920 v (format
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3921 "cp -f -p %s %s"
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3922 (tramp-shell-quote-argument tmpfile)
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3923 (tramp-shell-quote-argument localname2))))
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3924 (tramp-error-with-buffer
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3925 nil v 'file-error
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3926 "Copying directly failed, see buffer `%s' for details."
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3927 (tramp-get-buffer v))))
100933
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3928 (t1
100922
2b84620022aa * net/tramp.el (tramp-handle-load)
Michael Albinus <michael.albinus@gmx.de>
parents: 100903
diff changeset
3929 (tramp-run-real-handler
2b84620022aa * net/tramp.el (tramp-handle-load)
Michael Albinus <michael.albinus@gmx.de>
parents: 100903
diff changeset
3930 'rename-file
100933
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3931 (list tmpfile localname2 ok-if-already-exists)))))
cdbc9da35459 *** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents: 100930
diff changeset
3932
103333
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3933 ;; Save exit.
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3934 (condition-case nil
108816
94d1d8a6dcfd * net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents: 108806
diff changeset
3935 (delete-file tmpfile)
103333
01d7b6369496 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
Michael Albinus <michael.albinus@gmx.de>
parents: 103328
diff changeset
3936 (error)))))))))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3937
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3938 ;; Set the time and mode. Mask possible errors.
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3939 (condition-case nil
103627
2cc306c7ad91 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Set file
Michael Albinus <michael.albinus@gmx.de>
parents: 103527
diff changeset
3940 (when keep-date
103635
11f316dfa4b5 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Handle
Michael Albinus <michael.albinus@gmx.de>
parents: 103627
diff changeset
3941 (set-file-times newname file-times)
11f316dfa4b5 * net/tramp.el (tramp-do-copy-or-rename-file-directly): Handle
Michael Albinus <michael.albinus@gmx.de>
parents: 103627
diff changeset
3942 (set-file-modes newname file-modes))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3943 (error)))))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3944
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3945 (defun tramp-do-copy-or-rename-file-out-of-band (op filename newname keep-date)
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
3946 "Invoke rcp program to copy.
104097
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3947 The method used must be an out-of-band method."
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
3948 (let ((t1 (tramp-tramp-file-p filename))
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3949 (t2 (tramp-tramp-file-p newname))
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
3950 copy-program copy-args copy-env copy-keep-date port spec
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3951 source target)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3952
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3953 (with-parsed-tramp-file-name (if t1 filename newname) nil
104097
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3954 (if (and t1 t2)
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3955
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3956 ;; Both are Tramp files. We shall optimize it, when the
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3957 ;; methods for filename and newname are the same.
107320
d2bfe26756ed * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix an
Michael Albinus <michael.albinus@gmx.de>
parents: 107256
diff changeset
3958 (let* ((dir-flag (file-directory-p filename))
d2bfe26756ed * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix an
Michael Albinus <michael.albinus@gmx.de>
parents: 107256
diff changeset
3959 (tmpfile (tramp-compat-make-temp-file localname dir-flag)))
d2bfe26756ed * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix an
Michael Albinus <michael.albinus@gmx.de>
parents: 107256
diff changeset
3960 (if dir-flag
d2bfe26756ed * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix an
Michael Albinus <michael.albinus@gmx.de>
parents: 107256
diff changeset
3961 (setq tmpfile
d2bfe26756ed * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix an
Michael Albinus <michael.albinus@gmx.de>
parents: 107256
diff changeset
3962 (expand-file-name
d2bfe26756ed * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix an
Michael Albinus <michael.albinus@gmx.de>
parents: 107256
diff changeset
3963 (file-name-nondirectory newname) tmpfile)))
104097
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3964 (unwind-protect
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3965 (progn
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3966 (tramp-do-copy-or-rename-file-out-of-band
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3967 op filename tmpfile keep-date)
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3968 (tramp-do-copy-or-rename-file-out-of-band
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3969 'rename tmpfile newname keep-date))
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3970 ;; Save exit.
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3971 (condition-case nil
107320
d2bfe26756ed * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix an
Michael Albinus <michael.albinus@gmx.de>
parents: 107256
diff changeset
3972 (if dir-flag
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
3973 (tramp-compat-delete-directory
107320
d2bfe26756ed * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix an
Michael Albinus <michael.albinus@gmx.de>
parents: 107256
diff changeset
3974 (expand-file-name ".." tmpfile) 'recursive)
108816
94d1d8a6dcfd * net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents: 108806
diff changeset
3975 (delete-file tmpfile))
104097
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3976 (error))))
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3977
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3978 ;; Expand hops. Might be necessary for gateway methods.
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3979 (setq v (car (tramp-compute-multi-hops v)))
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3980 (aset v 3 localname)
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3981
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3982 ;; Check which ones of source and target are Tramp files.
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3983 (setq source (if t1 (tramp-make-copy-program-file-name v) filename)
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3984 target (funcall
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3985 (if (and (file-directory-p filename)
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3986 (string-equal
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3987 (file-name-nondirectory filename)
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3988 (file-name-nondirectory newname)))
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3989 'file-name-directory
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3990 'identity)
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
3991 (if t2 (tramp-make-copy-program-file-name v) newname)))
104097
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3992
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3993 ;; Check for port number. Until now, there's no need for handling
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3994 ;; like method, user, host.
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3995 (setq host (tramp-file-name-real-host v)
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3996 port (tramp-file-name-port v)
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3997 port (or (and port (number-to-string port)) ""))
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3998
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
3999 ;; Compose copy command.
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
4000 (setq spec (format-spec-make
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
4001 ?h host ?u user ?p port
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
4002 ?t (tramp-get-connection-property
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
4003 (tramp-get-connection-process v) "temp-file" "")
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
4004 ?k (if keep-date " " ""))
104097
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4005 copy-program (tramp-get-method-parameter
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4006 method 'tramp-copy-program)
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4007 copy-keep-date (tramp-get-method-parameter
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4008 method 'tramp-copy-keep-date)
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4009 copy-args
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4010 (delq
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4011 nil
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4012 (mapcar
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4013 (lambda (x)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4014 (setq
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4015 x
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4016 ;; " " is indication for keep-date argument.
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4017 (delete " " (mapcar (lambda (y) (format-spec y spec)) x)))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4018 (unless (member "" x) (mapconcat 'identity x " ")))
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
4019 (tramp-get-method-parameter method 'tramp-copy-args)))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
4020 copy-env
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
4021 (delq
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
4022 nil
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
4023 (mapcar
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4024 (lambda (x)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4025 (setq x (mapcar (lambda (y) (format-spec y spec)) x))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4026 (unless (member "" x) (mapconcat 'identity x " ")))
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
4027 (tramp-get-method-parameter method 'tramp-copy-env))))
104097
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4028
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4029 ;; Check for program.
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4030 (when (and (fboundp 'executable-find)
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4031 (not (let ((default-directory
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4032 (tramp-compat-temporary-file-directory)))
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4033 (executable-find copy-program))))
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4034 (tramp-error
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4035 v 'file-error "Cannot find copy program: %s" copy-program))
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4036
106115
94327931be14 * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Set
Michael Albinus <michael.albinus@gmx.de>
parents: 106090
diff changeset
4037 ;; Set variables for computing the prompt for reading
94327931be14 * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Set
Michael Albinus <michael.albinus@gmx.de>
parents: 106090
diff changeset
4038 ;; password.
94327931be14 * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Set
Michael Albinus <michael.albinus@gmx.de>
parents: 106090
diff changeset
4039 (setq tramp-current-method (tramp-file-name-method v)
94327931be14 * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Set
Michael Albinus <michael.albinus@gmx.de>
parents: 106090
diff changeset
4040 tramp-current-user (tramp-file-name-user v)
94327931be14 * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Set
Michael Albinus <michael.albinus@gmx.de>
parents: 106090
diff changeset
4041 tramp-current-host (tramp-file-name-host v))
94327931be14 * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Set
Michael Albinus <michael.albinus@gmx.de>
parents: 106090
diff changeset
4042
104097
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4043 (unwind-protect
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4044 (with-temp-buffer
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4045 ;; The default directory must be remote.
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4046 (let ((default-directory
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
4047 (file-name-directory (if t1 filename newname)))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
4048 (process-environment (copy-sequence process-environment)))
104097
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4049 ;; Set the transfer process properties.
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4050 (tramp-set-connection-property
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4051 v "process-name" (buffer-name (current-buffer)))
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4052 (tramp-set-connection-property
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4053 v "process-buffer" (current-buffer))
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
4054 (while copy-env
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
4055 (tramp-message v 5 "%s=\"%s\"" (car copy-env) (cadr copy-env))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
4056 (setenv (pop copy-env) (pop copy-env)))
104097
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4057
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4058 ;; Use an asynchronous process. By this, password can
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4059 ;; be handled. The default directory must be local, in
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4060 ;; order to apply the correct `copy-program'. We don't
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4061 ;; set a timeout, because the copying of large files can
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4062 ;; last longer than 60 secs.
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4063 (let ((p (let ((default-directory
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4064 (tramp-compat-temporary-file-directory)))
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4065 (apply 'start-process
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4066 (tramp-get-connection-property
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4067 v "process-name" nil)
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4068 (tramp-get-connection-property
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4069 v "process-buffer" nil)
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4070 copy-program
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4071 (append copy-args (list source target))))))
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4072 (tramp-message
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4073 v 6 "%s" (mapconcat 'identity (process-command p) " "))
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4074 (tramp-set-process-query-on-exit-flag p nil)
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4075 (tramp-process-actions p v tramp-actions-copy-out-of-band))))
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4076
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4077 ;; Reset the transfer process properties.
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4078 (tramp-set-connection-property v "process-name" nil)
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4079 (tramp-set-connection-property v "process-buffer" nil))
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4080
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4081 ;; Handle KEEP-DATE argument.
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4082 (when (and keep-date (not copy-keep-date))
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4083 (set-file-times newname (nth 5 (file-attributes filename))))
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4084
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4085 ;; Set the mode.
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4086 (unless (and keep-date copy-keep-date)
107209
4a0ca858272e * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Protect
Michael Albinus <michael.albinus@gmx.de>
parents: 107190
diff changeset
4087 (ignore-errors
4a0ca858272e * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Protect
Michael Albinus <michael.albinus@gmx.de>
parents: 107190
diff changeset
4088 (set-file-modes newname (tramp-default-file-modes filename)))))
104097
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4089
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4090 ;; If the operation was `rename', delete the original file.
0e24538056bf * net/tramp.el (tramp-do-copy-or-rename-file): Add messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 103934
diff changeset
4091 (unless (eq op 'copy)
107170
1f564d6c5e1d * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix
Michael Albinus <michael.albinus@gmx.de>
parents: 107151
diff changeset
4092 (if (file-regular-p filename)
108816
94d1d8a6dcfd * net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents: 108806
diff changeset
4093 (delete-file filename)
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
4094 (tramp-compat-delete-directory filename 'recursive))))))
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
4095
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4096 (defun tramp-handle-make-directory (dir &optional parents)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4097 "Like `make-directory' for Tramp files."
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
4098 (setq dir (expand-file-name dir))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4099 (with-parsed-tramp-file-name dir nil
105351
4eaec3ddca1c * net/tramp.el (tramp-handle-make-directory): Flush upper
Michael Albinus <michael.albinus@gmx.de>
parents: 105248
diff changeset
4100 (tramp-flush-directory-property v (file-name-directory localname))
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
4101 (save-excursion
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
4102 (tramp-barf-unless-okay
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4103 v
85508
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
4104 (format "%s %s"
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
4105 (if parents "mkdir -p" "mkdir")
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
4106 (tramp-shell-quote-argument localname))
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
4107 "Couldn't make directory %s" dir))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4108
105351
4eaec3ddca1c * net/tramp.el (tramp-handle-make-directory): Flush upper
Michael Albinus <michael.albinus@gmx.de>
parents: 105248
diff changeset
4109 (defun tramp-handle-delete-directory (directory &optional recursive)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4110 "Like `delete-directory' for Tramp files."
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
4111 (setq directory (expand-file-name directory))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4112 (with-parsed-tramp-file-name directory nil
107170
1f564d6c5e1d * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix
Michael Albinus <michael.albinus@gmx.de>
parents: 107151
diff changeset
4113 (tramp-flush-file-property v (file-name-directory localname))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4114 (tramp-flush-directory-property v localname)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4115 (unless (zerop (tramp-send-command-and-check
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4116 v
105351
4eaec3ddca1c * net/tramp.el (tramp-handle-make-directory): Flush upper
Michael Albinus <michael.albinus@gmx.de>
parents: 105248
diff changeset
4117 (format
4eaec3ddca1c * net/tramp.el (tramp-handle-make-directory): Flush upper
Michael Albinus <michael.albinus@gmx.de>
parents: 105248
diff changeset
4118 "%s %s"
4eaec3ddca1c * net/tramp.el (tramp-handle-make-directory): Flush upper
Michael Albinus <michael.albinus@gmx.de>
parents: 105248
diff changeset
4119 (if recursive "rm -rf" "rmdir")
4eaec3ddca1c * net/tramp.el (tramp-handle-make-directory): Flush upper
Michael Albinus <michael.albinus@gmx.de>
parents: 105248
diff changeset
4120 (tramp-shell-quote-argument localname))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4121 (tramp-error v 'file-error "Couldn't delete %s" directory))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4122
108806
511da81b16c5 Change delete-by-moving-to-trash so Lisp calls explicitly request trashing.
Chong Yidong <cyd@stupidchicken.com>
parents: 108777
diff changeset
4123 (defun tramp-handle-delete-file (filename &optional trash)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4124 "Like `delete-file' for Tramp files."
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
4125 (setq filename (expand-file-name filename))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4126 (with-parsed-tramp-file-name filename nil
107170
1f564d6c5e1d * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix
Michael Albinus <michael.albinus@gmx.de>
parents: 107151
diff changeset
4127 (tramp-flush-file-property v (file-name-directory localname))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4128 (tramp-flush-file-property v localname)
108817
a90103f99eea * net/tramp.el (tramp-debug-message): Add `tramp-compat-funcall'
Michael Albinus <michael.albinus@gmx.de>
parents: 108816
diff changeset
4129 (unless
a90103f99eea * net/tramp.el (tramp-debug-message): Add `tramp-compat-funcall'
Michael Albinus <michael.albinus@gmx.de>
parents: 108816
diff changeset
4130 (zerop
a90103f99eea * net/tramp.el (tramp-debug-message): Add `tramp-compat-funcall'
Michael Albinus <michael.albinus@gmx.de>
parents: 108816
diff changeset
4131 (tramp-send-command-and-check
a90103f99eea * net/tramp.el (tramp-debug-message): Add `tramp-compat-funcall'
Michael Albinus <michael.albinus@gmx.de>
parents: 108816
diff changeset
4132 v (format "%s %s"
a90103f99eea * net/tramp.el (tramp-debug-message): Add `tramp-compat-funcall'
Michael Albinus <michael.albinus@gmx.de>
parents: 108816
diff changeset
4133 (or (and trash (tramp-get-remote-trash v)) "rm -f")
a90103f99eea * net/tramp.el (tramp-debug-message): Add `tramp-compat-funcall'
Michael Albinus <michael.albinus@gmx.de>
parents: 108816
diff changeset
4134 (tramp-shell-quote-argument localname))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4135 (tramp-error v 'file-error "Couldn't delete %s" filename))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4136
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4137 ;; Dired.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4138
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4139 ;; CCC: This does not seem to be enough. Something dies when
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
4140 ;; we try and delete two directories under Tramp :/
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4141 (defun tramp-handle-dired-recursive-delete-directory (filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4142 "Recursively delete the directory given.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4143 This is like `dired-recursive-delete-directory' for Tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4144 (with-parsed-tramp-file-name filename nil
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4145 ;; Run a shell command 'rm -r <localname>'
102968
3f05108a52f1 * net/tramp.el (tramp-handle-dired-recursive-delete-directory):
Michael Albinus <michael.albinus@gmx.de>
parents: 102940
diff changeset
4146 ;; Code shamelessly stolen from the dired implementation and, um, hacked :)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4147 (unless (file-exists-p filename)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4148 (tramp-error v 'file-error "No such directory: %s" filename))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4149 ;; Which is better, -r or -R? (-r works for me <daniel@danann.net>)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4150 (tramp-send-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4151 v
85508
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
4152 (format "rm -rf %s" (tramp-shell-quote-argument localname))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4153 ;; Don't read the output, do it explicitely.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4154 nil t)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4155 ;; Wait for the remote system to return to us...
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4156 ;; This might take a while, allow it plenty of time.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4157 (tramp-wait-for-output (tramp-get-connection-process v) 120)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4158 ;; Make sure that it worked...
107170
1f564d6c5e1d * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix
Michael Albinus <michael.albinus@gmx.de>
parents: 107151
diff changeset
4159 (tramp-flush-file-property v (file-name-directory localname))
105351
4eaec3ddca1c * net/tramp.el (tramp-handle-make-directory): Flush upper
Michael Albinus <michael.albinus@gmx.de>
parents: 105248
diff changeset
4160 (tramp-flush-directory-property v localname)
56460
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
4161 (and (file-exists-p filename)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4162 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4163 v 'file-error "Failed to recursively delete %s" filename))))
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
4164
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4165 (defun tramp-handle-dired-compress-file (file &rest ok-flag)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4166 "Like `dired-compress-file' for Tramp files."
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4167 ;; OK-FLAG is valid for XEmacs only, but not implemented.
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4168 ;; Code stolen mainly from dired-aux.el.
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4169 (with-parsed-tramp-file-name file nil
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4170 (tramp-flush-file-property v localname)
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4171 (save-excursion
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4172 (let ((suffixes
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4173 (if (not (featurep 'xemacs))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4174 ;; Emacs case
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4175 (symbol-value 'dired-compress-file-suffixes)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4176 ;; XEmacs has `dired-compression-method-alist', which is
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4177 ;; transformed into `dired-compress-file-suffixes' structure.
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4178 (mapcar
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4179 (lambda (x)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4180 (list (concat (regexp-quote (nth 1 x)) "\\'")
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4181 nil
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4182 (mapconcat 'identity (nth 3 x) " ")))
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4183 (symbol-value 'dired-compression-method-alist))))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4184 suffix)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4185 ;; See if any suffix rule matches this file name.
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4186 (while suffixes
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4187 (let (case-fold-search)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4188 (if (string-match (car (car suffixes)) localname)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4189 (setq suffix (car suffixes) suffixes nil))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4190 (setq suffixes (cdr suffixes))))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4191
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4192 (cond ((file-symlink-p file)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4193 nil)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4194 ((and suffix (nth 2 suffix))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4195 ;; We found an uncompression rule.
108540
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4196 (with-progress-reporter v 0 (format "Uncompressing %s" file)
108066
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
4197 (when (zerop
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
4198 (tramp-send-command-and-check
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
4199 v (concat (nth 2 suffix) " "
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
4200 (tramp-shell-quote-argument localname))))
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
4201 ;; `dired-remove-file' is not defined in XEmacs.
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
4202 (tramp-compat-funcall 'dired-remove-file file)
108066
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
4203 (string-match (car suffix) file)
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
4204 (concat (substring file 0 (match-beginning 0))))))
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4205 (t
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4206 ;; We don't recognize the file as compressed, so compress it.
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4207 ;; Try gzip.
108540
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4208 (with-progress-reporter v 0 (format "Compressing %s" file)
108066
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
4209 (when (zerop
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
4210 (tramp-send-command-and-check
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
4211 v (concat "gzip -f "
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
4212 (tramp-shell-quote-argument localname))))
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
4213 ;; `dired-remove-file' is not defined in XEmacs.
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
4214 (tramp-compat-funcall 'dired-remove-file file)
108066
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
4215 (cond ((file-exists-p (concat file ".gz"))
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
4216 (concat file ".gz"))
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
4217 ((file-exists-p (concat file ".z"))
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
4218 (concat file ".z"))
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
4219 (t nil))))))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4220
107085
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 107044
diff changeset
4221 (defun tramp-handle-dired-uncache (dir &optional dir-p)
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4222 "Like `dired-uncache' for Tramp files."
107085
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 107044
diff changeset
4223 ;; DIR-P is valid for XEmacs only.
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 107044
diff changeset
4224 (with-parsed-tramp-file-name
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 107044
diff changeset
4225 (if (or dir-p (file-directory-p dir)) dir (file-name-directory dir)) nil
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4226 (tramp-flush-file-property v localname)))
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4227
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4228 ;; Pacify byte-compiler. The function is needed on XEmacs only. I'm
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4229 ;; not sure at all that this is the right way to do it, but let's hope
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4230 ;; it works for now, and wait for a guru to point out the Right Way to
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4231 ;; achieve this.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4232 ;;(eval-when-compile
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4233 ;; (unless (fboundp 'dired-insert-set-properties)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4234 ;; (fset 'dired-insert-set-properties 'ignore)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4235 ;; Gerd suggests this:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4236 (eval-when-compile (require 'dired))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4237 ;; Note that dired is required at run-time, too, when it is needed.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4238 ;; It is only needed on XEmacs for the function
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4239 ;; `dired-insert-set-properties'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4240
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4241 (defun tramp-handle-insert-directory
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4242 (filename switches &optional wildcard full-directory-p)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4243 "Like `insert-directory' for Tramp files."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4244 (setq filename (expand-file-name filename))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4245 (with-parsed-tramp-file-name filename nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4246 (if (and (featurep 'ls-lisp)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4247 (not (symbol-value 'ls-lisp-use-insert-directory-program)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4248 (tramp-run-real-handler
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4249 'insert-directory (list filename switches wildcard full-directory-p))
107040
5555e86608c1 * net/ange-ftp.el (ange-ftp-insert-directory): Handle the case,
Michael Albinus <albinus@detlef>
parents: 107021
diff changeset
4250 (when (stringp switches)
5555e86608c1 * net/ange-ftp.el (ange-ftp-insert-directory): Handle the case,
Michael Albinus <albinus@detlef>
parents: 107021
diff changeset
4251 (setq switches (split-string switches)))
5555e86608c1 * net/ange-ftp.el (ange-ftp-insert-directory): Handle the case,
Michael Albinus <albinus@detlef>
parents: 107021
diff changeset
4252 (when (and (member "--dired" switches)
104216
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
4253 (not (tramp-get-ls-command-with-dired v)))
107040
5555e86608c1 * net/ange-ftp.el (ange-ftp-insert-directory): Handle the case,
Michael Albinus <albinus@detlef>
parents: 107021
diff changeset
4254 (setq switches (delete "--dired" switches)))
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
4255 (when wildcard
94401
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
4256 (setq wildcard (tramp-run-real-handler
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
4257 'file-name-nondirectory (list localname)))
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
4258 (setq localname (tramp-run-real-handler
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
4259 'file-name-directory (list localname))))
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
4260 (unless full-directory-p
107040
5555e86608c1 * net/ange-ftp.el (ange-ftp-insert-directory): Handle the case,
Michael Albinus <albinus@detlef>
parents: 107021
diff changeset
4261 (setq switches (add-to-list 'switches "-d" 'append)))
5555e86608c1 * net/ange-ftp.el (ange-ftp-insert-directory): Handle the case,
Michael Albinus <albinus@detlef>
parents: 107021
diff changeset
4262 (setq switches (mapconcat 'tramp-shell-quote-argument switches " "))
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
4263 (when wildcard
107040
5555e86608c1 * net/ange-ftp.el (ange-ftp-insert-directory): Handle the case,
Michael Albinus <albinus@detlef>
parents: 107021
diff changeset
4264 (setq switches (concat switches " " wildcard)))
5555e86608c1 * net/ange-ftp.el (ange-ftp-insert-directory): Handle the case,
Michael Albinus <albinus@detlef>
parents: 107021
diff changeset
4265 (tramp-message
5555e86608c1 * net/ange-ftp.el (ange-ftp-insert-directory): Handle the case,
Michael Albinus <albinus@detlef>
parents: 107021
diff changeset
4266 v 4 "Inserting directory `ls %s %s', wildcard %s, fulldir %s"
5555e86608c1 * net/ange-ftp.el (ange-ftp-insert-directory): Handle the case,
Michael Albinus <albinus@detlef>
parents: 107021
diff changeset
4267 switches filename (if wildcard "yes" "no")
5555e86608c1 * net/ange-ftp.el (ange-ftp-insert-directory): Handle the case,
Michael Albinus <albinus@detlef>
parents: 107021
diff changeset
4268 (if full-directory-p "yes" "no"))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4269 ;; If `full-directory-p', we just say `ls -l FILENAME'.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4270 ;; Else we chdir to the parent directory, then say `ls -ld BASENAME'.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4271 (if full-directory-p
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4272 (tramp-send-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4273 v
106508
8c836ea59444 * net/tramp.el (tramp-handle-insert-directory): Suppress error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 106470
diff changeset
4274 (format "%s %s %s 2>/dev/null"
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4275 (tramp-get-ls-command v)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4276 switches
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4277 (if wildcard
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4278 localname
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4279 (tramp-shell-quote-argument (concat localname ".")))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4280 (tramp-barf-unless-okay
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4281 v
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4282 (format "cd %s" (tramp-shell-quote-argument
94401
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
4283 (tramp-run-real-handler
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
4284 'file-name-directory (list localname))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4285 "Couldn't `cd %s'"
94401
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
4286 (tramp-shell-quote-argument
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
4287 (tramp-run-real-handler 'file-name-directory (list localname))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4288 (tramp-send-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4289 v
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4290 (format "%s %s %s"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4291 (tramp-get-ls-command v)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4292 switches
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4293 (if (or wildcard
94401
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
4294 (zerop (length
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
4295 (tramp-run-real-handler
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
4296 'file-name-nondirectory (list localname)))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4297 ""
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4298 (tramp-shell-quote-argument
94401
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
4299 (tramp-run-real-handler
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
4300 'file-name-nondirectory (list localname)))))))
104216
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
4301 (let ((beg (point)))
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
4302 ;; We cannot use `insert-buffer-substring' because the Tramp
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
4303 ;; buffer changes its contents before insertion due to calling
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
4304 ;; `expand-file' and alike.
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
4305 (insert
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
4306 (with-current-buffer (tramp-get-buffer v)
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
4307 (buffer-string)))
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
4308
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
4309 ;; Check for "--dired" output.
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
4310 (forward-line -2)
106643
9e3bbd77797c * net/tramp.el (tramp-handle-insert-directory): Quote "'" in the
Michael Albinus <michael.albinus@gmx.de>
parents: 106613
diff changeset
4311 (when (looking-at "//SUBDIRED//")
9e3bbd77797c * net/tramp.el (tramp-handle-insert-directory): Quote "'" in the
Michael Albinus <michael.albinus@gmx.de>
parents: 106613
diff changeset
4312 (forward-line -1))
108777
04bc013ba171 * net/tramp.el (tramp-handle-insert-directory): Don't use
Michael Albinus <michael.albinus@gmx.de>
parents: 108775
diff changeset
4313 (when (looking-at "//DIRED//\\s-+")
04bc013ba171 * net/tramp.el (tramp-handle-insert-directory): Don't use
Michael Albinus <michael.albinus@gmx.de>
parents: 108775
diff changeset
4314 (let ((databeg (match-end 0))
04bc013ba171 * net/tramp.el (tramp-handle-insert-directory): Don't use
Michael Albinus <michael.albinus@gmx.de>
parents: 108775
diff changeset
4315 (end (tramp-compat-line-end-position)))
104216
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
4316 ;; Now read the numeric positions of file names.
108777
04bc013ba171 * net/tramp.el (tramp-handle-insert-directory): Don't use
Michael Albinus <michael.albinus@gmx.de>
parents: 108775
diff changeset
4317 (goto-char databeg)
104216
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
4318 (while (< (point) end)
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
4319 (let ((start (+ beg (read (current-buffer))))
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
4320 (end (+ beg (read (current-buffer)))))
104807
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
4321 (if (memq (char-after end) '(?\n ?\ ))
104216
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
4322 ;; End is followed by \n or by " -> ".
106508
8c836ea59444 * net/tramp.el (tramp-handle-insert-directory): Suppress error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 106470
diff changeset
4323 (put-text-property start end 'dired-filename t))))))
8c836ea59444 * net/tramp.el (tramp-handle-insert-directory): Suppress error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 106470
diff changeset
4324 ;; Remove trailing lines.
8c836ea59444 * net/tramp.el (tramp-handle-insert-directory): Suppress error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 106470
diff changeset
4325 (goto-char (tramp-compat-line-beginning-position))
8c836ea59444 * net/tramp.el (tramp-handle-insert-directory): Suppress error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 106470
diff changeset
4326 (while (looking-at "//")
8c836ea59444 * net/tramp.el (tramp-handle-insert-directory): Suppress error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 106470
diff changeset
4327 (forward-line 1)
8c836ea59444 * net/tramp.el (tramp-handle-insert-directory): Suppress error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 106470
diff changeset
4328 (delete-region (match-beginning 0) (point)))
107040
5555e86608c1 * net/ange-ftp.el (ange-ftp-insert-directory): Handle the case,
Michael Albinus <albinus@detlef>
parents: 107021
diff changeset
4329
5555e86608c1 * net/ange-ftp.el (ange-ftp-insert-directory): Handle the case,
Michael Albinus <albinus@detlef>
parents: 107021
diff changeset
4330 ;; The inserted file could be from somewhere else.
5555e86608c1 * net/ange-ftp.el (ange-ftp-insert-directory): Handle the case,
Michael Albinus <albinus@detlef>
parents: 107021
diff changeset
4331 (when (and (not wildcard) (not full-directory-p))
5555e86608c1 * net/ange-ftp.el (ange-ftp-insert-directory): Handle the case,
Michael Albinus <albinus@detlef>
parents: 107021
diff changeset
4332 (goto-char (point-max))
107044
28bc861d56c5 * net/tramp.el (tramp-handle-insert-directory): Handle also
Michael Albinus <michael.albinus@gmx.de>
parents: 107040
diff changeset
4333 (when (file-symlink-p filename)
28bc861d56c5 * net/tramp.el (tramp-handle-insert-directory): Handle also
Michael Albinus <michael.albinus@gmx.de>
parents: 107040
diff changeset
4334 (goto-char (search-backward "->" beg 'noerror)))
107040
5555e86608c1 * net/ange-ftp.el (ange-ftp-insert-directory): Handle the case,
Michael Albinus <albinus@detlef>
parents: 107021
diff changeset
4335 (search-backward
5555e86608c1 * net/ange-ftp.el (ange-ftp-insert-directory): Handle the case,
Michael Albinus <albinus@detlef>
parents: 107021
diff changeset
4336 (if (zerop (length (file-name-nondirectory filename)))
5555e86608c1 * net/ange-ftp.el (ange-ftp-insert-directory): Handle the case,
Michael Albinus <albinus@detlef>
parents: 107021
diff changeset
4337 "."
5555e86608c1 * net/ange-ftp.el (ange-ftp-insert-directory): Handle the case,
Michael Albinus <albinus@detlef>
parents: 107021
diff changeset
4338 (file-name-nondirectory filename))
5555e86608c1 * net/ange-ftp.el (ange-ftp-insert-directory): Handle the case,
Michael Albinus <albinus@detlef>
parents: 107021
diff changeset
4339 beg 'noerror)
5555e86608c1 * net/ange-ftp.el (ange-ftp-insert-directory): Handle the case,
Michael Albinus <albinus@detlef>
parents: 107021
diff changeset
4340 (replace-match (file-relative-name filename) t))
5555e86608c1 * net/ange-ftp.el (ange-ftp-insert-directory): Handle the case,
Michael Albinus <albinus@detlef>
parents: 107021
diff changeset
4341
106508
8c836ea59444 * net/tramp.el (tramp-handle-insert-directory): Suppress error messages.
Michael Albinus <michael.albinus@gmx.de>
parents: 106470
diff changeset
4342 (goto-char (point-max))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4343
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4344 (defun tramp-handle-unhandled-file-name-directory (filename)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4345 "Like `unhandled-file-name-directory' for Tramp files."
92982
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
4346 ;; With Emacs 23, we could simply return `nil'. But we must keep it
afa7a7913261 * tramp.el (tramp-root-regexp): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 91689
diff changeset
4347 ;; for backward compatibility.
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
4348 (expand-file-name "~/"))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4349
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4350 ;; Canonicalization of file names.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4351
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4352 (defun tramp-handle-expand-file-name (name &optional dir)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4353 "Like `expand-file-name' for Tramp files.
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
4354 If the localname part of the given filename starts with \"/../\" then
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
4355 the result will be a local, non-Tramp, filename."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4356 ;; If DIR is not given, use DEFAULT-DIRECTORY or "/".
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4357 (setq dir (or dir default-directory "/"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4358 ;; Unless NAME is absolute, concat DIR and NAME.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4359 (unless (file-name-absolute-p name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4360 (setq name (concat (file-name-as-directory dir) name)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4361 ;; If NAME is not a Tramp file, run the real handler.
108033
1545dcb1c3b7 Fix Bug#5840.
Michael Albinus <albinus@detlef>
parents: 108011
diff changeset
4362 (if (not (tramp-connectable-p name))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4363 (tramp-run-real-handler 'expand-file-name (list name nil))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4364 ;; Dissect NAME.
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4365 (with-parsed-tramp-file-name name nil
94401
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
4366 (unless (tramp-run-real-handler 'file-name-absolute-p (list localname))
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
4367 (setq localname (concat "~/" localname)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4368 ;; Tilde expansion if necessary. This needs a shell which
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4369 ;; groks tilde expansion! The function `tramp-find-shell' is
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4370 ;; supposed to find such a shell on the remote host. Please
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4371 ;; tell me about it when this doesn't work on your system.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4372 (when (string-match "\\`\\(~[^/]*\\)\\(.*\\)\\'" localname)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4373 (let ((uname (match-string 1 localname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4374 (fname (match-string 2 localname)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4375 ;; We cannot simply apply "~/", because under sudo "~/" is
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4376 ;; expanded to the local user home directory but to the
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4377 ;; root home directory. On the other hand, using always
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4378 ;; the default user name for tilde expansion is not
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4379 ;; appropriate either, because ssh and companions might
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4380 ;; use a user name from the config file.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4381 (when (and (string-equal uname "~")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4382 (string-match "\\`su\\(do\\)?\\'" method))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4383 (setq uname (concat uname user)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4384 (setq uname
106204
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
4385 (with-connection-property v uname
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
4386 (tramp-send-command
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
4387 v (format "cd %s; pwd" (tramp-shell-quote-argument uname)))
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
4388 (with-current-buffer (tramp-get-buffer v)
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
4389 (goto-char (point-min))
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
4390 (buffer-substring
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
4391 (point) (tramp-compat-line-end-position)))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4392 (setq localname (concat uname fname))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4393 ;; There might be a double slash, for example when "~/"
101729
adfc49512fc6 * net/tramp.el (tramp-read-passwd): Cached passwords shall still be used.
Michael Albinus <michael.albinus@gmx.de>
parents: 101656
diff changeset
4394 ;; expands to "/". Remove this.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4395 (while (string-match "//" localname)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4396 (setq localname (replace-match "/" t t localname)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4397 ;; No tilde characters in file name, do normal
105523
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
4398 ;; `expand-file-name' (this does "/./" and "/../"). We bind
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
4399 ;; `directory-sep-char' here for XEmacs on Windows, which would
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
4400 ;; otherwise use backslash. `default-directory' is bound,
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
4401 ;; because on Windows there would be problems with UNC shares or
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
4402 ;; Cygwin mounts.
93082
7e079018403b * net/tramp.el (tramp-let-maybe): Removed.
Michael Albinus <michael.albinus@gmx.de>
parents: 93062
diff changeset
4403 (let ((directory-sep-char ?/)
7e079018403b * net/tramp.el (tramp-let-maybe): Removed.
Michael Albinus <michael.albinus@gmx.de>
parents: 93062
diff changeset
4404 (default-directory (tramp-compat-temporary-file-directory)))
7e079018403b * net/tramp.el (tramp-let-maybe): Removed.
Michael Albinus <michael.albinus@gmx.de>
parents: 93062
diff changeset
4405 (tramp-make-tramp-file-name
7e079018403b * net/tramp.el (tramp-let-maybe): Removed.
Michael Albinus <michael.albinus@gmx.de>
parents: 93062
diff changeset
4406 method user host
7e079018403b * net/tramp.el (tramp-let-maybe): Removed.
Michael Albinus <michael.albinus@gmx.de>
parents: 93062
diff changeset
4407 (tramp-drop-volume-letter
94401
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
4408 (tramp-run-real-handler
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
4409 'expand-file-name (list localname))))))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4410
94395
f020c9568544 * net/tramp.el (tramp-replace-environment-variables): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 94333
diff changeset
4411 (defun tramp-replace-environment-variables (filename)
f020c9568544 * net/tramp.el (tramp-replace-environment-variables): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 94333
diff changeset
4412 "Replace environment variables in FILENAME.
f020c9568544 * net/tramp.el (tramp-replace-environment-variables): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 94333
diff changeset
4413 Return the string with the replaced variables."
94436
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
4414 (save-match-data
105615
33df72cf19f1 * net/tramp.el (tramp-replace-environment-variables): Do not fail
Michael Albinus <michael.albinus@gmx.de>
parents: 105549
diff changeset
4415 (let ((idx (string-match "$\\(\\w+\\)" filename)))
94436
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
4416 ;; `$' is coded as `$$'.
105615
33df72cf19f1 * net/tramp.el (tramp-replace-environment-variables): Do not fail
Michael Albinus <michael.albinus@gmx.de>
parents: 105549
diff changeset
4417 (when (and idx
33df72cf19f1 * net/tramp.el (tramp-replace-environment-variables): Do not fail
Michael Albinus <michael.albinus@gmx.de>
parents: 105549
diff changeset
4418 (or (zerop idx) (not (eq ?$ (aref filename (1- idx)))))
33df72cf19f1 * net/tramp.el (tramp-replace-environment-variables): Do not fail
Michael Albinus <michael.albinus@gmx.de>
parents: 105549
diff changeset
4419 (getenv (match-string 1 filename)))
94436
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
4420 (setq filename
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
4421 (replace-match
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
4422 (substitute-in-file-name (match-string 0 filename))
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
4423 t nil filename)))
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
4424 filename)))
94395
f020c9568544 * net/tramp.el (tramp-replace-environment-variables): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 94333
diff changeset
4425
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4426 (defun tramp-handle-substitute-in-file-name (filename)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4427 "Like `substitute-in-file-name' for Tramp files.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4428 \"//\" and \"/~\" substitute only in the local filename part.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4429 If the URL Tramp syntax is chosen, \"//\" as method delimeter and \"/~\" at
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4430 beginning of local filename are not substituted."
94395
f020c9568544 * net/tramp.el (tramp-replace-environment-variables): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 94333
diff changeset
4431 ;; First, we must replace environment variables.
f020c9568544 * net/tramp.el (tramp-replace-environment-variables): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 94333
diff changeset
4432 (setq filename (tramp-replace-environment-variables filename))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4433 (with-parsed-tramp-file-name filename nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4434 (if (equal tramp-syntax 'url)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4435 ;; We need to check localname only. The other parts cannot contain
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4436 ;; "//" or "/~".
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4437 (if (and (> (length localname) 1)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4438 (or (string-match "//" localname)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4439 (string-match "/~" localname 1)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4440 (tramp-run-real-handler 'substitute-in-file-name (list filename))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4441 (tramp-make-tramp-file-name
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4442 (when method (substitute-in-file-name method))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4443 (when user (substitute-in-file-name user))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4444 (when host (substitute-in-file-name host))
94401
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
4445 (when localname
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
4446 (tramp-run-real-handler
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
4447 'substitute-in-file-name (list localname)))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4448 ;; Ignore in LOCALNAME everything before "//" or "/~".
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4449 (when (and (stringp localname) (string-match ".+?/\\(/\\|~\\)" localname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4450 (setq filename
85962
7f134b676a0c * net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents: 85943
diff changeset
4451 (concat (file-remote-p filename)
7f134b676a0c * net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents: 85943
diff changeset
4452 (replace-match "\\1" nil nil localname)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4453 ;; "/m:h:~" does not work for completion. We use "/m:h:~/".
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4454 (when (string-match "~$" filename)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4455 (setq filename (concat filename "/"))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4456 (tramp-run-real-handler 'substitute-in-file-name (list filename)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4457
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4458 ;; In XEmacs, electricity is implemented via a key map for ?/ and ?~,
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4459 ;; which calls corresponding functions (see minibuf.el).
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4460 (when (fboundp 'minibuffer-electric-separator)
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4461 (mapc
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4462 (lambda (x)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4463 (eval
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4464 `(defadvice ,x
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4465 (around ,(intern (format "tramp-advice-%s" x)) activate)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4466 "Invoke `substitute-in-file-name' for Tramp files."
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4467 (if (and (symbol-value 'minibuffer-electric-file-name-behavior)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4468 (tramp-tramp-file-p (buffer-substring)))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4469 ;; We don't need to handle `last-input-event', because
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4470 ;; due to the key map we know it must be ?/ or ?~.
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4471 (let ((s (concat (buffer-substring (point-min) (point))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4472 (string last-command-char))))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4473 (delete-region (point-min) (point))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4474 (insert (substitute-in-file-name s))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4475 (setq ad-return-value last-command-char))
105952
c3e434f0d02f * net/tramp.el (tramp-advice-minibuffer-electric-separator)
Michael Albinus <michael.albinus@gmx.de>
parents: 105907
diff changeset
4476 ad-do-it)))
c3e434f0d02f * net/tramp.el (tramp-advice-minibuffer-electric-separator)
Michael Albinus <michael.albinus@gmx.de>
parents: 105907
diff changeset
4477 (eval
c3e434f0d02f * net/tramp.el (tramp-advice-minibuffer-electric-separator)
Michael Albinus <michael.albinus@gmx.de>
parents: 105907
diff changeset
4478 `(add-hook
c3e434f0d02f * net/tramp.el (tramp-advice-minibuffer-electric-separator)
Michael Albinus <michael.albinus@gmx.de>
parents: 105907
diff changeset
4479 'tramp-unload-hook
c3e434f0d02f * net/tramp.el (tramp-advice-minibuffer-electric-separator)
Michael Albinus <michael.albinus@gmx.de>
parents: 105907
diff changeset
4480 (lambda ()
c3e434f0d02f * net/tramp.el (tramp-advice-minibuffer-electric-separator)
Michael Albinus <michael.albinus@gmx.de>
parents: 105907
diff changeset
4481 (ad-remove-advice ',x 'around ',(intern (format "tramp-advice-%s" x)))
c3e434f0d02f * net/tramp.el (tramp-advice-minibuffer-electric-separator)
Michael Albinus <michael.albinus@gmx.de>
parents: 105907
diff changeset
4482 (ad-activate ',x)))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4483
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4484 '(minibuffer-electric-separator
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4485 minibuffer-electric-tilde)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4486
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4487
87648
7ae99e295dfd * vc-git.el (vc-git--call): Apply `process-file' instead of
Michael Albinus <michael.albinus@gmx.de>
parents: 87368
diff changeset
4488 ;;; Remote commands:
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4489
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4490 (defun tramp-handle-executable-find (command)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4491 "Like `executable-find' for Tramp files."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4492 (with-parsed-tramp-file-name default-directory nil
82603
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
4493 (tramp-find-executable v command (tramp-get-remote-path v) t)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4494
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4495 ;; We use BUFFER also as connection buffer during setup. Because of
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4496 ;; this, its original contents must be saved, and restored once
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4497 ;; connection has been setup.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4498 (defun tramp-handle-start-file-process (name buffer program &rest args)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4499 "Like `start-file-process' for Tramp files."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4500 (with-parsed-tramp-file-name default-directory nil
105482
cf961ce7712b (tramp-handle-start-file-process): Move tramp-error call
Glenn Morris <rgm@gnu.org>
parents: 105462
diff changeset
4501 (unless (stringp program)
cf961ce7712b (tramp-handle-start-file-process): Move tramp-error call
Glenn Morris <rgm@gnu.org>
parents: 105462
diff changeset
4502 (tramp-error
cf961ce7712b (tramp-handle-start-file-process): Move tramp-error call
Glenn Morris <rgm@gnu.org>
parents: 105462
diff changeset
4503 v 'file-error "pty association is not supported for `%s'" name))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4504 (unwind-protect
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
4505 (let ((command (format "cd %s; exec %s"
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
4506 (tramp-shell-quote-argument localname)
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
4507 (mapconcat 'tramp-shell-quote-argument
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
4508 (cons program args) " ")))
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
4509 (name1 name)
96990
c9371b294083 * net/tramp.el (tramp-handle-start-file-process): Make NAME a unique
Michael Albinus <michael.albinus@gmx.de>
parents: 96941
diff changeset
4510 (i 0))
96941
940a290a5646 * net/tramp.el (tramp-methods): Add "-q" for "scp", "scp1",
Michael Albinus <michael.albinus@gmx.de>
parents: 96392
diff changeset
4511 (unless buffer
97035
837d18731242 * net/tramp.el (tramp-handle-start-file-process): Set
Michael Albinus <michael.albinus@gmx.de>
parents: 96990
diff changeset
4512 ;; BUFFER can be nil. We use a temporary buffer.
96941
940a290a5646 * net/tramp.el (tramp-methods): Add "-q" for "scp", "scp1",
Michael Albinus <michael.albinus@gmx.de>
parents: 96392
diff changeset
4513 (setq buffer (generate-new-buffer tramp-temp-buffer-name)))
96990
c9371b294083 * net/tramp.el (tramp-handle-start-file-process): Make NAME a unique
Michael Albinus <michael.albinus@gmx.de>
parents: 96941
diff changeset
4514 (while (get-process name1)
c9371b294083 * net/tramp.el (tramp-handle-start-file-process): Make NAME a unique
Michael Albinus <michael.albinus@gmx.de>
parents: 96941
diff changeset
4515 ;; NAME must be unique as process name.
c9371b294083 * net/tramp.el (tramp-handle-start-file-process): Make NAME a unique
Michael Albinus <michael.albinus@gmx.de>
parents: 96941
diff changeset
4516 (setq i (1+ i)
c9371b294083 * net/tramp.el (tramp-handle-start-file-process): Make NAME a unique
Michael Albinus <michael.albinus@gmx.de>
parents: 96941
diff changeset
4517 name1 (format "%s<%d>" name i)))
c9371b294083 * net/tramp.el (tramp-handle-start-file-process): Make NAME a unique
Michael Albinus <michael.albinus@gmx.de>
parents: 96941
diff changeset
4518 (setq name name1)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4519 ;; Set the new process properties.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4520 (tramp-set-connection-property v "process-name" name)
96941
940a290a5646 * net/tramp.el (tramp-methods): Add "-q" for "scp", "scp1",
Michael Albinus <michael.albinus@gmx.de>
parents: 96392
diff changeset
4521 (tramp-set-connection-property v "process-buffer" buffer)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4522 ;; Activate narrowing in order to save BUFFER contents.
95963
a20bb74ebe03 * net/tramp.el (tramp-handle-start-file-process): Clear
Michael Albinus <michael.albinus@gmx.de>
parents: 95659
diff changeset
4523 ;; Clear also the modification time; otherwise we might be
a20bb74ebe03 * net/tramp.el (tramp-handle-start-file-process): Clear
Michael Albinus <michael.albinus@gmx.de>
parents: 95659
diff changeset
4524 ;; interrupted by `verify-visited-file-modtime'.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4525 (with-current-buffer (tramp-get-connection-buffer v)
95963
a20bb74ebe03 * net/tramp.el (tramp-handle-start-file-process): Clear
Michael Albinus <michael.albinus@gmx.de>
parents: 95659
diff changeset
4526 (clear-visited-file-modtime)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4527 (narrow-to-region (point-max) (point-max)))
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
4528 ;; Send the command. `tramp-send-command' opens a new
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4529 ;; connection.
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
4530 (tramp-send-command v command nil t) ; nooutput
97035
837d18731242 * net/tramp.el (tramp-handle-start-file-process): Set
Michael Albinus <michael.albinus@gmx.de>
parents: 96990
diff changeset
4531 ;; Set query flag for this process.
837d18731242 * net/tramp.el (tramp-handle-start-file-process): Set
Michael Albinus <michael.albinus@gmx.de>
parents: 96990
diff changeset
4532 (tramp-set-process-query-on-exit-flag
837d18731242 * net/tramp.el (tramp-handle-start-file-process): Set
Michael Albinus <michael.albinus@gmx.de>
parents: 96990
diff changeset
4533 (tramp-get-connection-process v) t)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4534 ;; Return process.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4535 (tramp-get-connection-process v))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4536 ;; Save exit.
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
4537 (with-current-buffer (tramp-get-connection-buffer v)
97035
837d18731242 * net/tramp.el (tramp-handle-start-file-process): Set
Michael Albinus <michael.albinus@gmx.de>
parents: 96990
diff changeset
4538 (if (string-match tramp-temp-buffer-name (buffer-name))
837d18731242 * net/tramp.el (tramp-handle-start-file-process): Set
Michael Albinus <michael.albinus@gmx.de>
parents: 96990
diff changeset
4539 (progn
837d18731242 * net/tramp.el (tramp-handle-start-file-process): Set
Michael Albinus <michael.albinus@gmx.de>
parents: 96990
diff changeset
4540 (set-process-buffer (tramp-get-connection-process v) nil)
837d18731242 * net/tramp.el (tramp-handle-start-file-process): Set
Michael Albinus <michael.albinus@gmx.de>
parents: 96990
diff changeset
4541 (kill-buffer (current-buffer)))
837d18731242 * net/tramp.el (tramp-handle-start-file-process): Set
Michael Albinus <michael.albinus@gmx.de>
parents: 96990
diff changeset
4542 (widen)
837d18731242 * net/tramp.el (tramp-handle-start-file-process): Set
Michael Albinus <michael.albinus@gmx.de>
parents: 96990
diff changeset
4543 (goto-char (point-max))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4544 (tramp-set-connection-property v "process-name" nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4545 (tramp-set-connection-property v "process-buffer" nil))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4546
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4547 (defun tramp-handle-process-file
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4548 (program &optional infile destination display &rest args)
57653
b324ca4df07c * simple.el (process-file): New function, similar to call-process
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 57559
diff changeset
4549 "Like `process-file' for Tramp files."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4550 ;; The implementation is not complete yet.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4551 (when (and (numberp destination) (zerop destination))
57653
b324ca4df07c * simple.el (process-file): New function, similar to call-process
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 57559
diff changeset
4552 (error "Implementation does not handle immediate return"))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4553
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4554 (with-parsed-tramp-file-name default-directory nil
85067
4636000015c5 * net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
4555 (let (command input tmpinput stderr tmpstderr outbuf ret)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4556 ;; Compute command.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4557 (setq command (mapconcat 'tramp-shell-quote-argument
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4558 (cons program args) " "))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4559 ;; Determine input.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4560 (if (null infile)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4561 (setq input "/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4562 (setq infile (expand-file-name infile))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4563 (if (tramp-equal-remote default-directory infile)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4564 ;; INFILE is on the same remote host.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4565 (setq input (with-parsed-tramp-file-name infile nil localname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4566 ;; INFILE must be copied to remote host.
85067
4636000015c5 * net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
4567 (setq input (tramp-make-tramp-temp-file v)
4636000015c5 * net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
4568 tmpinput (tramp-make-tramp-file-name method user host input))
4636000015c5 * net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
4569 (copy-file infile tmpinput t)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4570 (when input (setq command (format "%s <%s" command input)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4571
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4572 ;; Determine output.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4573 (cond
103934
33e088977519 * net/tramp.el (tramp-wait-for-output): Handle the case when
Michael Albinus <michael.albinus@gmx.de>
parents: 103782
diff changeset
4574 ;; Just a buffer.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4575 ((bufferp destination)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4576 (setq outbuf destination))
103934
33e088977519 * net/tramp.el (tramp-wait-for-output): Handle the case when
Michael Albinus <michael.albinus@gmx.de>
parents: 103782
diff changeset
4577 ;; A buffer name.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4578 ((stringp destination)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4579 (setq outbuf (get-buffer-create destination)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4580 ;; (REAL-DESTINATION ERROR-DESTINATION)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4581 ((consp destination)
103934
33e088977519 * net/tramp.el (tramp-wait-for-output): Handle the case when
Michael Albinus <michael.albinus@gmx.de>
parents: 103782
diff changeset
4582 ;; output.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4583 (cond
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4584 ((bufferp (car destination))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4585 (setq outbuf (car destination)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4586 ((stringp (car destination))
87648
7ae99e295dfd * vc-git.el (vc-git--call): Apply `process-file' instead of
Michael Albinus <michael.albinus@gmx.de>
parents: 87368
diff changeset
4587 (setq outbuf (get-buffer-create (car destination))))
7ae99e295dfd * vc-git.el (vc-git--call): Apply `process-file' instead of
Michael Albinus <michael.albinus@gmx.de>
parents: 87368
diff changeset
4588 ((car destination)
7ae99e295dfd * vc-git.el (vc-git--call): Apply `process-file' instead of
Michael Albinus <michael.albinus@gmx.de>
parents: 87368
diff changeset
4589 (setq outbuf (current-buffer))))
103934
33e088977519 * net/tramp.el (tramp-wait-for-output): Handle the case when
Michael Albinus <michael.albinus@gmx.de>
parents: 103782
diff changeset
4590 ;; stderr.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4591 (cond
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4592 ((stringp (cadr destination))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4593 (setcar (cdr destination) (expand-file-name (cadr destination)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4594 (if (tramp-equal-remote default-directory (cadr destination))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4595 ;; stderr is on the same remote host.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4596 (setq stderr (with-parsed-tramp-file-name
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4597 (cadr destination) nil localname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4598 ;; stderr must be copied to remote host. The temporary
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4599 ;; file must be deleted after execution.
85067
4636000015c5 * net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
4600 (setq stderr (tramp-make-tramp-temp-file v)
4636000015c5 * net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
4601 tmpstderr (tramp-make-tramp-file-name
4636000015c5 * net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
4602 method user host stderr))))
103934
33e088977519 * net/tramp.el (tramp-wait-for-output): Handle the case when
Michael Albinus <michael.albinus@gmx.de>
parents: 103782
diff changeset
4603 ;; stderr to be discarded.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4604 ((null (cadr destination))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4605 (setq stderr "/dev/null"))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4606 ;; 't
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4607 (destination
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4608 (setq outbuf (current-buffer))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4609 (when stderr (setq command (format "%s 2>%s" command stderr)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4610
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4611 ;; Send the command. It might not return in time, so we protect it.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4612 (condition-case nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4613 (unwind-protect
105767
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
4614 (setq ret
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
4615 (tramp-send-command-and-check
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
4616 v (format "\\cd %s; %s"
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
4617 (tramp-shell-quote-argument localname)
106204
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
4618 command)
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
4619 nil t))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4620 ;; We should show the output anyway.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4621 (when outbuf
105767
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
4622 (with-current-buffer outbuf
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
4623 (insert
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
4624 (with-current-buffer (tramp-get-connection-buffer v)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
4625 (buffer-string))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4626 (when display (display-buffer outbuf))))
102968
3f05108a52f1 * net/tramp.el (tramp-handle-dired-recursive-delete-directory):
Michael Albinus <michael.albinus@gmx.de>
parents: 102940
diff changeset
4627 ;; When the user did interrupt, we should do it also. We use
3f05108a52f1 * net/tramp.el (tramp-handle-dired-recursive-delete-directory):
Michael Albinus <michael.albinus@gmx.de>
parents: 102940
diff changeset
4628 ;; return code -1 as marker.
3f05108a52f1 * net/tramp.el (tramp-handle-dired-recursive-delete-directory):
Michael Albinus <michael.albinus@gmx.de>
parents: 102940
diff changeset
4629 (quit
3f05108a52f1 * net/tramp.el (tramp-handle-dired-recursive-delete-directory):
Michael Albinus <michael.albinus@gmx.de>
parents: 102940
diff changeset
4630 (kill-buffer (tramp-get-connection-buffer v))
3f05108a52f1 * net/tramp.el (tramp-handle-dired-recursive-delete-directory):
Michael Albinus <michael.albinus@gmx.de>
parents: 102940
diff changeset
4631 (setq ret -1))
3f05108a52f1 * net/tramp.el (tramp-handle-dired-recursive-delete-directory):
Michael Albinus <michael.albinus@gmx.de>
parents: 102940
diff changeset
4632 ;; Handle errors.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4633 (error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4634 (kill-buffer (tramp-get-connection-buffer v))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4635 (setq ret 1)))
85067
4636000015c5 * net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
4636
4636000015c5 * net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
4637 ;; Provide error file.
4636000015c5 * net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
4638 (when tmpstderr (rename-file tmpstderr (cadr destination) t))
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
4639
102968
3f05108a52f1 * net/tramp.el (tramp-handle-dired-recursive-delete-directory):
Michael Albinus <michael.albinus@gmx.de>
parents: 102940
diff changeset
4640 ;; Cleanup. We remove all file cache values for the connection,
3f05108a52f1 * net/tramp.el (tramp-handle-dired-recursive-delete-directory):
Michael Albinus <michael.albinus@gmx.de>
parents: 102940
diff changeset
4641 ;; because the remote process could have changed them.
108816
94d1d8a6dcfd * net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents: 108806
diff changeset
4642 (when tmpinput (delete-file tmpinput))
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
4643
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
4644 ;; `process-file-side-effects' has been introduced with GNU
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
4645 ;; Emacs 23.2. If set to `nil', no remote file will be changed
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
4646 ;; by `program'. If it doesn't exist, we assume its default
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
4647 ;; value 't'.
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
4648 (unless (and (boundp 'process-file-side-effects)
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
4649 (not (symbol-value 'process-file-side-effects)))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
4650 (tramp-flush-directory-property v ""))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
4651
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4652 ;; Return exit status.
102968
3f05108a52f1 * net/tramp.el (tramp-handle-dired-recursive-delete-directory):
Michael Albinus <michael.albinus@gmx.de>
parents: 102940
diff changeset
4653 (if (equal ret -1)
3f05108a52f1 * net/tramp.el (tramp-handle-dired-recursive-delete-directory):
Michael Albinus <michael.albinus@gmx.de>
parents: 102940
diff changeset
4654 (keyboard-quit)
3f05108a52f1 * net/tramp.el (tramp-handle-dired-recursive-delete-directory):
Michael Albinus <michael.albinus@gmx.de>
parents: 102940
diff changeset
4655 ret))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4656
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
4657 (defun tramp-local-call-process
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
4658 (program &optional infile destination display &rest args)
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
4659 "Calls `call-process' on the local host.
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
4660 This is needed because for some Emacs flavors Tramp has
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
4661 defadviced `call-process' to behave like `process-file'. The
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
4662 Lisp error raised when PROGRAM is nil is trapped also, returning 1."
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
4663 (let ((default-directory
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
4664 (if (file-remote-p default-directory)
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
4665 (tramp-compat-temporary-file-directory)
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
4666 default-directory)))
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
4667 (if (executable-find program)
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
4668 (apply 'call-process program infile destination display args)
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
4669 1)))
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
4670
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4671 (defun tramp-handle-call-process-region
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4672 (start end program &optional delete buffer display &rest args)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4673 "Like `call-process-region' for Tramp files."
85041
a42b8750a992 * net/tramp.el (tramp-make-temp-file): Move to tramp-compat.el.
Michael Albinus <michael.albinus@gmx.de>
parents: 85024
diff changeset
4674 (let ((tmpfile (tramp-compat-make-temp-file "")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4675 (write-region start end tmpfile)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4676 (when delete (delete-region start end))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4677 (unwind-protect
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4678 (apply 'call-process program tmpfile buffer display args)
108816
94d1d8a6dcfd * net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents: 108806
diff changeset
4679 (delete-file tmpfile))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4680
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4681 (defun tramp-handle-shell-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4682 (command &optional output-buffer error-buffer)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4683 "Like `shell-command' for Tramp files."
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
4684 (let* ((asynchronous (string-match "[ \t]*&[ \t]*\\'" command))
88051
a67ed67d274a * net/tramp.el (tramp-handle-shell-command): Use "/bin/sh -c" for
Michael Albinus <michael.albinus@gmx.de>
parents: 88028
diff changeset
4685 ;; We cannot use `shell-file-name' and `shell-command-switch',
a67ed67d274a * net/tramp.el (tramp-handle-shell-command): Use "/bin/sh -c" for
Michael Albinus <michael.albinus@gmx.de>
parents: 88028
diff changeset
4686 ;; they are variables of the local host.
109443
9e514d1076b4 * net/tramp.el (tramp-handle-shell-command): Don't use hard-wired
Michael Albinus <michael.albinus@gmx.de>
parents: 108975
diff changeset
4687 (args (list
9e514d1076b4 * net/tramp.el (tramp-handle-shell-command): Don't use hard-wired
Michael Albinus <michael.albinus@gmx.de>
parents: 108975
diff changeset
4688 (tramp-get-method-parameter
9e514d1076b4 * net/tramp.el (tramp-handle-shell-command): Don't use hard-wired
Michael Albinus <michael.albinus@gmx.de>
parents: 108975
diff changeset
4689 (tramp-file-name-method
9e514d1076b4 * net/tramp.el (tramp-handle-shell-command): Don't use hard-wired
Michael Albinus <michael.albinus@gmx.de>
parents: 108975
diff changeset
4690 (tramp-dissect-file-name default-directory))
9e514d1076b4 * net/tramp.el (tramp-handle-shell-command): Don't use hard-wired
Michael Albinus <michael.albinus@gmx.de>
parents: 108975
diff changeset
4691 'tramp-remote-sh)
9e514d1076b4 * net/tramp.el (tramp-handle-shell-command): Don't use hard-wired
Michael Albinus <michael.albinus@gmx.de>
parents: 108975
diff changeset
4692 "-c" (substring command 0 asynchronous)))
97444
85c2adddd765 (tramp-handle-shell-command): Correctly handle
Andreas Schwab <schwab@suse.de>
parents: 97052
diff changeset
4693 current-buffer-p
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
4694 (output-buffer
82324
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
4695 (cond
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
4696 ((bufferp output-buffer) output-buffer)
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
4697 ((stringp output-buffer) (get-buffer-create output-buffer))
97444
85c2adddd765 (tramp-handle-shell-command): Correctly handle
Andreas Schwab <schwab@suse.de>
parents: 97052
diff changeset
4698 (output-buffer
85c2adddd765 (tramp-handle-shell-command): Correctly handle
Andreas Schwab <schwab@suse.de>
parents: 97052
diff changeset
4699 (setq current-buffer-p t)
85c2adddd765 (tramp-handle-shell-command): Correctly handle
Andreas Schwab <schwab@suse.de>
parents: 97052
diff changeset
4700 (current-buffer))
88072
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
4701 (t (get-buffer-create
82324
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
4702 (if asynchronous
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
4703 "*Async Shell Command*"
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
4704 "*Shell Command Output*")))))
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
4705 (error-buffer
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
4706 (cond
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
4707 ((bufferp error-buffer) error-buffer)
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
4708 ((stringp error-buffer) (get-buffer-create error-buffer))))
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
4709 (buffer
82324
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
4710 (if (and (not asynchronous) error-buffer)
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
4711 (with-parsed-tramp-file-name default-directory nil
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
4712 (list output-buffer (tramp-make-tramp-temp-file v)))
88072
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
4713 output-buffer))
91486
76c777ce052a * net/tramp.el (tramp-process-sentinel): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 88072
diff changeset
4714 (p (get-buffer-process output-buffer)))
88072
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
4715
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
4716 ;; Check whether there is another process running. Tramp does not
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
4717 ;; support 2 (asynchronous) processes in parallel.
91486
76c777ce052a * net/tramp.el (tramp-process-sentinel): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 88072
diff changeset
4718 (when p
88072
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
4719 (if (yes-or-no-p "A command is running. Kill it? ")
93062
079f34f8306f (tramp-drop-volume-letter): Evaluate when compiling.
Glenn Morris <rgm@gnu.org>
parents: 93047
diff changeset
4720 (condition-case nil
079f34f8306f (tramp-drop-volume-letter): Evaluate when compiling.
Glenn Morris <rgm@gnu.org>
parents: 93047
diff changeset
4721 (kill-process p)
079f34f8306f (tramp-drop-volume-letter): Evaluate when compiling.
Glenn Morris <rgm@gnu.org>
parents: 93047
diff changeset
4722 (error nil))
88072
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
4723 (error "Shell command in progress")))
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
4724
97445
8f3b361fa8c1 (tramp-handle-shell-command): Handle output going
Andreas Schwab <schwab@suse.de>
parents: 97444
diff changeset
4725 (if current-buffer-p
8f3b361fa8c1 (tramp-handle-shell-command): Handle output going
Andreas Schwab <schwab@suse.de>
parents: 97444
diff changeset
4726 (progn
8f3b361fa8c1 (tramp-handle-shell-command): Handle output going
Andreas Schwab <schwab@suse.de>
parents: 97444
diff changeset
4727 (barf-if-buffer-read-only)
8f3b361fa8c1 (tramp-handle-shell-command): Handle output going
Andreas Schwab <schwab@suse.de>
parents: 97444
diff changeset
4728 (push-mark nil t))
97444
85c2adddd765 (tramp-handle-shell-command): Correctly handle
Andreas Schwab <schwab@suse.de>
parents: 97052
diff changeset
4729 (with-current-buffer output-buffer
85c2adddd765 (tramp-handle-shell-command): Correctly handle
Andreas Schwab <schwab@suse.de>
parents: 97052
diff changeset
4730 (setq buffer-read-only nil)
85c2adddd765 (tramp-handle-shell-command): Correctly handle
Andreas Schwab <schwab@suse.de>
parents: 97052
diff changeset
4731 (erase-buffer)))
85c2adddd765 (tramp-handle-shell-command): Correctly handle
Andreas Schwab <schwab@suse.de>
parents: 97052
diff changeset
4732
85c2adddd765 (tramp-handle-shell-command): Correctly handle
Andreas Schwab <schwab@suse.de>
parents: 97052
diff changeset
4733 (if (and (not current-buffer-p) (integerp asynchronous))
88072
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
4734 (prog1
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
4735 ;; Run the process.
85841
0c0a9419b0c4 * net/tramp.el (tramp-handle-shell-command): Call `start-file-process'
Michael Albinus <michael.albinus@gmx.de>
parents: 85802
diff changeset
4736 (apply 'start-file-process "*Async Shell*" buffer args)
88072
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
4737 ;; Display output.
91486
76c777ce052a * net/tramp.el (tramp-process-sentinel): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 88072
diff changeset
4738 (pop-to-buffer output-buffer)
76c777ce052a * net/tramp.el (tramp-process-sentinel): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 88072
diff changeset
4739 (setq mode-line-process '(":%s"))
76c777ce052a * net/tramp.el (tramp-process-sentinel): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 88072
diff changeset
4740 (require 'shell) (shell-mode))
88072
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
4741
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
4742 (prog1
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
4743 ;; Run the process.
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
4744 (apply 'process-file (car args) nil buffer nil (cdr args))
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
4745 ;; Insert error messages if they were separated.
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
4746 (when (listp buffer)
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
4747 (with-current-buffer error-buffer
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
4748 (insert-file-contents (cadr buffer)))
108816
94d1d8a6dcfd * net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents: 108806
diff changeset
4749 (delete-file (cadr buffer)))
97445
8f3b361fa8c1 (tramp-handle-shell-command): Handle output going
Andreas Schwab <schwab@suse.de>
parents: 97444
diff changeset
4750 (if current-buffer-p
8f3b361fa8c1 (tramp-handle-shell-command): Handle output going
Andreas Schwab <schwab@suse.de>
parents: 97444
diff changeset
4751 ;; This is like exchange-point-and-mark, but doesn't
8f3b361fa8c1 (tramp-handle-shell-command): Handle output going
Andreas Schwab <schwab@suse.de>
parents: 97444
diff changeset
4752 ;; activate the mark. It is cleaner to avoid activation,
8f3b361fa8c1 (tramp-handle-shell-command): Handle output going
Andreas Schwab <schwab@suse.de>
parents: 97444
diff changeset
4753 ;; even though the command loop would deactivate the mark
8f3b361fa8c1 (tramp-handle-shell-command): Handle output going
Andreas Schwab <schwab@suse.de>
parents: 97444
diff changeset
4754 ;; because we inserted text.
8f3b361fa8c1 (tramp-handle-shell-command): Handle output going
Andreas Schwab <schwab@suse.de>
parents: 97444
diff changeset
4755 (goto-char (prog1 (mark t)
8f3b361fa8c1 (tramp-handle-shell-command): Handle output going
Andreas Schwab <schwab@suse.de>
parents: 97444
diff changeset
4756 (set-marker (mark-marker) (point)
8f3b361fa8c1 (tramp-handle-shell-command): Handle output going
Andreas Schwab <schwab@suse.de>
parents: 97444
diff changeset
4757 (current-buffer))))
8f3b361fa8c1 (tramp-handle-shell-command): Handle output going
Andreas Schwab <schwab@suse.de>
parents: 97444
diff changeset
4758 ;; There's some output, display it.
8f3b361fa8c1 (tramp-handle-shell-command): Handle output going
Andreas Schwab <schwab@suse.de>
parents: 97444
diff changeset
4759 (when (with-current-buffer output-buffer (> (point-max) (point-min)))
8f3b361fa8c1 (tramp-handle-shell-command): Handle output going
Andreas Schwab <schwab@suse.de>
parents: 97444
diff changeset
4760 (if (functionp 'display-message-or-buffer)
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
4761 (tramp-compat-funcall 'display-message-or-buffer output-buffer)
97445
8f3b361fa8c1 (tramp-handle-shell-command): Handle output going
Andreas Schwab <schwab@suse.de>
parents: 97444
diff changeset
4762 (pop-to-buffer output-buffer))))))))
57653
b324ca4df07c * simple.el (process-file): New function, similar to call-process
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 57559
diff changeset
4763
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4764 ;; File Editing.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4765
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4766 (defvar tramp-handle-file-local-copy-hook nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4767 "Normal hook to be run at the end of `tramp-handle-file-local-copy'.")
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4768
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4769 (defun tramp-handle-file-local-copy (filename)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4770 "Like `file-local-copy' for Tramp files."
82808
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
4771
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4772 (with-parsed-tramp-file-name filename nil
100930
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4773 (unless (file-exists-p filename)
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4774 (tramp-error
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4775 v 'file-error
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4776 "Cannot make local copy of non-existing file `%s'" filename))
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4777
108186
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
4778 (let* ((size (nth 7 (file-attributes filename)))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
4779 (rem-enc (tramp-get-inline-coding v "remote-encoding" size))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
4780 (loc-dec (tramp-get-inline-coding v "local-decoding" size))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
4781 (tmpfile (tramp-compat-make-temp-file filename)))
100930
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4782
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4783 (condition-case err
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4784 (cond
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4785 ;; `copy-file' handles direct copy and out-of-band methods.
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4786 ((or (tramp-local-host-p v)
108186
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
4787 (tramp-method-out-of-band-p v size))
100930
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4788 (copy-file filename tmpfile t t))
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4789
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4790 ;; Use inline encoding for file transfer.
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4791 (rem-enc
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4792 (save-excursion
108540
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4793 (with-progress-reporter
108739
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
4794 v 3 (format "Encoding remote file %s" filename)
108540
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4795 (tramp-barf-unless-okay
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4796 v (format rem-enc (tramp-shell-quote-argument localname))
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4797 "Encoding remote file failed"))
100930
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4798
108186
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
4799 (if (functionp loc-dec)
100930
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4800 ;; If local decoding is a function, we call it. We
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4801 ;; must disable multibyte, because
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4802 ;; `uudecode-decode-region' doesn't handle it
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4803 ;; correctly.
82808
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
4804 (with-temp-buffer
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
4805 (set-buffer-multibyte nil)
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
4806 (insert-buffer-substring (tramp-get-buffer v))
108540
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4807 (with-progress-reporter
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4808 v 3 (format "Decoding remote file %s with function %s"
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4809 filename loc-dec)
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4810 (funcall loc-dec (point-min) (point-max))
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4811 ;; Unset `file-name-handler-alist'. Otherwise,
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4812 ;; epa-file gets confused.
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4813 (let (file-name-handler-alist
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4814 (coding-system-for-write 'binary))
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4815 (write-region (point-min) (point-max) tmpfile))))
100930
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4816
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4817 ;; If tramp-decoding-function is not defined for this
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4818 ;; method, we invoke tramp-decoding-command instead.
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4819 (let ((tmpfile2 (tramp-compat-make-temp-file filename)))
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4820 ;; Unset `file-name-handler-alist'. Otherwise,
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4821 ;; epa-file gets confused.
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4822 (let (file-name-handler-alist
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
4823 (coding-system-for-write 'binary))
100930
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4824 (write-region (point-min) (point-max) tmpfile2))
108540
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4825 (with-progress-reporter
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4826 v 3 (format "Decoding remote file %s with command %s"
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4827 filename loc-dec)
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4828 (unwind-protect
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4829 (tramp-call-local-coding-command
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4830 loc-dec tmpfile2 tmpfile)
108816
94d1d8a6dcfd * net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents: 108806
diff changeset
4831 (delete-file tmpfile2)))))
108540
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4832
100930
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4833 ;; Set proper permissions.
102851
5cc9a4c776e8 * net/tramp.el (tramp-default-file-modes) New defun. Replace all
Michael Albinus <michael.albinus@gmx.de>
parents: 102287
diff changeset
4834 (set-file-modes tmpfile (tramp-default-file-modes filename))
100930
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4835 ;; Set local user ownership.
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4836 (tramp-set-file-uid-gid tmpfile)))
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4837
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4838 ;; Oops, I don't know what to do.
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4839 (t (tramp-error
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4840 v 'file-error "Wrong method specification for `%s'" method)))
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4841
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4842 ;; Error handling.
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4843 ((error quit)
108816
94d1d8a6dcfd * net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents: 108806
diff changeset
4844 (delete-file tmpfile)
100930
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
4845 (signal (car err) (cdr err))))
82808
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
4846
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4847 (run-hooks 'tramp-handle-file-local-copy-hook)
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4848 tmpfile)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4849
78460
45e0e9795cdb * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 78411
diff changeset
4850 (defun tramp-handle-file-remote-p (filename &optional identification connected)
45e0e9795cdb * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 78411
diff changeset
4851 "Like `file-remote-p' for Tramp files."
107085
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 107044
diff changeset
4852 (let ((tramp-verbose 3))
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 107044
diff changeset
4853 (when (tramp-tramp-file-p filename)
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 107044
diff changeset
4854 (let* ((v (tramp-dissect-file-name filename))
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 107044
diff changeset
4855 (p (tramp-get-connection-process v))
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 107044
diff changeset
4856 (c (and p (processp p) (memq (process-status p) '(run open)))))
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 107044
diff changeset
4857 ;; We expand the file name only, if there is already a connection.
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 107044
diff changeset
4858 (with-parsed-tramp-file-name
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 107044
diff changeset
4859 (if c (expand-file-name filename) filename) nil
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 107044
diff changeset
4860 (and (or (not connected) c)
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 107044
diff changeset
4861 (cond
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 107044
diff changeset
4862 ((eq identification 'method) method)
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 107044
diff changeset
4863 ((eq identification 'user) user)
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 107044
diff changeset
4864 ((eq identification 'host) host)
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 107044
diff changeset
4865 ((eq identification 'localname) localname)
d7831d04952b * dired.el (dired-revert): If DIRED-DIRECTORY is a cons cell, call
Michael Albinus <michael.albinus@gmx.de>
parents: 107044
diff changeset
4866 (t (tramp-make-tramp-file-name method user host "")))))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4867
93938
3c06445e714c * net/tramp.el (tramp-find-file-name-coding-system-alist): New
Michael Albinus <michael.albinus@gmx.de>
parents: 93829
diff changeset
4868 (defun tramp-find-file-name-coding-system-alist (filename tmpname)
3c06445e714c * net/tramp.el (tramp-find-file-name-coding-system-alist): New
Michael Albinus <michael.albinus@gmx.de>
parents: 93829
diff changeset
4869 "Like `find-operation-coding-system' for Tramp filenames.
3c06445e714c * net/tramp.el (tramp-find-file-name-coding-system-alist): New
Michael Albinus <michael.albinus@gmx.de>
parents: 93829
diff changeset
4870 Tramp's `insert-file-contents' and `write-region' work over
3c06445e714c * net/tramp.el (tramp-find-file-name-coding-system-alist): New
Michael Albinus <michael.albinus@gmx.de>
parents: 93829
diff changeset
4871 temporary file names. If `file-coding-system-alist' contains an
3c06445e714c * net/tramp.el (tramp-find-file-name-coding-system-alist): New
Michael Albinus <michael.albinus@gmx.de>
parents: 93829
diff changeset
4872 expression, which matches more than the file name suffix, the
3c06445e714c * net/tramp.el (tramp-find-file-name-coding-system-alist): New
Michael Albinus <michael.albinus@gmx.de>
parents: 93829
diff changeset
4873 coding system might not be determined. This function repairs it."
3c06445e714c * net/tramp.el (tramp-find-file-name-coding-system-alist): New
Michael Albinus <michael.albinus@gmx.de>
parents: 93829
diff changeset
4874 (let (result)
3c06445e714c * net/tramp.el (tramp-find-file-name-coding-system-alist): New
Michael Albinus <michael.albinus@gmx.de>
parents: 93829
diff changeset
4875 (dolist (elt file-coding-system-alist result)
3c06445e714c * net/tramp.el (tramp-find-file-name-coding-system-alist): New
Michael Albinus <michael.albinus@gmx.de>
parents: 93829
diff changeset
4876 (when (and (consp elt) (string-match (car elt) filename))
3c06445e714c * net/tramp.el (tramp-find-file-name-coding-system-alist): New
Michael Albinus <michael.albinus@gmx.de>
parents: 93829
diff changeset
4877 ;; We found a matching entry in `file-coding-system-alist'.
3c06445e714c * net/tramp.el (tramp-find-file-name-coding-system-alist): New
Michael Albinus <michael.albinus@gmx.de>
parents: 93829
diff changeset
4878 ;; So we add a similar entry, but with the temporary file name
3c06445e714c * net/tramp.el (tramp-find-file-name-coding-system-alist): New
Michael Albinus <michael.albinus@gmx.de>
parents: 93829
diff changeset
4879 ;; as regexp.
3c06445e714c * net/tramp.el (tramp-find-file-name-coding-system-alist): New
Michael Albinus <michael.albinus@gmx.de>
parents: 93829
diff changeset
4880 (add-to-list
3c06445e714c * net/tramp.el (tramp-find-file-name-coding-system-alist): New
Michael Albinus <michael.albinus@gmx.de>
parents: 93829
diff changeset
4881 'result (cons (regexp-quote tmpname) (cdr elt)) 'append)))))
3c06445e714c * net/tramp.el (tramp-find-file-name-coding-system-alist): New
Michael Albinus <michael.albinus@gmx.de>
parents: 93829
diff changeset
4882
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4883 (defun tramp-handle-insert-file-contents
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4884 (filename &optional visit beg end replace)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4885 "Like `insert-file-contents' for Tramp files."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4886 (barf-if-buffer-read-only)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4887 (setq filename (expand-file-name filename))
108540
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4888 (let (result local-copy remote-copy)
104143
49b412e99f1e * net/tramp.el (top): Make check for tramp-gvfs loading more
Michael Albinus <michael.albinus@gmx.de>
parents: 104137
diff changeset
4889 (with-parsed-tramp-file-name filename nil
49b412e99f1e * net/tramp.el (top): Make check for tramp-gvfs loading more
Michael Albinus <michael.albinus@gmx.de>
parents: 104137
diff changeset
4890 (unwind-protect
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4891 (if (not (file-exists-p filename))
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4892 ;; We don't raise a Tramp error, because it might be
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4893 ;; suppressed, like in `find-file-noselect-1'.
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4894 (signal 'file-error
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4895 (list "File not found on remote host" filename))
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4896
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4897 (if (and (tramp-local-host-p v)
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4898 (let (file-name-handler-alist)
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4899 (file-readable-p localname)))
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4900 ;; Short track: if we are on the local host, we can
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4901 ;; run directly.
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4902 (setq result
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4903 (tramp-run-real-handler
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4904 'insert-file-contents
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4905 (list localname visit beg end replace)))
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4906
104125
fd4d8124e329 * net/tramp.el (tramp-debug-message): Print also microseconds.
Michael Albinus <michael.albinus@gmx.de>
parents: 104097
diff changeset
4907 ;; When we shall insert only a part of the file, we copy
fd4d8124e329 * net/tramp.el (tramp-debug-message): Print also microseconds.
Michael Albinus <michael.albinus@gmx.de>
parents: 104097
diff changeset
4908 ;; this part.
fd4d8124e329 * net/tramp.el (tramp-debug-message): Print also microseconds.
Michael Albinus <michael.albinus@gmx.de>
parents: 104097
diff changeset
4909 (when (or beg end)
fd4d8124e329 * net/tramp.el (tramp-debug-message): Print also microseconds.
Michael Albinus <michael.albinus@gmx.de>
parents: 104097
diff changeset
4910 (setq remote-copy (tramp-make-tramp-temp-file v))
fd4d8124e329 * net/tramp.el (tramp-debug-message): Print also microseconds.
Michael Albinus <michael.albinus@gmx.de>
parents: 104097
diff changeset
4911 (tramp-send-command
fd4d8124e329 * net/tramp.el (tramp-debug-message): Print also microseconds.
Michael Albinus <michael.albinus@gmx.de>
parents: 104097
diff changeset
4912 v
fd4d8124e329 * net/tramp.el (tramp-debug-message): Print also microseconds.
Michael Albinus <michael.albinus@gmx.de>
parents: 104097
diff changeset
4913 (cond
fd4d8124e329 * net/tramp.el (tramp-debug-message): Print also microseconds.
Michael Albinus <michael.albinus@gmx.de>
parents: 104097
diff changeset
4914 ((and beg end)
fd4d8124e329 * net/tramp.el (tramp-debug-message): Print also microseconds.
Michael Albinus <michael.albinus@gmx.de>
parents: 104097
diff changeset
4915 (format "tail -c +%d %s | head -c +%d >%s"
fd4d8124e329 * net/tramp.el (tramp-debug-message): Print also microseconds.
Michael Albinus <michael.albinus@gmx.de>
parents: 104097
diff changeset
4916 (1+ beg) (tramp-shell-quote-argument localname)
fd4d8124e329 * net/tramp.el (tramp-debug-message): Print also microseconds.
Michael Albinus <michael.albinus@gmx.de>
parents: 104097
diff changeset
4917 (- end beg) remote-copy))
fd4d8124e329 * net/tramp.el (tramp-debug-message): Print also microseconds.
Michael Albinus <michael.albinus@gmx.de>
parents: 104097
diff changeset
4918 (beg
fd4d8124e329 * net/tramp.el (tramp-debug-message): Print also microseconds.
Michael Albinus <michael.albinus@gmx.de>
parents: 104097
diff changeset
4919 (format "tail -c +%d %s >%s"
fd4d8124e329 * net/tramp.el (tramp-debug-message): Print also microseconds.
Michael Albinus <michael.albinus@gmx.de>
parents: 104097
diff changeset
4920 (1+ beg) (tramp-shell-quote-argument localname)
fd4d8124e329 * net/tramp.el (tramp-debug-message): Print also microseconds.
Michael Albinus <michael.albinus@gmx.de>
parents: 104097
diff changeset
4921 remote-copy))
fd4d8124e329 * net/tramp.el (tramp-debug-message): Print also microseconds.
Michael Albinus <michael.albinus@gmx.de>
parents: 104097
diff changeset
4922 (end
fd4d8124e329 * net/tramp.el (tramp-debug-message): Print also microseconds.
Michael Albinus <michael.albinus@gmx.de>
parents: 104097
diff changeset
4923 (format "head -c +%d %s >%s"
fd4d8124e329 * net/tramp.el (tramp-debug-message): Print also microseconds.
Michael Albinus <michael.albinus@gmx.de>
parents: 104097
diff changeset
4924 (1+ end) (tramp-shell-quote-argument localname)
fd4d8124e329 * net/tramp.el (tramp-debug-message): Print also microseconds.
Michael Albinus <michael.albinus@gmx.de>
parents: 104097
diff changeset
4925 remote-copy)))))
fd4d8124e329 * net/tramp.el (tramp-debug-message): Print also microseconds.
Michael Albinus <michael.albinus@gmx.de>
parents: 104097
diff changeset
4926
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4927 ;; `insert-file-contents-literally' takes care to avoid
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4928 ;; calling jka-compr. By let-binding
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4929 ;; `inhibit-file-name-operation', we propagate that care
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4930 ;; to the `file-local-copy' operation.
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4931 (setq local-copy
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4932 (let ((inhibit-file-name-operation
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4933 (when (eq inhibit-file-name-operation
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4934 'insert-file-contents)
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4935 'file-local-copy)))
105718
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
4936 (cond
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
4937 ((stringp remote-copy)
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
4938 (file-local-copy
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
4939 (tramp-make-tramp-file-name
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
4940 method user host remote-copy)))
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
4941 ((stringp tramp-temp-buffer-file-name)
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
4942 (copy-file filename tramp-temp-buffer-file-name 'ok)
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
4943 tramp-temp-buffer-file-name)
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
4944 (t (file-local-copy filename)))))
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
4945
107189
a48b193e3b5f (tramp-handle-insert-file-contents): Set always the permissions of the
Michael Albinus <michael.albinus@gmx.de>
parents: 107170
diff changeset
4946 ;; When the file is not readable for the owner, it
a48b193e3b5f (tramp-handle-insert-file-contents): Set always the permissions of the
Michael Albinus <michael.albinus@gmx.de>
parents: 107170
diff changeset
4947 ;; cannot be inserted, even it is redable for the group
a48b193e3b5f (tramp-handle-insert-file-contents): Set always the permissions of the
Michael Albinus <michael.albinus@gmx.de>
parents: 107170
diff changeset
4948 ;; or for everybody.
a48b193e3b5f (tramp-handle-insert-file-contents): Set always the permissions of the
Michael Albinus <michael.albinus@gmx.de>
parents: 107170
diff changeset
4949 (set-file-modes local-copy (tramp-octal-to-decimal "0600"))
a48b193e3b5f (tramp-handle-insert-file-contents): Set always the permissions of the
Michael Albinus <michael.albinus@gmx.de>
parents: 107170
diff changeset
4950
105718
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
4951 (when (and (null remote-copy)
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
4952 (tramp-get-method-parameter
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
4953 method 'tramp-copy-keep-tmpfile))
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
4954 ;; We keep the local file for performance reasons,
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
4955 ;; useful for "rsync".
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
4956 (setq tramp-temp-buffer-file-name local-copy)
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
4957 (put 'tramp-temp-buffer-file-name 'permanent-local t))
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
4958
108540
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4959 (with-progress-reporter
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4960 v 3 (format "Inserting local temp file `%s'" local-copy)
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4961 ;; We must ensure that `file-coding-system-alist'
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4962 ;; matches `local-copy'.
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4963 (let ((file-coding-system-alist
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4964 (tramp-find-file-name-coding-system-alist
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4965 filename local-copy)))
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4966 (setq result
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4967 (insert-file-contents
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
4968 local-copy nil nil nil replace))))))
104143
49b412e99f1e * net/tramp.el (top): Make check for tramp-gvfs loading more
Michael Albinus <michael.albinus@gmx.de>
parents: 104137
diff changeset
4969
49b412e99f1e * net/tramp.el (top): Make check for tramp-gvfs loading more
Michael Albinus <michael.albinus@gmx.de>
parents: 104137
diff changeset
4970 ;; Save exit.
49b412e99f1e * net/tramp.el (top): Make check for tramp-gvfs loading more
Michael Albinus <michael.albinus@gmx.de>
parents: 104137
diff changeset
4971 (progn
49b412e99f1e * net/tramp.el (top): Make check for tramp-gvfs loading more
Michael Albinus <michael.albinus@gmx.de>
parents: 104137
diff changeset
4972 (when visit
49b412e99f1e * net/tramp.el (top): Make check for tramp-gvfs loading more
Michael Albinus <michael.albinus@gmx.de>
parents: 104137
diff changeset
4973 (setq buffer-file-name filename)
49b412e99f1e * net/tramp.el (top): Make check for tramp-gvfs loading more
Michael Albinus <michael.albinus@gmx.de>
parents: 104137
diff changeset
4974 (setq buffer-read-only (not (file-writable-p filename)))
49b412e99f1e * net/tramp.el (top): Make check for tramp-gvfs loading more
Michael Albinus <michael.albinus@gmx.de>
parents: 104137
diff changeset
4975 (set-visited-file-modtime)
49b412e99f1e * net/tramp.el (top): Make check for tramp-gvfs loading more
Michael Albinus <michael.albinus@gmx.de>
parents: 104137
diff changeset
4976 (set-buffer-modified-p nil))
105718
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
4977 (when (and (stringp local-copy)
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
4978 (or remote-copy (null tramp-temp-buffer-file-name)))
108816
94d1d8a6dcfd * net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents: 108806
diff changeset
4979 (delete-file local-copy))
104143
49b412e99f1e * net/tramp.el (top): Make check for tramp-gvfs loading more
Michael Albinus <michael.albinus@gmx.de>
parents: 104137
diff changeset
4980 (when (stringp remote-copy)
108816
94d1d8a6dcfd * net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents: 108806
diff changeset
4981 (delete-file
108806
511da81b16c5 Change delete-by-moving-to-trash so Lisp calls explicitly request trashing.
Chong Yidong <cyd@stupidchicken.com>
parents: 108777
diff changeset
4982 (tramp-make-tramp-file-name method user host remote-copy))))))
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4983
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4984 ;; Result.
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4985 (list (expand-file-name filename)
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
4986 (cadr result))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4987
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4988 ;; This is needed for XEmacs only. Code stolen from files.el.
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4989 (defun tramp-handle-insert-file-contents-literally
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4990 (filename &optional visit beg end replace)
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4991 "Like `insert-file-contents-literally' for Tramp files."
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4992 (let ((format-alist nil)
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4993 (after-insert-file-functions nil)
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4994 (coding-system-for-read 'no-conversion)
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4995 (coding-system-for-write 'no-conversion)
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4996 (find-buffer-file-type-function
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4997 (if (fboundp 'find-buffer-file-type)
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4998 (symbol-function 'find-buffer-file-type)
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4999 nil))
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
5000 (inhibit-file-name-handlers '(jka-compr-handler image-file-handler))
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
5001 (inhibit-file-name-operation 'insert-file-contents))
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
5002 (unwind-protect
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
5003 (progn
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
5004 (fset 'find-buffer-file-type (lambda (filename) t))
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
5005 (insert-file-contents filename visit beg end replace))
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
5006 ;; Save exit.
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
5007 (if find-buffer-file-type-function
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
5008 (fset 'find-buffer-file-type find-buffer-file-type-function)
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
5009 (fmakunbound 'find-buffer-file-type)))))
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
5010
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
5011 (defun tramp-handle-find-backup-file-name (filename)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5012 "Like `find-backup-file-name' for Tramp files."
56460
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5013 (with-parsed-tramp-file-name filename nil
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5014 ;; We set both variables. It doesn't matter whether it is
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
5015 ;; Emacs or XEmacs.
56460
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5016 (let ((backup-directory-alist
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
5017 ;; Emacs case.
56460
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5018 (when (boundp 'backup-directory-alist)
102851
5cc9a4c776e8 * net/tramp.el (tramp-default-file-modes) New defun. Replace all
Michael Albinus <michael.albinus@gmx.de>
parents: 102287
diff changeset
5019 (if (symbol-value 'tramp-backup-directory-alist)
56460
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5020 (mapcar
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5021 (lambda (x)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5022 (cons
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5023 (car x)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5024 (if (and (stringp (cdr x))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5025 (file-name-absolute-p (cdr x))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5026 (not (tramp-file-name-p (cdr x))))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5027 (tramp-make-tramp-file-name method user host (cdr x))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5028 (cdr x))))
56460
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5029 (symbol-value 'tramp-backup-directory-alist))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5030 (symbol-value 'backup-directory-alist))))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5031
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5032 (bkup-backup-directory-info
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
5033 ;; XEmacs case.
56460
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5034 (when (boundp 'bkup-backup-directory-info)
102851
5cc9a4c776e8 * net/tramp.el (tramp-default-file-modes) New defun. Replace all
Michael Albinus <michael.albinus@gmx.de>
parents: 102287
diff changeset
5035 (if (symbol-value 'tramp-bkup-backup-directory-info)
56460
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5036 (mapcar
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5037 (lambda (x)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5038 (nconc
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5039 (list (car x))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5040 (list
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5041 (if (and (stringp (car (cdr x)))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5042 (file-name-absolute-p (car (cdr x)))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5043 (not (tramp-file-name-p (car (cdr x)))))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5044 (tramp-make-tramp-file-name
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5045 method user host (car (cdr x)))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5046 (car (cdr x))))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5047 (cdr (cdr x))))
56460
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5048 (symbol-value 'tramp-bkup-backup-directory-info))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5049 (symbol-value 'bkup-backup-directory-info)))))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5050
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5051 (tramp-run-real-handler 'find-backup-file-name (list filename)))))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5052
65248
0f994edbec5e Make `make-auto-save-file-name' a magic operation.
Michael Albinus <michael.albinus@gmx.de>
parents: 64772
diff changeset
5053 (defun tramp-handle-make-auto-save-file-name ()
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5054 "Like `make-auto-save-file-name' for Tramp files.
65248
0f994edbec5e Make `make-auto-save-file-name' a magic operation.
Michael Albinus <michael.albinus@gmx.de>
parents: 64772
diff changeset
5055 Returns a file name in `tramp-auto-save-directory' for autosaving this file."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5056 (let ((tramp-auto-save-directory tramp-auto-save-directory)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5057 (buffer-file-name
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5058 (tramp-subst-strs-in-string
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5059 '(("_" . "|")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5060 ("/" . "_a")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5061 (":" . "_b")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5062 ("|" . "__")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5063 ("[" . "_l")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5064 ("]" . "_r"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5065 (buffer-file-name))))
72569
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
5066 ;; File name must be unique. This is ensured with Emacs 22 (see
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
5067 ;; UNIQUIFY element of `auto-save-file-name-transforms'); but for
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
5068 ;; all other cases we must do it ourselves.
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
5069 (when (boundp 'auto-save-file-name-transforms)
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
5070 (mapc
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5071 (lambda (x)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5072 (when (and (string-match (car x) buffer-file-name)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5073 (not (car (cddr x))))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5074 (setq tramp-auto-save-directory
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5075 (or tramp-auto-save-directory
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5076 (tramp-compat-temporary-file-directory)))))
72569
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
5077 (symbol-value 'auto-save-file-name-transforms)))
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
5078 ;; Create directory.
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
5079 (when tramp-auto-save-directory
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5080 (setq buffer-file-name
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5081 (expand-file-name buffer-file-name tramp-auto-save-directory))
72569
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
5082 (unless (file-exists-p tramp-auto-save-directory)
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
5083 (make-directory tramp-auto-save-directory t)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5084 ;; Run plain `make-auto-save-file-name'. There might be an advice when
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5085 ;; it is not a magic file name operation (since Emacs 22).
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5086 ;; We must deactivate it temporarily.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5087 (if (not (ad-is-active 'make-auto-save-file-name))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5088 (tramp-run-real-handler 'make-auto-save-file-name nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5089 ;; else
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5090 (ad-deactivate 'make-auto-save-file-name)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5091 (prog1
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5092 (tramp-run-real-handler 'make-auto-save-file-name nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5093 (ad-activate 'make-auto-save-file-name)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5094
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5095 (defvar tramp-handle-write-region-hook nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5096 "Normal hook to be run at the end of `tramp-handle-write-region'.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5097
105718
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
5098 ;; CCC grok LOCKNAME
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5099 (defun tramp-handle-write-region
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5100 (start end filename &optional append visit lockname confirm)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5101 "Like `write-region' for Tramp files."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5102 (setq filename (expand-file-name filename))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
5103 (with-parsed-tramp-file-name filename nil
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5104 ;; Following part commented out because we don't know what to do about
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5105 ;; file locking, and it does not appear to be a problem to ignore it.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5106 ;; Ange-ftp ignores it, too.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5107 ;; (when (and lockname (stringp lockname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5108 ;; (setq lockname (expand-file-name lockname)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5109 ;; (unless (or (eq lockname nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5110 ;; (string= lockname filename))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5111 ;; (error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5112 ;; "tramp-handle-write-region: LOCKNAME must be nil or equal FILENAME"))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
5113
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
5114 ;; XEmacs takes a coding system as the seventh argument, not `confirm'.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5115 (when (and (not (featurep 'xemacs)) confirm (file-exists-p filename))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5116 (unless (y-or-n-p (format "File %s exists; overwrite anyway? " filename))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5117 (tramp-error v 'file-error "File not overwritten")))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
5118
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
5119 (let ((uid (or (nth 2 (tramp-compat-file-attributes filename 'integer))
85508
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5120 (tramp-get-remote-uid v 'integer)))
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
5121 (gid (or (nth 3 (tramp-compat-file-attributes filename 'integer))
85508
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5122 (tramp-get-remote-gid v 'integer))))
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5123
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5124 (if (and (tramp-local-host-p v)
103782
c5225871ee78 * net/tramp.el (tramp-set-file-uid-gid): Handle the case the
Michael Albinus <michael.albinus@gmx.de>
parents: 103735
diff changeset
5125 ;; `file-writable-p' calls `file-expand-file-name'. We
94401
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
5126 ;; cannot use `tramp-run-real-handler' therefore.
ed7a07d27b12 * net/tramp.el (tramp-handle-make-symbolic-link)
Michael Albinus <michael.albinus@gmx.de>
parents: 94395
diff changeset
5127 (let (file-name-handler-alist)
95050
adc57176d5f1 * net/tramp.el (tramp-handle-write-region): Fix check for short
Michael Albinus <michael.albinus@gmx.de>
parents: 95025
diff changeset
5128 (and
adc57176d5f1 * net/tramp.el (tramp-handle-write-region): Fix check for short
Michael Albinus <michael.albinus@gmx.de>
parents: 95025
diff changeset
5129 (file-writable-p (file-name-directory localname))
adc57176d5f1 * net/tramp.el (tramp-handle-write-region): Fix check for short
Michael Albinus <michael.albinus@gmx.de>
parents: 95025
diff changeset
5130 (or (file-directory-p localname)
adc57176d5f1 * net/tramp.el (tramp-handle-write-region): Fix check for short
Michael Albinus <michael.albinus@gmx.de>
parents: 95025
diff changeset
5131 (file-writable-p localname)))))
85508
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5132 ;; Short track: if we are on the local host, we can run directly.
107170
1f564d6c5e1d * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix
Michael Albinus <michael.albinus@gmx.de>
parents: 107151
diff changeset
5133 (tramp-run-real-handler
1f564d6c5e1d * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix
Michael Albinus <michael.albinus@gmx.de>
parents: 107151
diff changeset
5134 'write-region
1f564d6c5e1d * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix
Michael Albinus <michael.albinus@gmx.de>
parents: 107151
diff changeset
5135 (list start end localname append 'no-message lockname confirm))
85508
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5136
108186
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5137 (let ((modes (save-excursion (tramp-default-file-modes filename)))
85508
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5138 ;; We use this to save the value of
108186
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5139 ;; `last-coding-system-used' after writing the tmp
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5140 ;; file. At the end of the function, we set
85508
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5141 ;; `last-coding-system-used' to this saved value. This
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5142 ;; way, any intermediary coding systems used while
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5143 ;; talking to the remote shell or suchlike won't hose
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5144 ;; this variable. This approach was snarfed from
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5145 ;; ange-ftp.el.
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5146 coding-system-used
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5147 ;; Write region into a tmp file. This isn't really
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5148 ;; needed if we use an encoding function, but currently
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5149 ;; we use it always because this makes the logic
105767
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
5150 ;; simpler.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
5151 (tmpfile (or tramp-temp-buffer-file-name
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
5152 (tramp-compat-make-temp-file filename))))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
5153
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
5154 ;; If `append' is non-nil, we copy the file locally, and let
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
5155 ;; the native `write-region' implementation do the job.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
5156 (when append (copy-file filename tmpfile 'ok))
85508
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5157
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5158 ;; We say `no-message' here because we don't want the
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5159 ;; visited file modtime data to be clobbered from the temp
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5160 ;; file. We call `set-visited-file-modtime' ourselves later
93938
3c06445e714c * net/tramp.el (tramp-find-file-name-coding-system-alist): New
Michael Albinus <michael.albinus@gmx.de>
parents: 93829
diff changeset
5161 ;; on. We must ensure that `file-coding-system-alist'
3c06445e714c * net/tramp.el (tramp-find-file-name-coding-system-alist): New
Michael Albinus <michael.albinus@gmx.de>
parents: 93829
diff changeset
5162 ;; matches `tmpfile'.
108186
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5163 (let (file-name-handler-alist
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5164 (file-coding-system-alist
93938
3c06445e714c * net/tramp.el (tramp-find-file-name-coding-system-alist): New
Michael Albinus <michael.albinus@gmx.de>
parents: 93829
diff changeset
5165 (tramp-find-file-name-coding-system-alist filename tmpfile)))
100922
2b84620022aa * net/tramp.el (tramp-handle-load)
Michael Albinus <michael.albinus@gmx.de>
parents: 100903
diff changeset
5166 (condition-case err
2b84620022aa * net/tramp.el (tramp-handle-load)
Michael Albinus <michael.albinus@gmx.de>
parents: 100903
diff changeset
5167 (tramp-run-real-handler
2b84620022aa * net/tramp.el (tramp-handle-load)
Michael Albinus <michael.albinus@gmx.de>
parents: 100903
diff changeset
5168 'write-region
2b84620022aa * net/tramp.el (tramp-handle-load)
Michael Albinus <michael.albinus@gmx.de>
parents: 100903
diff changeset
5169 (list start end tmpfile append 'no-message lockname confirm))
100930
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
5170 ((error quit)
105718
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
5171 (setq tramp-temp-buffer-file-name nil)
108816
94d1d8a6dcfd * net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents: 108806
diff changeset
5172 (delete-file tmpfile)
100930
7d332b05e8ac * net/tramp.el (tramp-do-copy-or-rename-file-directly)
Michael Albinus <michael.albinus@gmx.de>
parents: 100922
diff changeset
5173 (signal (car err) (cdr err))))
100922
2b84620022aa * net/tramp.el (tramp-handle-load)
Michael Albinus <michael.albinus@gmx.de>
parents: 100903
diff changeset
5174
93938
3c06445e714c * net/tramp.el (tramp-find-file-name-coding-system-alist): New
Michael Albinus <michael.albinus@gmx.de>
parents: 93829
diff changeset
5175 ;; Now, `last-coding-system-used' has the right value. Remember it.
3c06445e714c * net/tramp.el (tramp-find-file-name-coding-system-alist): New
Michael Albinus <michael.albinus@gmx.de>
parents: 93829
diff changeset
5176 (when (boundp 'last-coding-system-used)
3c06445e714c * net/tramp.el (tramp-find-file-name-coding-system-alist): New
Michael Albinus <michael.albinus@gmx.de>
parents: 93829
diff changeset
5177 (setq coding-system-used
3c06445e714c * net/tramp.el (tramp-find-file-name-coding-system-alist): New
Michael Albinus <michael.albinus@gmx.de>
parents: 93829
diff changeset
5178 (symbol-value 'last-coding-system-used))))
3c06445e714c * net/tramp.el (tramp-find-file-name-coding-system-alist): New
Michael Albinus <michael.albinus@gmx.de>
parents: 93829
diff changeset
5179
85508
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5180 ;; The permissions of the temporary file should be set. If
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5181 ;; filename does not exist (eq modes nil) it has been
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5182 ;; renamed to the backup file. This case `save-buffer'
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5183 ;; handles permissions.
107209
4a0ca858272e * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Protect
Michael Albinus <michael.albinus@gmx.de>
parents: 107190
diff changeset
5184 ;; Ensure, that it is still readable.
4a0ca858272e * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Protect
Michael Albinus <michael.albinus@gmx.de>
parents: 107190
diff changeset
5185 (when modes
4a0ca858272e * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Protect
Michael Albinus <michael.albinus@gmx.de>
parents: 107190
diff changeset
5186 (set-file-modes
4a0ca858272e * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Protect
Michael Albinus <michael.albinus@gmx.de>
parents: 107190
diff changeset
5187 tmpfile (logior (or modes 0) (tramp-octal-to-decimal "0400"))))
85508
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5188
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5189 ;; This is a bit lengthy due to the different methods
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5190 ;; possible for file transfer. First, we check whether the
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5191 ;; method uses an rcp program. If so, we call it.
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5192 ;; Otherwise, both encoding and decoding command must be
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5193 ;; specified. However, if the method _also_ specifies an
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5194 ;; encoding function, then that is used for encoding the
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5195 ;; contents of the tmp file.
108186
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5196 (let* ((size (nth 7 (file-attributes tmpfile)))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5197 (rem-dec (tramp-get-inline-coding v "remote-decoding" size))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5198 (loc-enc (tramp-get-inline-coding v "local-encoding" size)))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5199 (cond
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5200 ;; `copy-file' handles direct copy and out-of-band methods.
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5201 ((or (tramp-local-host-p v)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5202 (tramp-method-out-of-band-p v size))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5203 (if (and (not (stringp start))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5204 (= (or end (point-max)) (point-max))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5205 (= (or start (point-min)) (point-min))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5206 (tramp-get-method-parameter
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5207 method 'tramp-copy-keep-tmpfile))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5208 (progn
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5209 (setq tramp-temp-buffer-file-name tmpfile)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5210 (condition-case err
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5211 ;; We keep the local file for performance
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5212 ;; reasons, useful for "rsync".
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5213 (copy-file tmpfile filename t)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5214 ((error quit)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5215 (setq tramp-temp-buffer-file-name nil)
108816
94d1d8a6dcfd * net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents: 108806
diff changeset
5216 (delete-file tmpfile)
108186
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5217 (signal (car err) (cdr err)))))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5218 (setq tramp-temp-buffer-file-name nil)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5219 ;; Don't rename, in order to keep context in SELinux.
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5220 (unwind-protect
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5221 (copy-file tmpfile filename t)
108816
94d1d8a6dcfd * net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents: 108806
diff changeset
5222 (delete-file tmpfile))))
108186
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5223
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5224 ;; Use inline file transfer.
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5225 (rem-dec
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5226 ;; Encode tmpfile.
105907
9abdd578d117 * net/tramp.el (tramp-advice-make-auto-save-file-name)
Michael Albinus <michael.albinus@gmx.de>
parents: 105893
diff changeset
5227 (unwind-protect
108186
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5228 (with-temp-buffer
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5229 (set-buffer-multibyte nil)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5230 ;; Use encoding function or command.
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5231 (if (functionp loc-enc)
108540
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5232 (with-progress-reporter
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5233 v 3 (format "Encoding region using function `%s'"
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5234 loc-enc)
108186
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5235 (let ((coding-system-for-read 'binary))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5236 (insert-file-contents-literally tmpfile))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5237 ;; The following `let' is a workaround for the
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5238 ;; base64.el that comes with pgnus-0.84. If
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5239 ;; both of the following conditions are
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5240 ;; satisfied, it tries to write to a local
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5241 ;; file in default-directory, but at this
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5242 ;; point, default-directory is remote.
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5243 ;; (`call-process-region' can't write to
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5244 ;; remote files, it seems.) The file in
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5245 ;; question is a tmp file anyway.
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5246 (let ((default-directory
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5247 (tramp-compat-temporary-file-directory)))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5248 (funcall loc-enc (point-min) (point-max))))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5249
108540
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5250 (with-progress-reporter
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5251 v 3 (format "Encoding region using command `%s'"
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5252 loc-enc)
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5253 (unless (zerop (tramp-call-local-coding-command
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5254 loc-enc tmpfile t))
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5255 (tramp-error
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5256 v 'file-error
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5257 (concat "Cannot write to `%s', "
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5258 "local encoding command `%s' failed")
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5259 filename loc-enc))))
108186
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5260
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5261 ;; Send buffer into remote decoding command which
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5262 ;; writes to remote file. Because this happens on
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5263 ;; the remote host, we cannot use the function.
108540
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5264 (with-progress-reporter
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5265 v 3
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5266 (format "Decoding region into remote file %s" filename)
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5267 (goto-char (point-max))
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5268 (unless (bolp) (newline))
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5269 (tramp-send-command
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5270 v
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5271 (format
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5272 (concat rem-dec " <<'EOF'\n%sEOF")
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5273 (tramp-shell-quote-argument localname)
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5274 (buffer-string)))
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5275 (tramp-barf-unless-okay
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5276 v nil
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5277 "Couldn't write region to `%s', decode using `%s' failed"
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5278 filename rem-dec)
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5279 ;; When `file-precious-flag' is set, the region is
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5280 ;; written to a temporary file. Check that the
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5281 ;; checksum is equal to that from the local tmpfile.
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5282 (when file-precious-flag
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5283 (erase-buffer)
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5284 (and
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5285 ;; cksum runs locally, if possible.
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5286 (zerop (tramp-local-call-process "cksum" tmpfile t))
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5287 ;; cksum runs remotely.
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5288 (zerop
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5289 (tramp-send-command-and-check
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5290 v
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5291 (format
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5292 "cksum <%s"
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5293 (tramp-shell-quote-argument localname))))
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5294 ;; ... they are different.
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5295 (not
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5296 (string-equal
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5297 (buffer-string)
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5298 (with-current-buffer (tramp-get-buffer v)
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5299 (buffer-string))))
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5300 (tramp-error
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5301 v 'file-error
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5302 (concat "Couldn't write region to `%s',"
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5303 " decode using `%s' failed")
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
5304 filename rem-dec)))))
108186
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5305
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5306 ;; Save exit.
108816
94d1d8a6dcfd * net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents: 108806
diff changeset
5307 (delete-file tmpfile)))
108186
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5308
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5309 ;; That's not expected.
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5310 (t
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5311 (tramp-error
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5312 v 'file-error
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5313 (concat "Method `%s' should specify both encoding and "
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5314 "decoding command or an rcp program")
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
5315 method))))
85508
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5316
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5317 ;; Make `last-coding-system-used' have the right value.
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5318 (when coding-system-used
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
5319 (set 'last-coding-system-used coding-system-used))))
85041
a42b8750a992 * net/tramp.el (tramp-make-temp-file): Move to tramp-compat.el.
Michael Albinus <michael.albinus@gmx.de>
parents: 85024
diff changeset
5320
107170
1f564d6c5e1d * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix
Michael Albinus <michael.albinus@gmx.de>
parents: 107151
diff changeset
5321 (tramp-flush-file-property v (file-name-directory localname))
1f564d6c5e1d * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix
Michael Albinus <michael.albinus@gmx.de>
parents: 107151
diff changeset
5322 (tramp-flush-file-property v localname)
1f564d6c5e1d * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix
Michael Albinus <michael.albinus@gmx.de>
parents: 107151
diff changeset
5323
93040
ba82da0cb626 * net/tramp.el (tramp-root-regexp): Simplify.
Michael Albinus <michael.albinus@gmx.de>
parents: 93036
diff changeset
5324 ;; We must protect `last-coding-system-used', now we have set it
ba82da0cb626 * net/tramp.el (tramp-root-regexp): Simplify.
Michael Albinus <michael.albinus@gmx.de>
parents: 93036
diff changeset
5325 ;; to its correct value.
105767
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
5326 (let (last-coding-system-used (need-chown t))
93040
ba82da0cb626 * net/tramp.el (tramp-root-regexp): Simplify.
Michael Albinus <michael.albinus@gmx.de>
parents: 93036
diff changeset
5327 ;; Set file modification time.
ba82da0cb626 * net/tramp.el (tramp-root-regexp): Simplify.
Michael Albinus <michael.albinus@gmx.de>
parents: 93036
diff changeset
5328 (when (or (eq visit t) (stringp visit))
105767
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
5329 (let ((file-attr (file-attributes filename)))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
5330 (set-visited-file-modtime
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
5331 ;; We must pass modtime explicitely, because filename can
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
5332 ;; be different from (buffer-file-name), f.e. if
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
5333 ;; `file-precious-flag' is set.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
5334 (nth 5 file-attr))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
5335 (when (and (eq (nth 2 file-attr) uid)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
5336 (eq (nth 3 file-attr) gid))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
5337 (setq need-chown nil))))
93040
ba82da0cb626 * net/tramp.el (tramp-root-regexp): Simplify.
Michael Albinus <michael.albinus@gmx.de>
parents: 93036
diff changeset
5338
ba82da0cb626 * net/tramp.el (tramp-root-regexp): Simplify.
Michael Albinus <michael.albinus@gmx.de>
parents: 93036
diff changeset
5339 ;; Set the ownership.
105767
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
5340 (when need-chown
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
5341 (tramp-set-file-uid-gid filename uid gid))
93040
ba82da0cb626 * net/tramp.el (tramp-root-regexp): Simplify.
Michael Albinus <michael.albinus@gmx.de>
parents: 93036
diff changeset
5342 (when (or (eq visit t) (null visit) (stringp visit))
ba82da0cb626 * net/tramp.el (tramp-root-regexp): Simplify.
Michael Albinus <michael.albinus@gmx.de>
parents: 93036
diff changeset
5343 (tramp-message v 0 "Wrote %s" filename))
ba82da0cb626 * net/tramp.el (tramp-root-regexp): Simplify.
Michael Albinus <michael.albinus@gmx.de>
parents: 93036
diff changeset
5344 (run-hooks 'tramp-handle-write-region-hook)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5345
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5346 (defvar tramp-vc-registered-file-names nil
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5347 "List used to collect file names, which are checked during `vc-registered'.")
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5348
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5349 ;; VC backends check for the existence of various different special
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5350 ;; files. This is very time consuming, because every single check
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5351 ;; requires a remote command (the file cache must be invalidated).
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5352 ;; Therefore, we apply a kind of optimization. We install the file
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5353 ;; name handler `tramp-vc-file-name-handler', which does nothing but
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5354 ;; remembers all file names for which `file-exists-p' or
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5355 ;; `file-readable-p' has been applied. A first run of `vc-registered'
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5356 ;; is performed. Afterwards, a script is applied for all collected
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5357 ;; file names, using just one remote command. The result of this
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5358 ;; script is used to fill the file cache with actual values. Now we
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5359 ;; can reset the file name handlers, and we make a second run of
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5360 ;; `vc-registered', which returns the expected result without sending
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5361 ;; any other remote command.
102907
5055f4ba592b * net/tramp.el (tramp-file-name-handler-alist): Add
Michael Albinus <michael.albinus@gmx.de>
parents: 102851
diff changeset
5362 (defun tramp-handle-vc-registered (file)
5055f4ba592b * net/tramp.el (tramp-file-name-handler-alist): Add
Michael Albinus <michael.albinus@gmx.de>
parents: 102851
diff changeset
5363 "Like `vc-registered' for Tramp files."
108739
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5364 (with-temp-message ""
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5365 (with-parsed-tramp-file-name file nil
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5366 (with-progress-reporter
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5367 v 3 (format "Checking `vc-registered' for %s" file)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5368
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5369 ;; There could be new files, created by the vc backend. We
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5370 ;; cannot reuse the old cache entries, therefore.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5371 (let (tramp-vc-registered-file-names
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5372 (tramp-cache-inhibit-cache (current-time))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5373 (file-name-handler-alist
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5374 `((,tramp-file-name-regexp . tramp-vc-file-name-handler))))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5375
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5376 ;; Here we collect only file names, which need an operation.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5377 (tramp-run-real-handler 'vc-registered (list file))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5378 (tramp-message v 10 "\n%s" tramp-vc-registered-file-names)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5379
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5380 ;; Send just one command, in order to fill the cache.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5381 (when tramp-vc-registered-file-names
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5382 (tramp-maybe-send-script
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5383 v
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5384 (format tramp-vc-registered-read-file-names
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5385 (tramp-get-file-exists-command v)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5386 (format "%s -r" (tramp-get-test-command v)))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5387 "tramp_vc_registered_read_file_names")
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5388
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5389 (dolist
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5390 (elt
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5391 (tramp-send-command-and-read
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5392 v
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5393 (format
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5394 "tramp_vc_registered_read_file_names %s"
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5395 (mapconcat 'tramp-shell-quote-argument
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5396 tramp-vc-registered-file-names
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5397 " "))))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5398
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5399 (tramp-set-file-property
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5400 v (car elt) (cadr elt) (cadr (cdr elt))))))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5401
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5402 ;; Second run. Now all `file-exists-p' or `file-readable-p'
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5403 ;; calls shall be answered from the file cache. We unset
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5404 ;; `process-file-side-effects' in order to keep the cache when
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5405 ;; `process-file' calls appear.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5406 (let (process-file-side-effects)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
5407 (tramp-run-real-handler 'vc-registered (list file)))))))
102907
5055f4ba592b * net/tramp.el (tramp-file-name-handler-alist): Add
Michael Albinus <michael.albinus@gmx.de>
parents: 102851
diff changeset
5408
70318
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
5409 ;;;###autoload
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
5410 (progn (defun tramp-run-real-handler (operation args)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5411 "Invoke normal file name handler for OPERATION.
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
5412 First arg specifies the OPERATION, second arg is a list of arguments to
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
5413 pass to the OPERATION."
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5414 (let* ((inhibit-file-name-handlers
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5415 `(tramp-file-name-handler
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5416 tramp-vc-file-name-handler
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5417 tramp-completion-file-name-handler
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5418 cygwin-mount-name-hook-function
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5419 cygwin-mount-map-drive-hook-function
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5420 .
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5421 ,(and (eq inhibit-file-name-operation operation)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5422 inhibit-file-name-handlers)))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5423 (inhibit-file-name-operation operation))
70318
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
5424 (apply operation args))))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5425
70318
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
5426 ;;;###autoload
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
5427 (progn (defun tramp-completion-run-real-handler (operation args)
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5428 "Invoke `tramp-file-name-handler' for OPERATION.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5429 First arg specifies the OPERATION, second arg is a list of arguments to
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5430 pass to the OPERATION."
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5431 (let* ((inhibit-file-name-handlers
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5432 `(tramp-completion-file-name-handler
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5433 cygwin-mount-name-hook-function
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5434 cygwin-mount-map-drive-hook-function
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5435 .
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5436 ,(and (eq inhibit-file-name-operation operation)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5437 inhibit-file-name-handlers)))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5438 (inhibit-file-name-operation operation))
70318
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
5439 (apply operation args))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5440
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5441 ;; We handle here all file primitives. Most of them have the file
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5442 ;; name as first parameter; nevertheless we check for them explicitly
96361
a99299e4d2de American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents: 95967
diff changeset
5443 ;; in order to be signaled if a new primitive appears. This
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5444 ;; scenario is needed because there isn't a way to decide by
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5445 ;; syntactical means whether a foreign method must be called. It would
55844
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
5446 ;; ease the life if `file-name-handler-alist' would support a decision
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5447 ;; function as well but regexp only.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5448 (defun tramp-file-name-for-operation (operation &rest args)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5449 "Return file name related to OPERATION file primitive.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5450 ARGS are the arguments OPERATION has been called with."
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5451 (cond
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
5452 ;; FILE resp DIRECTORY.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5453 ((member operation
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5454 (list 'access-file 'byte-compiler-base-file-name 'delete-directory
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5455 'delete-file 'diff-latest-backup-file 'directory-file-name
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5456 'directory-files 'directory-files-and-attributes
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5457 'dired-compress-file 'dired-uncache
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5458 'file-accessible-directory-p 'file-attributes
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5459 'file-directory-p 'file-executable-p 'file-exists-p
108064
589643be353e * net/tramp.el (tramp-handle-copy-file): Add new optional
Michael Albinus <michael.albinus@gmx.de>
parents: 108059
diff changeset
5460 'file-local-copy 'file-remote-p 'file-modes
55844
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
5461 'file-name-as-directory 'file-name-directory
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
5462 'file-name-nondirectory 'file-name-sans-versions
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
5463 'file-ownership-preserved-p 'file-readable-p
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
5464 'file-regular-p 'file-symlink-p 'file-truename
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
5465 'file-writable-p 'find-backup-file-name 'find-file-noselect
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
5466 'get-file-buffer 'insert-directory 'insert-file-contents
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
5467 'load 'make-directory 'make-directory-internal
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
5468 'set-file-modes 'substitute-in-file-name
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
5469 'unhandled-file-name-directory 'vc-registered
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
5470 ;; Emacs 22+ only.
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
5471 'set-file-times
108064
589643be353e * net/tramp.el (tramp-handle-copy-file): Add new optional
Michael Albinus <michael.albinus@gmx.de>
parents: 108059
diff changeset
5472 ;; Emacs 24+ only.
589643be353e * net/tramp.el (tramp-handle-copy-file): Add new optional
Michael Albinus <michael.albinus@gmx.de>
parents: 108059
diff changeset
5473 'file-selinux-context 'set-file-selinux-context
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
5474 ;; XEmacs only.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5475 'abbreviate-file-name 'create-file-buffer
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5476 'dired-file-modtime 'dired-make-compressed-filename
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5477 'dired-recursive-delete-directory 'dired-set-file-modtime
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5478 'dired-shell-unhandle-file-name 'dired-uucode-file
95025
bdaea36b81dd * net/tramp.el: Load auth-source library.
Michael Albinus <michael.albinus@gmx.de>
parents: 94975
diff changeset
5479 'insert-file-contents-literally 'make-temp-name 'recover-file
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5480 'vm-imap-check-mail 'vm-pop-check-mail 'vm-spool-check-mail))
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
5481 (if (file-name-absolute-p (nth 0 args))
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
5482 (nth 0 args)
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
5483 (expand-file-name (nth 0 args))))
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
5484 ;; FILE DIRECTORY resp FILE1 FILE2.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5485 ((member operation
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5486 (list 'add-name-to-file 'copy-file 'expand-file-name
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5487 'file-name-all-completions 'file-name-completion
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5488 'file-newer-than-file-p 'make-symbolic-link 'rename-file
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
5489 ;; Emacs 23+ only.
105462
f6c5cf0fc0c9 * net/tramp.el (tramp-verbose): Fix docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 105351
diff changeset
5490 'copy-directory
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
5491 ;; XEmacs only.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5492 'dired-make-relative-symlink
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5493 'vm-imap-move-mail 'vm-pop-move-mail 'vm-spool-move-mail))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5494 (save-match-data
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5495 (cond
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5496 ((string-match tramp-file-name-regexp (nth 0 args)) (nth 0 args))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5497 ((string-match tramp-file-name-regexp (nth 1 args)) (nth 1 args))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5498 (t (buffer-file-name (current-buffer))))))
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
5499 ;; START END FILE.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5500 ((eq operation 'write-region)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5501 (nth 2 args))
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
5502 ;; BUFFER.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5503 ((member operation
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5504 (list 'set-visited-file-modtime 'verify-visited-file-modtime
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
5505 ;; Emacs 22+ only.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5506 'make-auto-save-file-name
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
5507 ;; XEmacs only.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5508 'backup-buffer))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5509 (buffer-file-name
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5510 (if (bufferp (nth 0 args)) (nth 0 args) (current-buffer))))
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
5511 ;; COMMAND.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5512 ((member operation
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
5513 (list ;; not in Emacs 23+.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5514 'dired-call-process
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
5515 ;; Emacs only.
60287
865aec6814c3 (tramp-file-name-for-operation): Fix misapplied
Andreas Schwab <schwab@suse.de>
parents: 60156
diff changeset
5516 'shell-command
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
5517 ;; Emacs 22+ only.
57653
b324ca4df07c * simple.el (process-file): New function, similar to call-process
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 57559
diff changeset
5518 'process-file
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
5519 ;; Emacs 23+ only.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5520 'start-file-process
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
5521 ;; XEmacs only.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5522 'dired-print-file 'dired-shell-call-process
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
5523 ;; nowhere yet.
108975
c4552014bea2 * net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents: 108817
diff changeset
5524 'executable-find 'start-process
c4552014bea2 * net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents: 108817
diff changeset
5525 'call-process 'call-process-region))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5526 default-directory)
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
5527 ;; Unknown file primitive.
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5528 (t (error "unknown file I/O primitive: %s" operation))))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5529
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5530 (defun tramp-find-foreign-file-name-handler (filename)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5531 "Return foreign file name handler if exists."
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
5532 (when (tramp-tramp-file-p filename)
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
5533 (let ((v (tramp-dissect-file-name filename t))
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
5534 (handler tramp-foreign-file-name-handler-alist)
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
5535 elt res)
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
5536 ;; When we are not fully sure that filename completion is safe,
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
5537 ;; we should not return a handler.
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
5538 (when (or (tramp-file-name-method v) (tramp-file-name-user v)
85089
8fb95bcda144 * net/tramp.el (tramp-find-foreign-file-name-handler): Check also
Michael Albinus <michael.albinus@gmx.de>
parents: 85067
diff changeset
5539 (and (tramp-file-name-host v)
8fb95bcda144 * net/tramp.el (tramp-find-foreign-file-name-handler): Check also
Michael Albinus <michael.albinus@gmx.de>
parents: 85067
diff changeset
5540 (not (member (tramp-file-name-host v)
8fb95bcda144 * net/tramp.el (tramp-find-foreign-file-name-handler): Check also
Michael Albinus <michael.albinus@gmx.de>
parents: 85067
diff changeset
5541 (mapcar 'car tramp-methods))))
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
5542 (not (tramp-completion-mode-p)))
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
5543 (while handler
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
5544 (setq elt (car handler)
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
5545 handler (cdr handler))
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
5546 (when (funcall (car elt) filename)
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
5547 (setq handler nil
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
5548 res (cdr elt))))
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
5549 res))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5550
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5551 ;; Main function.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5552 ;;;###autoload
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5553 (defun tramp-file-name-handler (operation &rest args)
51603
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
5554 "Invoke Tramp file name handler.
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
5555 Falls back to normal file name handler if no Tramp file name handler exists."
94436
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
5556 (if tramp-mode
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
5557 (save-match-data
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
5558 (let* ((filename
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
5559 (tramp-replace-environment-variables
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
5560 (apply 'tramp-file-name-for-operation operation args)))
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
5561 (completion (tramp-completion-mode-p))
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
5562 (foreign (tramp-find-foreign-file-name-handler filename)))
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
5563 (with-parsed-tramp-file-name filename nil
107870
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
5564 ;; Call the backend function.
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
5565 (if foreign
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
5566 (condition-case err
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
5567 (apply foreign operation args)
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
5568 (error
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
5569 (cond
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
5570 ;; When we are in completion mode, some failed
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
5571 ;; operations shall return at least a default
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
5572 ;; value in order to give the user a chance to
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
5573 ;; correct the file name in the minibuffer.
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
5574 ((and completion (zerop (length localname))
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
5575 (memq operation '(file-exists-p file-directory-p)))
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
5576 t)
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
5577 ((and completion (zerop (length localname))
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
5578 (memq operation
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
5579 '(expand-file-name file-name-as-directory)))
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
5580 filename)
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
5581 ;; Propagate the error.
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
5582 (t (signal (car err) (cdr err))))))
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
5583 ;; Nothing to do for us.
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
5584 (tramp-run-real-handler operation args)))))
973ae1d72536 * net/tramp.el (tramp-error-with-buffer): Don't show the
Michael Albinus <albinus@detlef>
parents: 107858
diff changeset
5585
94436
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
5586 ;; When `tramp-mode' is not enabled, we don't do anything.
0918f4a758d2 * net/tramp.el (tramp-mode): New defcustom.
Michael Albinus <michael.albinus@gmx.de>
parents: 94401
diff changeset
5587 (tramp-run-real-handler operation args)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5588
56460
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5589 ;; In Emacs, there is some concurrency due to timers. If a timer
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5590 ;; interrupts Tramp and wishes to use the same connection buffer as
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5591 ;; the "main" Emacs, then garbage might occur in the connection
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5592 ;; buffer. Therefore, we need to make sure that a timer does not use
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5593 ;; the same connection buffer as the "main" Emacs. We implement a
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5594 ;; cheap global lock, instead of locking each connection buffer
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5595 ;; separately. The global lock is based on two variables,
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5596 ;; `tramp-locked' and `tramp-locker'. `tramp-locked' is set to true
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5597 ;; (with setq) to indicate a lock. But Tramp also calls itself during
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5598 ;; processing of a single file operation, so we need to allow
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5599 ;; recursive calls. That's where the `tramp-locker' variable comes in
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5600 ;; -- it is let-bound to t during the execution of the current
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5601 ;; handler. So if `tramp-locked' is t and `tramp-locker' is also t,
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5602 ;; then we should just proceed because we have been called
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5603 ;; recursively. But if `tramp-locker' is nil, then we are a timer
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5604 ;; interrupting the "main" Emacs, and then we signal an error.
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5605
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5606 (defvar tramp-locked nil
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5607 "If non-nil, then Tramp is currently busy.
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5608 Together with `tramp-locker', this implements a locking mechanism
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5609 preventing reentrant calls of Tramp.")
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5610
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5611 (defvar tramp-locker nil
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5612 "If non-nil, then a caller has locked Tramp.
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5613 Together with `tramp-locked', this implements a locking mechanism
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5614 preventing reentrant calls of Tramp.")
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5615
51603
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
5616 (defun tramp-sh-file-name-handler (operation &rest args)
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
5617 "Invoke remote-shell Tramp file name handler.
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
5618 Fall back to normal file name handler if no Tramp handler exists."
56460
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5619 (when (and tramp-locked (not tramp-locker))
95963
a20bb74ebe03 * net/tramp.el (tramp-handle-start-file-process): Clear
Michael Albinus <michael.albinus@gmx.de>
parents: 95659
diff changeset
5620 (setq tramp-locked nil)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5621 (signal 'file-error (list "Forbidden reentrant call of Tramp")))
56460
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5622 (let ((tl tramp-locked))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5623 (unwind-protect
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5624 (progn
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5625 (setq tramp-locked t)
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5626 (let ((tramp-locker t))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5627 (save-match-data
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5628 (let ((fn (assoc operation tramp-file-name-handler-alist)))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5629 (if fn
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5630 (apply (cdr fn) args)
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5631 (tramp-run-real-handler operation args))))))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
5632 (setq tramp-locked tl))))
51603
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
5633
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5634 (defun tramp-vc-file-name-handler (operation &rest args)
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5635 "Invoke special file name handler, which collects files to be handled."
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5636 (save-match-data
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5637 (let ((filename
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5638 (tramp-replace-environment-variables
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5639 (apply 'tramp-file-name-for-operation operation args)))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5640 (fn (assoc operation tramp-file-name-handler-alist)))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5641 (with-parsed-tramp-file-name filename nil
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5642 (cond
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5643 ;; That's what we want: file names, for which checks are
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5644 ;; applied. We assume, that VC uses only `file-exists-p' and
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5645 ;; `file-readable-p' checks; otherwise we must extend the
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5646 ;; list. We do not perform any action, but return nil, in
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5647 ;; order to keep `vc-registered' running.
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5648 ((and fn (memq operation '(file-exists-p file-readable-p)))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5649 (add-to-list 'tramp-vc-registered-file-names localname 'append)
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5650 nil)
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5651 ;; Tramp file name handlers like `expand-file-name'. They
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5652 ;; must still work.
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5653 (fn
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5654 (save-match-data (apply (cdr fn) args)))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5655 ;; Default file name handlers, we don't care.
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5656 (t (tramp-run-real-handler operation args)))))))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
5657
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5658 ;;;###autoload
70255
d57fb8c98714 * net/tramp.el (tramp-completion-file-name-handler): Disable
Michael Albinus <michael.albinus@gmx.de>
parents: 70191
diff changeset
5659 (progn (defun tramp-completion-file-name-handler (operation &rest args)
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
5660 "Invoke Tramp file name completion handler.
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
5661 Falls back to normal file name handler if no Tramp file name handler exists."
93040
ba82da0cb626 * net/tramp.el (tramp-root-regexp): Simplify.
Michael Albinus <michael.albinus@gmx.de>
parents: 93036
diff changeset
5662 ;; We bind `directory-sep-char' here for XEmacs on Windows, which
ba82da0cb626 * net/tramp.el (tramp-root-regexp): Simplify.
Michael Albinus <michael.albinus@gmx.de>
parents: 93036
diff changeset
5663 ;; would otherwise use backslash.
93082
7e079018403b * net/tramp.el (tramp-let-maybe): Removed.
Michael Albinus <michael.albinus@gmx.de>
parents: 93062
diff changeset
5664 (let ((directory-sep-char ?/)
7e079018403b * net/tramp.el (tramp-let-maybe): Removed.
Michael Albinus <michael.albinus@gmx.de>
parents: 93062
diff changeset
5665 (fn (assoc operation tramp-completion-file-name-handler-alist)))
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5666 (if (and
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5667 ;; When `tramp-mode' is not enabled, we don't do anything.
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5668 fn tramp-mode
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5669 ;; For other syntaxes than `sep', the regexp matches many common
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5670 ;; situations where the user doesn't actually want to use Tramp.
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5671 ;; So to avoid autoloading Tramp after typing just "/s", we
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5672 ;; disable this part of the completion, unless the user implicitly
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5673 ;; indicated his interest in using a fancier completion system.
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5674 (or (eq tramp-syntax 'sep)
108066
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
5675 (featurep 'tramp) ;; If it's loaded, we may as well use it.
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
5676 ;; `partial-completion-mode' does not exist in XEmacs.
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
5677 ;; It is obsoleted with Emacs 24.1.
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
5678 (and (boundp 'partial-completion-mode)
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
5679 (symbol-value 'partial-completion-mode))
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5680 ;; FIXME: These may have been loaded even if the user never
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5681 ;; intended to use them.
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5682 (featurep 'ido)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5683 (featurep 'icicles)))
93082
7e079018403b * net/tramp.el (tramp-let-maybe): Removed.
Michael Albinus <michael.albinus@gmx.de>
parents: 93062
diff changeset
5684 (save-match-data (apply (cdr fn) args))
7e079018403b * net/tramp.el (tramp-let-maybe): Removed.
Michael Albinus <michael.albinus@gmx.de>
parents: 93062
diff changeset
5685 (tramp-completion-run-real-handler operation args)))))
70318
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
5686
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5687 ;;;###autoload
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5688 (progn (defun tramp-register-file-name-handlers ()
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5689 "Add Tramp file name handlers to `file-name-handler-alist'."
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5690 ;; Remove autoloaded handlers from file name handler alist. Useful,
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5691 ;; if `tramp-syntax' has been changed.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5692 (let ((a1 (rassq 'tramp-file-name-handler file-name-handler-alist)))
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5693 (setq file-name-handler-alist (delq a1 file-name-handler-alist)))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5694 (let ((a1 (rassq
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5695 'tramp-completion-file-name-handler file-name-handler-alist)))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5696 (setq file-name-handler-alist (delq a1 file-name-handler-alist)))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5697 ;; Add the handlers.
70318
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
5698 (add-to-list 'file-name-handler-alist
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
5699 (cons tramp-file-name-regexp 'tramp-file-name-handler))
107040
5555e86608c1 * net/ange-ftp.el (ange-ftp-insert-directory): Handle the case,
Michael Albinus <albinus@detlef>
parents: 107021
diff changeset
5700 (put 'tramp-file-name-handler 'safe-magic t)
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5701 (add-to-list 'file-name-handler-alist
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5702 (cons tramp-completion-file-name-regexp
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5703 'tramp-completion-file-name-handler))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5704 (put 'tramp-completion-file-name-handler 'safe-magic t)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5705 ;; If jka-compr or epa-file are already loaded, move them to the
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5706 ;; front of `file-name-handler-alist'.
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5707 (dolist (fnh '(epa-file-handler jka-compr-handler))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5708 (let ((entry (rassoc fnh file-name-handler-alist)))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5709 (when entry
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5710 (setq file-name-handler-alist
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5711 (cons entry (delete entry file-name-handler-alist))))))))
76846
d55ab93ab5bf * net/tramp.el (tramp-register-file-name-handler)
Michael Albinus <michael.albinus@gmx.de>
parents: 76326
diff changeset
5712
d55ab93ab5bf * net/tramp.el (tramp-register-file-name-handler)
Michael Albinus <michael.albinus@gmx.de>
parents: 76326
diff changeset
5713 ;; `tramp-file-name-handler' must be registered before evaluation of
d55ab93ab5bf * net/tramp.el (tramp-register-file-name-handler)
Michael Albinus <michael.albinus@gmx.de>
parents: 76326
diff changeset
5714 ;; site-start and init files, because there might exist remote files
d55ab93ab5bf * net/tramp.el (tramp-register-file-name-handler)
Michael Albinus <michael.albinus@gmx.de>
parents: 76326
diff changeset
5715 ;; already, f.e. files kept via recentf-mode.
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5716 ;;;###autoload(tramp-register-file-name-handlers)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
5717 (tramp-register-file-name-handlers)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5718
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
5719 ;;;###autoload
70191
3a3093f77da8 * net/tramp.el (tramp-register-file-name-handlers): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 70073
diff changeset
5720 (defun tramp-unload-file-name-handlers ()
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
5721 (setq file-name-handler-alist
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
5722 (delete (rassoc 'tramp-file-name-handler
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
5723 file-name-handler-alist)
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
5724 (delete (rassoc 'tramp-completion-file-name-handler
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
5725 file-name-handler-alist)
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
5726 file-name-handler-alist))))
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
5727
70191
3a3093f77da8 * net/tramp.el (tramp-register-file-name-handlers): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 70073
diff changeset
5728 (add-hook 'tramp-unload-hook 'tramp-unload-file-name-handlers)
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
5729
87648
7ae99e295dfd * vc-git.el (vc-git--call): Apply `process-file' instead of
Michael Albinus <michael.albinus@gmx.de>
parents: 87368
diff changeset
5730 ;;; File name handler functions for completion mode:
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5731
66496
63563507d684 (tramp-completion-mode): defvar moved up.
Richard M. Stallman <rms@gnu.org>
parents: 66135
diff changeset
5732 (defvar tramp-completion-mode nil
78997
ef0a2673bf5e * net/tramp.el (tramp-completion-mode): Extend doc-string.
Michael Albinus <michael.albinus@gmx.de>
parents: 78887
diff changeset
5733 "If non-nil, external packages signal that they are in file name completion.
ef0a2673bf5e * net/tramp.el (tramp-completion-mode): Extend doc-string.
Michael Albinus <michael.albinus@gmx.de>
parents: 78887
diff changeset
5734
ef0a2673bf5e * net/tramp.el (tramp-completion-mode): Extend doc-string.
Michael Albinus <michael.albinus@gmx.de>
parents: 78887
diff changeset
5735 This is necessary, because Tramp uses a heuristic depending on last
ef0a2673bf5e * net/tramp.el (tramp-completion-mode): Extend doc-string.
Michael Albinus <michael.albinus@gmx.de>
parents: 78887
diff changeset
5736 input event. This fails when external packages use other characters
ef0a2673bf5e * net/tramp.el (tramp-completion-mode): Extend doc-string.
Michael Albinus <michael.albinus@gmx.de>
parents: 78887
diff changeset
5737 but <TAB>, <SPACE> or ?\\? for file name completion. This variable
ef0a2673bf5e * net/tramp.el (tramp-completion-mode): Extend doc-string.
Michael Albinus <michael.albinus@gmx.de>
parents: 78887
diff changeset
5738 should never be set globally, the intention is to let-bind it.")
66496
63563507d684 (tramp-completion-mode): defvar moved up.
Richard M. Stallman <rms@gnu.org>
parents: 66135
diff changeset
5739
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5740 ;; Necessary because `tramp-file-name-regexp-unified' and
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5741 ;; `tramp-completion-file-name-regexp-unified' aren't different. If
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5742 ;; nil, `tramp-completion-run-real-handler' is called (i.e. forwarding
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5743 ;; to `tramp-file-name-handler'). Otherwise, it takes
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5744 ;; `tramp-run-real-handler'. Using `last-input-event' is a little bit
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5745 ;; risky, because completing a file might require loading other files,
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5746 ;; like "~/.netrc", and for them it shouldn't be decided based on that
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5747 ;; variable. On the other hand, those files shouldn't have partial
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
5748 ;; Tramp file name syntax. Maybe another variable should be introduced
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
5749 ;; overwriting this check in such cases. Or we change Tramp file name
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5750 ;; syntax in order to avoid ambiguities, like in XEmacs ...
84833
b8f420afb6df * net/tramp.el (tramp-completion-mode-p): Rename from
Michael Albinus <michael.albinus@gmx.de>
parents: 84739
diff changeset
5751 (defun tramp-completion-mode-p ()
108066
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
5752 "Check, whether method / user name / host name completion is active."
84833
b8f420afb6df * net/tramp.el (tramp-completion-mode-p): Rename from
Michael Albinus <michael.albinus@gmx.de>
parents: 84739
diff changeset
5753 (or
107858
57532220127a Fix Bug#5840.
Michael Albinus <albinus@detlef>
parents: 107822
diff changeset
5754 ;; Signal from outside. `non-essential' has been introduced in Emacs 24.
57532220127a Fix Bug#5840.
Michael Albinus <albinus@detlef>
parents: 107822
diff changeset
5755 (and (boundp 'non-essential) (symbol-value 'non-essential))
85067
4636000015c5 * net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
5756 tramp-completion-mode
4636000015c5 * net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
5757 ;; Emacs.
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
5758 (equal last-input-event 'tab)
84833
b8f420afb6df * net/tramp.el (tramp-completion-mode-p): Rename from
Michael Albinus <michael.albinus@gmx.de>
parents: 84739
diff changeset
5759 (and (natnump last-input-event)
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
5760 (or
85067
4636000015c5 * net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
5761 ;; ?\t has event-modifier 'control.
93036
50a5f7c885c1 (tramp-completion-mode-p): Don't use char-equal for
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92982
diff changeset
5762 (equal last-input-event ?\t)
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
5763 (and (not (event-modifiers last-input-event))
93036
50a5f7c885c1 (tramp-completion-mode-p): Don't use char-equal for
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92982
diff changeset
5764 (or (equal last-input-event ?\?)
50a5f7c885c1 (tramp-completion-mode-p): Don't use char-equal for
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92982
diff changeset
5765 (equal last-input-event ?\ )))))
85067
4636000015c5 * net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
5766 ;; XEmacs.
84833
b8f420afb6df * net/tramp.el (tramp-completion-mode-p): Rename from
Michael Albinus <michael.albinus@gmx.de>
parents: 84739
diff changeset
5767 (and (featurep 'xemacs)
b8f420afb6df * net/tramp.el (tramp-completion-mode-p): Rename from
Michael Albinus <michael.albinus@gmx.de>
parents: 84739
diff changeset
5768 ;; `last-input-event' might be nil.
b8f420afb6df * net/tramp.el (tramp-completion-mode-p): Rename from
Michael Albinus <michael.albinus@gmx.de>
parents: 84739
diff changeset
5769 (not (null last-input-event))
b8f420afb6df * net/tramp.el (tramp-completion-mode-p): Rename from
Michael Albinus <michael.albinus@gmx.de>
parents: 84739
diff changeset
5770 ;; `last-input-event' may have no character approximation.
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
5771 (tramp-compat-funcall 'event-to-character last-input-event)
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
5772 (or
85067
4636000015c5 * net/tramp.el (top): Move loading of tramp-util.el and
Michael Albinus <michael.albinus@gmx.de>
parents: 85041
diff changeset
5773 ;; ?\t has event-modifier 'control.
93036
50a5f7c885c1 (tramp-completion-mode-p): Don't use char-equal for
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92982
diff changeset
5774 (equal
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
5775 (tramp-compat-funcall 'event-to-character last-input-event) ?\t)
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
5776 (and (not (event-modifiers last-input-event))
93036
50a5f7c885c1 (tramp-completion-mode-p): Don't use char-equal for
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92982
diff changeset
5777 (or (equal
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
5778 (tramp-compat-funcall 'event-to-character last-input-event)
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
5779 ?\?)
93036
50a5f7c885c1 (tramp-completion-mode-p): Don't use char-equal for
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92982
diff changeset
5780 (equal
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
5781 (tramp-compat-funcall 'event-to-character last-input-event)
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
5782 ?\ )))))))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5783
108033
1545dcb1c3b7 Fix Bug#5840.
Michael Albinus <albinus@detlef>
parents: 108011
diff changeset
5784 (defun tramp-connectable-p (filename)
1545dcb1c3b7 Fix Bug#5840.
Michael Albinus <albinus@detlef>
parents: 108011
diff changeset
5785 "Check, whether it is possible to connect the remote host w/o side-effects.
1545dcb1c3b7 Fix Bug#5840.
Michael Albinus <albinus@detlef>
parents: 108011
diff changeset
5786 This is true, if either the remote host is already connected, or if we are
1545dcb1c3b7 Fix Bug#5840.
Michael Albinus <albinus@detlef>
parents: 108011
diff changeset
5787 not in completion mode."
1545dcb1c3b7 Fix Bug#5840.
Michael Albinus <albinus@detlef>
parents: 108011
diff changeset
5788 (and (tramp-tramp-file-p filename)
1545dcb1c3b7 Fix Bug#5840.
Michael Albinus <albinus@detlef>
parents: 108011
diff changeset
5789 (with-parsed-tramp-file-name filename nil
1545dcb1c3b7 Fix Bug#5840.
Michael Albinus <albinus@detlef>
parents: 108011
diff changeset
5790 (or (get-buffer (tramp-buffer-name v))
1545dcb1c3b7 Fix Bug#5840.
Michael Albinus <albinus@detlef>
parents: 108011
diff changeset
5791 (not (tramp-completion-mode-p))))))
1545dcb1c3b7 Fix Bug#5840.
Michael Albinus <albinus@detlef>
parents: 108011
diff changeset
5792
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5793 ;; Method, host name and user name completion.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5794 ;; `tramp-completion-dissect-file-name' returns a list of
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5795 ;; tramp-file-name structures. For all of them we return possible completions.
70318
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
5796 ;;;###autoload
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5797 (defun tramp-completion-handle-file-name-all-completions (filename directory)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5798 "Like `file-name-all-completions' for partial Tramp files."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5799
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5800 (let* ((fullname (tramp-drop-volume-letter
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5801 (expand-file-name filename directory)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5802 ;; Possible completion structures.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5803 (v (tramp-completion-dissect-file-name fullname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5804 result result1)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5805
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5806 (while v
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5807 (let* ((car (car v))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5808 (method (tramp-file-name-method car))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5809 (user (tramp-file-name-user car))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5810 (host (tramp-file-name-host car))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5811 (localname (tramp-file-name-localname car))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5812 (m (tramp-find-method method user host))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5813 (tramp-current-user user) ; see `tramp-parse-passwd'
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5814 all-user-hosts)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5815
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5816 (unless localname ;; Nothing to complete.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5817
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5818 (if (or user host)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5819
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5820 ;; Method dependent user / host combinations.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5821 (progn
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
5822 (mapc
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5823 (lambda (x)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5824 (setq all-user-hosts
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5825 (append all-user-hosts
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5826 (funcall (nth 0 x) (nth 1 x)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5827 (tramp-get-completion-function m))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5828
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
5829 (setq result
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
5830 (append result
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
5831 (mapcar
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
5832 (lambda (x)
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
5833 (tramp-get-completion-user-host
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
5834 method user host (nth 0 x) (nth 1 x)))
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
5835 (delq nil all-user-hosts)))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5836
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5837 ;; Possible methods.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5838 (setq result
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5839 (append result (tramp-get-completion-methods m)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5840
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5841 (setq v (cdr v))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5842
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5843 ;; Unify list, remove nil elements.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5844 (while result
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5845 (let ((car (car result)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5846 (when car
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5847 (add-to-list
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5848 'result1
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5849 (substring car (length (tramp-drop-volume-letter directory)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5850 (setq result (cdr result))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5851
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5852 ;; Complete local parts.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5853 (append
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5854 result1
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5855 (condition-case nil
108059
6469bf1a3a10 * net/tramp.el(tramp-completion-handle-file-name-all-completions):
Michael Albinus <albinus@detlef>
parents: 108033
diff changeset
5856 (apply (if (tramp-connectable-p fullname)
6469bf1a3a10 * net/tramp.el(tramp-completion-handle-file-name-all-completions):
Michael Albinus <albinus@detlef>
parents: 108033
diff changeset
5857 'tramp-completion-run-real-handler
6469bf1a3a10 * net/tramp.el(tramp-completion-handle-file-name-all-completions):
Michael Albinus <albinus@detlef>
parents: 108033
diff changeset
5858 'tramp-run-real-handler)
6469bf1a3a10 * net/tramp.el(tramp-completion-handle-file-name-all-completions):
Michael Albinus <albinus@detlef>
parents: 108033
diff changeset
5859 'file-name-all-completions (list (list filename directory)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5860 (error nil)))))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5861
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5862 ;; Method, host name and user name completion for a file.
70318
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
5863 ;;;###autoload
74766
ca4412906dbd * net/ange-ftp.el (ange-ftp-file-name-completion): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 74739
diff changeset
5864 (defun tramp-completion-handle-file-name-completion
ca4412906dbd * net/ange-ftp.el (ange-ftp-file-name-completion): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 74739
diff changeset
5865 (filename directory &optional predicate)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5866 "Like `file-name-completion' for Tramp files."
74766
ca4412906dbd * net/ange-ftp.el (ange-ftp-file-name-completion): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 74739
diff changeset
5867 (try-completion
ca4412906dbd * net/ange-ftp.el (ange-ftp-file-name-completion): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 74739
diff changeset
5868 filename
ca4412906dbd * net/ange-ftp.el (ange-ftp-file-name-completion): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 74739
diff changeset
5869 (mapcar 'list (file-name-all-completions filename directory))
108033
1545dcb1c3b7 Fix Bug#5840.
Michael Albinus <albinus@detlef>
parents: 108011
diff changeset
5870 (when (and predicate
1545dcb1c3b7 Fix Bug#5840.
Michael Albinus <albinus@detlef>
parents: 108011
diff changeset
5871 (tramp-connectable-p (expand-file-name filename directory)))
74777
948c86bf6396 * net/tramp.el (tramp-default-method): We still need to check for
Michael Albinus <michael.albinus@gmx.de>
parents: 74766
diff changeset
5872 (lambda (x) (funcall predicate (expand-file-name (car x) directory))))))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5873
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5874 ;; I misuse a little bit the tramp-file-name structure in order to handle
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5875 ;; completion possibilities for partial methods / user names / host names.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5876 ;; Return value is a list of tramp-file-name structures according to possible
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5877 ;; completions. If "localname" is non-nil it means there
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5878 ;; shouldn't be a completion anymore.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5879
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5880 ;; Expected results:
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5881
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5882 ;; "/x" "/[x" "/x@" "/[x@" "/x@y" "/[x@y"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5883 ;; [nil nil "x" nil] [nil "x" nil nil] [nil "x" "y" nil]
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5884 ;; [nil "x" nil nil]
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5885 ;; ["x" nil nil nil]
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5886
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5887 ;; "/x:" "/x:y" "/x:y:"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5888 ;; [nil nil "x" ""] [nil nil "x" "y"] ["x" nil "y" ""]
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5889 ;; "/[x/" "/[x/y"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5890 ;; ["x" nil "" nil] ["x" nil "y" nil]
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5891 ;; ["x" "" nil nil] ["x" "y" nil nil]
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5892
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5893 ;; "/x:y@" "/x:y@z" "/x:y@z:"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5894 ;; [nil nil "x" "y@"] [nil nil "x" "y@z"] ["x" "y" "z" ""]
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5895 ;; "/[x/y@" "/[x/y@z"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5896 ;; ["x" nil "y" nil] ["x" "y" "z" nil]
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5897 (defun tramp-completion-dissect-file-name (name)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5898 "Returns a list of `tramp-file-name' structures.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5899 They are collected by `tramp-completion-dissect-file-name1'."
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5900
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5901 (let* ((result)
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5902 (x-nil "\\|\\(\\)")
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5903 (tramp-completion-ipv6-regexp
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5904 (format
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5905 "[^%s]*"
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5906 (if (zerop (length tramp-postfix-ipv6-format))
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5907 tramp-postfix-host-format
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5908 tramp-postfix-ipv6-format)))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5909 ;; "/method" "/[method"
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5910 (tramp-completion-file-name-structure1
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5911 (list (concat tramp-prefix-regexp "\\(" tramp-method-regexp x-nil "\\)$")
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5912 1 nil nil nil))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5913 ;; "/user" "/[user"
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5914 (tramp-completion-file-name-structure2
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5915 (list (concat tramp-prefix-regexp "\\(" tramp-user-regexp x-nil "\\)$")
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5916 nil 1 nil nil))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5917 ;; "/host" "/[host"
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5918 (tramp-completion-file-name-structure3
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5919 (list (concat tramp-prefix-regexp "\\(" tramp-host-regexp x-nil "\\)$")
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5920 nil nil 1 nil))
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5921 ;; "/[ipv6" "/[ipv6"
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5922 (tramp-completion-file-name-structure4
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5923 (list (concat tramp-prefix-regexp
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5924 tramp-prefix-ipv6-regexp
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5925 "\\(" tramp-completion-ipv6-regexp x-nil "\\)$")
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5926 nil nil 1 nil))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5927 ;; "/user@host" "/[user@host"
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5928 (tramp-completion-file-name-structure5
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5929 (list (concat tramp-prefix-regexp
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5930 "\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5931 "\\(" tramp-host-regexp x-nil "\\)$")
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5932 nil 1 2 nil))
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5933 ;; "/user@[ipv6" "/[user@ipv6"
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5934 (tramp-completion-file-name-structure6
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5935 (list (concat tramp-prefix-regexp
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5936 "\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5937 tramp-prefix-ipv6-regexp
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5938 "\\(" tramp-completion-ipv6-regexp x-nil "\\)$")
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5939 nil 1 2 nil))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5940 ;; "/method:user" "/[method/user" "/method://user"
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5941 (tramp-completion-file-name-structure7
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5942 (list (concat tramp-prefix-regexp
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5943 "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5944 "\\(" tramp-user-regexp x-nil "\\)$")
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5945 1 2 nil nil))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5946 ;; "/method:host" "/[method/host" "/method://host"
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5947 (tramp-completion-file-name-structure8
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5948 (list (concat tramp-prefix-regexp
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5949 "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5950 "\\(" tramp-host-regexp x-nil "\\)$")
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5951 1 nil 2 nil))
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5952 ;; "/method:[ipv6" "/[method/ipv6" "/method://[ipv6"
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5953 (tramp-completion-file-name-structure9
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5954 (list (concat tramp-prefix-regexp
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5955 "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5956 tramp-prefix-ipv6-regexp
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5957 "\\(" tramp-completion-ipv6-regexp x-nil "\\)$")
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5958 1 nil 2 nil))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5959 ;; "/method:user@host" "/[method/user@host" "/method://user@host"
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5960 (tramp-completion-file-name-structure10
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5961 (list (concat tramp-prefix-regexp
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5962 "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5963 "\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5964 "\\(" tramp-host-regexp x-nil "\\)$")
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5965 1 2 3 nil))
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5966 ;; "/method:user@[ipv6" "/[method/user@ipv6" "/method://user@[ipv6"
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5967 (tramp-completion-file-name-structure11
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5968 (list (concat tramp-prefix-regexp
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5969 "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5970 "\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5971 tramp-prefix-ipv6-regexp
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5972 "\\(" tramp-completion-ipv6-regexp x-nil "\\)$")
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5973 1 2 3 nil))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5974 ;; "/method: "/method:/"
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5975 (tramp-completion-file-name-structure12
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5976 (list
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5977 (if (equal tramp-syntax 'url)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5978 (concat tramp-prefix-regexp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5979 "\\(" tramp-method-regexp "\\)"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5980 "\\(" (substring tramp-postfix-method-regexp 0 1)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5981 "\\|" (substring tramp-postfix-method-regexp 1 2) "\\)"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5982 "\\(" "\\)$")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5983 ;; Should not match if not URL syntax.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5984 (concat tramp-prefix-regexp "/$"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5985 1 3 nil nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5986 ;; "/method: "/method:/"
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
5987 (tramp-completion-file-name-structure13
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5988 (list
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5989 (if (equal tramp-syntax 'url)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5990 (concat tramp-prefix-regexp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5991 "\\(" tramp-method-regexp "\\)"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5992 "\\(" (substring tramp-postfix-method-regexp 0 1)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5993 "\\|" (substring tramp-postfix-method-regexp 1 2) "\\)"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5994 "\\(" "\\)$")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5995 ;; Should not match if not URL syntax.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5996 (concat tramp-prefix-regexp "/$"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5997 1 nil 3 nil)))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
5998
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
5999 (mapc (lambda (regexp)
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6000 (add-to-list 'result
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6001 (tramp-completion-dissect-file-name1 regexp name)))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6002 (list
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6003 tramp-completion-file-name-structure1
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6004 tramp-completion-file-name-structure2
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6005 tramp-completion-file-name-structure3
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6006 tramp-completion-file-name-structure4
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6007 tramp-completion-file-name-structure5
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6008 tramp-completion-file-name-structure6
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6009 tramp-completion-file-name-structure7
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6010 tramp-completion-file-name-structure8
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6011 tramp-completion-file-name-structure9
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
6012 tramp-completion-file-name-structure10
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
6013 tramp-completion-file-name-structure11
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
6014 tramp-completion-file-name-structure12
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
6015 tramp-completion-file-name-structure13
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6016 tramp-file-name-structure))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6017
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6018 (delq nil result)))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6019
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6020 (defun tramp-completion-dissect-file-name1 (structure name)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6021 "Returns a `tramp-file-name' structure matching STRUCTURE.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6022 The structure consists of remote method, remote user,
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
6023 remote host and localname (filename on remote host)."
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6024
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6025 (save-match-data
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6026 (when (string-match (nth 0 structure) name)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6027 (let ((method (and (nth 1 structure)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6028 (match-string (nth 1 structure) name)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6029 (user (and (nth 2 structure)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6030 (match-string (nth 2 structure) name)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6031 (host (and (nth 3 structure)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6032 (match-string (nth 3 structure) name)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6033 (localname (and (nth 4 structure)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6034 (match-string (nth 4 structure) name))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6035 (vector method user host localname)))))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6036
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6037 ;; This function returns all possible method completions, adding the
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6038 ;; trailing method delimeter.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6039 (defun tramp-get-completion-methods (partial-method)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6040 "Returns all method completions for PARTIAL-METHOD."
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
6041 (mapcar
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
6042 (lambda (method)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
6043 (and method
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
6044 (string-match (concat "^" (regexp-quote partial-method)) method)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6045 (tramp-completion-make-tramp-file-name method nil nil nil)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6046 (mapcar 'car tramp-methods)))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6047
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6048 ;; Compares partial user and host names with possible completions.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6049 (defun tramp-get-completion-user-host (method partial-user partial-host user host)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6050 "Returns the most expanded string for user and host name completion.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6051 PARTIAL-USER must match USER, PARTIAL-HOST must match HOST."
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6052 (cond
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6053
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6054 ((and partial-user partial-host)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6055 (if (and host
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6056 (string-match (concat "^" (regexp-quote partial-host)) host)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6057 (string-equal partial-user (or user partial-user)))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6058 (setq user partial-user)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6059 (setq user nil
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6060 host nil)))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6061
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6062 (partial-user
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6063 (setq host nil)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6064 (unless
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6065 (and user (string-match (concat "^" (regexp-quote partial-user)) user))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6066 (setq user nil)))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6067
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6068 (partial-host
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6069 (setq user nil)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6070 (unless
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6071 (and host (string-match (concat "^" (regexp-quote partial-host)) host))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6072 (setq host nil)))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6073
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6074 (t (setq user nil
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6075 host nil)))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6076
47578
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6077 (unless (zerop (+ (length user) (length host)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6078 (tramp-completion-make-tramp-file-name method user host nil)))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6079
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6080 (defun tramp-parse-rhosts (filename)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6081 "Return a list of (user host) tuples allowed to access.
47578
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6082 Either user or host may be nil."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6083 ;; On Windows, there are problems in completion when
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6084 ;; `default-directory' is remote.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6085 (let ((default-directory (tramp-compat-temporary-file-directory))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6086 res)
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6087 (when (file-readable-p filename)
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6088 (with-temp-buffer
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6089 (insert-file-contents filename)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6090 (goto-char (point-min))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6091 (while (not (eobp))
47578
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6092 (push (tramp-parse-rhosts-group) res))))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6093 res))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6094
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6095 (defun tramp-parse-rhosts-group ()
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6096 "Return a (user host) tuple allowed to access.
47578
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6097 Either user or host may be nil."
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6098 (let ((result)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6099 (regexp
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6100 (concat
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6101 "^\\(" tramp-host-regexp "\\)"
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6102 "\\([ \t]+" "\\(" tramp-user-regexp "\\)" "\\)?")))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6103 (narrow-to-region (point) (tramp-compat-line-end-position))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6104 (when (re-search-forward regexp nil t)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6105 (setq result (append (list (match-string 3) (match-string 1)))))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6106 (widen)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6107 (forward-line 1)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6108 result))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6109
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6110 (defun tramp-parse-shosts (filename)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6111 "Return a list of (user host) tuples allowed to access.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6112 User is always nil."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6113 ;; On Windows, there are problems in completion when
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6114 ;; `default-directory' is remote.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6115 (let ((default-directory (tramp-compat-temporary-file-directory))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6116 res)
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6117 (when (file-readable-p filename)
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6118 (with-temp-buffer
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6119 (insert-file-contents filename)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6120 (goto-char (point-min))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6121 (while (not (eobp))
47578
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6122 (push (tramp-parse-shosts-group) res))))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6123 res))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6124
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6125 (defun tramp-parse-shosts-group ()
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6126 "Return a (user host) tuple allowed to access.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6127 User is always nil."
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6128 (let ((result)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6129 (regexp (concat "^\\(" tramp-host-regexp "\\)")))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6130 (narrow-to-region (point) (tramp-compat-line-end-position))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6131 (when (re-search-forward regexp nil t)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6132 (setq result (list nil (match-string 1))))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6133 (widen)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6134 (or
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6135 (> (skip-chars-forward ",") 0)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6136 (forward-line 1))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6137 result))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6138
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6139 (defun tramp-parse-sconfig (filename)
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6140 "Return a list of (user host) tuples allowed to access.
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6141 User is always nil."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6142 ;; On Windows, there are problems in completion when
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6143 ;; `default-directory' is remote.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6144 (let ((default-directory (tramp-compat-temporary-file-directory))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6145 res)
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6146 (when (file-readable-p filename)
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6147 (with-temp-buffer
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6148 (insert-file-contents filename)
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6149 (goto-char (point-min))
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6150 (while (not (eobp))
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6151 (push (tramp-parse-sconfig-group) res))))
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6152 res))
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6153
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6154 (defun tramp-parse-sconfig-group ()
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6155 "Return a (user host) tuple allowed to access.
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6156 User is always nil."
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6157 (let ((result)
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6158 (regexp (concat "^[ \t]*Host[ \t]+" "\\(" tramp-host-regexp "\\)")))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6159 (narrow-to-region (point) (tramp-compat-line-end-position))
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6160 (when (re-search-forward regexp nil t)
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6161 (setq result (list nil (match-string 1))))
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6162 (widen)
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6163 (or
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6164 (> (skip-chars-forward ",") 0)
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6165 (forward-line 1))
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6166 result))
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6167
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
6168 (defun tramp-parse-shostkeys (dirname)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
6169 "Return a list of (user host) tuples allowed to access.
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
6170 User is always nil."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6171 ;; On Windows, there are problems in completion when
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6172 ;; `default-directory' is remote.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6173 (let* ((default-directory (tramp-compat-temporary-file-directory))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6174 (regexp (concat "^key_[0-9]+_\\(" tramp-host-regexp "\\)\\.pub$"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6175 (files (when (file-directory-p dirname) (directory-files dirname)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6176 result)
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
6177 (while files
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
6178 (when (string-match regexp (car files))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
6179 (push (list nil (match-string 1 (car files))) result))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
6180 (setq files (cdr files)))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
6181 result))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
6182
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
6183 (defun tramp-parse-sknownhosts (dirname)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
6184 "Return a list of (user host) tuples allowed to access.
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
6185 User is always nil."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6186 ;; On Windows, there are problems in completion when
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6187 ;; `default-directory' is remote.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6188 (let* ((default-directory (tramp-compat-temporary-file-directory))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6189 (regexp (concat "^\\(" tramp-host-regexp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6190 "\\)\\.ssh-\\(dss\\|rsa\\)\\.pub$"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6191 (files (when (file-directory-p dirname) (directory-files dirname)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6192 result)
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
6193 (while files
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
6194 (when (string-match regexp (car files))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
6195 (push (list nil (match-string 1 (car files))) result))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
6196 (setq files (cdr files)))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
6197 result))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
6198
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6199 (defun tramp-parse-hosts (filename)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6200 "Return a list of (user host) tuples allowed to access.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6201 User is always nil."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6202 ;; On Windows, there are problems in completion when
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6203 ;; `default-directory' is remote.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6204 (let ((default-directory (tramp-compat-temporary-file-directory))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6205 res)
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6206 (when (file-readable-p filename)
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6207 (with-temp-buffer
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6208 (insert-file-contents filename)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6209 (goto-char (point-min))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6210 (while (not (eobp))
47578
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6211 (push (tramp-parse-hosts-group) res))))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6212 res))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6213
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6214 (defun tramp-parse-hosts-group ()
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6215 "Return a (user host) tuple allowed to access.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6216 User is always nil."
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6217 (let ((result)
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
6218 (regexp
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
6219 (concat "^\\(" tramp-ipv6-regexp "\\|" tramp-host-regexp "\\)")))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6220 (narrow-to-region (point) (tramp-compat-line-end-position))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6221 (when (re-search-forward regexp nil t)
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
6222 (setq result (list nil (match-string 1))))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6223 (widen)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6224 (or
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6225 (> (skip-chars-forward " \t") 0)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6226 (forward-line 1))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6227 result))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6228
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6229 ;; For su-alike methods it would be desirable to return "root@localhost"
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6230 ;; as default. Unfortunately, we have no information whether any user name
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6231 ;; has been typed already. So we use `tramp-current-user' as indication,
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6232 ;; assuming it is set in `tramp-completion-handle-file-name-all-completions'.
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6233 (defun tramp-parse-passwd (filename)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6234 "Return a list of (user host) tuples allowed to access.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6235 Host is always \"localhost\"."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6236 ;; On Windows, there are problems in completion when
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6237 ;; `default-directory' is remote.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6238 (let ((default-directory (tramp-compat-temporary-file-directory))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6239 res)
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6240 (if (zerop (length tramp-current-user))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6241 '(("root" nil))
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6242 (when (file-readable-p filename)
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6243 (with-temp-buffer
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6244 (insert-file-contents filename)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6245 (goto-char (point-min))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6246 (while (not (eobp))
47578
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6247 (push (tramp-parse-passwd-group) res))))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6248 res)))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6249
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6250 (defun tramp-parse-passwd-group ()
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6251 "Return a (user host) tuple allowed to access.
47578
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6252 Host is always \"localhost\"."
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6253 (let ((result)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6254 (regexp (concat "^\\(" tramp-user-regexp "\\):")))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6255 (narrow-to-region (point) (tramp-compat-line-end-position))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6256 (when (re-search-forward regexp nil t)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6257 (setq result (list (match-string 1) "localhost")))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6258 (widen)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6259 (forward-line 1)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6260 result))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
6261
47578
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6262 (defun tramp-parse-netrc (filename)
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6263 "Return a list of (user host) tuples allowed to access.
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6264 User may be nil."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6265 ;; On Windows, there are problems in completion when
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6266 ;; `default-directory' is remote.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6267 (let ((default-directory (tramp-compat-temporary-file-directory))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6268 res)
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
6269 (when (file-readable-p filename)
47578
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6270 (with-temp-buffer
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6271 (insert-file-contents filename)
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6272 (goto-char (point-min))
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6273 (while (not (eobp))
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6274 (push (tramp-parse-netrc-group) res))))
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6275 res))
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6276
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6277 (defun tramp-parse-netrc-group ()
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6278 "Return a (user host) tuple allowed to access.
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6279 User may be nil."
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6280 (let ((result)
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6281 (regexp
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6282 (concat
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6283 "^[ \t]*machine[ \t]+" "\\(" tramp-host-regexp "\\)"
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6284 "\\([ \t]+login[ \t]+" "\\(" tramp-user-regexp "\\)" "\\)?")))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6285 (narrow-to-region (point) (tramp-compat-line-end-position))
47578
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6286 (when (re-search-forward regexp nil t)
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6287 (setq result (list (match-string 3) (match-string 1))))
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6288 (widen)
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6289 (forward-line 1)
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6290 result))
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
6291
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6292 (defun tramp-parse-putty (registry)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6293 "Return a list of (user host) tuples allowed to access.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6294 User is always nil."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6295 ;; On Windows, there are problems in completion when
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6296 ;; `default-directory' is remote.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6297 (let ((default-directory (tramp-compat-temporary-file-directory))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6298 res)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6299 (with-temp-buffer
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
6300 (when (zerop (tramp-local-call-process "reg" nil t nil "query" registry))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6301 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6302 (while (not (eobp))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6303 (push (tramp-parse-putty-group registry) res))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6304 res))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6305
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6306 (defun tramp-parse-putty-group (registry)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6307 "Return a (user host) tuple allowed to access.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6308 User is always nil."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6309 (let ((result)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6310 (regexp (concat (regexp-quote registry) "\\\\\\(.+\\)")))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6311 (narrow-to-region (point) (tramp-compat-line-end-position))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6312 (when (re-search-forward regexp nil t)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6313 (setq result (list nil (match-string 1))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6314 (widen)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6315 (forward-line 1)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6316 result))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6317
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6318 ;;; Internal Functions:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6319
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6320 (defun tramp-maybe-send-script (vec script name)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6321 "Define in remote shell function NAME implemented as SCRIPT.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6322 Only send the definition if it has not already been done."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6323 (let* ((p (tramp-get-connection-process vec))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6324 (scripts (tramp-get-connection-property p "scripts" nil)))
85089
8fb95bcda144 * net/tramp.el (tramp-find-foreign-file-name-handler): Check also
Michael Albinus <michael.albinus@gmx.de>
parents: 85067
diff changeset
6325 (unless (member name scripts)
108540
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
6326 (with-progress-reporter vec 5 (format "Sending script `%s'" name)
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
6327 ;; The script could contain a call of Perl. This is masked with `%s'.
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
6328 (tramp-send-command-and-check
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
6329 vec
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
6330 (format "%s () {\n%s\n}" name
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
6331 (format script (tramp-get-remote-perl vec))))
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
6332 (tramp-set-connection-property p "scripts" (cons name scripts))))))
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
6333
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6334 (defun tramp-set-auto-save ()
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6335 (when (and ;; ange-ftp has its own auto-save mechanism
62344
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
6336 (eq (tramp-find-foreign-file-name-handler (buffer-file-name))
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
6337 'tramp-sh-file-name-handler)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6338 auto-save-default)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6339 (auto-save-mode 1)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6340 (add-hook 'find-file-hooks 'tramp-set-auto-save t)
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
6341 (add-hook 'tramp-unload-hook
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
6342 (lambda ()
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
6343 (remove-hook 'find-file-hooks 'tramp-set-auto-save)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6344
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6345 (defun tramp-run-test (switch filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6346 "Run `test' on the remote system, given a SWITCH and a FILENAME.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6347 Returns the exit code of the `test' program."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6348 (with-parsed-tramp-file-name filename nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6349 (tramp-send-command-and-check
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6350 v
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6351 (format
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6352 "%s %s %s"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6353 (tramp-get-test-command v)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6354 switch
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6355 (tramp-shell-quote-argument localname)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6356
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6357 (defun tramp-run-test2 (format-string file1 file2)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6358 "Run `test'-like program on the remote system, given FILE1, FILE2.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6359 FORMAT-STRING contains the program name, switches, and place holders.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6360 Returns the exit code of the `test' program. Barfs if the methods,
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6361 hosts, or files, disagree."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6362 (unless (tramp-equal-remote file1 file2)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6363 (with-parsed-tramp-file-name (if (tramp-tramp-file-p file1) file1 file2) nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6364 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6365 v 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6366 "tramp-run-test2 only implemented for same method, user, host")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6367 (with-parsed-tramp-file-name file1 v1
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6368 (with-parsed-tramp-file-name file1 v2
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6369 (tramp-send-command-and-check
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6370 v1
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6371 (format format-string
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6372 (tramp-shell-quote-argument v1-localname)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6373 (tramp-shell-quote-argument v2-localname))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6374
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6375 (defun tramp-buffer-name (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6376 "A name for the connection buffer VEC."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6377 ;; We must use `tramp-file-name-real-host', because for gateway
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6378 ;; methods the default port will be expanded later on, which would
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6379 ;; tamper the name.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6380 (let ((method (tramp-file-name-method vec))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6381 (user (tramp-file-name-user vec))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6382 (host (tramp-file-name-real-host vec)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6383 (if (not (zerop (length user)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6384 (format "*tramp/%s %s@%s*" method user host)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6385 (format "*tramp/%s %s*" method host))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6386
105718
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
6387 (defun tramp-delete-temp-file-function ()
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
6388 "Remove temporary files related to current buffer."
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
6389 (when (stringp tramp-temp-buffer-file-name)
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
6390 (condition-case nil
108816
94d1d8a6dcfd * net/tramp-compat.el (tramp-compat-delete-file): Use
Michael Albinus <michael.albinus@gmx.de>
parents: 108806
diff changeset
6391 (delete-file tramp-temp-buffer-file-name)
105718
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
6392 (error nil))))
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
6393
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
6394 (add-hook 'kill-buffer-hook 'tramp-delete-temp-file-function)
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
6395 (add-hook 'tramp-cache-unload-hook
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
6396 (lambda ()
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
6397 (remove-hook 'kill-buffer-hook
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
6398 'tramp-delete-temp-file-function)))
828d51e45d15 * net/tramp.el (top): Remove `tramp-rfn-eshadow-update-overlay'
Michael Albinus <michael.albinus@gmx.de>
parents: 105615
diff changeset
6399
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6400 (defun tramp-get-buffer (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6401 "Get the connection buffer to be used for VEC."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6402 (or (get-buffer (tramp-buffer-name vec))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6403 (with-current-buffer (get-buffer-create (tramp-buffer-name vec))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6404 (setq buffer-undo-list t)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6405 (setq default-directory
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6406 (tramp-make-tramp-file-name
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6407 (tramp-file-name-method vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6408 (tramp-file-name-user vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6409 (tramp-file-name-host vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6410 "/"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6411 (current-buffer))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6412
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6413 (defun tramp-get-connection-buffer (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6414 "Get the connection buffer to be used for VEC.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6415 In case a second asynchronous communication has been started, it is different
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6416 from `tramp-get-buffer'."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6417 (or (tramp-get-connection-property vec "process-buffer" nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6418 (tramp-get-buffer vec)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6419
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6420 (defun tramp-get-connection-process (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6421 "Get the connection process to be used for VEC.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6422 In case a second asynchronous communication has been started, it is different
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6423 from the default one."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6424 (get-process
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6425 (or (tramp-get-connection-property vec "process-name" nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6426 (tramp-buffer-name vec))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6427
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6428 (defun tramp-debug-buffer-name (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6429 "A name for the debug buffer for VEC."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6430 ;; We must use `tramp-file-name-real-host', because for gateway
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6431 ;; methods the default port will be expanded later on, which would
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6432 ;; tamper the name.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6433 (let ((method (tramp-file-name-method vec))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6434 (user (tramp-file-name-user vec))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6435 (host (tramp-file-name-real-host vec)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6436 (if (not (zerop (length user)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6437 (format "*debug tramp/%s %s@%s*" method user host)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6438 (format "*debug tramp/%s %s*" method host))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6439
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
6440 (defconst tramp-debug-outline-regexp
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
6441 "[0-9]+:[0-9]+:[0-9]+\\.[0-9]+ [a-z0-9-]+ (\\([0-9]+\\)) #")
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
6442
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6443 (defun tramp-get-debug-buffer (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6444 "Get the debug buffer for VEC."
59582
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
6445 (with-current-buffer
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6446 (get-buffer-create (tramp-debug-buffer-name vec))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6447 (when (bobp)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6448 (setq buffer-undo-list t)
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
6449 ;; Activate `outline-mode'. This runs `text-mode-hook' and
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
6450 ;; `outline-mode-hook'. We must prevent that local processes
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
6451 ;; die. Yes: I've seen `flyspell-mode', which starts "ispell".
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
6452 ;; Furthermore, `outline-regexp' must have the correct value
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
6453 ;; already, because it is used by `font-lock-compile-keywords'.
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
6454 (let ((default-directory (tramp-compat-temporary-file-directory))
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
6455 (outline-regexp tramp-debug-outline-regexp))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6456 (outline-mode))
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
6457 (set (make-local-variable 'outline-regexp) tramp-debug-outline-regexp)
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
6458 (set (make-local-variable 'outline-level) 'tramp-outline-level))
59582
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
6459 (current-buffer)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6460
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6461 (defun tramp-outline-level ()
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6462 "Return the depth to which a statement is nested in the outline.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6463 Point must be at the beginning of a header line.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6464
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6465 The outline level is equal to the verbosity of the Tramp message."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6466 (1+ (string-to-number (match-string 1))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6467
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6468 (defun tramp-find-executable
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6469 (vec progname dirlist &optional ignore-tilde ignore-path)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6470 "Searches for PROGNAME in $PATH and all directories mentioned in DIRLIST.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6471 First arg VEC specifies the connection, PROGNAME is the program
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6472 to search for, and DIRLIST gives the list of directories to
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6473 search. If IGNORE-TILDE is non-nil, directory names starting
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6474 with `~' will be ignored. If IGNORE-PATH is non-nil, searches
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6475 only in DIRLIST.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6476
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
6477 Returns the absolute file name of PROGNAME, if found, and nil otherwise.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6478
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6479 This function expects to be in the right *tramp* buffer."
107498
40467a8dcd6c * net/tramp.el (tramp-find-executable): Use
Michael Albinus <albinus@detlef>
parents: 107320
diff changeset
6480 (with-current-buffer (tramp-get-connection-buffer vec)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6481 (let (result)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6482 ;; Check whether the executable is in $PATH. "which(1)" does not
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6483 ;; report always a correct error code; therefore we check the
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6484 ;; number of words it returns.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6485 (unless ignore-path
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6486 (tramp-send-command vec (format "which \\%s | wc -w" progname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6487 (goto-char (point-min))
107498
40467a8dcd6c * net/tramp.el (tramp-find-executable): Use
Michael Albinus <albinus@detlef>
parents: 107320
diff changeset
6488 (if (looking-at "^\\s-*1$")
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6489 (setq result (concat "\\" progname))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6490 (unless result
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6491 (when ignore-tilde
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
6492 ;; Remove all ~/foo directories from dirlist. In XEmacs,
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6493 ;; `remove' is in CL, and we want to avoid CL dependencies.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6494 (let (newdl d)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6495 (while dirlist
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6496 (setq d (car dirlist))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6497 (setq dirlist (cdr dirlist))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6498 (unless (char-equal ?~ (aref d 0))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6499 (setq newdl (cons d newdl))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6500 (setq dirlist (nreverse newdl))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6501 (tramp-send-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6502 vec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6503 (format (concat "while read d; "
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6504 "do if test -x $d/%s -a -f $d/%s; "
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6505 "then echo tramp_executable $d/%s; "
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6506 "break; fi; done <<'EOF'\n"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6507 "%s\nEOF")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6508 progname progname progname (mapconcat 'identity dirlist "\n")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6509 (goto-char (point-max))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6510 (when (search-backward "tramp_executable " nil t)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6511 (skip-chars-forward "^ ")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6512 (skip-chars-forward " ")
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6513 (setq result (buffer-substring
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6514 (point) (tramp-compat-line-end-position)))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6515 result)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6516
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6517 (defun tramp-set-remote-path (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6518 "Sets the remote environment PATH to existing directories.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6519 I.e., for each directory in `tramp-remote-path', it is tested
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6520 whether it exists and if so, it is added to the environment
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6521 variable PATH."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6522 (tramp-message vec 5 (format "Setting $PATH environment variable"))
82603
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
6523 (tramp-send-command
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
6524 vec (format "PATH=%s; export PATH"
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
6525 (mapconcat 'identity (tramp-get-remote-path vec) ":"))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6526
91486
76c777ce052a * net/tramp.el (tramp-process-sentinel): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 88072
diff changeset
6527 ;; ------------------------------------------------------------
76c777ce052a * net/tramp.el (tramp-process-sentinel): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 88072
diff changeset
6528 ;; -- Communication with external shell --
76c777ce052a * net/tramp.el (tramp-process-sentinel): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 88072
diff changeset
6529 ;; ------------------------------------------------------------
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6530
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6531 (defun tramp-find-file-exists-command (vec)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6532 "Find a command on the remote host for checking if a file exists.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6533 Here, we are looking for a command which has zero exit status if the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6534 file exists and nonzero exit status otherwise."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6535 (let ((existing "/")
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6536 (nonexisting
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6537 (tramp-shell-quote-argument "/ this file does not exist "))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6538 result)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6539 ;; The algorithm is as follows: we try a list of several commands.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6540 ;; For each command, we first run `$cmd /' -- this should return
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6541 ;; true, as the root directory always exists. And then we run
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6542 ;; `$cmd /this\ file\ does\ not\ exist ', hoping that the file indeed
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6543 ;; does not exist. This should return false. We use the first
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6544 ;; command we find that seems to work.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6545 ;; The list of commands to try is as follows:
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6546 ;; `ls -d' This works on most systems, but NetBSD 1.4
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6547 ;; has a bug: `ls' always returns zero exit
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6548 ;; status, even for files which don't exist.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6549 ;; `test -e' Some Bourne shells have a `test' builtin
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6550 ;; which does not know the `-e' option.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6551 ;; `/bin/test -e' For those, the `test' binary on disk normally
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6552 ;; provides the option. Alas, the binary
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6553 ;; is sometimes `/bin/test' and sometimes it's
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6554 ;; `/usr/bin/test'.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6555 ;; `/usr/bin/test -e' In case `/bin/test' does not exist.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6556 (unless (or
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6557 (and (setq result (format "%s -e" (tramp-get-test-command vec)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6558 (zerop (tramp-send-command-and-check
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6559 vec (format "%s %s" result existing)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6560 (not (zerop (tramp-send-command-and-check
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6561 vec (format "%s %s" result nonexisting)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6562 (and (setq result "/bin/test -e")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6563 (zerop (tramp-send-command-and-check
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6564 vec (format "%s %s" result existing)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6565 (not (zerop (tramp-send-command-and-check
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6566 vec (format "%s %s" result nonexisting)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6567 (and (setq result "/usr/bin/test -e")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6568 (zerop (tramp-send-command-and-check
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6569 vec (format "%s %s" result existing)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6570 (not (zerop (tramp-send-command-and-check
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6571 vec (format "%s %s" result nonexisting)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6572 (and (setq result (format "%s -d" (tramp-get-ls-command vec)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6573 (zerop (tramp-send-command-and-check
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6574 vec (format "%s %s" result existing)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6575 (not (zerop (tramp-send-command-and-check
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6576 vec (format "%s %s" result nonexisting))))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6577 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6578 vec 'file-error "Couldn't find command to check if file exists"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6579 result))
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
6580
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6581 ;; CCC test ksh or bash found for tilde expansion?
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6582 (defun tramp-find-shell (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6583 "Opens a shell on the remote host which groks tilde expansion."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6584 (unless (tramp-get-connection-property vec "remote-shell" nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6585 (let (shell)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6586 (with-current-buffer (tramp-get-buffer vec)
85553
4ccd437aad2e * net/tramp.el (tramp-find-shell)
Michael Albinus <michael.albinus@gmx.de>
parents: 85542
diff changeset
6587 (tramp-send-command vec "echo ~root" t)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6588 (cond
107498
40467a8dcd6c * net/tramp.el (tramp-find-executable): Use
Michael Albinus <albinus@detlef>
parents: 107320
diff changeset
6589 ((or (string-match "^~root$" (buffer-string))
40467a8dcd6c * net/tramp.el (tramp-find-executable): Use
Michael Albinus <albinus@detlef>
parents: 107320
diff changeset
6590 ;; The default shell (ksh93) of OpenSolaris is buggy.
40467a8dcd6c * net/tramp.el (tramp-find-executable): Use
Michael Albinus <albinus@detlef>
parents: 107320
diff changeset
6591 (string-equal (tramp-get-connection-property vec "uname" "")
40467a8dcd6c * net/tramp.el (tramp-find-executable): Use
Michael Albinus <albinus@detlef>
parents: 107320
diff changeset
6592 "SunOS 5.11"))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6593 (setq shell
82603
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
6594 (or (tramp-find-executable
107498
40467a8dcd6c * net/tramp.el (tramp-find-executable): Use
Michael Albinus <albinus@detlef>
parents: 107320
diff changeset
6595 vec "bash" (tramp-get-remote-path vec) t t)
82603
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
6596 (tramp-find-executable
107498
40467a8dcd6c * net/tramp.el (tramp-find-executable): Use
Michael Albinus <albinus@detlef>
parents: 107320
diff changeset
6597 vec "ksh" (tramp-get-remote-path vec) t t)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6598 (unless shell
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6599 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6600 vec 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6601 "Couldn't find a shell which groks tilde expansion"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6602 ;; Find arguments for this shell.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6603 (let ((alist tramp-sh-extra-args)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6604 item extra-args)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6605 (while (and alist (null extra-args))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6606 (setq item (pop alist))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6607 (when (string-match (car item) shell)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6608 (setq extra-args (cdr item))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6609 (when extra-args (setq shell (concat shell " " extra-args))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6610 (tramp-message
108540
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
6611 vec 5 "Starting remote shell `%s' for tilde expansion" shell)
106470
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
6612 (let ((tramp-end-of-output tramp-initial-end-of-output))
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
6613 (tramp-send-command
85962
7f134b676a0c * net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents: 85943
diff changeset
6614 vec
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
6615 (format "PROMPT_COMMAND='' PS1=%s PS2='' PS3='' exec %s"
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
6616 (shell-quote-argument tramp-end-of-output) shell)
85962
7f134b676a0c * net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents: 85943
diff changeset
6617 t))
87921
c49bc2860fd0 * net/tramp.el (tramp-remote-process-environment): Set "LC_ALL=C".
Michael Albinus <michael.albinus@gmx.de>
parents: 87748
diff changeset
6618 ;; Setting prompts.
108540
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
6619 (with-progress-reporter vec 5 (format "Setting remote shell prompt")
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
6620 (tramp-send-command
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
6621 vec (format "PS1=%s" (shell-quote-argument tramp-end-of-output)) t)
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
6622 (tramp-send-command vec "PS2=''" t)
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
6623 (tramp-send-command vec "PS3=''" t)
bfc1be04834c * net/tramp.el (with-progress-reporter): Create reporter object
Michael Albinus <albinus@detlef>
parents: 108469
diff changeset
6624 (tramp-send-command vec "PROMPT_COMMAND=''" t)))
87921
c49bc2860fd0 * net/tramp.el (tramp-remote-process-environment): Set "LC_ALL=C".
Michael Albinus <michael.albinus@gmx.de>
parents: 87748
diff changeset
6625
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6626 (t (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6627 vec 5 "Remote `%s' groks tilde expansion, good"
109443
9e514d1076b4 * net/tramp.el (tramp-handle-shell-command): Don't use hard-wired
Michael Albinus <michael.albinus@gmx.de>
parents: 108975
diff changeset
6628 (tramp-set-connection-property
9e514d1076b4 * net/tramp.el (tramp-handle-shell-command): Don't use hard-wired
Michael Albinus <michael.albinus@gmx.de>
parents: 108975
diff changeset
6629 vec "remote-shell"
9e514d1076b4 * net/tramp.el (tramp-handle-shell-command): Don't use hard-wired
Michael Albinus <michael.albinus@gmx.de>
parents: 108975
diff changeset
6630 (tramp-get-method-parameter
9e514d1076b4 * net/tramp.el (tramp-handle-shell-command): Don't use hard-wired
Michael Albinus <michael.albinus@gmx.de>
parents: 108975
diff changeset
6631 (tramp-file-name-method vec) 'tramp-remote-sh)))))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6632
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
6633 ;; ------------------------------------------------------------
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
6634 ;; -- Functions for establishing connection --
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
6635 ;; ------------------------------------------------------------
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6636
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6637 ;; The following functions are actions to be taken when seeing certain
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6638 ;; prompts from the remote host. See the variable
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6639 ;; `tramp-actions-before-shell' for usage of these functions.
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6640
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6641 (defun tramp-action-login (proc vec)
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6642 "Send the login name."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6643 (when (not (stringp tramp-current-user))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6644 (save-window-excursion
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6645 (let ((enable-recursive-minibuffers t))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6646 (pop-to-buffer (tramp-get-connection-buffer vec))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6647 (setq tramp-current-user (read-string (match-string 0))))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6648 (tramp-message vec 3 "Sending login name `%s'" tramp-current-user)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6649 (with-current-buffer (tramp-get-connection-buffer vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6650 (tramp-message vec 6 "\n%s" (buffer-string)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6651 (tramp-send-string vec tramp-current-user))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6652
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6653 (defun tramp-action-password (proc vec)
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6654 "Query the user for a password."
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
6655 (with-current-buffer (process-buffer proc)
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
6656 (tramp-check-for-regexp proc tramp-password-prompt-regexp)
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
6657 (tramp-message vec 3 "Sending %s" (match-string 1)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6658 (tramp-enter-password proc))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6659
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6660 (defun tramp-action-succeed (proc vec)
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6661 "Signal success in finding shell prompt."
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6662 (throw 'tramp-action 'ok))
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6663
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6664 (defun tramp-action-permission-denied (proc vec)
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6665 "Signal permission denied."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6666 (kill-process proc)
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6667 (throw 'tramp-action 'permission-denied))
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6668
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6669 (defun tramp-action-yesno (proc vec)
46992
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
6670 "Ask the user for confirmation using `yes-or-no-p'.
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
6671 Send \"yes\" to remote process on confirmation, abort otherwise.
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
6672 See also `tramp-action-yn'."
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6673 (save-window-excursion
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6674 (let ((enable-recursive-minibuffers t))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6675 (save-match-data (pop-to-buffer (tramp-get-connection-buffer vec)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6676 (unless (yes-or-no-p (match-string 0))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6677 (kill-process proc)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6678 (throw 'tramp-action 'permission-denied))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6679 (with-current-buffer (tramp-get-connection-buffer vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6680 (tramp-message vec 6 "\n%s" (buffer-string)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6681 (tramp-send-string vec "yes"))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6682
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6683 (defun tramp-action-yn (proc vec)
46992
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
6684 "Ask the user for confirmation using `y-or-n-p'.
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
6685 Send \"y\" to remote process on confirmation, abort otherwise.
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
6686 See also `tramp-action-yesno'."
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
6687 (save-window-excursion
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6688 (let ((enable-recursive-minibuffers t))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6689 (save-match-data (pop-to-buffer (tramp-get-connection-buffer vec)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6690 (unless (y-or-n-p (match-string 0))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6691 (kill-process proc)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6692 (throw 'tramp-action 'permission-denied))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6693 (with-current-buffer (tramp-get-connection-buffer vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6694 (tramp-message vec 6 "\n%s" (buffer-string)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6695 (tramp-send-string vec "y"))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6696
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6697 (defun tramp-action-terminal (proc vec)
47771
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
6698 "Tell the remote host which terminal type to use.
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
6699 The terminal type can be configured with `tramp-terminal-type'."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6700 (tramp-message vec 5 "Setting `%s' as terminal type." tramp-terminal-type)
85553
4ccd437aad2e * net/tramp.el (tramp-find-shell)
Michael Albinus <michael.albinus@gmx.de>
parents: 85542
diff changeset
6701 (with-current-buffer (tramp-get-connection-buffer vec)
4ccd437aad2e * net/tramp.el (tramp-find-shell)
Michael Albinus <michael.albinus@gmx.de>
parents: 85542
diff changeset
6702 (tramp-message vec 6 "\n%s" (buffer-string)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6703 (tramp-send-string vec tramp-terminal-type))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6704
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6705 (defun tramp-action-process-alive (proc vec)
108066
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
6706 "Check, whether a process has finished."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6707 (unless (memq (process-status proc) '(run open))
55844
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
6708 (throw 'tramp-action 'process-died)))
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
6709
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6710 (defun tramp-action-out-of-band (proc vec)
108066
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
6711 "Check, whether an out-of-band copy has finished."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6712 (cond ((and (memq (process-status proc) '(stop exit))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6713 (zerop (process-exit-status proc)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6714 (tramp-message vec 3 "Process has finished.")
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
6715 (throw 'tramp-action 'ok))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6716 ((or (and (memq (process-status proc) '(stop exit))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6717 (not (zerop (process-exit-status proc))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6718 (memq (process-status proc) '(signal)))
59582
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
6719 ;; `scp' could have copied correctly, but set modes could have failed.
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
6720 ;; This can be ignored.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6721 (with-current-buffer (process-buffer proc)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6722 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6723 (if (re-search-forward tramp-operation-not-permitted-regexp nil t)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6724 (progn
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6725 (tramp-message vec 5 "'set mode' error ignored.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6726 (tramp-message vec 3 "Process has finished.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6727 (throw 'tramp-action 'ok))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6728 (tramp-message vec 3 "Process has died.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6729 (throw 'tramp-action 'process-died))))
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
6730 (t nil)))
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
6731
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6732 ;; Functions for processing the actions.
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6733
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6734 (defun tramp-process-one-action (proc vec actions)
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6735 "Wait for output from the shell and perform one action."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6736 (let (found todo item pattern action)
75148
bdffb0038313 * net/tramp.el: (tramp-process-one-action): Remove `with-timeout'.
Michael Albinus <michael.albinus@gmx.de>
parents: 75007
diff changeset
6737 (while (not found)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6738 ;; Reread output once all actions have been performed.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6739 ;; Obviously, the output was not complete.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6740 (tramp-accept-process-output proc 1)
75148
bdffb0038313 * net/tramp.el: (tramp-process-one-action): Remove `with-timeout'.
Michael Albinus <michael.albinus@gmx.de>
parents: 75007
diff changeset
6741 (setq todo actions)
bdffb0038313 * net/tramp.el: (tramp-process-one-action): Remove `with-timeout'.
Michael Albinus <michael.albinus@gmx.de>
parents: 75007
diff changeset
6742 (while todo
bdffb0038313 * net/tramp.el: (tramp-process-one-action): Remove `with-timeout'.
Michael Albinus <michael.albinus@gmx.de>
parents: 75007
diff changeset
6743 (setq item (pop todo))
98699
f3c1254483a0 * net/tramp.el (tramp-process-one-action): Embed regexp in
Michael Albinus <michael.albinus@gmx.de>
parents: 97613
diff changeset
6744 (setq pattern (format "\\(%s\\)\\'" (symbol-value (nth 0 item))))
75148
bdffb0038313 * net/tramp.el: (tramp-process-one-action): Remove `with-timeout'.
Michael Albinus <michael.albinus@gmx.de>
parents: 75007
diff changeset
6745 (setq action (nth 1 item))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6746 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6747 vec 5 "Looking for regexp \"%s\" from remote shell" pattern)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6748 (when (tramp-check-for-regexp proc pattern)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6749 (tramp-message vec 5 "Call `%s'" (symbol-name action))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6750 (setq found (funcall action proc vec)))))
75148
bdffb0038313 * net/tramp.el: (tramp-process-one-action): Remove `with-timeout'.
Michael Albinus <michael.albinus@gmx.de>
parents: 75007
diff changeset
6751 found))
bdffb0038313 * net/tramp.el: (tramp-process-one-action): Remove `with-timeout'.
Michael Albinus <michael.albinus@gmx.de>
parents: 75007
diff changeset
6752
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6753 (defun tramp-process-actions (proc vec actions &optional timeout)
75148
bdffb0038313 * net/tramp.el: (tramp-process-one-action): Remove `with-timeout'.
Michael Albinus <michael.albinus@gmx.de>
parents: 75007
diff changeset
6754 "Perform actions until success or TIMEOUT."
108775
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
6755 ;; Preserve message for `progress-reporter'.
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
6756 (with-temp-message ""
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
6757 ;; Enable auth-source and password-cache.
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
6758 (tramp-set-connection-property vec "first-password-request" t)
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
6759 (let (exit)
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
6760 (while (not exit)
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
6761 (tramp-message proc 3 "Waiting for prompts from remote shell")
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
6762 (setq exit
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
6763 (catch 'tramp-action
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
6764 (if timeout
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
6765 (with-timeout (timeout)
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
6766 (tramp-process-one-action proc vec actions))
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
6767 (tramp-process-one-action proc vec actions)))))
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
6768 (with-current-buffer (tramp-get-connection-buffer vec)
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
6769 (tramp-message vec 6 "\n%s" (buffer-string)))
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
6770 (unless (eq exit 'ok)
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
6771 (tramp-clear-passwd vec)
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
6772 (tramp-error-with-buffer
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
6773 nil vec 'file-error
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
6774 (cond
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
6775 ((eq exit 'permission-denied) "Permission denied")
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
6776 ((eq exit 'process-died) "Process died")
481bba2e11df * net/tramp.el (tramp-progress-reporter-update): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 108739
diff changeset
6777 (t "Login failed")))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6778
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6779 ;; Utility functions.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6780
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6781 (defun tramp-accept-process-output (&optional proc timeout timeout-msecs)
64772
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
6782 "Like `accept-process-output' for Tramp processes.
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
6783 This is needed in order to hide `last-coding-system-used', which is set
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
6784 for process communication also."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6785 (with-current-buffer (process-buffer proc)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6786 (tramp-message proc 10 "%s %s" proc (process-status proc))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6787 (let (buffer-read-only last-coding-system-used)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6788 ;; Under Windows XP, accept-process-output doesn't return
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6789 ;; sometimes. So we add an additional timeout.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6790 (with-timeout ((or timeout 1))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6791 (accept-process-output proc timeout timeout-msecs)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6792 (tramp-message proc 10 "\n%s" (buffer-string))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6793
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6794 (defun tramp-check-for-regexp (proc regexp)
108066
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
6795 "Check, whether REGEXP is contained in process buffer of PROC.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6796 Erase echoed commands if exists."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6797 (with-current-buffer (process-buffer proc)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6798 (goto-char (point-min))
94975
5bb8f7b3f835 * net/tramp.el (tramp-echo-mark): Update docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 94677
diff changeset
6799
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6800 ;; Check whether we need to remove echo output.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6801 (when (and (tramp-get-connection-property proc "check-remote-echo" nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6802 (re-search-forward tramp-echoed-echo-mark-regexp nil t))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6803 (let ((begin (match-beginning 0)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6804 (when (re-search-forward tramp-echoed-echo-mark-regexp nil t)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6805 ;; Discard echo from remote output.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6806 (tramp-set-connection-property proc "check-remote-echo" nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6807 (tramp-message proc 5 "echo-mark found")
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
6808 (forward-line 1)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6809 (delete-region begin (point))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6810 (goto-char (point-min)))))
94975
5bb8f7b3f835 * net/tramp.el (tramp-echo-mark): Update docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 94677
diff changeset
6811
106597
b0e5aae20733 * net/tramp.el (tramp-echo-mark-marker-length): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 106508
diff changeset
6812 (when (or (not (tramp-get-connection-property proc "check-remote-echo" nil))
b0e5aae20733 * net/tramp.el (tramp-echo-mark-marker-length): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 106508
diff changeset
6813 ;; Sometimes, the echo string is suppressed on the remote side.
b0e5aae20733 * net/tramp.el (tramp-echo-mark-marker-length): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 106508
diff changeset
6814 (not (string-equal
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
6815 (tramp-compat-funcall
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
6816 'substring-no-properties tramp-echo-mark-marker
106597
b0e5aae20733 * net/tramp.el (tramp-echo-mark-marker-length): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 106508
diff changeset
6817 0 (min tramp-echo-mark-marker-length (1- (point-max))))
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
6818 (tramp-compat-funcall
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
6819 'buffer-substring-no-properties
106597
b0e5aae20733 * net/tramp.el (tramp-echo-mark-marker-length): New defconst.
Michael Albinus <michael.albinus@gmx.de>
parents: 106508
diff changeset
6820 1 (min (1+ tramp-echo-mark-marker-length) (point-max))))))
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
6821 ;; No echo to be handled, now we can look for the regexp.
94975
5bb8f7b3f835 * net/tramp.el (tramp-echo-mark): Update docstring.
Michael Albinus <michael.albinus@gmx.de>
parents: 94677
diff changeset
6822 (goto-char (point-min))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6823 (re-search-forward regexp nil t))))
64772
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
6824
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6825 (defun tramp-wait-for-regexp (proc timeout regexp)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6826 "Wait for a REGEXP to appear from process PROC within TIMEOUT seconds.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6827 Expects the output of PROC to be sent to the current buffer. Returns
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6828 the string that matched, or nil. Waits indefinitely if TIMEOUT is
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6829 nil."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6830 (with-current-buffer (process-buffer proc)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6831 (let ((found (tramp-check-for-regexp proc regexp))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6832 (start-time (current-time)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6833 (cond (timeout
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6834 ;; Work around a bug in XEmacs 21, where the timeout
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6835 ;; expires faster than it should. This degenerates
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6836 ;; to polling for buggy XEmacsen, but oh, well.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6837 (while (and (not found)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6838 (< (tramp-time-diff (current-time) start-time)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6839 timeout))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6840 (with-timeout (timeout)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6841 (while (not found)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6842 (tramp-accept-process-output proc 1)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6843 (unless (memq (process-status proc) '(run open))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6844 (tramp-error-with-buffer
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6845 nil proc 'file-error "Process has died"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6846 (setq found (tramp-check-for-regexp proc regexp))))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6847 (t
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6848 (while (not found)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6849 (tramp-accept-process-output proc 1)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6850 (unless (memq (process-status proc) '(run open))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6851 (tramp-error-with-buffer
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6852 nil proc 'file-error "Process has died"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6853 (setq found (tramp-check-for-regexp proc regexp)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6854 (tramp-message proc 6 "\n%s" (buffer-string))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6855 (when (not found)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6856 (if timeout
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6857 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6858 proc 'file-error "[[Regexp `%s' not found in %d secs]]"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6859 regexp timeout)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6860 (tramp-error proc 'file-error "[[Regexp `%s' not found]]" regexp)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6861 found)))
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
6862
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
6863 (defun tramp-barf-if-no-shell-prompt (proc timeout &rest error-args)
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
6864 "Wait for shell prompt and barf if none appears.
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
6865 Looks at process PROC to see if a shell prompt appears in TIMEOUT
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
6866 seconds. If not, it produces an error message with the given ERROR-ARGS."
85553
4ccd437aad2e * net/tramp.el (tramp-find-shell)
Michael Albinus <michael.albinus@gmx.de>
parents: 85542
diff changeset
6867 (unless
4ccd437aad2e * net/tramp.el (tramp-find-shell)
Michael Albinus <michael.albinus@gmx.de>
parents: 85542
diff changeset
6868 (tramp-wait-for-regexp
4ccd437aad2e * net/tramp.el (tramp-find-shell)
Michael Albinus <michael.albinus@gmx.de>
parents: 85542
diff changeset
6869 proc timeout
4ccd437aad2e * net/tramp.el (tramp-find-shell)
Michael Albinus <michael.albinus@gmx.de>
parents: 85542
diff changeset
6870 (format
4ccd437aad2e * net/tramp.el (tramp-find-shell)
Michael Albinus <michael.albinus@gmx.de>
parents: 85542
diff changeset
6871 "\\(%s\\|%s\\)\\'" shell-prompt-pattern tramp-shell-prompt-pattern))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6872 (apply 'tramp-error-with-buffer nil proc 'file-error error-args)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6873
85553
4ccd437aad2e * net/tramp.el (tramp-find-shell)
Michael Albinus <michael.albinus@gmx.de>
parents: 85542
diff changeset
6874 ;; We don't call `tramp-send-string' in order to hide the password
4ccd437aad2e * net/tramp.el (tramp-find-shell)
Michael Albinus <michael.albinus@gmx.de>
parents: 85542
diff changeset
6875 ;; from the debug buffer, and because end-of-line handling of the
4ccd437aad2e * net/tramp.el (tramp-find-shell)
Michael Albinus <michael.albinus@gmx.de>
parents: 85542
diff changeset
6876 ;; string.
4ccd437aad2e * net/tramp.el (tramp-find-shell)
Michael Albinus <michael.albinus@gmx.de>
parents: 85542
diff changeset
6877 (defun tramp-enter-password (proc)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6878 "Prompt for a password and send it to the remote end."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6879 (process-send-string
85553
4ccd437aad2e * net/tramp.el (tramp-find-shell)
Michael Albinus <michael.albinus@gmx.de>
parents: 85542
diff changeset
6880 proc (concat (tramp-read-passwd proc)
4ccd437aad2e * net/tramp.el (tramp-find-shell)
Michael Albinus <michael.albinus@gmx.de>
parents: 85542
diff changeset
6881 (or (tramp-get-method-parameter
4ccd437aad2e * net/tramp.el (tramp-find-shell)
Michael Albinus <michael.albinus@gmx.de>
parents: 85542
diff changeset
6882 tramp-current-method
4ccd437aad2e * net/tramp.el (tramp-find-shell)
Michael Albinus <michael.albinus@gmx.de>
parents: 85542
diff changeset
6883 'tramp-password-end-of-line)
4ccd437aad2e * net/tramp.el (tramp-find-shell)
Michael Albinus <michael.albinus@gmx.de>
parents: 85542
diff changeset
6884 tramp-default-password-end-of-line))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6885
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6886 (defun tramp-open-connection-setup-interactive-shell (proc vec)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6887 "Set up an interactive shell.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6888 Mainly sets the prompt and the echo correctly. PROC is the shell
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6889 process to set up. VEC specifies the connection."
106470
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
6890 (let ((tramp-end-of-output tramp-initial-end-of-output))
86241
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6891 ;; It is useful to set the prompt in the following command because
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6892 ;; some people have a setting for $PS1 which /bin/sh doesn't know
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6893 ;; about and thus /bin/sh will display a strange prompt. For
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6894 ;; example, if $PS1 has "${CWD}" in the value, then ksh will
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6895 ;; display the current working directory but /bin/sh will display
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6896 ;; a dollar sign. The following command line sets $PS1 to a sane
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6897 ;; value, and works under Bourne-ish shells as well as csh-like
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6898 ;; shells. Daniel Pittman reports that the unusual positioning of
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6899 ;; the single quotes makes it work under `rc', too. We also unset
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6900 ;; the variable $ENV because that is read by some sh
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6901 ;; implementations (eg, bash when called as sh) on startup; this
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6902 ;; way, we avoid the startup file clobbering $PS1. $PROMP_COMMAND
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6903 ;; is another way to set the prompt in /bin/bash, it must be
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6904 ;; discarded as well.
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
6905 (tramp-send-command
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
6906 vec
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
6907 (format
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
6908 "exec env ENV='' PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s"
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
6909 (shell-quote-argument tramp-end-of-output)
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
6910 (tramp-get-method-parameter
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
6911 (tramp-file-name-method vec) 'tramp-remote-sh))
86241
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6912 t)
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6913
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6914 ;; Disable echo.
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6915 (tramp-message vec 5 "Setting up remote shell environment")
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6916 (tramp-send-command vec "stty -inlcr -echo kill '^U' erase '^H'" t)
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6917 ;; Check whether the echo has really been disabled. Some
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6918 ;; implementations, like busybox of embedded GNU/Linux, don't
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6919 ;; support disabling.
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6920 (tramp-send-command vec "echo foo" t)
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6921 (with-current-buffer (process-buffer proc)
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6922 (goto-char (point-min))
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6923 (when (looking-at "echo foo")
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6924 (tramp-set-connection-property proc "remote-echo" t)
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6925 (tramp-message vec 5 "Remote echo still on. Ok.")
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6926 ;; Make sure backspaces and their echo are enabled and no line
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6927 ;; width magic interferes with them.
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
6928 (tramp-send-command vec "stty icanon erase ^H cols 32767" t))))
86048
766c1ba3d613 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
Michael Albinus <michael.albinus@gmx.de>
parents: 85970
diff changeset
6929
85553
4ccd437aad2e * net/tramp.el (tramp-find-shell)
Michael Albinus <michael.albinus@gmx.de>
parents: 85542
diff changeset
6930 (tramp-message vec 5 "Setting shell prompt")
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
6931 (tramp-send-command
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
6932 vec (format "PS1=%s" (shell-quote-argument tramp-end-of-output)) t)
87322
e99e230d7eb3 * files.el (cd-absolute): Set `list-buffers-directory' in order to
Michael Albinus <michael.albinus@gmx.de>
parents: 87040
diff changeset
6933 (tramp-send-command vec "PS2=''" t)
e99e230d7eb3 * files.el (cd-absolute): Set `list-buffers-directory' in order to
Michael Albinus <michael.albinus@gmx.de>
parents: 87040
diff changeset
6934 (tramp-send-command vec "PS3=''" t)
e99e230d7eb3 * files.el (cd-absolute): Set `list-buffers-directory' in order to
Michael Albinus <michael.albinus@gmx.de>
parents: 87040
diff changeset
6935 (tramp-send-command vec "PROMPT_COMMAND=''" t)
62344
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
6936
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6937 ;; Try to set up the coding system correctly.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6938 ;; CCC this can't be the right way to do it. Hm.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6939 (tramp-message vec 5 "Determining coding system")
85553
4ccd437aad2e * net/tramp.el (tramp-find-shell)
Michael Albinus <michael.albinus@gmx.de>
parents: 85542
diff changeset
6940 (tramp-send-command vec "echo foo ; echo bar" t)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6941 (with-current-buffer (process-buffer proc)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6942 (goto-char (point-min))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6943 (if (featurep 'mule)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6944 ;; Use MULE to select the right EOL convention for communicating
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6945 ;; with the process.
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
6946 (let* ((cs (or (tramp-compat-funcall 'process-coding-system proc)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6947 (cons 'undecided 'undecided)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6948 cs-decode cs-encode)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6949 (when (symbolp cs) (setq cs (cons cs cs)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6950 (setq cs-decode (car cs))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6951 (setq cs-encode (cdr cs))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6952 (unless cs-decode (setq cs-decode 'undecided))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6953 (unless cs-encode (setq cs-encode 'undecided))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6954 (setq cs-encode (tramp-coding-system-change-eol-conversion
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6955 cs-encode 'unix))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6956 (when (search-forward "\r" nil t)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6957 (setq cs-decode (tramp-coding-system-change-eol-conversion
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6958 cs-decode 'dos)))
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
6959 (tramp-compat-funcall
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
6960 'set-buffer-process-coding-system cs-decode cs-encode)
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
6961 (tramp-message
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
6962 vec 5 "Setting coding system to `%s' and `%s'" cs-decode cs-encode))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6963 ;; Look for ^M and do something useful if found.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6964 (when (search-forward "\r" nil t)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6965 ;; We have found a ^M but cannot frob the process coding system
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6966 ;; because we're running on a non-MULE Emacs. Let's try
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6967 ;; stty, instead.
85553
4ccd437aad2e * net/tramp.el (tramp-find-shell)
Michael Albinus <michael.albinus@gmx.de>
parents: 85542
diff changeset
6968 (tramp-send-command vec "stty -onlcr" t))))
107021
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
6969 ;; Dump stty settings in the traces.
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
6970 (when (>= tramp-verbose 10)
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
6971 (tramp-send-command vec "stty -a" t))
85553
4ccd437aad2e * net/tramp.el (tramp-find-shell)
Michael Albinus <michael.albinus@gmx.de>
parents: 85542
diff changeset
6972 (tramp-send-command vec "set +o vi +o emacs" t)
86048
766c1ba3d613 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
Michael Albinus <michael.albinus@gmx.de>
parents: 85970
diff changeset
6973
766c1ba3d613 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
Michael Albinus <michael.albinus@gmx.de>
parents: 85970
diff changeset
6974 ;; Check whether the output of "uname -sr" has been changed. If
766c1ba3d613 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
Michael Albinus <michael.albinus@gmx.de>
parents: 85970
diff changeset
6975 ;; yes, this is a strong indication that we must expire all
95967
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
6976 ;; connection properties. We start again with
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
6977 ;; `tramp-maybe-open-connection', it will be catched there.
86048
766c1ba3d613 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
Michael Albinus <michael.albinus@gmx.de>
parents: 85970
diff changeset
6978 (tramp-message vec 5 "Checking system information")
766c1ba3d613 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
Michael Albinus <michael.albinus@gmx.de>
parents: 85970
diff changeset
6979 (let ((old-uname (tramp-get-connection-property vec "uname" nil))
766c1ba3d613 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
Michael Albinus <michael.albinus@gmx.de>
parents: 85970
diff changeset
6980 (new-uname
766c1ba3d613 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
Michael Albinus <michael.albinus@gmx.de>
parents: 85970
diff changeset
6981 (tramp-set-connection-property
766c1ba3d613 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
Michael Albinus <michael.albinus@gmx.de>
parents: 85970
diff changeset
6982 vec "uname"
766c1ba3d613 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
Michael Albinus <michael.albinus@gmx.de>
parents: 85970
diff changeset
6983 (tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\""))))
766c1ba3d613 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
Michael Albinus <michael.albinus@gmx.de>
parents: 85970
diff changeset
6984 (when (and (stringp old-uname) (not (string-equal old-uname new-uname)))
95967
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
6985 (with-current-buffer (tramp-get-debug-buffer vec)
108158
94e4a7a7cadf * net/tramp.el (tramp-remote-selinux-p): New defun.
Michael Albinus <albinus@detlef>
parents: 108077
diff changeset
6986 ;; Keep the debug buffer.
96941
940a290a5646 * net/tramp.el (tramp-methods): Add "-q" for "scp", "scp1",
Michael Albinus <michael.albinus@gmx.de>
parents: 96392
diff changeset
6987 (rename-buffer
940a290a5646 * net/tramp.el (tramp-methods): Add "-q" for "scp", "scp1",
Michael Albinus <michael.albinus@gmx.de>
parents: 96392
diff changeset
6988 (generate-new-buffer-name tramp-temp-buffer-name) 'unique)
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
6989 (tramp-compat-funcall 'tramp-cleanup-connection vec)
95967
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
6990 (if (= (point-min) (point-max))
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
6991 (kill-buffer nil)
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
6992 (rename-buffer (tramp-debug-buffer-name vec) 'unique))
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
6993 ;; We call `tramp-get-buffer' in order to keep the debug buffer.
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
6994 (tramp-get-buffer vec)
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
6995 (tramp-message
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
6996 vec 3
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
6997 "Connection reset, because remote host changed from `%s' to `%s'"
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
6998 old-uname new-uname)
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
6999 (throw 'uname-changed (tramp-maybe-open-connection vec)))))
86048
766c1ba3d613 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
Michael Albinus <michael.albinus@gmx.de>
parents: 85970
diff changeset
7000
766c1ba3d613 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
Michael Albinus <michael.albinus@gmx.de>
parents: 85970
diff changeset
7001 ;; Check whether the remote host suffers from buggy
766c1ba3d613 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
Michael Albinus <michael.albinus@gmx.de>
parents: 85970
diff changeset
7002 ;; `send-process-string'. This is known for FreeBSD (see comment in
766c1ba3d613 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
Michael Albinus <michael.albinus@gmx.de>
parents: 85970
diff changeset
7003 ;; `send_process', file process.c). I've tested sending 624 bytes
766c1ba3d613 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
Michael Albinus <michael.albinus@gmx.de>
parents: 85970
diff changeset
7004 ;; successfully, sending 625 bytes failed. Emacs makes a hack when
766c1ba3d613 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
Michael Albinus <michael.albinus@gmx.de>
parents: 85970
diff changeset
7005 ;; this host type is detected locally. It cannot handle remote
766c1ba3d613 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
Michael Albinus <michael.albinus@gmx.de>
parents: 85970
diff changeset
7006 ;; hosts, though.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7007 (with-connection-property proc "chunksize"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7008 (cond
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7009 ((and (integerp tramp-chunksize) (> tramp-chunksize 0))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7010 tramp-chunksize)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7011 (t
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7012 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7013 vec 5 "Checking remote host type for `send-process-string' bug")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7014 (if (string-match
86048
766c1ba3d613 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
Michael Albinus <michael.albinus@gmx.de>
parents: 85970
diff changeset
7015 "^FreeBSD" (tramp-get-connection-property vec "uname" ""))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7016 500 0))))
86048
766c1ba3d613 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
Michael Albinus <michael.albinus@gmx.de>
parents: 85970
diff changeset
7017
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7018 ;; Set remote PATH variable.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7019 (tramp-set-remote-path vec)
86048
766c1ba3d613 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
Michael Albinus <michael.albinus@gmx.de>
parents: 85970
diff changeset
7020
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7021 ;; Search for a good shell before searching for a command which
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7022 ;; checks if a file exists. This is done because Tramp wants to use
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7023 ;; "test foo; echo $?" to check if various conditions hold, and
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7024 ;; there are buggy /bin/sh implementations which don't execute the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7025 ;; "echo $?" part if the "test" part has an error. In particular,
107498
40467a8dcd6c * net/tramp.el (tramp-find-executable): Use
Michael Albinus <albinus@detlef>
parents: 107320
diff changeset
7026 ;; the OpenSolaris /bin/sh is a problem. There are also other
40467a8dcd6c * net/tramp.el (tramp-find-executable): Use
Michael Albinus <albinus@detlef>
parents: 107320
diff changeset
7027 ;; problems with /bin/sh of OpenSolaris, like redirection of stderr
40467a8dcd6c * net/tramp.el (tramp-find-executable): Use
Michael Albinus <albinus@detlef>
parents: 107320
diff changeset
7028 ;; in in function declarations, or changing HISTFILE in place.
40467a8dcd6c * net/tramp.el (tramp-find-executable): Use
Michael Albinus <albinus@detlef>
parents: 107320
diff changeset
7029 ;; Therefore, OpenSolaris' /bin/sh is replaced by bash, when
40467a8dcd6c * net/tramp.el (tramp-find-executable): Use
Michael Albinus <albinus@detlef>
parents: 107320
diff changeset
7030 ;; detected.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7031 (tramp-find-shell vec)
86048
766c1ba3d613 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
Michael Albinus <michael.albinus@gmx.de>
parents: 85970
diff changeset
7032
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7033 ;; Disable unexpected output.
85553
4ccd437aad2e * net/tramp.el (tramp-find-shell)
Michael Albinus <michael.albinus@gmx.de>
parents: 85542
diff changeset
7034 (tramp-send-command vec "mesg n; biff n" t)
86048
766c1ba3d613 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
Michael Albinus <michael.albinus@gmx.de>
parents: 85970
diff changeset
7035
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7036 ;; Set the environment.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7037 (tramp-message vec 5 "Setting default environment")
103328
485abb3b56cd * tramp.el (tramp-open-connection-setup-interactive-shell): Apply
Michael Albinus <michael.albinus@gmx.de>
parents: 103060
diff changeset
7038
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7039 (let ((env (copy-sequence tramp-remote-process-environment))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7040 unset item)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7041 (while env
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
7042 (setq item (tramp-compat-split-string (car env) "="))
107021
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
7043 (setcdr item (mapconcat 'identity (cdr item) "="))
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
7044 (if (and (stringp (cdr item)) (not (string-equal (cdr item) "")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7045 (tramp-send-command
107021
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
7046 vec (format "%s=%s; export %s" (car item) (cdr item) (car item)) t)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7047 (push (car item) unset))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7048 (setq env (cdr env)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7049 (when unset
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7050 (tramp-send-command
85553
4ccd437aad2e * net/tramp.el (tramp-find-shell)
Michael Albinus <michael.albinus@gmx.de>
parents: 85542
diff changeset
7051 vec (format "unset %s" (mapconcat 'identity unset " "))))) t)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7052
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
7053 ;; CCC: We should either implement a Perl version of base64 encoding
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
7054 ;; and decoding. Then we just use that in the last item. The other
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
7055 ;; alternative is to use the Perl version of UU encoding. But then
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
7056 ;; we need a Lisp version of uuencode.
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7057 ;;
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7058 ;; Old text from documentation of tramp-methods:
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7059 ;; Using a uuencode/uudecode inline method is discouraged, please use one
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7060 ;; of the base64 methods instead since base64 encoding is much more
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7061 ;; reliable and the commands are more standardized between the different
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7062 ;; Unix versions. But if you can't use base64 for some reason, please
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7063 ;; note that the default uudecode command does not work well for some
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7064 ;; Unices, in particular AIX and Irix. For AIX, you might want to use
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7065 ;; the following command for uudecode:
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7066 ;;
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7067 ;; sed '/^begin/d;/^[` ]$/d;/^end/d' | iconv -f uucode -t ISO8859-1
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7068 ;;
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7069 ;; For Irix, no solution is known yet.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7070
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7071 (defconst tramp-local-coding-commands
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7072 '((b64 base64-encode-region base64-decode-region)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7073 (uu tramp-uuencode-region uudecode-decode-region)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7074 (pack
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7075 "perl -e 'binmode STDIN; binmode STDOUT; print pack(q{u*}, join q{}, <>)'"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7076 "perl -e 'binmode STDIN; binmode STDOUT; print unpack(q{u*}, join q{}, <>)'"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7077 "List of local coding commands for inline transfer.
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7078 Each item is a list that looks like this:
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7079
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
7080 \(FORMAT ENCODING DECODING\)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7081
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7082 FORMAT is symbol describing the encoding/decoding format. It can be
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7083 `b64' for base64 encoding, `uu' for uu encoding, or `pack' for simple packing.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7084
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7085 ENCODING and DECODING can be strings, giving commands, or symbols,
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7086 giving functions. If they are strings, then they can contain
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7087 the \"%s\" format specifier. If that specifier is present, the input
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7088 filename will be put into the command line at that spot. If the
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7089 specifier is not present, the input should be read from standard
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7090 input.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7091
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7092 If they are functions, they will be called with two arguments, start
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7093 and end of region, and are expected to replace the region contents
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7094 with the encoded or decoded results, respectively.")
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
7095
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7096 (defconst tramp-remote-coding-commands
102287
fdcbc3edbb87 * net/tramp.el (tramp-remote-coding-commands): Add "base64". (Bug#2463)
Michael Albinus <michael.albinus@gmx.de>
parents: 101729
diff changeset
7097 '((b64 "base64" "base64 -d")
fdcbc3edbb87 * net/tramp.el (tramp-remote-coding-commands): Add "base64". (Bug#2463)
Michael Albinus <michael.albinus@gmx.de>
parents: 101729
diff changeset
7098 (b64 "mimencode -b" "mimencode -u -b")
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7099 (b64 "mmencode -b" "mmencode -u -b")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7100 (b64 "recode data..base64" "recode base64..data")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7101 (b64 tramp-perl-encode-with-module tramp-perl-decode-with-module)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7102 (b64 tramp-perl-encode tramp-perl-decode)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7103 (uu "uuencode xxx" "uudecode -o /dev/stdout")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7104 (uu "uuencode xxx" "uudecode -o -")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7105 (uu "uuencode xxx" "uudecode -p")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7106 (uu "uuencode xxx" tramp-uudecode)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7107 (pack
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7108 "perl -e 'binmode STDIN; binmode STDOUT; print pack(q{u*}, join q{}, <>)'"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7109 "perl -e 'binmode STDIN; binmode STDOUT; print unpack(q{u*}, join q{}, <>)'"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7110 "List of remote coding commands for inline transfer.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7111 Each item is a list that looks like this:
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7112
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
7113 \(FORMAT ENCODING DECODING\)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7114
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7115 FORMAT is symbol describing the encoding/decoding format. It can be
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7116 `b64' for base64 encoding, `uu' for uu encoding, or `pack' for simple packing.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7117
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7118 ENCODING and DECODING can be strings, giving commands, or symbols,
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7119 giving variables. If they are strings, then they can contain
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7120 the \"%s\" format specifier. If that specifier is present, the input
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7121 filename will be put into the command line at that spot. If the
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7122 specifier is not present, the input should be read from standard
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7123 input.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7124
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7125 If they are variables, this variable is a string containing a Perl
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7126 implementation for this functionality. This Perl program will be transferred
106895
181539c8b6a4 Fix typos in docstrings, error messages, etc.
Juanma Barranquero <lekktu@gmail.com>
parents: 106815
diff changeset
7127 to the remote host, and it is available as shell function with the same name.")
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7128
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7129 (defun tramp-find-inline-encoding (vec)
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
7130 "Find an inline transfer encoding that works.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7131 Goes through the list `tramp-local-coding-commands' and
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7132 `tramp-remote-coding-commands'."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7133 (save-excursion
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7134 (let ((local-commands tramp-local-coding-commands)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7135 (magic "xyzzy")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7136 loc-enc loc-dec rem-enc rem-dec litem ritem found)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7137 (while (and local-commands (not found))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7138 (setq litem (pop local-commands))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7139 (catch 'wont-work-local
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7140 (let ((format (nth 0 litem))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7141 (remote-commands tramp-remote-coding-commands))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7142 (setq loc-enc (nth 1 litem))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7143 (setq loc-dec (nth 2 litem))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7144 ;; If the local encoder or decoder is a string, the
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7145 ;; corresponding command has to work locally.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7146 (if (not (stringp loc-enc))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7147 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7148 vec 5 "Checking local encoding function `%s'" loc-enc)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7149 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7150 vec 5 "Checking local encoding command `%s' for sanity" loc-enc)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7151 (unless (zerop (tramp-call-local-coding-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7152 loc-enc nil nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7153 (throw 'wont-work-local nil)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7154 (if (not (stringp loc-dec))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7155 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7156 vec 5 "Checking local decoding function `%s'" loc-dec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7157 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7158 vec 5 "Checking local decoding command `%s' for sanity" loc-dec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7159 (unless (zerop (tramp-call-local-coding-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7160 loc-dec nil nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7161 (throw 'wont-work-local nil)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7162 ;; Search for remote coding commands with the same format
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7163 (while (and remote-commands (not found))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7164 (setq ritem (pop remote-commands))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7165 (catch 'wont-work-remote
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7166 (when (equal format (nth 0 ritem))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7167 (setq rem-enc (nth 1 ritem))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7168 (setq rem-dec (nth 2 ritem))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7169 ;; Check if remote encoding and decoding commands can be
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7170 ;; called remotely with null input and output. This makes
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7171 ;; sure there are no syntax errors and the command is really
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7172 ;; found. Note that we do not redirect stdout to /dev/null,
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7173 ;; for two reasons: when checking the decoding command, we
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7174 ;; actually check the output it gives. And also, when
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7175 ;; redirecting "mimencode" output to /dev/null, then as root
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7176 ;; it might change the permissions of /dev/null!
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7177 (when (not (stringp rem-enc))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7178 (let ((name (symbol-name rem-enc)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7179 (while (string-match (regexp-quote "-") name)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7180 (setq name (replace-match "_" nil t name)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7181 (tramp-maybe-send-script vec (symbol-value rem-enc) name)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7182 (setq rem-enc name)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7183 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7184 vec 5
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7185 "Checking remote encoding command `%s' for sanity" rem-enc)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7186 (unless (zerop (tramp-send-command-and-check
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7187 vec (format "%s </dev/null" rem-enc) t))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7188 (throw 'wont-work-remote nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7189
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7190 (when (not (stringp rem-dec))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7191 (let ((name (symbol-name rem-dec)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7192 (while (string-match (regexp-quote "-") name)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7193 (setq name (replace-match "_" nil t name)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7194 (tramp-maybe-send-script vec (symbol-value rem-dec) name)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7195 (setq rem-dec name)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7196 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7197 vec 5
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7198 "Checking remote decoding command `%s' for sanity" rem-dec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7199 (unless (zerop (tramp-send-command-and-check
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7200 vec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7201 (format "echo %s | %s | %s"
106204
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
7202 magic rem-enc rem-dec)
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
7203 t))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7204 (throw 'wont-work-remote nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7205
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7206 (with-current-buffer (tramp-get-buffer vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7207 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7208 (unless (looking-at (regexp-quote magic))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7209 (throw 'wont-work-remote nil)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7210
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7211 ;; `rem-enc' and `rem-dec' could be a string meanwhile.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7212 (setq rem-enc (nth 1 ritem))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7213 (setq rem-dec (nth 2 ritem))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7214 (setq found t)))))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7215
99950
f803581cae44 * net/tramp.el (tramp-handle-write-region): Improve the check for
Michael Albinus <michael.albinus@gmx.de>
parents: 99615
diff changeset
7216 ;; Did we find something?
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7217 (unless found
107021
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
7218 (tramp-error
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
7219 vec 'file-error "Couldn't find an inline transfer encoding"))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7220
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7221 ;; Set connection properties.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7222 (tramp-message vec 5 "Using local encoding `%s'" loc-enc)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7223 (tramp-set-connection-property vec "local-encoding" loc-enc)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7224 (tramp-message vec 5 "Using local decoding `%s'" loc-dec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7225 (tramp-set-connection-property vec "local-decoding" loc-dec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7226 (tramp-message vec 5 "Using remote encoding `%s'" rem-enc)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7227 (tramp-set-connection-property vec "remote-encoding" rem-enc)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7228 (tramp-message vec 5 "Using remote decoding `%s'" rem-dec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7229 (tramp-set-connection-property vec "remote-decoding" rem-dec))))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7230
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7231 (defun tramp-call-local-coding-command (cmd input output)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7232 "Call the local encoding or decoding command.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7233 If CMD contains \"%s\", provide input file INPUT there in command.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7234 Otherwise, INPUT is passed via standard input.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7235 INPUT can also be nil which means `/dev/null'.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7236 OUTPUT can be a string (which specifies a filename), or t (which
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7237 means standard output and thus the current buffer), or nil (which
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7238 means discard it)."
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
7239 (tramp-local-call-process
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
7240 tramp-encoding-shell
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
7241 (when (and input (not (string-match "%s" cmd))) input)
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
7242 (if (eq output t) t nil)
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
7243 nil
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7244 tramp-encoding-command-switch
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7245 (concat
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7246 (if (string-match "%s" cmd) (format cmd input) cmd)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7247 (if (stringp output) (concat "> " output) ""))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7248
108186
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7249 (defconst tramp-inline-compress-commands
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7250 '(("gzip" "gzip -d")
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7251 ("bzip2" "bzip2 -d")
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7252 ("compress" "compress -d"))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7253 "List of compress and decompress commands for inline transfer.
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7254 Each item is a list that looks like this:
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7255
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7256 \(COMPRESS DECOMPRESS\)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7257
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7258 COMPRESS or DECOMPRESS are strings with the respective commands.")
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7259
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7260 (defun tramp-find-inline-compress (vec)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7261 "Find an inline transfer compress command that works.
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7262 Goes through the list `tramp-inline-compress-commands'."
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7263 (save-excursion
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7264 (let ((commands tramp-inline-compress-commands)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7265 (magic "xyzzy")
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7266 item compress decompress
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7267 found)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7268 (while (and commands (not found))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7269 (catch 'next
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7270 (setq item (pop commands)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7271 compress (nth 0 item)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7272 decompress (nth 1 item))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7273 (tramp-message
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7274 vec 5
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7275 "Checking local compress command `%s', `%s' for sanity"
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7276 compress decompress)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7277 (unless (zerop (tramp-call-local-coding-command
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7278 (format "echo %s | %s | %s"
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7279 magic compress decompress) nil nil))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7280 (throw 'next nil))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7281 (tramp-message
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7282 vec 5
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7283 "Checking remote compress command `%s', `%s' for sanity"
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7284 compress decompress)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7285 (unless (zerop (tramp-send-command-and-check
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7286 vec (format "echo %s | %s | %s"
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7287 magic compress decompress) t))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7288 (throw 'next nil))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7289 (setq found t)))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7290
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7291 ;; Did we find something?
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7292 (if found
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7293 (progn
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7294 ;; Set connection properties.
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7295 (tramp-message
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7296 vec 5 "Using inline transfer compress command `%s'" compress)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7297 (tramp-set-connection-property vec "inline-compress" compress)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7298 (tramp-message
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7299 vec 5 "Using inline transfer decompress command `%s'" decompress)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7300 (tramp-set-connection-property vec "inline-decompress" decompress))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7301
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7302 (tramp-set-connection-property vec "inline-compress" nil)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7303 (tramp-set-connection-property vec "inline-decompress" nil)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7304 (tramp-message
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7305 vec 2 "Couldn't find an inline transfer compress command")))))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
7306
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7307 (defun tramp-compute-multi-hops (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7308 "Expands VEC according to `tramp-default-proxies-alist'.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7309 Gateway hops are already opened."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7310 (let ((target-alist `(,vec))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7311 (choices tramp-default-proxies-alist)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7312 item proxy)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7313
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7314 ;; Look for proxy hosts to be passed.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7315 (while choices
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7316 (setq item (pop choices)
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
7317 proxy (eval (nth 2 item)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7318 (when (and
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7319 ;; host
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
7320 (string-match (or (eval (nth 0 item)) "")
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7321 (or (tramp-file-name-host (car target-alist)) ""))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7322 ;; user
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
7323 (string-match (or (eval (nth 1 item)) "")
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7324 (or (tramp-file-name-user (car target-alist)) "")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7325 (if (null proxy)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7326 ;; No more hops needed.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7327 (setq choices nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7328 ;; Replace placeholders.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7329 (setq proxy
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7330 (format-spec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7331 proxy
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
7332 (format-spec-make
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
7333 ?u (or (tramp-file-name-user (car target-alist)) "")
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
7334 ?h (or (tramp-file-name-host (car target-alist)) ""))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7335 (with-parsed-tramp-file-name proxy l
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7336 ;; Add the hop.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7337 (add-to-list 'target-alist l)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7338 ;; Start next search.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7339 (setq choices tramp-default-proxies-alist)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7340
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7341 ;; Handle gateways.
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
7342 (when (and (boundp 'tramp-gw-tunnel-method)
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
7343 (string-match (format
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
7344 "^\\(%s\\|%s\\)$"
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
7345 (symbol-value 'tramp-gw-tunnel-method)
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
7346 (symbol-value 'tramp-gw-socks-method))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
7347 (tramp-file-name-method (car target-alist))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7348 (let ((gw (pop target-alist))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7349 (hop (pop target-alist)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7350 ;; Is the method prepared for gateways?
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7351 (unless (tramp-get-method-parameter
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7352 (tramp-file-name-method hop) 'tramp-default-port)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7353 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7354 vec 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7355 "Method `%s' is not supported for gateway access."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7356 (tramp-file-name-method hop)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7357 ;; Add default port if needed.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7358 (unless
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7359 (string-match
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7360 tramp-host-with-port-regexp (tramp-file-name-host hop))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7361 (aset hop 2
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7362 (concat
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7363 (tramp-file-name-host hop) tramp-prefix-port-format
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7364 (number-to-string
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7365 (tramp-get-method-parameter
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7366 (tramp-file-name-method hop) 'tramp-default-port)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7367 ;; Open the gateway connection.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7368 (add-to-list
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7369 'target-alist
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7370 (vector
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7371 (tramp-file-name-method hop) (tramp-file-name-user hop)
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
7372 (tramp-compat-funcall 'tramp-gw-open-connection vec gw hop) nil))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7373 ;; For the password prompt, we need the correct values.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7374 ;; Therefore, we must remember the gateway vector. But we
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7375 ;; cannot do it as connection property, because it shouldn't
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7376 ;; be persistent. And we have no started process yet either.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7377 (tramp-set-file-property (car target-alist) "" "gateway" hop)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7378
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7379 ;; Foreign and out-of-band methods are not supported for multi-hops.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7380 (when (cdr target-alist)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7381 (setq choices target-alist)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7382 (while choices
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7383 (setq item (pop choices))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7384 (when
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7385 (or
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7386 (not
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7387 (tramp-get-method-parameter
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7388 (tramp-file-name-method item) 'tramp-login-program))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7389 (tramp-get-method-parameter
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7390 (tramp-file-name-method item) 'tramp-copy-program))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7391 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7392 vec 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7393 "Method `%s' is not supported for multi-hops."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7394 (tramp-file-name-method item)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7395
88028
2a4ab582b2a6 * net/tramp.el (tramp-compute-multi-hops): In case of su(do)?
Michael Albinus <michael.albinus@gmx.de>
parents: 87997
diff changeset
7396 ;; In case the host name is not used for the remote shell
2a4ab582b2a6 * net/tramp.el (tramp-compute-multi-hops): In case of su(do)?
Michael Albinus <michael.albinus@gmx.de>
parents: 87997
diff changeset
7397 ;; command, the user could be misguided by applying a random
2a4ab582b2a6 * net/tramp.el (tramp-compute-multi-hops): In case of su(do)?
Michael Albinus <michael.albinus@gmx.de>
parents: 87997
diff changeset
7398 ;; hostname.
2a4ab582b2a6 * net/tramp.el (tramp-compute-multi-hops): In case of su(do)?
Michael Albinus <michael.albinus@gmx.de>
parents: 87997
diff changeset
7399 (let* ((v (car target-alist))
2a4ab582b2a6 * net/tramp.el (tramp-compute-multi-hops): In case of su(do)?
Michael Albinus <michael.albinus@gmx.de>
parents: 87997
diff changeset
7400 (method (tramp-file-name-method v))
2a4ab582b2a6 * net/tramp.el (tramp-compute-multi-hops): In case of su(do)?
Michael Albinus <michael.albinus@gmx.de>
parents: 87997
diff changeset
7401 (host (tramp-file-name-host v)))
2a4ab582b2a6 * net/tramp.el (tramp-compute-multi-hops): In case of su(do)?
Michael Albinus <michael.albinus@gmx.de>
parents: 87997
diff changeset
7402 (unless
2a4ab582b2a6 * net/tramp.el (tramp-compute-multi-hops): In case of su(do)?
Michael Albinus <michael.albinus@gmx.de>
parents: 87997
diff changeset
7403 (or
2a4ab582b2a6 * net/tramp.el (tramp-compute-multi-hops): In case of su(do)?
Michael Albinus <michael.albinus@gmx.de>
parents: 87997
diff changeset
7404 ;; There are multi-hops.
2a4ab582b2a6 * net/tramp.el (tramp-compute-multi-hops): In case of su(do)?
Michael Albinus <michael.albinus@gmx.de>
parents: 87997
diff changeset
7405 (cdr target-alist)
2a4ab582b2a6 * net/tramp.el (tramp-compute-multi-hops): In case of su(do)?
Michael Albinus <michael.albinus@gmx.de>
parents: 87997
diff changeset
7406 ;; The host name is used for the remote shell command.
2a4ab582b2a6 * net/tramp.el (tramp-compute-multi-hops): In case of su(do)?
Michael Albinus <michael.albinus@gmx.de>
parents: 87997
diff changeset
7407 (member
2a4ab582b2a6 * net/tramp.el (tramp-compute-multi-hops): In case of su(do)?
Michael Albinus <michael.albinus@gmx.de>
parents: 87997
diff changeset
7408 '("%h") (tramp-get-method-parameter method 'tramp-login-args))
2a4ab582b2a6 * net/tramp.el (tramp-compute-multi-hops): In case of su(do)?
Michael Albinus <michael.albinus@gmx.de>
parents: 87997
diff changeset
7409 ;; The host is local. We cannot use `tramp-local-host-p'
2a4ab582b2a6 * net/tramp.el (tramp-compute-multi-hops): In case of su(do)?
Michael Albinus <michael.albinus@gmx.de>
parents: 87997
diff changeset
7410 ;; here, because it opens a connection as well.
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
7411 (string-match tramp-local-host-regexp host))
88028
2a4ab582b2a6 * net/tramp.el (tramp-compute-multi-hops): In case of su(do)?
Michael Albinus <michael.albinus@gmx.de>
parents: 87997
diff changeset
7412 (tramp-error
88072
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
7413 v 'file-error
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
7414 "Host `%s' looks like a remote host, `%s' can only use the local host"
948a005afe18 * net/tramp.el (tramp-methods): Use "-H" option for "sudo". Suggested
Michael Albinus <michael.albinus@gmx.de>
parents: 88051
diff changeset
7415 host method)))
88028
2a4ab582b2a6 * net/tramp.el (tramp-compute-multi-hops): In case of su(do)?
Michael Albinus <michael.albinus@gmx.de>
parents: 87997
diff changeset
7416
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7417 ;; Result.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7418 target-alist))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7419
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7420 (defun tramp-maybe-open-connection (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7421 "Maybe open a connection VEC.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7422 Does not do anything if a connection is already open, but re-opens the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7423 connection if a previous connection has died for some reason."
95967
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7424 (catch 'uname-changed
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7425 (let ((p (tramp-get-connection-process vec))
108702
a0b236a315d5 * net/tramp.el (tramp-methods): Add `tramp-async-args' attribute
Michael Albinus <albinus@detlef>
parents: 108540
diff changeset
7426 (process-name (tramp-get-connection-property vec "process-name" nil))
95967
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7427 (process-environment (copy-sequence process-environment)))
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7428
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7429 ;; If too much time has passed since last command was sent, look
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7430 ;; whether process is still alive. If it isn't, kill it. When
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7431 ;; using ssh, it can sometimes happen that the remote end has
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7432 ;; hung up but the local ssh client doesn't recognize this until
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7433 ;; it tries to send some data to the remote end. So that's why
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7434 ;; we try to send a command from time to time, then look again
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7435 ;; whether the process is really alive.
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7436 (condition-case nil
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7437 (when (and (> (tramp-time-diff
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7438 (current-time)
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7439 (tramp-get-connection-property
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7440 p "last-cmd-time" '(0 0 0)))
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7441 60)
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7442 p (processp p) (memq (process-status p) '(run open)))
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7443 (tramp-send-command vec "echo are you awake" t t)
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7444 (unless (and (memq (process-status p) '(run open))
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7445 (tramp-wait-for-output p 10))
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7446 ;; The error will be catched locally.
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7447 (tramp-error vec 'file-error "Awake did fail")))
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7448 (file-error
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7449 (tramp-flush-connection-property vec)
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7450 (tramp-flush-connection-property p)
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7451 (delete-process p)
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7452 (setq p nil)))
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7453
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7454 ;; New connection must be opened.
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7455 (unless (and p (processp p) (memq (process-status p) '(run open)))
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7456
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7457 ;; We call `tramp-get-buffer' in order to get a debug buffer for
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7458 ;; messages from the beginning.
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7459 (tramp-get-buffer vec)
108739
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7460 (with-progress-reporter
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7461 vec 3
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7462 (if (zerop (length (tramp-file-name-user vec)))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7463 (format "Opening connection for %s using %s"
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7464 (tramp-file-name-host vec)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7465 (tramp-file-name-method vec))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7466 (format "Opening connection for %s@%s using %s"
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7467 (tramp-file-name-user vec)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7468 (tramp-file-name-host vec)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7469 (tramp-file-name-method vec)))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7470
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7471 ;; Start new process.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7472 (when (and p (processp p))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7473 (delete-process p))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7474 (setenv "TERM" tramp-terminal-type)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7475 (setenv "LC_ALL" "C")
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7476 (setenv "PROMPT_COMMAND")
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7477 (setenv "PS1" tramp-initial-end-of-output)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7478 (let* ((target-alist (tramp-compute-multi-hops vec))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7479 (process-connection-type tramp-process-connection-type)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7480 (process-adaptive-read-buffering nil)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7481 (coding-system-for-read nil)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7482 ;; This must be done in order to avoid our file name handler.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7483 (p (let ((default-directory
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7484 (tramp-compat-temporary-file-directory)))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7485 (start-process
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7486 (or process-name (tramp-buffer-name vec))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7487 (tramp-get-connection-buffer vec)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7488 tramp-encoding-shell))))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7489
95967
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7490 (tramp-message
108739
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7491 vec 6 "%s" (mapconcat 'identity (process-command p) " "))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7492
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7493 ;; Check whether process is alive.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7494 (tramp-set-process-query-on-exit-flag p nil)
108066
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
7495 (tramp-barf-if-no-shell-prompt
108739
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7496 p 60 "Couldn't find local shell prompt %s" tramp-encoding-shell)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7497
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7498 ;; Now do all the connections as specified.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7499 (while target-alist
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7500 (let* ((hop (car target-alist))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7501 (l-method (tramp-file-name-method hop))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7502 (l-user (tramp-file-name-user hop))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7503 (l-host (tramp-file-name-host hop))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7504 (l-port nil)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7505 (login-program
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7506 (tramp-get-method-parameter
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7507 l-method 'tramp-login-program))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7508 (login-args
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7509 (tramp-get-method-parameter l-method 'tramp-login-args))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7510 (async-args
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7511 (tramp-get-method-parameter l-method 'tramp-async-args))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7512 (gw-args
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7513 (tramp-get-method-parameter l-method 'tramp-gw-args))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7514 (gw (tramp-get-file-property hop "" "gateway" nil))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7515 (g-method (and gw (tramp-file-name-method gw)))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7516 (g-user (and gw (tramp-file-name-user gw)))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7517 (g-host (and gw (tramp-file-name-host gw)))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7518 (command login-program)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7519 ;; We don't create the temporary file. In fact,
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7520 ;; it is just a prefix for the ControlPath option
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7521 ;; of ssh; the real temporary file has another
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7522 ;; name, and it is created and protected by ssh.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7523 ;; It is also removed by ssh, when the connection
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7524 ;; is closed.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7525 (tmpfile
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7526 (tramp-set-connection-property
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7527 p "temp-file"
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7528 (make-temp-name
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7529 (expand-file-name
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7530 tramp-temp-name-prefix
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7531 (tramp-compat-temporary-file-directory)))))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7532 spec)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7533
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7534 ;; Add arguments for asynchrononous processes.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7535 (when (and process-name async-args)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7536 (setq login-args (append login-args async-args)))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7537
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7538 ;; Add gateway arguments if necessary.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7539 (when (and gw gw-args)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7540 (setq login-args (append login-args gw-args)))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7541
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7542 ;; Check for port number. Until now, there's no need
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7543 ;; for handling like method, user, host.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7544 (when (string-match tramp-host-with-port-regexp l-host)
95967
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7545 (setq l-port (match-string 2 l-host)
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7546 l-host (match-string 1 l-host)))
13aa0133c5af (tramp-open-connection-setup-interactive-shell): Flush cache, and
Michael Albinus <michael.albinus@gmx.de>
parents: 95963
diff changeset
7547
108739
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7548 ;; Set variables for computing the prompt for reading
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7549 ;; password. They can also be derived from a gateway.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7550 (setq tramp-current-method (or g-method l-method)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7551 tramp-current-user (or g-user l-user)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7552 tramp-current-host (or g-host l-host))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7553
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7554 ;; Replace login-args place holders.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7555 (setq
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7556 l-host (or l-host "")
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7557 l-user (or l-user "")
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7558 l-port (or l-port "")
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7559 spec (format-spec-make
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7560 ?h l-host ?u l-user ?p l-port ?t tmpfile)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7561 command
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7562 (concat
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7563 ;; We do not want to see the trailing local prompt in
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7564 ;; `start-file-process'.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7565 (unless (memq system-type '(windows-nt)) "exec ")
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7566 command " "
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7567 (mapconcat
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7568 (lambda (x)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7569 (setq x (mapcar (lambda (y) (format-spec y spec)) x))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7570 (unless (member "" x) (mapconcat 'identity x " ")))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7571 login-args " ")
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7572 ;; Local shell could be a Windows COMSPEC. It
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7573 ;; doesn't know the ";" syntax, but we must exit
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7574 ;; always for `start-file-process'. "exec" does not
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7575 ;; work either.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7576 (if (memq system-type '(windows-nt)) " && exit || exit")))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7577
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7578 ;; Send the command.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7579 (tramp-message vec 3 "Sending command `%s'" command)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7580 (tramp-send-command vec command t t)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7581 (tramp-process-actions p vec tramp-actions-before-shell 60)
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7582 (tramp-message
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7583 vec 3 "Found remote shell prompt on `%s'" l-host))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7584 ;; Next hop.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7585 (setq target-alist (cdr target-alist)))
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7586
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7587 ;; Make initial shell settings.
ae0f7dfcf9c9 * net/tramp.el (tramp-do-copy-or-rename-file)
Michael Albinus <michael.albinus@gmx.de>
parents: 108702
diff changeset
7588 (tramp-open-connection-setup-interactive-shell p vec)))))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7589
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7590 (defun tramp-send-command (vec command &optional neveropen nooutput)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7591 "Send the COMMAND to connection VEC.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7592 Erases temporary buffer before sending the command. If optional
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7593 arg NEVEROPEN is non-nil, never try to open the connection. This
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7594 is meant to be used from `tramp-maybe-open-connection' only. The
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7595 function waits for output unless NOOUTPUT is set."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7596 (unless neveropen (tramp-maybe-open-connection vec))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7597 (let ((p (tramp-get-connection-process vec)))
86241
4a7e0b7fde4e * net/tramp.el (tramp-open-connection-setup-interactive-shell):
Michael Albinus <michael.albinus@gmx.de>
parents: 86224
diff changeset
7598 (when (tramp-get-connection-property p "remote-echo" nil)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7599 ;; We mark the command string that it can be erased in the output buffer.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7600 (tramp-set-connection-property p "check-remote-echo" t)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7601 (setq command (format "%s%s%s" tramp-echo-mark command tramp-echo-mark)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7602 (tramp-message vec 6 "%s" command)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7603 (tramp-send-string vec command)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7604 (unless nooutput (tramp-wait-for-output p))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7605
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7606 (defun tramp-wait-for-output (proc &optional timeout)
107021
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
7607 "Wait for output from remote command."
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
7608 (unless (buffer-live-p (process-buffer proc))
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
7609 (delete-process proc)
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
7610 (tramp-error proc 'file-error "Process `%s' not available, try again" proc))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7611 (with-current-buffer (process-buffer proc)
106470
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
7612 (let* (;; Initially, `tramp-end-of-output' is "#$ ". There might
103934
33e088977519 * net/tramp.el (tramp-wait-for-output): Handle the case when
Michael Albinus <michael.albinus@gmx.de>
parents: 103782
diff changeset
7613 ;; be leading escape sequences, which must be ignored.
106470
9e96dbbd314e Handle prompt rules of ksh in OpenBSD 4.5. Reported by Raphal
Michael Albinus <michael.albinus@gmx.de>
parents: 106390
diff changeset
7614 (regexp (format "[^#$\n]*%s\r?$" (regexp-quote tramp-end-of-output)))
103934
33e088977519 * net/tramp.el (tramp-wait-for-output): Handle the case when
Michael Albinus <michael.albinus@gmx.de>
parents: 103782
diff changeset
7615 ;; Sometimes, the commands do not return a newline but a
33e088977519 * net/tramp.el (tramp-wait-for-output): Handle the case when
Michael Albinus <michael.albinus@gmx.de>
parents: 103782
diff changeset
7616 ;; null byte before the shell prompt, for example "git
33e088977519 * net/tramp.el (tramp-wait-for-output): Handle the case when
Michael Albinus <michael.albinus@gmx.de>
parents: 103782
diff changeset
7617 ;; ls-files -c -z ...".
33e088977519 * net/tramp.el (tramp-wait-for-output): Handle the case when
Michael Albinus <michael.albinus@gmx.de>
parents: 103782
diff changeset
7618 (regexp1 (format "\\(^\\|\000\\)%s" regexp))
33e088977519 * net/tramp.el (tramp-wait-for-output): Handle the case when
Michael Albinus <michael.albinus@gmx.de>
parents: 103782
diff changeset
7619 (found (tramp-wait-for-regexp proc timeout regexp1)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7620 (if found
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7621 (let (buffer-read-only)
107021
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
7622 ;; A simple-minded busybox has sent " ^H" sequences.
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
7623 ;; Delete them.
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
7624 (goto-char (point-min))
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
7625 (when (re-search-forward
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
7626 "^\\(.\b\\)+$" (tramp-compat-line-end-position) t)
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
7627 (forward-line 1)
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
7628 (delete-region (point-min) (point)))
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
7629 ;; Delete the prompt.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7630 (goto-char (point-max))
87648
7ae99e295dfd * vc-git.el (vc-git--call): Apply `process-file' instead of
Michael Albinus <michael.albinus@gmx.de>
parents: 87368
diff changeset
7631 (re-search-backward regexp nil t)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7632 (delete-region (point) (point-max)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7633 (if timeout
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7634 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7635 proc 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7636 "[[Remote prompt `%s' not found in %d secs]]"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7637 tramp-end-of-output timeout)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7638 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7639 proc 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7640 "[[Remote prompt `%s' not found]]" tramp-end-of-output)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7641 ;; Return value is whether end-of-output sentinel was found.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7642 found)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7643
106204
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
7644 (defun tramp-send-command-and-check
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
7645 (vec command &optional subshell dont-suppress-err)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7646 "Run COMMAND and check its exit status.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7647 Sends `echo $?' along with the COMMAND for checking the exit status. If
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7648 COMMAND is nil, just sends `echo $?'. Returns the exit status found.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7649
106204
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
7650 If the optional argument SUBSHELL is non-nil, the command is
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
7651 executed in a subshell, ie surrounded by parentheses. If
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
7652 DONT-SUPPRESS-ERR is non-nil, stderr won't be sent to /dev/null."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7653 (tramp-send-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7654 vec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7655 (concat (if subshell "( " "")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7656 command
106204
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
7657 (if command (if dont-suppress-err "; " " 2>/dev/null; ") "")
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7658 "echo tramp_exit_status $?"
106204
075fc4ee6c41 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
Michael Albinus <michael.albinus@gmx.de>
parents: 106115
diff changeset
7659 (if subshell " )" "")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7660 (with-current-buffer (tramp-get-connection-buffer vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7661 (goto-char (point-max))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7662 (unless (re-search-backward "tramp_exit_status [0-9]+" nil t)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7663 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7664 vec 'file-error "Couldn't find exit status of `%s'" command))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7665 (skip-chars-forward "^ ")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7666 (prog1
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7667 (read (current-buffer))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7668 (let (buffer-read-only) (delete-region (match-beginning 0) (point-max))))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7669
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7670 (defun tramp-barf-unless-okay (vec command fmt &rest args)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7671 "Run COMMAND, check exit status, throw error if exit status not okay.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7672 Similar to `tramp-send-command-and-check' but accepts two more arguments
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7673 FMT and ARGS which are passed to `error'."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7674 (unless (zerop (tramp-send-command-and-check vec command))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7675 (apply 'tramp-error vec 'file-error fmt args)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7676
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7677 (defun tramp-send-command-and-read (vec command)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7678 "Run COMMAND and return the output, which must be a Lisp expression.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7679 In case there is no valid Lisp expression, it raises an error"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7680 (tramp-barf-unless-okay vec command "`%s' returns with error" command)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7681 (with-current-buffer (tramp-get-connection-buffer vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7682 ;; Read the expression.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7683 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7684 (condition-case nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7685 (prog1 (read (current-buffer))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7686 ;; Error handling.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
7687 (when (re-search-forward "\\S-" (tramp-compat-line-end-position) t)
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
7688 (error nil)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7689 (error (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7690 vec 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7691 "`%s' does not return a valid Lisp expression: `%s'"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7692 command (buffer-string))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7693
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
7694 ;; It seems that Tru64 Unix does not like it if long strings are sent
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
7695 ;; to it in one go. (This happens when sending the Perl
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
7696 ;; `file-attributes' implementation, for instance.) Therefore, we
82324
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
7697 ;; have this function which sends the string in chunks.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7698 (defun tramp-send-string (vec string)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7699 "Send the STRING via connection VEC.
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
7700
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
7701 The STRING is expected to use Unix line-endings, but the lines sent to
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
7702 the remote host use line-endings as defined in the variable
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7703 `tramp-rsh-end-of-line'. The communication buffer is erased before sending."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7704 (let* ((p (tramp-get-connection-process vec))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7705 (chunksize (tramp-get-connection-property p "chunksize" nil)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7706 (unless p
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7707 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7708 vec 'file-error "Can't send string to remote host -- not logged in"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7709 (tramp-set-connection-property p "last-cmd-time" (current-time))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7710 (tramp-message vec 10 "%s" string)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7711 (with-current-buffer (tramp-get-connection-buffer vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7712 ;; Clean up the buffer. We cannot call `erase-buffer' because
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7713 ;; narrowing might be in effect.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7714 (let (buffer-read-only) (delete-region (point-min) (point-max)))
82324
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
7715 ;; Replace "\n" by `tramp-rsh-end-of-line'.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7716 (setq string
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7717 (mapconcat 'identity
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
7718 (tramp-compat-split-string string "\n")
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7719 tramp-rsh-end-of-line))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7720 (unless (or (string= string "")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7721 (string-equal (substring string -1) tramp-rsh-end-of-line))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7722 (setq string (concat string tramp-rsh-end-of-line)))
82324
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
7723 ;; Send the string.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7724 (if (and chunksize (not (zerop chunksize)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7725 (let ((pos 0)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7726 (end (length string)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7727 (while (< pos end)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7728 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7729 vec 10 "Sending chunk from %s to %s"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7730 pos (min (+ pos chunksize) end))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7731 (process-send-string
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7732 p (substring string pos (min (+ pos chunksize) end)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7733 (setq pos (+ pos chunksize))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7734 (process-send-string p string)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7735
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7736 (defun tramp-mode-string-to-int (mode-string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7737 "Converts a ten-letter `drwxrwxrwx'-style mode string into mode bits."
77986
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7738 (let* (case-fold-search
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7739 (mode-chars (string-to-vector mode-string))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7740 (owner-read (aref mode-chars 1))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7741 (owner-write (aref mode-chars 2))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7742 (owner-execute-or-setid (aref mode-chars 3))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7743 (group-read (aref mode-chars 4))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7744 (group-write (aref mode-chars 5))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7745 (group-execute-or-setid (aref mode-chars 6))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7746 (other-read (aref mode-chars 7))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7747 (other-write (aref mode-chars 8))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7748 (other-execute-or-sticky (aref mode-chars 9)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7749 (save-match-data
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7750 (logior
77986
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7751 (cond
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7752 ((char-equal owner-read ?r) (tramp-octal-to-decimal "00400"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7753 ((char-equal owner-read ?-) 0)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7754 (t (error "Second char `%c' must be one of `r-'" owner-read)))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7755 (cond
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7756 ((char-equal owner-write ?w) (tramp-octal-to-decimal "00200"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7757 ((char-equal owner-write ?-) 0)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7758 (t (error "Third char `%c' must be one of `w-'" owner-write)))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7759 (cond
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7760 ((char-equal owner-execute-or-setid ?x)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7761 (tramp-octal-to-decimal "00100"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7762 ((char-equal owner-execute-or-setid ?S)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7763 (tramp-octal-to-decimal "04000"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7764 ((char-equal owner-execute-or-setid ?s)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7765 (tramp-octal-to-decimal "04100"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7766 ((char-equal owner-execute-or-setid ?-) 0)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7767 (t (error "Fourth char `%c' must be one of `xsS-'"
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7768 owner-execute-or-setid)))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7769 (cond
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7770 ((char-equal group-read ?r) (tramp-octal-to-decimal "00040"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7771 ((char-equal group-read ?-) 0)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7772 (t (error "Fifth char `%c' must be one of `r-'" group-read)))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7773 (cond
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7774 ((char-equal group-write ?w) (tramp-octal-to-decimal "00020"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7775 ((char-equal group-write ?-) 0)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7776 (t (error "Sixth char `%c' must be one of `w-'" group-write)))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7777 (cond
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7778 ((char-equal group-execute-or-setid ?x)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7779 (tramp-octal-to-decimal "00010"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7780 ((char-equal group-execute-or-setid ?S)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7781 (tramp-octal-to-decimal "02000"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7782 ((char-equal group-execute-or-setid ?s)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7783 (tramp-octal-to-decimal "02010"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7784 ((char-equal group-execute-or-setid ?-) 0)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7785 (t (error "Seventh char `%c' must be one of `xsS-'"
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7786 group-execute-or-setid)))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7787 (cond
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7788 ((char-equal other-read ?r)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7789 (tramp-octal-to-decimal "00004"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7790 ((char-equal other-read ?-) 0)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7791 (t (error "Eighth char `%c' must be one of `r-'" other-read)))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7792 (cond
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7793 ((char-equal other-write ?w) (tramp-octal-to-decimal "00002"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7794 ((char-equal other-write ?-) 0)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7795 (t (error "Nineth char `%c' must be one of `w-'" other-write)))
77986
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7796 (cond
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7797 ((char-equal other-execute-or-sticky ?x)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7798 (tramp-octal-to-decimal "00001"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7799 ((char-equal other-execute-or-sticky ?T)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7800 (tramp-octal-to-decimal "01000"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7801 ((char-equal other-execute-or-sticky ?t)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7802 (tramp-octal-to-decimal "01001"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7803 ((char-equal other-execute-or-sticky ?-) 0)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7804 (t (error "Tenth char `%c' must be one of `xtT-'"
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
7805 other-execute-or-sticky)))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7806
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7807 (defun tramp-convert-file-attributes (vec attr)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7808 "Convert file-attributes ATTR generated by perl script, stat or ls.
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
7809 Convert file mode bits to string and set virtual device number.
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
7810 Return ATTR."
104866
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7811 (when attr
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7812 ;; Convert last access time.
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7813 (unless (listp (nth 4 attr))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7814 (setcar (nthcdr 4 attr)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7815 (list (floor (nth 4 attr) 65536)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7816 (floor (mod (nth 4 attr) 65536)))))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7817 ;; Convert last modification time.
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7818 (unless (listp (nth 5 attr))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7819 (setcar (nthcdr 5 attr)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7820 (list (floor (nth 5 attr) 65536)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7821 (floor (mod (nth 5 attr) 65536)))))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7822 ;; Convert last status change time.
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7823 (unless (listp (nth 6 attr))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7824 (setcar (nthcdr 6 attr)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7825 (list (floor (nth 6 attr) 65536)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7826 (floor (mod (nth 6 attr) 65536)))))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7827 ;; Convert file size.
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7828 (when (< (nth 7 attr) 0)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7829 (setcar (nthcdr 7 attr) -1))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7830 (when (and (floatp (nth 7 attr))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7831 (<= (nth 7 attr) (tramp-compat-most-positive-fixnum)))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7832 (setcar (nthcdr 7 attr) (round (nth 7 attr))))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7833 ;; Convert file mode bits to string.
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7834 (unless (stringp (nth 8 attr))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7835 (setcar (nthcdr 8 attr) (tramp-file-mode-from-int (nth 8 attr)))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7836 (when (stringp (car attr))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7837 (aset (nth 8 attr) 0 ?l)))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7838 ;; Convert directory indication bit.
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7839 (when (string-match "^d" (nth 8 attr))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7840 (setcar attr t))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7841 ;; Convert symlink from `tramp-do-file-attributes-with-stat'.
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7842 (when (consp (car attr))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7843 (if (and (stringp (caar attr))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7844 (string-match ".+ -> .\\(.+\\)." (caar attr)))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7845 (setcar attr (match-string 1 (caar attr)))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7846 (setcar attr nil)))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7847 ;; Set file's gid change bit.
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7848 (setcar (nthcdr 9 attr)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7849 (if (numberp (nth 3 attr))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7850 (not (= (nth 3 attr)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7851 (tramp-get-remote-gid vec 'integer)))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7852 (not (string-equal
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7853 (nth 3 attr)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7854 (tramp-get-remote-gid vec 'string)))))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7855 ;; Convert inode.
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7856 (unless (listp (nth 10 attr))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7857 (setcar (nthcdr 10 attr)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7858 (condition-case nil
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7859 (cons (floor (nth 10 attr) 65536)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7860 (floor (mod (nth 10 attr) 65536)))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7861 ;; Inodes can be incredible huge. We must hide this.
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7862 (error (tramp-get-inode vec)))))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7863 ;; Set virtual device number.
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7864 (setcar (nthcdr 11 attr)
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7865 (tramp-get-device vec))
3d5d2850cbef * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
Michael Albinus <michael.albinus@gmx.de>
parents: 104850
diff changeset
7866 attr))
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
7867
105767
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7868 (defun tramp-check-cached-permissions (vec access)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7869 "Check `file-attributes' caches for VEC.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7870 Return t if according to the cache access type ACCESS is known to
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7871 be granted."
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7872 (let ((result nil)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7873 (offset (cond
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7874 ((eq ?r access) 1)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7875 ((eq ?w access) 2)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7876 ((eq ?x access) 3))))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7877 (dolist (suffix '("string" "integer") result)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7878 (setq
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7879 result
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7880 (or
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7881 result
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7882 (let ((file-attr
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7883 (tramp-get-file-property
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7884 vec (tramp-file-name-localname vec)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7885 (concat "file-attributes-" suffix) nil))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7886 (remote-uid
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7887 (tramp-get-connection-property
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7888 vec (concat "uid-" suffix) nil))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7889 (remote-gid
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7890 (tramp-get-connection-property
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7891 vec (concat "gid-" suffix) nil)))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7892 (and
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7893 file-attr
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7894 (or
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7895 ;; Not a symlink
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7896 (eq t (car file-attr))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7897 (null (car file-attr)))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7898 (or
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7899 ;; World accessible.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7900 (eq access (aref (nth 8 file-attr) (+ offset 6)))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7901 ;; User accessible and owned by user.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7902 (and
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7903 (eq access (aref (nth 8 file-attr) offset))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7904 (equal remote-uid (nth 2 file-attr)))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7905 ;; Group accessible and owned by user's
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7906 ;; principal group.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7907 (and
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7908 (eq access (aref (nth 8 file-attr) (+ offset 3)))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7909 (equal remote-gid (nth 3 file-attr)))))))))))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
7910
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
7911 (defun tramp-get-inode (vec)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7912 "Returns the virtual inode number.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7913 If it doesn't exist, generate a new one."
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
7914 (let ((string (tramp-make-tramp-file-name
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
7915 (tramp-file-name-method vec)
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
7916 (tramp-file-name-user vec)
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
7917 (tramp-file-name-host vec)
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
7918 "")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7919 (unless (assoc string tramp-inodes)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7920 (add-to-list 'tramp-inodes
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7921 (list string (length tramp-inodes))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7922 (nth 1 (assoc string tramp-inodes))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7923
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7924 (defun tramp-get-device (vec)
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
7925 "Returns the virtual device number.
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
7926 If it doesn't exist, generate a new one."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7927 (let ((string (tramp-make-tramp-file-name
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7928 (tramp-file-name-method vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7929 (tramp-file-name-user vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7930 (tramp-file-name-host vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7931 "")))
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
7932 (unless (assoc string tramp-devices)
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
7933 (add-to-list 'tramp-devices
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
7934 (list string (length tramp-devices))))
97052
bed318e44ebd * net/tramp.el (tramp-perl-directory-files-and-attributes)
Michael Albinus <michael.albinus@gmx.de>
parents: 97035
diff changeset
7935 (cons -1 (nth 1 (assoc string tramp-devices)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7936
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7937 (defun tramp-file-mode-from-int (mode)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7938 "Turn an integer representing a file mode into an ls(1)-like string."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7939 (let ((type (cdr (assoc (logand (lsh mode -12) 15) tramp-file-mode-type-map)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7940 (user (logand (lsh mode -6) 7))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7941 (group (logand (lsh mode -3) 7))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7942 (other (logand (lsh mode -0) 7))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7943 (suid (> (logand (lsh mode -9) 4) 0))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7944 (sgid (> (logand (lsh mode -9) 2) 0))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7945 (sticky (> (logand (lsh mode -9) 1) 0)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7946 (setq user (tramp-file-mode-permissions user suid "s"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7947 (setq group (tramp-file-mode-permissions group sgid "s"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7948 (setq other (tramp-file-mode-permissions other sticky "t"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7949 (concat type user group other)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7950
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7951 (defun tramp-file-mode-permissions (perm suid suid-text)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7952 "Convert a permission bitset into a string.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7953 This is used internally by `tramp-file-mode-from-int'."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7954 (let ((r (> (logand perm 4) 0))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7955 (w (> (logand perm 2) 0))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7956 (x (> (logand perm 1) 0)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7957 (concat (or (and r "r") "-")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7958 (or (and w "w") "-")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7959 (or (and suid x suid-text) ; suid, execute
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7960 (and suid (upcase suid-text)) ; suid, !execute
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7961 (and x "x") "-")))) ; !suid
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7962
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7963 (defun tramp-decimal-to-octal (i)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7964 "Return a string consisting of the octal digits of I.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7965 Not actually used. Use `(format \"%o\" i)' instead?"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7966 (cond ((< i 0) (error "Cannot convert negative number to octal"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7967 ((not (integerp i)) (error "Cannot convert non-integer to octal"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7968 ((zerop i) "0")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7969 (t (concat (tramp-decimal-to-octal (/ i 8))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7970 (number-to-string (% i 8))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7971
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7972 ;; Kudos to Gerd Moellmann for this suggestion.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7973 (defun tramp-octal-to-decimal (ostr)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7974 "Given a string of octal digits, return a decimal number."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7975 (let ((x (or ostr "")))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7976 ;; `save-match' is in `tramp-mode-string-to-int' which calls this.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7977 (unless (string-match "\\`[0-7]*\\'" x)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7978 (error "Non-octal junk in string `%s'" x))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7979 (string-to-number ostr 8)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7980
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7981 (defun tramp-shell-case-fold (string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7982 "Converts STRING to shell glob pattern which ignores case."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7983 (mapconcat
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7984 (lambda (c)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7985 (if (equal (downcase c) (upcase c))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7986 (vector c)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7987 (format "[%c%c]" (downcase c) (upcase c))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7988 string
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7989 ""))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7990
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7991
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
7992 ;; ------------------------------------------------------------
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
7993 ;; -- Tramp file names --
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
7994 ;; ------------------------------------------------------------
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7995 ;; Conversion functions between external representation and
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7996 ;; internal data structure. Convenience functions for internal
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7997 ;; data structure.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7998
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7999 (defun tramp-file-name-p (vec)
108066
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
8000 "Check, whether VEC is a Tramp object."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8001 (and (vectorp vec) (= 4 (length vec))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8002
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8003 (defun tramp-file-name-method (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8004 "Return method component of VEC."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8005 (and (tramp-file-name-p vec) (aref vec 0)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8006
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8007 (defun tramp-file-name-user (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8008 "Return user component of VEC."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8009 (and (tramp-file-name-p vec) (aref vec 1)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8010
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8011 (defun tramp-file-name-host (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8012 "Return host component of VEC."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8013 (and (tramp-file-name-p vec) (aref vec 2)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8014
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8015 (defun tramp-file-name-localname (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8016 "Return localname component of VEC."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8017 (and (tramp-file-name-p vec) (aref vec 3)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8018
100634
2af636c8c9d2 * net/tramp.el (tramp-rfn-eshadow-update-overlay): Move overlay to
Michael Albinus <michael.albinus@gmx.de>
parents: 100316
diff changeset
8019 ;; The user part of a Tramp file name vector can be of kind
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
8020 ;; "user%domain". Sometimes, we must extract these parts.
100634
2af636c8c9d2 * net/tramp.el (tramp-rfn-eshadow-update-overlay): Move overlay to
Michael Albinus <michael.albinus@gmx.de>
parents: 100316
diff changeset
8021 (defun tramp-file-name-real-user (vec)
2af636c8c9d2 * net/tramp.el (tramp-rfn-eshadow-update-overlay): Move overlay to
Michael Albinus <michael.albinus@gmx.de>
parents: 100316
diff changeset
8022 "Return the user name of VEC without domain."
105523
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
8023 (save-match-data
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
8024 (let ((user (tramp-file-name-user vec)))
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
8025 (if (and (stringp user)
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
8026 (string-match tramp-user-with-domain-regexp user))
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
8027 (match-string 1 user)
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
8028 user))))
100634
2af636c8c9d2 * net/tramp.el (tramp-rfn-eshadow-update-overlay): Move overlay to
Michael Albinus <michael.albinus@gmx.de>
parents: 100316
diff changeset
8029
2af636c8c9d2 * net/tramp.el (tramp-rfn-eshadow-update-overlay): Move overlay to
Michael Albinus <michael.albinus@gmx.de>
parents: 100316
diff changeset
8030 (defun tramp-file-name-domain (vec)
2af636c8c9d2 * net/tramp.el (tramp-rfn-eshadow-update-overlay): Move overlay to
Michael Albinus <michael.albinus@gmx.de>
parents: 100316
diff changeset
8031 "Return the domain name of VEC."
105523
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
8032 (save-match-data
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
8033 (let ((user (tramp-file-name-user vec)))
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
8034 (and (stringp user)
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
8035 (string-match tramp-user-with-domain-regexp user)
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
8036 (match-string 2 user)))))
100634
2af636c8c9d2 * net/tramp.el (tramp-rfn-eshadow-update-overlay): Move overlay to
Michael Albinus <michael.albinus@gmx.de>
parents: 100316
diff changeset
8037
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8038 ;; The host part of a Tramp file name vector can be of kind
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8039 ;; "host#port". Sometimes, we must extract these parts.
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
8040 (defun tramp-file-name-real-host (vec)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8041 "Return the host name of VEC without port."
105523
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
8042 (save-match-data
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
8043 (let ((host (tramp-file-name-host vec)))
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
8044 (if (and (stringp host)
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
8045 (string-match tramp-host-with-port-regexp host))
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
8046 (match-string 1 host)
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
8047 host))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8048
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
8049 (defun tramp-file-name-port (vec)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8050 "Return the port number of VEC."
105523
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
8051 (save-match-data
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
8052 (let ((host (tramp-file-name-host vec)))
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
8053 (and (stringp host)
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
8054 (string-match tramp-host-with-port-regexp host)
54704a452681 * net/tramp.el (tramp-file-name-real-user, tramp-file-name-domain)
Michael Albinus <michael.albinus@gmx.de>
parents: 105482
diff changeset
8055 (string-to-number (match-string 2 host))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8056
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8057 (defun tramp-tramp-file-p (name)
106390
4eee659fa954 Cleanup.
Michael Albinus <michael.albinus@gmx.de>
parents: 106310
diff changeset
8058 "Return t if NAME is a string with Tramp file name syntax."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8059 (save-match-data
106390
4eee659fa954 Cleanup.
Michael Albinus <michael.albinus@gmx.de>
parents: 106310
diff changeset
8060 (and (stringp name) (string-match tramp-file-name-regexp name))))
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
8061
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
8062 (defun tramp-find-method (method user host)
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
8063 "Return the right method string to use.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8064 This is METHOD, if non-nil. Otherwise, do a lookup in
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
8065 `tramp-default-method-alist'."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8066 (or method
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8067 (let ((choices tramp-default-method-alist)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8068 lmethod item)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8069 (while choices
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8070 (setq item (pop choices))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8071 (when (and (string-match (or (nth 0 item) "") (or host ""))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8072 (string-match (or (nth 1 item) "") (or user "")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8073 (setq lmethod (nth 2 item))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8074 (setq choices nil)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8075 lmethod)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8076 tramp-default-method))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8077
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
8078 (defun tramp-find-user (method user host)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8079 "Return the right user string to use.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8080 This is USER, if non-nil. Otherwise, do a lookup in
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8081 `tramp-default-user-alist'."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8082 (or user
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8083 (let ((choices tramp-default-user-alist)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8084 luser item)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8085 (while choices
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8086 (setq item (pop choices))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8087 (when (and (string-match (or (nth 0 item) "") (or method ""))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8088 (string-match (or (nth 1 item) "") (or host "")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8089 (setq luser (nth 2 item))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8090 (setq choices nil)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8091 luser)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8092 tramp-default-user))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8093
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
8094 (defun tramp-find-host (method user host)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8095 "Return the right host string to use.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8096 This is HOST, if non-nil. Otherwise, it is `tramp-default-host'."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8097 (or (and (> (length host) 0) host)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8098 tramp-default-host))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8099
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
8100 (defun tramp-dissect-file-name (name &optional nodefault)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8101 "Return a `tramp-file-name' structure.
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
8102 The structure consists of remote method, remote user, remote host
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
8103 and localname (file name on remote host). If NODEFAULT is
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
8104 non-nil, the file name parts are not expanded to their default
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
8105 values."
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
8106 (save-match-data
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8107 (let ((match (string-match (nth 0 tramp-file-name-structure) name)))
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
8108 (unless match (error "Not a Tramp file name: %s" name))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8109 (let ((method (match-string (nth 1 tramp-file-name-structure) name))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8110 (user (match-string (nth 2 tramp-file-name-structure) name))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8111 (host (match-string (nth 3 tramp-file-name-structure) name))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8112 (localname (match-string (nth 4 tramp-file-name-structure) name)))
87997
13df71a98040 * net/tramp.el (tramp-dissect-file-name): Raise an error when
Michael Albinus <michael.albinus@gmx.de>
parents: 87947
diff changeset
8113 (when (member method '("multi" "multiu"))
13df71a98040 * net/tramp.el (tramp-dissect-file-name): Raise an error when
Michael Albinus <michael.albinus@gmx.de>
parents: 87947
diff changeset
8114 (error
13df71a98040 * net/tramp.el (tramp-dissect-file-name): Raise an error when
Michael Albinus <michael.albinus@gmx.de>
parents: 87947
diff changeset
8115 "`%s' method is no longer supported, see (info \"(tramp)Multi-hops\")"
13df71a98040 * net/tramp.el (tramp-dissect-file-name): Raise an error when
Michael Albinus <michael.albinus@gmx.de>
parents: 87947
diff changeset
8116 method))
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
8117 (when host
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
8118 (when (string-match tramp-prefix-ipv6-regexp host)
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
8119 (setq host (replace-match "" nil t host)))
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
8120 (when (string-match tramp-postfix-ipv6-regexp host)
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
8121 (setq host (replace-match "" nil t host))))
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
8122 (if nodefault
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
8123 (vector method user host localname)
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
8124 (vector
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
8125 (tramp-find-method method user host)
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
8126 (tramp-find-user method user host)
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
8127 (tramp-find-host method user host)
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
8128 localname))))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8129
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8130 (defun tramp-equal-remote (file1 file2)
108066
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
8131 "Check, whether the remote parts of FILE1 and FILE2 are identical.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8132 The check depends on method, user and host name of the files. If
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8133 one of the components is missing, the default values are used.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8134 The local file name parts of FILE1 and FILE2 are not taken into
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8135 account.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8136
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8137 Example:
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8138
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8139 (tramp-equal-remote \"/ssh::/etc\" \"/<your host name>:/home\")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8140
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8141 would yield `t'. On the other hand, the following check results in nil:
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8142
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8143 (tramp-equal-remote \"/sudo::/etc\" \"/su::/etc\")"
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
8144 (and (stringp (file-remote-p file1))
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
8145 (stringp (file-remote-p file2))
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
8146 (string-equal (file-remote-p file1) (file-remote-p file2))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8147
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8148 (defun tramp-make-tramp-file-name (method user host localname)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8149 "Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8150 (concat tramp-prefix-format
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8151 (when (not (zerop (length method)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8152 (concat method tramp-postfix-method-format))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8153 (when (not (zerop (length user)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8154 (concat user tramp-postfix-user-format))
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
8155 (when host
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
8156 (if (string-match tramp-ipv6-regexp host)
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
8157 (concat tramp-prefix-ipv6-format host tramp-postfix-ipv6-format)
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
8158 host))
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
8159 tramp-postfix-host-format
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8160 (when localname localname)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8161
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8162 (defun tramp-completion-make-tramp-file-name (method user host localname)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8163 "Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8164 It must not be a complete Tramp file name, but as long as there are
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8165 necessary only. This function will be used in file name completion."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8166 (concat tramp-prefix-format
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8167 (when (not (zerop (length method)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8168 (concat method tramp-postfix-method-format))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8169 (when (not (zerop (length user)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8170 (concat user tramp-postfix-user-format))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8171 (when (not (zerop (length host)))
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
8172 (concat
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
8173 (if (string-match tramp-ipv6-regexp host)
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
8174 (concat tramp-prefix-ipv6-format host tramp-postfix-ipv6-format)
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
8175 host)
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
8176 tramp-postfix-host-format))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8177 (when localname localname)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8178
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8179 (defun tramp-make-copy-program-file-name (vec)
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
8180 "Create a file name suitable to be passed to `rcp' and workalikes."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8181 (let ((user (tramp-file-name-user vec))
82808
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
8182 (host (tramp-file-name-real-host vec))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8183 (localname (tramp-shell-quote-argument
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8184 (tramp-file-name-localname vec))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8185 (if (not (zerop (length user)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8186 (format "%s@%s:%s" user host localname)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8187 (format "%s:%s" host localname))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8188
104807
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
8189 (defun tramp-method-out-of-band-p (vec size)
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
8190 "Return t if this is an out-of-band method, nil otherwise."
104807
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
8191 (and
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
8192 ;; It shall be an out-of-band method.
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
8193 (tramp-get-method-parameter (tramp-file-name-method vec) 'tramp-copy-program)
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
8194 ;; Either the file size is large enough, or (in rare cases) there
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
8195 ;; does not exist a remote encoding.
108186
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8196 (or (null tramp-copy-size-limit)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8197 (> size tramp-copy-size-limit)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8198 (null (tramp-get-inline-coding vec "remote-encoding" size)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8199
82808
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
8200 (defun tramp-local-host-p (vec)
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
8201 "Return t if this points to the local host, nil otherwise."
87748
e958bc9885ca * net/tramp.el (tramp-local-host-p): Use `tramp-file-name-host'
Michael Albinus <michael.albinus@gmx.de>
parents: 87649
diff changeset
8202 ;; We cannot use `tramp-file-name-real-host'. A port is an
e958bc9885ca * net/tramp.el (tramp-local-host-p): Use `tramp-file-name-host'
Michael Albinus <michael.albinus@gmx.de>
parents: 87649
diff changeset
8203 ;; indication for an ssh tunnel or alike.
e958bc9885ca * net/tramp.el (tramp-local-host-p): Use `tramp-file-name-host'
Michael Albinus <michael.albinus@gmx.de>
parents: 87649
diff changeset
8204 (let ((host (tramp-file-name-host vec)))
82808
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
8205 (and
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
8206 (stringp host)
100856
49bc8bb7a597 * net/tramp.el (tramp-local-host-regexp)
Michael Albinus <michael.albinus@gmx.de>
parents: 100634
diff changeset
8207 (string-match tramp-local-host-regexp host)
105549
e7c777c6e230 * net/tramp.el (tramp-local-host-p): Function shall return nil for
Michael Albinus <michael.albinus@gmx.de>
parents: 105523
diff changeset
8208 ;; The method shall be applied to one of the shell file name
e7c777c6e230 * net/tramp.el (tramp-local-host-p): Function shall return nil for
Michael Albinus <michael.albinus@gmx.de>
parents: 105523
diff changeset
8209 ;; handler. `tramp-local-host-p' is also called for "smb" and
e7c777c6e230 * net/tramp.el (tramp-local-host-p): Function shall return nil for
Michael Albinus <michael.albinus@gmx.de>
parents: 105523
diff changeset
8210 ;; alike, where it must fail.
e7c777c6e230 * net/tramp.el (tramp-local-host-p): Function shall return nil for
Michael Albinus <michael.albinus@gmx.de>
parents: 105523
diff changeset
8211 (tramp-get-method-parameter
e7c777c6e230 * net/tramp.el (tramp-local-host-p): Function shall return nil for
Michael Albinus <michael.albinus@gmx.de>
parents: 105523
diff changeset
8212 (tramp-file-name-method vec) 'tramp-login-program)
87921
c49bc2860fd0 * net/tramp.el (tramp-remote-process-environment): Set "LC_ALL=C".
Michael Albinus <michael.albinus@gmx.de>
parents: 87748
diff changeset
8213 ;; The local temp directory must be writable for the other user.
c49bc2860fd0 * net/tramp.el (tramp-remote-process-environment): Set "LC_ALL=C".
Michael Albinus <michael.albinus@gmx.de>
parents: 87748
diff changeset
8214 (file-writable-p
c49bc2860fd0 * net/tramp.el (tramp-remote-process-environment): Set "LC_ALL=C".
Michael Albinus <michael.albinus@gmx.de>
parents: 87748
diff changeset
8215 (tramp-make-tramp-file-name
c49bc2860fd0 * net/tramp.el (tramp-remote-process-environment): Set "LC_ALL=C".
Michael Albinus <michael.albinus@gmx.de>
parents: 87748
diff changeset
8216 (tramp-file-name-method vec)
c49bc2860fd0 * net/tramp.el (tramp-remote-process-environment): Set "LC_ALL=C".
Michael Albinus <michael.albinus@gmx.de>
parents: 87748
diff changeset
8217 (tramp-file-name-user vec)
c49bc2860fd0 * net/tramp.el (tramp-remote-process-environment): Set "LC_ALL=C".
Michael Albinus <michael.albinus@gmx.de>
parents: 87748
diff changeset
8218 host
103782
c5225871ee78 * net/tramp.el (tramp-set-file-uid-gid): Handle the case the
Michael Albinus <michael.albinus@gmx.de>
parents: 103735
diff changeset
8219 (tramp-compat-temporary-file-directory)))
c5225871ee78 * net/tramp.el (tramp-set-file-uid-gid): Handle the case the
Michael Albinus <michael.albinus@gmx.de>
parents: 103735
diff changeset
8220 ;; On some systems, chown runs only for root.
c5225871ee78 * net/tramp.el (tramp-set-file-uid-gid): Handle the case the
Michael Albinus <michael.albinus@gmx.de>
parents: 103735
diff changeset
8221 (or (zerop (user-uid))
c5225871ee78 * net/tramp.el (tramp-set-file-uid-gid): Handle the case the
Michael Albinus <michael.albinus@gmx.de>
parents: 103735
diff changeset
8222 (zerop (tramp-get-remote-uid vec 'integer))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8223
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8224 ;; Variables local to connection.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8225
82603
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
8226 (defun tramp-get-remote-path (vec)
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8227 (with-connection-property
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8228 ;; When `tramp-own-remote-path' is in `tramp-remote-path', we
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8229 ;; cache the result for the session only. Otherwise, the result
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8230 ;; is cached persistently.
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8231 (if (memq 'tramp-own-remote-path tramp-remote-path)
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8232 (tramp-get-connection-process vec)
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8233 vec)
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8234 "remote-path"
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
8235 (let* ((remote-path (copy-tree tramp-remote-path))
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8236 (elt1 (memq 'tramp-default-remote-path remote-path))
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8237 (elt2 (memq 'tramp-own-remote-path remote-path))
82603
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
8238 (default-remote-path
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8239 (when elt1
82603
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
8240 (condition-case nil
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8241 (tramp-send-command-and-read
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8242 vec "echo \\\"`getconf PATH`\\\"")
82603
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
8243 ;; Default if "getconf" is not available.
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
8244 (error
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
8245 (tramp-message
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
8246 vec 3
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
8247 "`getconf PATH' not successful, using default value \"%s\"."
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
8248 "/bin:/usr/bin")
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8249 "/bin:/usr/bin"))))
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8250 (own-remote-path
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8251 (when elt2
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8252 (condition-case nil
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8253 (tramp-send-command-and-read vec "echo \\\"$PATH\\\"")
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8254 ;; Default if "getconf" is not available.
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8255 (error
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8256 (tramp-message
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8257 vec 3 "$PATH not set, ignoring `tramp-own-remote-path'.")
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8258 nil)))))
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8259
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8260 ;; Replace place holder `tramp-default-remote-path'.
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8261 (when elt1
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8262 (setcdr elt1
82603
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
8263 (append
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8264 (tramp-compat-split-string default-remote-path ":")
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8265 (cdr elt1)))
82603
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
8266 (setq remote-path (delq 'tramp-default-remote-path remote-path)))
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
8267
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8268 ;; Replace place holder `tramp-own-remote-path'.
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8269 (when elt2
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8270 (setcdr elt2
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8271 (append
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8272 (tramp-compat-split-string own-remote-path ":")
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8273 (cdr elt2)))
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8274 (setq remote-path (delq 'tramp-own-remote-path remote-path)))
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8275
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8276 ;; Remove double entries.
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8277 (setq elt1 remote-path)
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8278 (while (consp elt1)
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8279 (while (and (car elt1) (setq elt2 (member (car elt1) (cdr elt1))))
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8280 (setcar elt2 nil))
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8281 (setq elt1 (cdr elt1)))
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8282
82603
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
8283 ;; Remove non-existing directories.
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
8284 (delq
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
8285 nil
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
8286 (mapcar
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
8287 (lambda (x)
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
8288 (and
103527
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8289 (stringp x)
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8290 (file-directory-p
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8291 (tramp-make-tramp-file-name
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8292 (tramp-file-name-method vec)
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8293 (tramp-file-name-user vec)
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8294 (tramp-file-name-host vec)
d820807ffab7 * net/tramp.el (top): Require tramp-gvfs. Catch `tramp-loading',
Michael Albinus <michael.albinus@gmx.de>
parents: 103333
diff changeset
8295 x))
82603
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
8296 x))
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
8297 remote-path)))))
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
8298
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
8299 (defun tramp-get-remote-tmpdir (vec)
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
8300 (with-connection-property vec "tmp-directory"
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
8301 (let ((dir (tramp-shell-quote-argument "/tmp")))
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
8302 (if (and (zerop
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
8303 (tramp-send-command-and-check
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
8304 vec (format "%s -d %s" (tramp-get-test-command vec) dir)))
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
8305 (zerop
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
8306 (tramp-send-command-and-check
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
8307 vec (format "%s -w %s" (tramp-get-test-command vec) dir))))
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
8308 dir
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
8309 (tramp-error vec 'file-error "Directory %s not accessible" dir)))))
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
8310
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8311 (defun tramp-get-ls-command (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8312 (with-connection-property vec "ls"
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8313 (tramp-message vec 5 "Finding a suitable `ls' command")
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8314 (or
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8315 (catch 'ls-found
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8316 (dolist (cmd '("ls" "gnuls" "gls"))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8317 (let ((dl (tramp-get-remote-path vec))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8318 result)
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8319 (while (and dl (setq result (tramp-find-executable vec cmd dl t t)))
107021
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
8320 ;; Check parameters. On busybox, "ls" output coloring is
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
8321 ;; enabled by default sometimes. So we try to disable it
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
8322 ;; when possible. $LS_COLORING is not supported there.
109443
9e514d1076b4 * net/tramp.el (tramp-handle-shell-command): Don't use hard-wired
Michael Albinus <michael.albinus@gmx.de>
parents: 108975
diff changeset
8323 ;; Some "ls" versions are sensible wrt the order of
9e514d1076b4 * net/tramp.el (tramp-handle-shell-command): Don't use hard-wired
Michael Albinus <michael.albinus@gmx.de>
parents: 108975
diff changeset
8324 ;; arguments, they fail when "-al" is after the
9e514d1076b4 * net/tramp.el (tramp-handle-shell-command): Don't use hard-wired
Michael Albinus <michael.albinus@gmx.de>
parents: 108975
diff changeset
8325 ;; "--color=never" argument (for example on FreeBSD).
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8326 (when (zerop (tramp-send-command-and-check
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8327 vec (format "%s -lnd /" result)))
107021
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
8328 (when (zerop (tramp-send-command-and-check
109443
9e514d1076b4 * net/tramp.el (tramp-handle-shell-command): Don't use hard-wired
Michael Albinus <michael.albinus@gmx.de>
parents: 108975
diff changeset
8329 vec (format "%s --color=never -al /" result)))
107021
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
8330 (setq result (concat result " --color=never")))
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8331 (throw 'ls-found result))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8332 (setq dl (cdr dl))))))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8333 (tramp-error vec 'file-error "Couldn't find a proper `ls' command"))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8334
104216
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
8335 (defun tramp-get-ls-command-with-dired (vec)
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
8336 (save-match-data
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
8337 (with-connection-property vec "ls-dired"
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
8338 (tramp-message vec 5 "Checking, whether `ls --dired' works")
109449
333d4b14e6cb * net/tramp.el (tramp-get-ls-command-with-dired): Make test for
Michael Albinus <albinus@detlef>
parents: 109443
diff changeset
8339 ;; Some "ls" versions are sensible wrt the order of arguments,
333d4b14e6cb * net/tramp.el (tramp-get-ls-command-with-dired): Make test for
Michael Albinus <albinus@detlef>
parents: 109443
diff changeset
8340 ;; they fail when "-al" is after the "--dired" argument (for
333d4b14e6cb * net/tramp.el (tramp-get-ls-command-with-dired): Make test for
Michael Albinus <albinus@detlef>
parents: 109443
diff changeset
8341 ;; example on FreeBSD).
104216
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
8342 (zerop (tramp-send-command-and-check
109449
333d4b14e6cb * net/tramp.el (tramp-get-ls-command-with-dired): Make test for
Michael Albinus <albinus@detlef>
parents: 109443
diff changeset
8343 vec (format "%s --dired -al /" (tramp-get-ls-command vec)))))))
104216
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
8344
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8345 (defun tramp-get-test-command (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8346 (with-connection-property vec "test"
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8347 (tramp-message vec 5 "Finding a suitable `test' command")
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8348 (if (zerop (tramp-send-command-and-check vec "test 0"))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8349 "test"
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8350 (tramp-find-executable vec "test" (tramp-get-remote-path vec)))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8351
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8352 (defun tramp-get-test-nt-command (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8353 ;; Does `test A -nt B' work? Use abominable `find' construct if it
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8354 ;; doesn't. BSD/OS 4.0 wants the parentheses around the command,
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8355 ;; for otherwise the shell crashes.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8356 (with-connection-property vec "test-nt"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8357 (or
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8358 (progn
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8359 (tramp-send-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8360 vec (format "( %s / -nt / )" (tramp-get-test-command vec)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8361 (with-current-buffer (tramp-get-buffer vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8362 (goto-char (point-min))
87921
c49bc2860fd0 * net/tramp.el (tramp-remote-process-environment): Set "LC_ALL=C".
Michael Albinus <michael.albinus@gmx.de>
parents: 87748
diff changeset
8363 (when (looking-at (regexp-quote tramp-end-of-output))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8364 (format "%s %%s -nt %%s" (tramp-get-test-command vec)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8365 (progn
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8366 (tramp-send-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8367 vec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8368 (format
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8369 "tramp_test_nt () {\n%s -n \"`find $1 -prune -newer $2 -print`\"\n}"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8370 (tramp-get-test-command vec)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8371 "tramp_test_nt %s %s"))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8372
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8373 (defun tramp-get-file-exists-command (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8374 (with-connection-property vec "file-exists"
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8375 (tramp-message vec 5 "Finding command to check if file exists")
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8376 (tramp-find-file-exists-command vec)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8377
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8378 (defun tramp-get-remote-ln (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8379 (with-connection-property vec "ln"
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8380 (tramp-message vec 5 "Finding a suitable `ln' command")
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8381 (tramp-find-executable vec "ln" (tramp-get-remote-path vec))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8382
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8383 (defun tramp-get-remote-perl (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8384 (with-connection-property vec "perl"
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8385 (tramp-message vec 5 "Finding a suitable `perl' command")
105767
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8386 (let ((result
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8387 (or (tramp-find-executable vec "perl5" (tramp-get-remote-path vec))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8388 (tramp-find-executable
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8389 vec "perl" (tramp-get-remote-path vec)))))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8390 ;; We must check also for some Perl modules.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8391 (when result
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8392 (with-connection-property vec "perl-file-spec"
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8393 (zerop
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8394 (tramp-send-command-and-check
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8395 vec (format "%s -e 'use File::Spec;'" result))))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8396 (with-connection-property vec "perl-cwd-realpath"
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8397 (zerop
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8398 (tramp-send-command-and-check
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8399 vec (format "%s -e 'use Cwd \"realpath\";'" result)))))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8400 result)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8401
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8402 (defun tramp-get-remote-stat (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8403 (with-connection-property vec "stat"
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8404 (tramp-message vec 5 "Finding a suitable `stat' command")
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8405 (let ((result (tramp-find-executable
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8406 vec "stat" (tramp-get-remote-path vec)))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8407 tmp)
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8408 ;; Check whether stat(1) returns usable syntax. %s does not
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8409 ;; work on older AIX systems.
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8410 (when result
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8411 (setq tmp
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8412 ;; We don't want to display an error message.
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8413 (with-temp-message (or (current-message) "")
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8414 (condition-case nil
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8415 (tramp-send-command-and-read
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8416 vec (format "%s -c '(\"%%N\" %%s)' /" result))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8417 (error nil))))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8418 (unless (and (listp tmp) (stringp (car tmp))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8419 (string-match "^./.$" (car tmp))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8420 (integerp (cadr tmp)))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8421 (setq result nil)))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8422 result)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8423
105767
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8424 (defun tramp-get-remote-readlink (vec)
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8425 (with-connection-property vec "readlink"
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8426 (tramp-message vec 5 "Finding a suitable `readlink' command")
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8427 (let ((result (tramp-find-executable
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8428 vec "readlink" (tramp-get-remote-path vec))))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8429 (when (and result
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8430 ;; We don't want to display an error message.
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8431 (with-temp-message (or (current-message) "")
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8432 (condition-case nil
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8433 (zerop
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8434 (tramp-send-command-and-check
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8435 vec (format "%s --canonicalize-missing /" result)))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8436 (error nil))))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8437 result))))
986f88345cba * net/tramp.el (tramp-perl-file-truename): New defconst. Perl
Michael Albinus <michael.albinus@gmx.de>
parents: 105718
diff changeset
8438
108817
a90103f99eea * net/tramp.el (tramp-debug-message): Add `tramp-compat-funcall'
Michael Albinus <michael.albinus@gmx.de>
parents: 108816
diff changeset
8439 (defun tramp-get-remote-trash (vec)
a90103f99eea * net/tramp.el (tramp-debug-message): Add `tramp-compat-funcall'
Michael Albinus <michael.albinus@gmx.de>
parents: 108816
diff changeset
8440 (with-connection-property vec "trash"
a90103f99eea * net/tramp.el (tramp-debug-message): Add `tramp-compat-funcall'
Michael Albinus <michael.albinus@gmx.de>
parents: 108816
diff changeset
8441 (tramp-message vec 5 "Finding a suitable `trash' command")
a90103f99eea * net/tramp.el (tramp-debug-message): Add `tramp-compat-funcall'
Michael Albinus <michael.albinus@gmx.de>
parents: 108816
diff changeset
8442 (tramp-find-executable vec "trash" (tramp-get-remote-path vec))))
a90103f99eea * net/tramp.el (tramp-debug-message): Add `tramp-compat-funcall'
Michael Albinus <michael.albinus@gmx.de>
parents: 108816
diff changeset
8443
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8444 (defun tramp-get-remote-id (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8445 (with-connection-property vec "id"
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8446 (tramp-message vec 5 "Finding POSIX `id' command")
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8447 (or
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8448 (catch 'id-found
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8449 (let ((dl (tramp-get-remote-path vec))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8450 result)
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8451 (while (and dl (setq result (tramp-find-executable vec "id" dl t t)))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8452 ;; Check POSIX parameter.
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8453 (when (zerop (tramp-send-command-and-check
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8454 vec (format "%s -u" result)))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8455 (throw 'id-found result))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8456 (setq dl (cdr dl)))))
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8457 (tramp-error vec 'file-error "Couldn't find a POSIX `id' command"))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8458
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8459 (defun tramp-get-remote-uid (vec id-format)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8460 (with-connection-property vec (format "uid-%s" id-format)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8461 (let ((res (tramp-send-command-and-read
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8462 vec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8463 (format "%s -u%s %s"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8464 (tramp-get-remote-id vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8465 (if (equal id-format 'integer) "" "n")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8466 (if (equal id-format 'integer)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8467 "" "| sed -e s/^/\\\"/ -e s/\$/\\\"/")))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8468 ;; The command might not always return a number.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8469 (if (and (equal id-format 'integer) (not (integerp res))) -1 res))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8470
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8471 (defun tramp-get-remote-gid (vec id-format)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8472 (with-connection-property vec (format "gid-%s" id-format)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8473 (let ((res (tramp-send-command-and-read
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8474 vec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8475 (format "%s -g%s %s"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8476 (tramp-get-remote-id vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8477 (if (equal id-format 'integer) "" "n")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8478 (if (equal id-format 'integer)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8479 "" "| sed -e s/^/\\\"/ -e s/\$/\\\"/")))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8480 ;; The command might not always return a number.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8481 (if (and (equal id-format 'integer) (not (integerp res))) -1 res))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8482
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
8483 (defun tramp-get-local-uid (id-format)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
8484 (if (equal id-format 'integer) (user-uid) (user-login-name)))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
8485
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
8486 (defun tramp-get-local-gid (id-format)
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
8487 (nth 3 (tramp-compat-file-attributes "~/" id-format)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8488
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
8489 ;; Some predefined connection properties.
108186
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8490 (defun tramp-get-inline-compress (vec prop size)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8491 "Return the compress command related to PROP.
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8492 PROP is either `inline-compress' or `inline-decompress'. SIZE is
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8493 the length of the file to be compressed.
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8494
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8495 If no corresponding command is found, nil is returned."
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8496 (when (and (integerp tramp-inline-compress-start-size)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8497 (> size tramp-inline-compress-start-size))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8498 (with-connection-property vec prop
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8499 (tramp-find-inline-compress vec)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8500 (tramp-get-connection-property vec prop nil))))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8501
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8502 (defun tramp-get-inline-coding (vec prop size)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8503 "Return the coding command related to PROP.
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8504 PROP is either `remote-encoding', `remode-decoding',
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8505 `local-encoding' or `local-decoding'.
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8506
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8507 SIZE is the length of the file to be coded. Depending on SIZE,
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8508 compression might be applied.
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8509
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8510 If no corresponding command is found, nil is returned.
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8511 Otherwise, either a string is returned which contains a `%s' mark
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8512 to be used for the respective input or output file; or a Lisp
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8513 function cell is returned to be applied on a buffer."
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8514 (let ((coding
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8515 (with-connection-property vec prop
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8516 (tramp-find-inline-encoding vec)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8517 (tramp-get-connection-property vec prop nil)))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8518 (prop1 (if (string-match "encoding" prop)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8519 "inline-compress" "inline-decompress"))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8520 compress)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8521 ;; The connection property might have been cached. So we must send
108186
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8522 ;; the script to the remote side - maybe.
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8523 (when (and coding (symbolp coding) (string-match "remote" prop))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8524 (let ((name (symbol-name coding)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8525 (while (string-match (regexp-quote "-") name)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8526 (setq name (replace-match "_" nil t name)))
108186
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8527 (tramp-maybe-send-script vec (symbol-value coding) name)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8528 (setq coding name)))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8529 (when coding
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8530 ;; Check for the `compress' command.
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8531 (setq compress (tramp-get-inline-compress vec prop1 size))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8532 ;; Return the value.
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8533 (cond
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8534 ((and compress (symbolp coding))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8535 (if (string-match "decompress" prop1)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8536 `(lambda (beg end)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8537 (,coding beg end)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8538 (let ((coding-system-for-write 'binary)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8539 (coding-system-for-read 'binary))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8540 (apply
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8541 'call-process-region (point-min) (point-max)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8542 (car (split-string ,compress)) t t nil
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8543 (cdr (split-string ,compress)))))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8544 `(lambda (beg end)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8545 (let ((coding-system-for-write 'binary)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8546 (coding-system-for-read 'binary))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8547 (apply
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8548 'call-process-region beg end
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8549 (car (split-string ,compress)) t t nil
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8550 (cdr (split-string ,compress))))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8551 (,coding (point-min) (point-max)))))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8552 ((symbolp coding)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8553 coding)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8554 ((and compress (string-match "decoding" prop))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8555 (format "(%s | %s >%%s)" coding compress))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8556 (compress
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8557 (format "(%s <%%s | %s)" compress coding))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8558 ((string-match "decoding" prop)
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8559 (format "%s >%%s" coding))
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8560 (t
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8561 (format "%s <%%s" coding))))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8562
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8563 (defun tramp-get-method-parameter (method param)
53206
0c19f1a19b2b (tramp-chunksize): Extend docstring. Suggested by
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 52401
diff changeset
8564 "Return the method parameter PARAM.
108186
3287df4f3442 Implement compression for inline methods.
Michael Albinus <albinus@detlef>
parents: 108158
diff changeset
8565 If the `tramp-methods' entry does not exist, return nil."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8566 (let ((entry (assoc param (assoc method tramp-methods))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8567 (when entry (cadr entry))))
51968
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
8568
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8569 ;; Auto saving to a special directory.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8570
65304
379e08762d65 * net/tramp.el (tramp-handle-make-auto-save-file-name): Deactivate
Michael Albinus <michael.albinus@gmx.de>
parents: 65254
diff changeset
8571 (defun tramp-exists-file-name-handler (operation &rest args)
108066
47a124b50bbf Synchronize with Tramp repository.
Michael Albinus <michael.albinus@gmx.de>
parents: 108065
diff changeset
8572 "Check, whether OPERATION runs a file name handler."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8573 ;; The file name handler is determined on base of either an
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8574 ;; argument, `buffer-file-name', or `default-directory'.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8575 (condition-case nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8576 (let* ((buffer-file-name "/")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8577 (default-directory "/")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8578 (fnha file-name-handler-alist)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8579 (check-file-name-operation operation)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8580 (file-name-handler-alist
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8581 (list
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8582 (cons "/"
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
8583 (lambda (operation &rest args)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
8584 "Returns OPERATION if it is the one to be checked."
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
8585 (if (equal check-file-name-operation operation)
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
8586 operation
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
8587 (let ((file-name-handler-alist fnha))
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
8588 (apply operation args))))))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8589 (equal (apply operation args) operation))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8590 (error nil)))
65248
0f994edbec5e Make `make-auto-save-file-name' a magic operation.
Michael Albinus <michael.albinus@gmx.de>
parents: 64772
diff changeset
8591
0f994edbec5e Make `make-auto-save-file-name' a magic operation.
Michael Albinus <michael.albinus@gmx.de>
parents: 64772
diff changeset
8592 (unless (tramp-exists-file-name-handler 'make-auto-save-file-name)
0f994edbec5e Make `make-auto-save-file-name' a magic operation.
Michael Albinus <michael.albinus@gmx.de>
parents: 64772
diff changeset
8593 (defadvice make-auto-save-file-name
0f994edbec5e Make `make-auto-save-file-name' a magic operation.
Michael Albinus <michael.albinus@gmx.de>
parents: 64772
diff changeset
8594 (around tramp-advice-make-auto-save-file-name () activate)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8595 "Invoke `tramp-handle-make-auto-save-file-name' for Tramp files."
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
8596 (if (tramp-tramp-file-p (buffer-file-name))
104807
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
8597 ;; We cannot call `tramp-handle-make-auto-save-file-name'
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
8598 ;; directly, because this would bypass the locking mechanism.
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
8599 (setq ad-return-value
509a5b989179 * net/tramp.el (tramp-handle-file-attributes-with-ls)
Michael Albinus <michael.albinus@gmx.de>
parents: 104673
diff changeset
8600 (tramp-file-name-handler 'make-auto-save-file-name))
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
8601 ad-do-it))
105907
9abdd578d117 * net/tramp.el (tramp-advice-make-auto-save-file-name)
Michael Albinus <michael.albinus@gmx.de>
parents: 105893
diff changeset
8602 (add-hook
9abdd578d117 * net/tramp.el (tramp-advice-make-auto-save-file-name)
Michael Albinus <michael.albinus@gmx.de>
parents: 105893
diff changeset
8603 'tramp-unload-hook
9abdd578d117 * net/tramp.el (tramp-advice-make-auto-save-file-name)
Michael Albinus <michael.albinus@gmx.de>
parents: 105893
diff changeset
8604 (lambda ()
9abdd578d117 * net/tramp.el (tramp-advice-make-auto-save-file-name)
Michael Albinus <michael.albinus@gmx.de>
parents: 105893
diff changeset
8605 (ad-remove-advice
9abdd578d117 * net/tramp.el (tramp-advice-make-auto-save-file-name)
Michael Albinus <michael.albinus@gmx.de>
parents: 105893
diff changeset
8606 'make-auto-save-file-name
105952
c3e434f0d02f * net/tramp.el (tramp-advice-minibuffer-electric-separator)
Michael Albinus <michael.albinus@gmx.de>
parents: 105907
diff changeset
8607 'around 'tramp-advice-make-auto-save-file-name)
c3e434f0d02f * net/tramp.el (tramp-advice-minibuffer-electric-separator)
Michael Albinus <michael.albinus@gmx.de>
parents: 105907
diff changeset
8608 (ad-activate 'make-auto-save-file-name))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8609
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
8610 ;; In XEmacs < 21.5, autosaved remote files have permission 0666 minus
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
8611 ;; umask. This is a security threat.
57463
40298ea4d83f Sync with Tramp 2.0.45.
Michael Albinus <michael.albinus@gmx.de>
parents: 56644
diff changeset
8612
40298ea4d83f Sync with Tramp 2.0.45.
Michael Albinus <michael.albinus@gmx.de>
parents: 56644
diff changeset
8613 (defun tramp-set-auto-save-file-modes ()
40298ea4d83f Sync with Tramp 2.0.45.
Michael Albinus <michael.albinus@gmx.de>
parents: 56644
diff changeset
8614 "Set permissions of autosaved remote files to the original permissions."
40298ea4d83f Sync with Tramp 2.0.45.
Michael Albinus <michael.albinus@gmx.de>
parents: 56644
diff changeset
8615 (let ((bfn (buffer-file-name)))
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
8616 (when (and (tramp-tramp-file-p bfn)
86204
7d7472ea9c0a * net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents: 86048
diff changeset
8617 (buffer-modified-p)
57463
40298ea4d83f Sync with Tramp 2.0.45.
Michael Albinus <michael.albinus@gmx.de>
parents: 56644
diff changeset
8618 (stringp buffer-auto-save-file-name)
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
8619 (not (equal bfn buffer-auto-save-file-name)))
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
8620 (unless (file-exists-p buffer-auto-save-file-name)
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
8621 (write-region "" nil buffer-auto-save-file-name))
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
8622 ;; Permissions should be set always, because there might be an old
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
8623 ;; auto-saved file belonging to another original file. This could
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
8624 ;; be a security threat.
62344
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
8625 (set-file-modes buffer-auto-save-file-name
65925
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
8626 (or (file-modes bfn) (tramp-octal-to-decimal "0600"))))))
57463
40298ea4d83f Sync with Tramp 2.0.45.
Michael Albinus <michael.albinus@gmx.de>
parents: 56644
diff changeset
8627
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
8628 (unless (and (featurep 'xemacs)
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
8629 (= emacs-major-version 21)
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
8630 (> emacs-minor-version 4))
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
8631 (add-hook 'auto-save-hook 'tramp-set-auto-save-file-modes)
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
8632 (add-hook 'tramp-unload-hook
104673
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
8633 (lambda ()
317dde5b902b * net/tramp.el (all): Replace "'(lambda" by "(lambda".
Michael Albinus <michael.albinus@gmx.de>
parents: 104642
diff changeset
8634 (remove-hook 'auto-save-hook 'tramp-set-auto-save-file-modes))))
57463
40298ea4d83f Sync with Tramp 2.0.45.
Michael Albinus <michael.albinus@gmx.de>
parents: 56644
diff changeset
8635
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8636 (defun tramp-subst-strs-in-string (alist string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8637 "Replace all occurrences of the string FROM with TO in STRING.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8638 ALIST is of the form ((FROM . TO) ...)."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8639 (save-match-data
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8640 (while alist
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8641 (let* ((pr (car alist))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8642 (from (car pr))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8643 (to (cdr pr)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8644 (while (string-match (regexp-quote from) string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8645 (setq string (replace-match to t t string)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8646 (setq alist (cdr alist))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8647 string))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8648
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8649 ;; ------------------------------------------------------------
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8650 ;; -- Compatibility functions section --
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8651 ;; ------------------------------------------------------------
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8652
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8653 (defun tramp-read-passwd (proc &optional prompt)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8654 "Read a password from user (compat function).
95025
bdaea36b81dd * net/tramp.el: Load auth-source library.
Michael Albinus <michael.albinus@gmx.de>
parents: 94975
diff changeset
8655 Consults the auth-source package.
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
8656 Invokes `password-read' if available, `read-passwd' else."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8657 (let* ((key (tramp-make-tramp-file-name
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8658 tramp-current-method tramp-current-user
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8659 tramp-current-host ""))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8660 (pw-prompt
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8661 (or prompt
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8662 (with-current-buffer (process-buffer proc)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8663 (tramp-check-for-regexp proc tramp-password-prompt-regexp)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8664 (format "%s for %s " (capitalize (match-string 1)) key)))))
107151
7e66e7efd47d * net/tramp.el (tramp-process-actions, tramp-read-passwd):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
8665 (with-parsed-tramp-file-name key nil
7e66e7efd47d * net/tramp.el (tramp-process-actions, tramp-read-passwd):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
8666 (prog1
7e66e7efd47d * net/tramp.el (tramp-process-actions, tramp-read-passwd):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
8667 (or
7e66e7efd47d * net/tramp.el (tramp-process-actions, tramp-read-passwd):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
8668 ;; See if auth-sources contains something useful, if it's bound.
7e66e7efd47d * net/tramp.el (tramp-process-actions, tramp-read-passwd):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
8669 (and (boundp 'auth-sources)
7e66e7efd47d * net/tramp.el (tramp-process-actions, tramp-read-passwd):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
8670 (tramp-get-connection-property v "first-password-request" nil)
7e66e7efd47d * net/tramp.el (tramp-process-actions, tramp-read-passwd):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
8671 ;; Try with Tramp's current method.
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8672 (tramp-compat-funcall
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8673 'auth-source-user-or-password
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8674 "password" tramp-current-host tramp-current-method))
107151
7e66e7efd47d * net/tramp.el (tramp-process-actions, tramp-read-passwd):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
8675 ;; Try the password cache.
7e66e7efd47d * net/tramp.el (tramp-process-actions, tramp-read-passwd):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
8676 (when (functionp 'password-read)
7e66e7efd47d * net/tramp.el (tramp-process-actions, tramp-read-passwd):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
8677 (unless (tramp-get-connection-property
7e66e7efd47d * net/tramp.el (tramp-process-actions, tramp-read-passwd):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
8678 v "first-password-request" nil)
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8679 (tramp-compat-funcall 'password-cache-remove key))
107151
7e66e7efd47d * net/tramp.el (tramp-process-actions, tramp-read-passwd):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
8680 (let ((password
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8681 (tramp-compat-funcall 'password-read pw-prompt key)))
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8682 (tramp-compat-funcall 'password-cache-add key password)
107151
7e66e7efd47d * net/tramp.el (tramp-process-actions, tramp-read-passwd):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
8683 password))
7e66e7efd47d * net/tramp.el (tramp-process-actions, tramp-read-passwd):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
8684 ;; Else, get the password interactively.
7e66e7efd47d * net/tramp.el (tramp-process-actions, tramp-read-passwd):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
8685 (read-passwd pw-prompt))
7e66e7efd47d * net/tramp.el (tramp-process-actions, tramp-read-passwd):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
8686 (tramp-set-connection-property v "first-password-request" nil)))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8687
85508
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
8688 (defun tramp-clear-passwd (vec)
05c8e6a18913 * net/tramp.el (top): Put load of all tramp-* files into a dolist.
Michael Albinus <michael.albinus@gmx.de>
parents: 85428
diff changeset
8689 "Clear password cache for connection related to VEC."
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8690 (tramp-compat-funcall
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8691 'password-cache-remove
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8692 (tramp-make-tramp-file-name
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8693 (tramp-file-name-method vec)
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8694 (tramp-file-name-user vec)
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8695 (tramp-file-name-host vec)
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8696 "")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8697
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8698 ;; Snarfed code from time-date.el and parse-time.el
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8699
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8700 (defconst tramp-half-a-year '(241 17024)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8701 "Evaluated by \"(days-to-time 183)\".")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8702
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8703 (defconst tramp-parse-time-months
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8704 '(("jan" . 1) ("feb" . 2) ("mar" . 3)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8705 ("apr" . 4) ("may" . 5) ("jun" . 6)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8706 ("jul" . 7) ("aug" . 8) ("sep" . 9)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8707 ("oct" . 10) ("nov" . 11) ("dec" . 12))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8708 "Alist mapping month names to integers.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8709
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8710 (defun tramp-time-less-p (t1 t2)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8711 "Say whether time value T1 is less than time value T2."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8712 (unless t1 (setq t1 '(0 0)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8713 (unless t2 (setq t2 '(0 0)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8714 (or (< (car t1) (car t2))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8715 (and (= (car t1) (car t2))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8716 (< (nth 1 t1) (nth 1 t2)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8717
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8718 (defun tramp-time-subtract (t1 t2)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8719 "Subtract two time values.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8720 Return the difference in the format of a time value."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8721 (unless t1 (setq t1 '(0 0)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8722 (unless t2 (setq t2 '(0 0)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8723 (let ((borrow (< (cadr t1) (cadr t2))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8724 (list (- (car t1) (car t2) (if borrow 1 0))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8725 (- (+ (if borrow 65536 0) (cadr t1)) (cadr t2)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8726
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8727 (defun tramp-time-diff (t1 t2)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8728 "Return the difference between the two times, in seconds.
72569
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
8729 T1 and T2 are time values (as returned by `current-time' for example)."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8730 ;; Pacify byte-compiler with `symbol-function'.
51603
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
8731 (cond ((and (fboundp 'subtract-time)
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
8732 (fboundp 'float-time))
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8733 (tramp-compat-funcall
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8734 'float-time (tramp-compat-funcall 'subtract-time t1 t2)))
51603
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
8735 ((and (fboundp 'subtract-time)
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
8736 (fboundp 'time-to-seconds))
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8737 (tramp-compat-funcall
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8738 'time-to-seconds (tramp-compat-funcall 'subtract-time t1 t2)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8739 ((fboundp 'itimer-time-difference)
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8740 (tramp-compat-funcall
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8741 'itimer-time-difference
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8742 (if (< (length t1) 3) (append t1 '(0)) t1)
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8743 (if (< (length t2) 3) (append t2 '(0)) t2)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8744 (t
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8745 (let ((time (tramp-time-subtract t1 t2)))
51603
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
8746 (+ (* (car time) 65536.0)
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
8747 (cadr time)
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
8748 (/ (or (nth 2 time) 0) 1000000.0))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8749
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8750 (defun tramp-coding-system-change-eol-conversion (coding-system eol-type)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8751 "Return a coding system like CODING-SYSTEM but with given EOL-TYPE.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8752 EOL-TYPE can be one of `dos', `unix', or `mac'."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8753 (cond ((fboundp 'coding-system-change-eol-conversion)
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8754 (tramp-compat-funcall
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8755 'coding-system-change-eol-conversion coding-system eol-type))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8756 ((fboundp 'subsidiary-coding-system)
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8757 (tramp-compat-funcall
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8758 'subsidiary-coding-system coding-system
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8759 (cond ((eq eol-type 'dos) 'crlf)
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8760 ((eq eol-type 'unix) 'lf)
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8761 ((eq eol-type 'mac) 'cr)
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8762 (t
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8763 (error "Unknown EOL-TYPE `%s', must be %s"
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8764 eol-type
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8765 "`dos', `unix', or `mac'")))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8766 (t (error "Can't change EOL conversion -- is MULE missing?"))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8767
55844
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
8768 (defun tramp-set-process-query-on-exit-flag (process flag)
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
8769 "Specify if query is needed for process when Emacs is exited.
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
8770 If the second argument flag is non-nil, Emacs will query the user before
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
8771 exiting if process is running."
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
8772 (if (fboundp 'set-process-query-on-exit-flag)
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8773 (tramp-compat-funcall 'set-process-query-on-exit-flag process flag)
108975
c4552014bea2 * net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents: 108817
diff changeset
8774 (tramp-compat-funcall 'process-kill-without-query process flag)))
55844
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
8775
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
8776
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
8777 ;; ------------------------------------------------------------
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
8778 ;; -- Kludges section --
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
8779 ;; ------------------------------------------------------------
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8780
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8781 ;; Currently (as of Emacs 20.5), the function `shell-quote-argument'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8782 ;; does not deal well with newline characters. Newline is replaced by
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8783 ;; backslash newline. But if, say, the string `a backslash newline b'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8784 ;; is passed to a shell, the shell will expand this into "ab",
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8785 ;; completely omitting the newline. This is not what was intended.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8786 ;; It does not appear to be possible to make the function
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8787 ;; `shell-quote-argument' work with newlines without making it
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8788 ;; dependent on the shell used. But within this package, we know that
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8789 ;; we will always use a Bourne-like shell, so we use an approach which
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8790 ;; groks newlines.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8791 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8792 ;; The approach is simple: we call `shell-quote-argument', then
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8793 ;; massage the newline part of the result.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8794 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8795 ;; This function should produce a string which is grokked by a Unix
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8796 ;; shell, even if the Emacs is running on Windows. Since this is the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8797 ;; kludges section, we bind `system-type' in such a way that
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8798 ;; `shell-quote-arguments' behaves as if on Unix.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8799 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8800 ;; Thanks to Mario DeWeerd for the hint that it is sufficient for this
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8801 ;; function to work with Bourne-like shells.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8802 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8803 ;; CCC: This function should be rewritten so that
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8804 ;; `shell-quote-argument' is not used. This way, we are safe from
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8805 ;; changes in `shell-quote-argument'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8806 (defun tramp-shell-quote-argument (s)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8807 "Similar to `shell-quote-argument', but groks newlines.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8808 Only works for Bourne-like shells."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8809 (let ((system-type 'not-windows))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8810 (save-match-data
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8811 (let ((result (shell-quote-argument s))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8812 (nl (regexp-quote (format "\\%s" tramp-rsh-end-of-line))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8813 (when (and (>= (length result) 2)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8814 (string= (substring result 0 2) "\\~"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8815 (setq result (substring result 1)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8816 (while (string-match nl result)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8817 (setq result (replace-match (format "'%s'" tramp-rsh-end-of-line)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8818 t t result)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8819 result))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8820
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
8821 ;; Checklist for `tramp-unload-hook'
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
8822 ;; - Unload all `tramp-*' packages
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
8823 ;; - Reset `file-name-handler-alist'
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
8824 ;; - Cleanup hooks where Tramp functions are in
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
8825 ;; - Cleanup advised functions
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
8826 ;; - Cleanup autoloads
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
8827 ;;;###autoload
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
8828 (defun tramp-unload-tramp ()
71485
5b1bf37e044d * net/rcompile.el (remote-compile): Replace ange-ftp based
Michael Albinus <michael.albinus@gmx.de>
parents: 71350
diff changeset
8829 "Discard Tramp from loading remote files."
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
8830 (interactive)
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
8831 ;; When Tramp is not loaded yet, its autoloads are still active.
70191
3a3093f77da8 * net/tramp.el (tramp-register-file-name-handlers): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 70073
diff changeset
8832 (tramp-unload-file-name-handlers)
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
8833 ;; ange-ftp settings must be enabled.
108377
7827d5a5c826 * net/tramp-compat.el (byte-compile-not-obsolete-vars): Define if
Michael Albinus <albinus@detlef>
parents: 108269
diff changeset
8834 (tramp-compat-funcall 'tramp-ftp-enable-ange-ftp)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8835 ;; Maybe its not loaded yet.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8836 (condition-case nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8837 (unload-feature 'tramp 'force)
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
8838 (error nil)))
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
8839
100634
2af636c8c9d2 * net/tramp.el (tramp-rfn-eshadow-update-overlay): Move overlay to
Michael Albinus <michael.albinus@gmx.de>
parents: 100316
diff changeset
8840 (when (and load-in-progress
2af636c8c9d2 * net/tramp.el (tramp-rfn-eshadow-update-overlay): Move overlay to
Michael Albinus <michael.albinus@gmx.de>
parents: 100316
diff changeset
8841 (string-match "Loading tramp..." (or (current-message) "")))
100216
9c5b974a0a5b * net/tramp.el (top): Write a message, when loading Tramp.
Michael Albinus <michael.albinus@gmx.de>
parents: 99950
diff changeset
8842 (message "Loading tramp...done"))
9c5b974a0a5b * net/tramp.el (top): Write a message, when loading Tramp.
Michael Albinus <michael.albinus@gmx.de>
parents: 99950
diff changeset
8843
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8844 (provide 'tramp)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8845
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8846 ;;; TODO:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8847
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
8848 ;; * Handle nonlocal exits such as C-g.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8849 ;; * But it would probably be better to use with-local-quit at the
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8850 ;; place where it's actually needed: around any potentially
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8851 ;; indefinitely blocking piece of code. In this case it would be
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8852 ;; within Tramp around one of its calls to accept-process-output (or
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8853 ;; around one of the loops that calls accept-process-output)
84739
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
8854 ;; (Stefan Monnier).
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8855 ;; * Rewrite `tramp-shell-quote-argument' to abstain from using
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
8856 ;; `shell-quote-argument'.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8857 ;; * In Emacs 21, `insert-directory' shows total number of bytes used
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8858 ;; by the files in that directory. Add this here.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8859 ;; * Avoid screen blanking when hitting `g' in dired. (Eli Tziperman)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8860 ;; * Make ffap.el grok Tramp filenames. (Eli Tziperman)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8861 ;; * Case-insensitive filename completion. (Norbert Goevert.)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8862 ;; * Don't use globbing for directories with many files, as this is
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8863 ;; likely to produce long command lines, and some shells choke on
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8864 ;; long command lines.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8865 ;; * How to deal with MULE in `insert-file-contents' and `write-region'?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8866 ;; * Test remote ksh or bash for tilde expansion in `tramp-find-shell'?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8867 ;; * abbreviate-file-name
104216
bf65b05e8cf1 * net/tramp.el (tramp-get-ls-command-with-dired): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 104143
diff changeset
8868 ;; * Better error checking. At least whenever we see something
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8869 ;; strange when doing zerop, we should kill the process and start
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8870 ;; again. (Greg Stark)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8871 ;; * Remove unneeded parameters from methods.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8872 ;; * Make it work for different encodings, and for different file name
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8873 ;; encodings, too. (Daniel Pittman)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8874 ;; * Don't search for perl5 and perl. Instead, only search for perl and
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8875 ;; then look if it's the right version (with `perl -v').
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8876 ;; * When editing a remote CVS controlled file as a different user, VC
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8877 ;; gets confused about the file locking status. Try to find out why
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8878 ;; the workaround doesn't work.
46992
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
8879 ;; * Username and hostname completion.
78887
8faf94b6c420 * net/tramp.el (tramp-completion-mode-p): Rename from
Michael Albinus <michael.albinus@gmx.de>
parents: 78489
diff changeset
8880 ;; ** Try to avoid usage of `last-input-event' in `tramp-completion-mode-p'.
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
8881 ;; ** Unify `tramp-parse-{rhosts,shosts,sconfig,hosts,passwd,netrc}'.
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
8882 ;; Code is nearly identical.
91486
76c777ce052a * net/tramp.el (tramp-process-sentinel): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 88072
diff changeset
8883 ;; * Allow out-of-band methods as _last_ multi-hop. Open a connection
76c777ce052a * net/tramp.el (tramp-process-sentinel): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 88072
diff changeset
8884 ;; until the last but one hop via `start-file-process'. Apply it
76c777ce052a * net/tramp.el (tramp-process-sentinel): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 88072
diff changeset
8885 ;; also for ftp and smb.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8886 ;; * WIBNI if we had a command "trampclient"? If I was editing in
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8887 ;; some shell with root priviledges, it would be nice if I could
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8888 ;; just call
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8889 ;; trampclient filename.c
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8890 ;; as an editor, and the _current_ shell would connect to an Emacs
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8891 ;; server and would be used in an existing non-priviledged Emacs
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8892 ;; session for doing the editing in question.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8893 ;; That way, I need not tell Emacs my password again and be afraid
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8894 ;; that it makes it into core dumps or other ugly stuff (I had Emacs
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8895 ;; once display a just typed password in the context of a keyboard
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8896 ;; sequence prompt for a question immediately following in a shell
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8897 ;; script run within Emacs -- nasty).
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8898 ;; And if I have some ssh session running to a different computer,
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8899 ;; having the possibility of passing a local file there to a local
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8900 ;; Emacs session (in case I can arrange for a connection back) would
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8901 ;; be nice.
85694
21983e7c844a * net/tramp.el (tramp-wrong-passwd-regexp): Tune regexp.
Michael Albinus <michael.albinus@gmx.de>
parents: 85600
diff changeset
8902 ;; Likely the corresponding Tramp server should not allow the
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8903 ;; equivalent of the emacsclient -eval option in order to make this
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8904 ;; reasonably unproblematic. And maybe trampclient should have some
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8905 ;; way of passing credentials, like by using an SSL socket or
107189
a48b193e3b5f (tramp-handle-insert-file-contents): Set always the permissions of the
Michael Albinus <michael.albinus@gmx.de>
parents: 107170
diff changeset
8906 ;; something. (David Kastrup)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8907 ;; * Reconnect directly to a compliant shell without first going
107189
a48b193e3b5f (tramp-handle-insert-file-contents): Set always the permissions of the
Michael Albinus <michael.albinus@gmx.de>
parents: 107170
diff changeset
8908 ;; through the user's default shell. (Pete Forman)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
8909 ;; * Make `tramp-default-user' obsolete.
95963
a20bb74ebe03 * net/tramp.el (tramp-handle-start-file-process): Clear
Michael Albinus <michael.albinus@gmx.de>
parents: 95659
diff changeset
8910 ;; * How can I interrupt the remote process with a signal
107189
a48b193e3b5f (tramp-handle-insert-file-contents): Set always the permissions of the
Michael Albinus <michael.albinus@gmx.de>
parents: 107170
diff changeset
8911 ;; (interrupt-process seems not to work)? (Markus Triska)
96941
940a290a5646 * net/tramp.el (tramp-methods): Add "-q" for "scp", "scp1",
Michael Albinus <michael.albinus@gmx.de>
parents: 96392
diff changeset
8912 ;; * Avoid the local shell entirely for starting remote processes. If
940a290a5646 * net/tramp.el (tramp-methods): Add "-q" for "scp", "scp1",
Michael Albinus <michael.albinus@gmx.de>
parents: 96392
diff changeset
8913 ;; so, I think even a signal, when delivered directly to the local
940a290a5646 * net/tramp.el (tramp-methods): Add "-q" for "scp", "scp1",
Michael Albinus <michael.albinus@gmx.de>
parents: 96392
diff changeset
8914 ;; SSH instance, would correctly be propagated to the remote process
940a290a5646 * net/tramp.el (tramp-methods): Add "-q" for "scp", "scp1",
Michael Albinus <michael.albinus@gmx.de>
parents: 96392
diff changeset
8915 ;; automatically; possibly SSH would have to be started with
107189
a48b193e3b5f (tramp-handle-insert-file-contents): Set always the permissions of the
Michael Albinus <michael.albinus@gmx.de>
parents: 107170
diff changeset
8916 ;; "-t". (Markus Triska)
100634
2af636c8c9d2 * net/tramp.el (tramp-rfn-eshadow-update-overlay): Move overlay to
Michael Albinus <michael.albinus@gmx.de>
parents: 100316
diff changeset
8917 ;; * It makes me wonder if tramp couldn't fall back to ssh when scp
107189
a48b193e3b5f (tramp-handle-insert-file-contents): Set always the permissions of the
Michael Albinus <michael.albinus@gmx.de>
parents: 107170
diff changeset
8918 ;; isn't on the remote host. (Mark A. Hershberger)
a48b193e3b5f (tramp-handle-insert-file-contents): Set always the permissions of the
Michael Albinus <michael.albinus@gmx.de>
parents: 107170
diff changeset
8919 ;; * Use lsh instead of ssh. (Alfred M. Szmidt)
103735
d3d4dbf21c9b * net/tramp.el (tramp-handle-write-region): Flush file properties
Michael Albinus <michael.albinus@gmx.de>
parents: 103642
diff changeset
8920 ;; * Implement a general server-local-variable mechanism, as there are
d3d4dbf21c9b * net/tramp.el (tramp-handle-write-region): Flush file properties
Michael Albinus <michael.albinus@gmx.de>
parents: 103642
diff changeset
8921 ;; probably other variables that need different values for different
d3d4dbf21c9b * net/tramp.el (tramp-handle-write-region): Flush file properties
Michael Albinus <michael.albinus@gmx.de>
parents: 103642
diff changeset
8922 ;; servers too. The user could then configure a variable (such as
d3d4dbf21c9b * net/tramp.el (tramp-handle-write-region): Flush file properties
Michael Albinus <michael.albinus@gmx.de>
parents: 103642
diff changeset
8923 ;; tramp-server-local-variable-alist) to define any such variables
d3d4dbf21c9b * net/tramp.el (tramp-handle-write-region): Flush file properties
Michael Albinus <michael.albinus@gmx.de>
parents: 103642
diff changeset
8924 ;; that they need to, which would then be let bound as appropriate
107189
a48b193e3b5f (tramp-handle-insert-file-contents): Set always the permissions of the
Michael Albinus <michael.albinus@gmx.de>
parents: 107170
diff changeset
8925 ;; in tramp functions. (Jason Rumney)
104642
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8926 ;; * Optimize out-of-band copying, when both methods are scp-like (not
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8927 ;; rsync).
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8928 ;; * Keep a second connection open for out-of-band methods like scp or
67bdc8713158 * net/tramp.el (tramp-methods): New method "rsyncc".
Michael Albinus <michael.albinus@gmx.de>
parents: 104314
diff changeset
8929 ;; rsync.
108975
c4552014bea2 * net/tramp.el (tramp-remote-process-environment): Protect version
Michael Albinus <albinus@detlef>
parents: 108817
diff changeset
8930 ;; * Support ptys in `tramp-handle-start-file-process'. (Bug#4604, Bug#6360)
107021
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
8931 ;; * IMHO, it's a drawback that currently Tramp doesn't support
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
8932 ;; Unicode in Dired file names by default. Is it possible to
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
8933 ;; improve Tramp to set LC_ALL to "C" only for commands where Tramp
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
8934 ;; expects English? Or just to set LC_MESSAGES to "C" if Tramp
107189
a48b193e3b5f (tramp-handle-insert-file-contents): Set always the permissions of the
Michael Albinus <michael.albinus@gmx.de>
parents: 107170
diff changeset
8935 ;; expects only English messages? (Juri Linkov)
107021
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
8936 ;; * Make shadowfile.el grok Tramp filenames. (Bug#4526, Bug#4846)
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
8937 ;; * Do not handle files with drive letter as remote. (Bug#5447)
107820
e97568b31550 Synchronize with Tramp repository.
Michael Albinus <albinus@detlef>
parents: 107538
diff changeset
8938 ;; * Load Tramp subpackages only when needed. (Bug#1529, Bug#5448, Bug#5705)
107021
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
8939 ;; * Try telnet+curl as new method. It might be useful for busybox,
b38ac2be4408 Fix some busybox annoyances.
Michael Albinus <albinus@detlef>
parents: 106895
diff changeset
8940 ;; without built-in uuencode/uudecode.
107151
7e66e7efd47d * net/tramp.el (tramp-process-actions, tramp-read-passwd):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
8941 ;; * Let `shell-dynamic-complete-*' and `comint-dynamic-complete' work
7e66e7efd47d * net/tramp.el (tramp-process-actions, tramp-read-passwd):
Michael Albinus <michael.albinus@gmx.de>
parents: 107085
diff changeset
8942 ;; on remote hosts.
107858
57532220127a Fix Bug#5840.
Michael Albinus <albinus@detlef>
parents: 107822
diff changeset
8943 ;; * Load ~/.emacs_SHELLNAME on the remote host for `shell'.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8944
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8945 ;; Functions for file-name-handler-alist:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8946 ;; diff-latest-backup-file -- in diff.el
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8947
93103
19a32f437b65 Fix up encoding.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 93082
diff changeset
8948 ;; arch-tag: 3a21a994-182b-48fa-b0cd-c1d9fede424a
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
8949 ;;; tramp.el ends here
93040
ba82da0cb626 * net/tramp.el (tramp-root-regexp): Simplify.
Michael Albinus <michael.albinus@gmx.de>
parents: 93036
diff changeset
8950
ba82da0cb626 * net/tramp.el (tramp-root-regexp): Simplify.
Michael Albinus <michael.albinus@gmx.de>
parents: 93036
diff changeset
8951 ;; Local Variables:
ba82da0cb626 * net/tramp.el (tramp-root-regexp): Simplify.
Michael Albinus <michael.albinus@gmx.de>
parents: 93036
diff changeset
8952 ;; mode: Emacs-Lisp
ba82da0cb626 * net/tramp.el (tramp-root-regexp): Simplify.
Michael Albinus <michael.albinus@gmx.de>
parents: 93036
diff changeset
8953 ;; coding: utf-8
ba82da0cb626 * net/tramp.el (tramp-root-regexp): Simplify.
Michael Albinus <michael.albinus@gmx.de>
parents: 93036
diff changeset
8954 ;; End: