annotate lisp/net/tramp.el @ 85024:ef71cdab0d5c

* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'. (tramp-file-name-handler-alist): Add `tramp-handle-insert-file-contents-literally'. Neded for XEmacs. (tramp-make-temp-file): Use `make-temp-name'. `make-temp-file', used before, creates the file already, which is not desired. (tramp-do-copy-or-rename-file-directly): Simplify handling of temporary file. (tramp-handle-insert-file-contents): Assign the result in the short track case. (tramp-handle-insert-file-contents-literally): New defun. (tramp-completion-mode-p): Revert change from 2007-09-24. Checking for `return' etc as last character is not sufficient, for example in dired-mode when entering <g> (revert-buffer) or <s> (dired-sort). * net/tramp-compat.el (top): Add also compatibility code for loading appropriate timer package. (tramp-compat-copy-tree): Check for `subrp' and `symbol-file' in order to avoid autoloading problems. * net/tramp-fish.el: * net/tramp-smb.el: Move further compatibility code to tramp-compat.el. * net/tramp-ftp.el (tramp-ftp-file-name-handler): Handle the case where the second parameter of `copy-file' or `rename-file' is a remote file but not via ftp.
author Michael Albinus <michael.albinus@gmx.de>
date Wed, 03 Oct 2007 10:54:03 +0000
parents f7642749252b
children a42b8750a992
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
1 ;;; tramp.el --- Transparent Remote Access, Multiple Protocol
82201
b3182f0c969c * net/tramp.el:
Michael Albinus <michael.albinus@gmx.de>
parents: 82140
diff changeset
2 ;;; -*- mode: Emacs-Lisp; coding: utf-8; -*-
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3
64701
34bd8e434dd7 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64559
diff changeset
4 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
75148
bdffb0038313 * net/tramp.el: (tramp-process-one-action): Remove `with-timeout'.
Michael Albinus <michael.albinus@gmx.de>
parents: 75007
diff changeset
5 ;; 2005, 2006, 2007 Free Software Foundation, Inc.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6
75361
9cc44485654f (tramp-perl-encode, tramp-perl-decode): Update copyrights.
Glenn Morris <rgm@gnu.org>
parents: 75194
diff changeset
7 ;; (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
8
82201
b3182f0c969c * net/tramp.el:
Michael Albinus <michael.albinus@gmx.de>
parents: 82140
diff changeset
9 ;; 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
10 ;; Michael Albinus <michael.albinus@gmx.de>
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
11 ;; Keywords: comm, processes
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
12
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
13 ;; This file is part of GNU Emacs.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
14
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
15 ;; GNU Emacs is free software; you can redistribute it and/or modify
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
16 ;; it under the terms of the GNU General Public License as published by
78230
84cf1e2214c5 Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents: 77986
diff changeset
17 ;; the Free Software Foundation; either version 3, or (at your option)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
18 ;; any later version.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
19
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
20 ;; 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
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
23 ;; GNU General Public License for more details.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
24
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
25 ;; You should have received a copy of the GNU General Public License
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
26 ;; along with GNU Emacs; see the file COPYING. If not, see
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
27 ;; <http://www.gnu.org/licenses/>.
45861
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 ;;; Commentary:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
30
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
31 ;; This package provides remote file editing, similar to ange-ftp.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
32 ;; 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
33 ;; 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
34 ;; 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
35 ;;
50338
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
36 ;; For more detailed instructions, please see the info file.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
37 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
38 ;; Notes:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
39 ;; -----
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
40 ;;
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
41 ;; This package only works for Emacs 21.1 and higher, and for XEmacs 21.4
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
42 ;; and higher. For XEmacs 21, you need the package `fsf-compat' for
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
43 ;; the `with-timeout' macro.)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
44 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
45 ;; This version might not work with pre-Emacs 21 VC unless VC is
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
46 ;; loaded before tramp.el. Could you please test this and tell me about
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
47 ;; the result? Thanks.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
48 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
49 ;; 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
50 ;;
50338
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
51 ;; 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
52 ;; http://ftp.gnu.org/gnu/tramp/
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
53 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
54 ;; 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
55 ;; tramp-devel@gnu.org
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
56 ;; 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
57 ;; http://lists.gnu.org/mailman/listinfo/tramp-devel
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
58 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
59 ;; For the adventurous, the current development sources are available
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
60 ;; 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
61 ;; http://savannah.gnu.org/projects/tramp/
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
62 ;; Click on "CVS" in the navigation bar near the top.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
63 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
64 ;; Don't forget to put on your asbestos longjohns, first!
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
65
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
66 ;;; Code:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
67
50338
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
68 ;; 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
69 (require 'trampver)
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
70 (add-hook 'tramp-unload-hook
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
71 '(lambda ()
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
72 (when (featurep 'trampver)
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
73 (unload-feature 'trampver 'force))))
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
74
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
75 (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
76 (add-hook 'tramp-unload-hook
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
77 '(lambda ()
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
78 (when (featurep 'tramp-compat)
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
79 (unload-feature 'tramp-compat 'force))))
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
80
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
81 (require 'format-spec) ;from Gnus 5.8, 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
82 ;; 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
83 ;; be mandatory
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
84 (if (featurep 'xemacs)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
85 (load "password" 'noerror)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
86 (require 'password nil 'noerror)) ;from No Gnus, also in tar ball
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
87
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
88 (require 'shell)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
89 (require 'advice)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
90
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
91 ;; 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
92 (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
93 (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
94 (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
95 (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
96 (autoload 'tramp-cache-print "tramp-cache")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
97 (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
98 (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
99 (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
100 (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
101 (add-hook 'tramp-unload-hook
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
102 '(lambda ()
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
103 (when (featurep 'tramp-cache)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
104 (unload-feature 'tramp-cache 'force))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
105
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
106 (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
107 "Implementation of `uuencode' in Lisp.")
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
108 (add-hook 'tramp-unload-hook
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
109 '(lambda ()
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
110 (when (featurep 'tramp-uu)
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
111 (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
112
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
113 (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
114
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
115 ;; The following Tramp packages must be loaded after Tramp, because
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
116 ;; they require Tramp as well.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
117 (eval-after-load "tramp"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
118 '(progn
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
119
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
120 ;; Load foreign FTP method.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
121 (let ((feature (if (featurep 'xemacs) 'tramp-efs 'tramp-ftp)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
122 (require feature)
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
123 (add-hook 'tramp-unload-hook
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
124 `(lambda ()
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
125 (when (featurep ,feature)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
126 (unload-feature ,feature 'force)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
127
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
128 ;; tramp-smb uses "smbclient" from Samba. Not available under
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
129 ;; Cygwin and Windows, because they don't offer "smbclient". And
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
130 ;; even not necessary there, because Emacs supports UNC file names
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
131 ;; like "//host/share/localname".
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
132 (unless (memq system-type '(cygwin windows-nt))
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
133 (require 'tramp-smb)
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
134 (add-hook 'tramp-unload-hook
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
135 '(lambda ()
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
136 (when (featurep 'tramp-smb)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
137 (unload-feature 'tramp-smb 'force)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
138
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
139 ;; Load foreign FISH method.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
140 (require 'tramp-fish)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
141 (add-hook 'tramp-unload-hook
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
142 '(lambda ()
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
143 (when (featurep 'tramp-fish)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
144 (unload-feature 'tramp-fish 'force))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
145
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
146 ;; Load gateways. It needs `make-network-process' from Emacs 22.
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
147 (when (functionp 'make-network-process)
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
148 (require 'tramp-gw)
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
149 (add-hook 'tramp-unload-hook
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
150 '(lambda ()
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
151 (when (featurep 'tramp-gw)
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
152 (unload-feature 'tramp-gw 'force)))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
153
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
154 ;; tramp-util offers integration into other (X)Emacs packages like
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
155 ;; compile.el, gud.el etc. Not necessary in Emacs 23.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
156 (unless (functionp 'start-file-process)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
157 (require 'tramp-util)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
158 (add-hook 'tramp-unload-hook
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
159 '(lambda ()
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
160 (when (featurep 'tramp-util)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
161 (unload-feature 'tramp-util 'force)))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
162
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
163 ;;; User Customizable Internal Variables:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
164
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
165 (defgroup tramp nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
166 "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
167 :group 'files
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
168 :version "22.1")
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
169
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
170 (defcustom tramp-verbose 3
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
171 "*Verbosity level for Tramp.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
172 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
173
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
174 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
175 1 errors
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
176 2 warnings
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
177 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
178 4 activities
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
179 5 internal
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
180 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
181 7 file caching
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
182 8 connection properties
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
183 10 traces (huge)."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
184 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
185 :type 'integer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
186
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
187 ;; Emacs case
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
188 (eval-and-compile
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
189 (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
190 (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
191 "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
192 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
193 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
194 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
195 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
196
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
197 \(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
198
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
199 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
200 policy for local files."
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
201 :group 'tramp
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
202 :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
203 (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
204
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
205 ;; 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
206 ;; 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
207 (eval-and-compile
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
208 (when (featurep 'xemacs)
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
209 (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
210 "*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
211 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
212 `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
213 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
214 \(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
215
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
216 \(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
217
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
218 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
219 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
220 :type '(repeat
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
221 (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
222 (string :tag "Backup Dir")
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
223 (set :inline t
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
224 (const ok-create)
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
225 (const full-path)
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
226 (const prepend-name)
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
227 (const search-upward))))
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
228 :group 'tramp)))
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
229
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
230 (defcustom tramp-auto-save-directory nil
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
231 "*Put auto-save files in this directory, if set.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
232 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
233 :group 'tramp
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
234 :type '(choice (const nil) string))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
235
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
236 (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
237 (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
238 (getenv "COMSPEC")
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
239 "/bin/sh")
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
240 "*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
241 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
242 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
243 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
244 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
245
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
246 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
247
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
248 /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
249
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
250 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
251 variable `tramp-encoding-command-switch' for the \"-c\" part.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
252
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
253 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
254 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
255 use for the remote host."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
256 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
257 :type '(file :must-match t))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
258
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
259 (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
260 (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
261 "/c"
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
262 "-c")
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
263 "*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
264 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
265 :group 'tramp
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
266 :type 'string)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
267
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
268 (defcustom tramp-copy-size-limit 10240
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
269 "*The maximum file size where inline copying is preferred over an out-of-the-band copy."
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
270 :group 'tramp
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
271 :type 'integer)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
272
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
273 (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
274 "*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
275 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
276 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
277 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
278 :group 'tramp
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
279 :type 'string)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
280
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
281 (defvar tramp-methods
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
282 `(("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
283 (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
284 (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
285 (tramp-copy-program "rcp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
286 (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
287 (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
288 (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
289 ("scp" (tramp-login-program "ssh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
290 (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
291 ("-e" "none")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
292 (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
293 (tramp-copy-program "scp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
294 (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
295 (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
296 (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
297 (tramp-gw-args (("-o"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
298 "GlobalKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
299 ("-o" "UserKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
300 ("-o" "StrictHostKeyChecking=no")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
301 (tramp-default-port 22))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
302 ("scp1" (tramp-login-program "ssh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
303 (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
304 ("-1" "-e" "none")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
305 (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
306 (tramp-copy-program "scp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
307 (tramp-copy-args (("-1") ("-P" "%p") ("-p" "%k")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
308 ("-q")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
309 (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
310 (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
311 (tramp-gw-args (("-o"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
312 "GlobalKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
313 ("-o" "UserKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
314 ("-o" "StrictHostKeyChecking=no")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
315 (tramp-default-port 22))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
316 ("scp2" (tramp-login-program "ssh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
317 (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
318 ("-2" "-e" "none")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
319 (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
320 (tramp-copy-program "scp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
321 (tramp-copy-args (("-2") ("-P" "%p") ("-p" "%k")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
322 ("-q")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
323 (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
324 (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
325 (tramp-gw-args (("-o"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
326 "GlobalKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
327 ("-o" "UserKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
328 ("-o" "StrictHostKeyChecking=no")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
329 (tramp-default-port 22))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
330 ("scp1_old"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
331 (tramp-login-program "ssh1")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
332 (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
333 ("-e" "none")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
334 (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
335 (tramp-copy-program "scp1")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
336 (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
337 (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
338 (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
339 ("scp2_old"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
340 (tramp-login-program "ssh2")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
341 (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
342 ("-e" "none")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
343 (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
344 (tramp-copy-program "scp2")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
345 (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
346 (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
347 (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
348 ("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
349 (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
350 ("-e" "none")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
351 (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
352 (tramp-copy-program "sftp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
353 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
354 (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
355 (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
356 ("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
357 (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
358 ("-e" "none")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
359 (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
360 (tramp-copy-program "rsync")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
361 (tramp-copy-args (("-e" "ssh") ("-t" "%k")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
362 (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
363 (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
364 ("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
365 (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
366 (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
367 (tramp-copy-program "rcp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
368 (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
369 (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
370 (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
371 ("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
372 (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
373 (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
374 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
375 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
376 (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
377 (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
378 ("ssh" (tramp-login-program "ssh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
379 (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
380 ("-e" "none")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
381 (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
382 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
383 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
384 (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
385 (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
386 (tramp-gw-args (("-o"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
387 "GlobalKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
388 ("-o" "UserKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
389 ("-o" "StrictHostKeyChecking=no")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
390 (tramp-default-port 22))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
391 ("ssh1" (tramp-login-program "ssh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
392 (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
393 ("-1" "-e" "none")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
394 (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
395 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
396 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
397 (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
398 (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
399 (tramp-gw-args (("-o"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
400 "GlobalKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
401 ("-o" "UserKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
402 ("-o" "StrictHostKeyChecking=no")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
403 (tramp-default-port 22))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
404 ("ssh2" (tramp-login-program "ssh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
405 (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
406 ("-2" "-e" "none")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
407 (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
408 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
409 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
410 (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
411 (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
412 (tramp-gw-args (("-o"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
413 "GlobalKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
414 ("-o" "UserKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
415 ("-o" "StrictHostKeyChecking=no")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
416 (tramp-default-port 22))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
417 ("ssh1_old"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
418 (tramp-login-program "ssh1")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
419 (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
420 ("-e" "none")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
421 (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
422 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
423 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
424 (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
425 (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
426 ("ssh2_old"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
427 (tramp-login-program "ssh2")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
428 (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
429 ("-e" "none")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
430 (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
431 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
432 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
433 (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
434 (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
435 ("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
436 (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
437 (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
438 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
439 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
440 (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
441 (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
442 ("telnet"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
443 (tramp-login-program "telnet")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
444 (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
445 (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
446 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
447 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
448 (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
449 (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
450 (tramp-default-port 23))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
451 ("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
452 (tramp-login-args (("-") ("%u")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
453 (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
454 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
455 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
456 (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
457 (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
458 ("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
459 (tramp-login-args (("-u" "%u")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
460 ("-s" "-p" "Password:")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
461 (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
462 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
463 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
464 (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
465 (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
466 ("scpc" (tramp-login-program "ssh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
467 (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
468 ("-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
469 ("-o" "ControlMaster=yes")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
470 ("-e" "none")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
471 (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
472 (tramp-copy-program "scp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
473 (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
474 ("-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
475 ("-o" "ControlMaster=auto")))
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 t)
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 ("scpx" (tramp-login-program "ssh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
484 (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
485 ("-e" "none" "-t" "-t" "/bin/sh")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
486 (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
487 (tramp-copy-program "scp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
488 (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
489 (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
490 (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
491 (tramp-gw-args (("-o"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
492 "GlobalKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
493 ("-o" "UserKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
494 ("-o" "StrictHostKeyChecking=no")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
495 (tramp-default-port 22))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
496 ("sshx" (tramp-login-program "ssh")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
497 (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
498 ("-e" "none" "-t" "-t" "/bin/sh")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
499 (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
500 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
501 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
502 (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
503 (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
504 (tramp-gw-args (("-o"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
505 "GlobalKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
506 ("-o" "UserKnownHostsFile=/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
507 ("-o" "StrictHostKeyChecking=no")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
508 (tramp-default-port 22))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
509 ("krlogin"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
510 (tramp-login-program "krlogin")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
511 (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
512 (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
513 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
514 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
515 (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
516 (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
517 ("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
518 (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
519 ("-ssh")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
520 (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
521 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
522 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
523 (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
524 (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
525 (tramp-default-port 22))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
526 ("plink1"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
527 (tramp-login-program "plink")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
528 (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
529 ("-1" "-ssh")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
530 (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
531 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
532 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
533 (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
534 (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
535 (tramp-default-port 22))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
536 ("plinkx"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
537 (tramp-login-program "plink")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
538 (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
539 (,(format
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
540 "env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=$ '"
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
541 tramp-terminal-type))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
542 ("/bin/sh")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
543 (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
544 (tramp-copy-program nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
545 (tramp-copy-args nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
546 (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
547 (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
548 ("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
549 (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
550 ("-ssh")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
551 (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
552 (tramp-copy-program "pscp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
553 (tramp-copy-args (("-scp") ("-p" "%k")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
554 (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
555 (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
556 (tramp-default-port 22))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
557 ("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
558 (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
559 ("-ssh")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
560 (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
561 (tramp-copy-program "pscp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
562 (tramp-copy-args (("-psftp") ("-p" "%k")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
563 (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
564 (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
565 ("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
566 (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
567 (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
568 (tramp-copy-program "fcp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
569 (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
570 (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
571 (tramp-password-end-of-line nil)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
572 "*Alist of methods for remote files.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
573 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
574 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
575 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
576 * `tramp-remote-sh'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
577 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
578 MUST be a Bourne-like shell. It is normally not necessary to set
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
579 this to any value other than \"/bin/sh\": tramp wants to use a shell
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
580 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
581 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
582 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
583 * `tramp-login-program'
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
584 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
585 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
586 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
587 * `tramp-login-args'
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
588 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
589 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
590 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
591 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
592 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
593 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
594 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
595 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
596 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
597 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
598 \"%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
599 `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
600 parameter of a program, if exists.
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
601 * `tramp-copy-program'
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
602 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
603 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
604 a workalike program.
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
605 * `tramp-copy-args'
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
606 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
607 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
608 * `tramp-copy-keep-date'
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
609 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
610 timestamp of the original file.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
611 * `tramp-default-port'
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
612 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
613 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
614 passing gateways.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
615 * `tramp-gw-args'
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
616 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
617 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
618 * `tramp-password-end-of-line'
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
619 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
620 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
621 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
622 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
623 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
624 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
625 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
626 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
627
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
628 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
629 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
630 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
631 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
632 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
633
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
634 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
635 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
636 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
637 `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
638 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
639 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
640 `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
641
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
642 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
643 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
644 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
645 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
646
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
647 Notes:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
648
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
649 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
650 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
651 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
652 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
653 `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
654 useful only in combination with `tramp-default-proxies-alist'.")
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
655
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
656 (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
657 ;; 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
658 ;; 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
659 ;; 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
660 ;; permanent password queries. Either a password agent like
948c86bf6396 * net/tramp.el (tramp-default-method): We still need to check for
Michael Albinus <michael.albinus@gmx.de>
parents: 74766
diff changeset
661 ;; "ssh-agent" or "Pageant" shall run, or the optional password.el
948c86bf6396 * net/tramp.el (tramp-default-method): We still need to check for
Michael Albinus <michael.albinus@gmx.de>
parents: 74766
diff changeset
662 ;; package shall be active for password caching. "scpc" would be
948c86bf6396 * net/tramp.el (tramp-default-method): We still need to check for
Michael Albinus <michael.albinus@gmx.de>
parents: 74766
diff changeset
663 ;; another good choice because of the "ControlMaster" option, but
948c86bf6396 * net/tramp.el (tramp-default-method): We still need to check for
Michael Albinus <michael.albinus@gmx.de>
parents: 74766
diff changeset
664 ;; this is a more modern alternative in OpenSSH 4, which cannot be
948c86bf6396 * net/tramp.el (tramp-default-method): We still need to check for
Michael Albinus <michael.albinus@gmx.de>
parents: 74766
diff changeset
665 ;; taken as default.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
666 (cond
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
667 ;; PuTTY is installed.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
668 ((executable-find "pscp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
669 (if (or (fboundp 'password-read)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
670 ;; Pageant is running.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
671 (and (fboundp 'w32-window-exists-p)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
672 (funcall (symbol-function 'w32-window-exists-p)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
673 "Pageant" "Pageant")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
674 "pscp"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
675 "plink"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
676 ;; 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
677 ((executable-find "scp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
678 (if (or (fboundp 'password-read)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
679 ;; ssh-agent is running.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
680 (getenv "SSH_AUTH_SOCK")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
681 (getenv "SSH_AGENT_PID"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
682 "scp"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
683 "ssh"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
684 ;; Fallback.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
685 (t "ftp"))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
686 "*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
687 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
688 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
689 :group 'tramp
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
690 :type 'string)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
691
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
692 (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
693 '(("\\`localhost\\'" "\\`root\\'" "su"))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
694 "*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
695 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
696 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
697 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
698 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
699 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
700
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
701 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
702 empty string for the user name.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
703
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
704 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
705 :group 'tramp
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
706 :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
707 (regexp :tag "User regexp")
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
708 (string :tag "Method"))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
709
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
710 (defcustom tramp-default-user
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
711 nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
712 "*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
713 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
714 \"~/.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
715
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
716 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
717 :group 'tramp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
718 :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
719
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
720 (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
721 `(("\\`su\\(do\\)?\\'" nil "root")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
722 ("\\`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
723 nil ,(user-login-name)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
724 "*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
725 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
726 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
727 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
728 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
729 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
730
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
731 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
732 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
733 :group 'tramp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
734 :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
735 (regexp :tag "Host regexp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
736 (string :tag "User"))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
737
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
738 (defcustom tramp-default-host
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
739 (system-name)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
740 "*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
741 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
742 :group 'tramp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
743 :type 'string)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
744
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
745 (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
746 "*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
747 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
748 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
749 a remote target matching USER@HOST. HOST and USER are regular
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
750 expressions or nil, which is interpreted as a regular expression
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
751 which always matches. PROXY must be a Tramp filename without a
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
752 localname part. Method and user name on PROXY are optional,
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
753 which is interpreted with the default values. PROXY can contain
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
754 the patterns %h and %u, which are replaced by the strings
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
755 matching HOST or USER, respectively."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
756 :group 'tramp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
757 :type '(repeat (list (regexp :tag "Host regexp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
758 (regexp :tag "User regexp")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
759 (string :tag "Proxy remote name"))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
760
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
761 (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
762 '((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
763 (tramp-parse-rhosts "~/.rhosts"))
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
764 "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
765
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
766 (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
767 '((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
768 (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
769 (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
770 (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
771 (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
772 (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
773 (tramp-parse-rhosts "~/.rhosts")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
774 (tramp-parse-rhosts "~/.shosts")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
775 (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
776 (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
777 (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
778 (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
779 "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
780
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
781 (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
782 '((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
783 "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
784
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
785 (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
786 '((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
787 "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
788
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
789 (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
790 '((tramp-parse-putty
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
791 "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
792 "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
793
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
794 (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
795 "*Alist of methods for remote files.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
796 This is a list of entries of the form (NAME PAIR1 PAIR2 ...).
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
797 Each NAME stands for a remote access method. Each PAIR is of the form
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
798 \(FUNCTION FILE). FUNCTION is responsible to extract user names and host
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
799 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
800
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
801 * `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
802 * `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
803 * `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
804 * `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
805 * `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
806 * `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
807 * `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
808 * `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
809 * `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
810
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
811 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
812 the info pages.")
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
813
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
814 (eval-after-load "tramp"
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
815 '(progn
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
816 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
817 "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
818 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
819 "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
820 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
821 "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
822 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
823 "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
824 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
825 "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
826 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
827 "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
828 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
829 "rsync" 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
830 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
831 "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
832 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
833 "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
834 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
835 "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
836 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
837 "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
838 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
839 "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
840 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
841 "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
842 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
843 "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
844 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
845 "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
846 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
847 "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
848 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
849 "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
850 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
851 "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
852 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
853 "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
854 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
855 "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
856 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
857 "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
858 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
859 "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
860 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
861 "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
862 (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
863 "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
864 (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
865 "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
866 (tramp-set-completion-function
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
867 "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
868
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
869 (defconst tramp-echo-mark "_echo\b\b\b\b\b"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
870 "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
871 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
872 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
873 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
874 producing some echo which can later be detected by
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
875 `tramp-echoed-echo-mark-regexp'. Using some characters followed
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
876 by an equal number of backspaces to erase them will usually
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
877 suffice.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
878
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
879 (defconst tramp-echoed-echo-mark-regexp "_echo\\(\b\\( \b\\)?\\)\\{5\\}"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
880 "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
881 the remote shell.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
882
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
883 (defcustom tramp-rsh-end-of-line "\n"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
884 "*String used for end of line in rsh connections.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
885 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
886 if you need to change this.
51968
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
887 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
888 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
889 :group 'tramp
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
890 :type 'string)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
891
51968
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
892 (defcustom tramp-default-password-end-of-line
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
893 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
894 "*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
895 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
896 `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
897
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
898 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
899 \"\\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
900 \"\\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
901 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
902
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
903 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
904 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
905 :type 'string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
906
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
907 ;; "getconf PATH" yields:
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
908 ;; 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
909 ;; Solaris: /usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/opt/SUNWspro/bin
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
910 ;; Linux (Debian, Suse): /bin:/usr/bin
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
911 ;; FreeBSD: /usr/bin:/bin:/usr/sbin:/sbin: - beware trailing ":"!
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
912 (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
913 '(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
914 "/local/bin" "/local/freeware/bin" "/local/gnu/bin"
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
915 "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
916 "*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
917 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
918 keeping the list of existing directories on that host.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
919
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
920 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
921 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
922
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
923 `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
924 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
925 entry on top of this list, because these are the default
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
926 directories for POSIX compatible commands."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
927 :group 'tramp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
928 :type '(repeat (choice
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
929 (const :tag "Default Directories" tramp-default-remote-path)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
930 (string :tag "Directory"))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
931
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
932 (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
933 "*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
934 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
935 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
936 files conditionalize this setup based on the TERM environment variable."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
937 :group 'tramp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
938 :type 'string)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
939
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
940 (defcustom tramp-remote-process-environment
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
941 `("HISTFILE=$HOME/.tramp_history" "HISTSIZE=1" "LC_TIME=C"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
942 ,(concat "TERM=" tramp-terminal-type)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
943 "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
944 "autocorrect=" "correct=")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
945
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
946 "*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
947
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
948 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
949 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
950 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
951
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
952 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
953 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
954 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
955 :type '(repeat string))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
956
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
957 (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
958 ".*ogin\\( .*\\)?: *"
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
959 "*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
960 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
961
efa862a76bc2 * net/tramp.el (tramp-login-prompt-regexp): Expand regexp in order to
Michael Albinus <michael.albinus@gmx.de>
parents: 65359
diff changeset
962 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
963 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
964 :type 'regexp)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
965
46998
9d6aef07c793 Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46992
diff changeset
966 (defcustom tramp-shell-prompt-pattern
51603
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
967 "^[^#$%>\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
968 "Regexp to match prompts from remote shell.
9d6aef07c793 Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46992
diff changeset
969 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
970 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
971 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
972 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
973 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
974 variable is similar to the default value of `shell-prompt-pattern',
46998
9d6aef07c793 Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46992
diff changeset
975 which should work well in many cases."
9d6aef07c793 Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46992
diff changeset
976 :group 'tramp
9d6aef07c793 Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46992
diff changeset
977 :type 'regexp)
9d6aef07c793 Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46992
diff changeset
978
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
979 (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
980 "^.*\\([pP]assword\\|[pP]assphrase\\).*:\^@? *"
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
981 "*Regexp matching password-like prompts.
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
982 The regexp should match at end of buffer.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
983
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
984 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
985 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
986 :type 'regexp)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
987
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
988 (defcustom tramp-wrong-passwd-regexp
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
989 (concat "^.*"
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
990 ;; These strings should be on the last line
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
991 (regexp-opt '("Permission denied."
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
992 "Login incorrect"
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
993 "Login Incorrect"
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
994 "Connection refused"
82324
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
995 "Connection closed"
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
996 "Sorry, try again."
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
997 "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
998 "Host key verification failed."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
999 "No supported authentication methods left to try!"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1000 "Tramp connection closed") t)
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1001 ".*"
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1002 "\\|"
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1003 "^.*\\("
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1004 ;; Here comes a list of regexes, separated by \\|
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1005 "Received signal [0-9]+"
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1006 "\\).*")
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1007 "*Regexp matching a `login failed' message.
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1008 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
1009 :group 'tramp
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1010 :type 'regexp)
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1011
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1012 (defcustom tramp-yesno-prompt-regexp
46992
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
1013 (concat
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
1014 (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
1015 "\\s-*")
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
1016 "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
1017 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
1018 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
1019 See also `tramp-yn-prompt-regexp'."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1020 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1021 :type 'regexp)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1022
46992
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
1023 (defcustom tramp-yn-prompt-regexp
74985
155a8e75cd11 Sync with Tramp 2.0.55.
Michael Albinus <michael.albinus@gmx.de>
parents: 74777
diff changeset
1024 (concat
155a8e75cd11 Sync with Tramp 2.0.55.
Michael Albinus <michael.albinus@gmx.de>
parents: 74777
diff changeset
1025 (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
1026 "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
1027 "\\s-*")
46992
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
1028 "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
1029 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
1030 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
1031 See also `tramp-yesno-prompt-regexp'."
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
1032 :group 'tramp
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
1033 :type 'regexp)
47771
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
1034
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
1035 (defcustom tramp-terminal-prompt-regexp
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
1036 (concat "\\("
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
1037 "TERM = (.*)"
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
1038 "\\|"
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
1039 "Terminal type\\? \\[.*\\]"
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
1040 "\\)\\s-*")
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
1041 "Regular expression matching all terminal setting prompts.
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
1042 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
1043 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
1044 :group 'tramp
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
1045 :type 'regexp)
46992
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
1046
59582
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
1047 (defcustom tramp-operation-not-permitted-regexp
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
1048 (concat "\\(" "preserving times.*" "\\|" "set mode" "\\)" ":\\s-*"
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
1049 (regexp-opt '("Operation not permitted") t))
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
1050 "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
1051 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
1052 be ignored safely."
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
1053 :group 'tramp
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
1054 :type 'regexp)
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
1055
74166
5b973e5dc882 (tramp-default-method): Under Windows, change from plink to pscp.
Lars Hansen <larsh@soem.dk>
parents: 74052
diff changeset
1056 (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
1057 (concat "\\(.+: "
5b973e5dc882 (tramp-default-method): Under Windows, change from plink to pscp.
Lars Hansen <larsh@soem.dk>
parents: 74052
diff changeset
1058 (regexp-opt '("Permission denied"
5b973e5dc882 (tramp-default-method): Under Windows, change from plink to pscp.
Lars Hansen <larsh@soem.dk>
parents: 74052
diff changeset
1059 "not a regular file"
5b973e5dc882 (tramp-default-method): Under Windows, change from plink to pscp.
Lars Hansen <larsh@soem.dk>
parents: 74052
diff changeset
1060 "is a directory"
5b973e5dc882 (tramp-default-method): Under Windows, change from plink to pscp.
Lars Hansen <larsh@soem.dk>
parents: 74052
diff changeset
1061 "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
1062 "\\)\\s-*")
5b973e5dc882 (tramp-default-method): Under Windows, change from plink to pscp.
Lars Hansen <larsh@soem.dk>
parents: 74052
diff changeset
1063 "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
1064 :group 'tramp
5b973e5dc882 (tramp-default-method): Under Windows, change from plink to pscp.
Lars Hansen <larsh@soem.dk>
parents: 74052
diff changeset
1065 :type 'regexp)
5b973e5dc882 (tramp-default-method): Under Windows, change from plink to pscp.
Lars Hansen <larsh@soem.dk>
parents: 74052
diff changeset
1066
55844
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
1067 (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
1068 ""
55844
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
1069 "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
1070 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
1071 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
1072 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
1073 `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
1074 :group 'tramp
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
1075 :type 'regexp)
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
1076
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1077 (defcustom tramp-temp-name-prefix "tramp."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1078 "*Prefix to use for temporary files.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1079 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
1080 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
1081 `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
1082 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
1083 part, though."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1084 :group 'tramp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1085 :type 'string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1086
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
1087 (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
1088 "*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
1089 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
1090 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
1091 arguments.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1092
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1093 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
1094 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
1095 shell from reading its init file."
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1096 :group 'tramp
51968
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
1097 ;; 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
1098 ;; `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
1099 :type (if (get 'alist 'widget-type)
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
1100 '(alist :key-type string :value-type string)
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
1101 '(repeat (cons string string))))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1102
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1103 ;; 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
1104 ;; 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
1105 ;; 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
1106 ;; 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
1107 ;; 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
1108 ;; 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
1109 ;; 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
1110 ;; the other places.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1111
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1112 ;; 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
1113 ;;;###autoload
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1114 (defcustom tramp-syntax
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1115 (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
1116 "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
1117
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1118 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
1119
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1120 '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
1121 '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
1122 'url -- URL-like syntax."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1123 :group 'tramp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1124 :type (if (featurep 'xemacs)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1125 '(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
1126 (const :tag "XEmacs" sep)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1127 (const :tag "URL" url))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1128 '(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
1129 (const :tag "URL" url))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1130
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1131 (defconst tramp-prefix-format
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1132 (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
1133 ((equal tramp-syntax 'sep) "/[")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1134 ((equal tramp-syntax 'url) "/")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1135 (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
1136 "*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
1137 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
1138
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1139 (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
1140 (concat "^" (regexp-quote tramp-prefix-format))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1141 "*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
1142 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
1143
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1144 (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
1145 "[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
1146 "*Regexp matching methods identifiers.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1147
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1148 (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
1149 (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
1150 ((equal tramp-syntax 'sep) "/")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1151 ((equal tramp-syntax 'url) "://")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1152 (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
1153 "*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
1154 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
1155
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1156 (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
1157 (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
1158 "*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
1159 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
1160
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1161 (defconst tramp-user-regexp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1162 "[^:/ \t]+"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1163 "*Regexp matching user names.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1164
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1165 (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
1166 "@"
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1167 "*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
1168 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
1169
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1170 (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
1171 (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
1172 "*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
1173 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
1174
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1175 (defconst tramp-host-regexp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1176 "[a-zA-Z0-9_.-]+"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1177 "*Regexp matching host names.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1178
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1179 (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
1180 (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
1181 ((equal tramp-syntax 'sep) "#")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1182 ((equal tramp-syntax 'url) ":")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1183 (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
1184 "*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
1185
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1186 (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
1187 (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
1188 "*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
1189 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
1190
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1191 (defconst tramp-port-regexp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1192 "[0-9]+"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1193 "*Regexp matching port numbers.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1194
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1195 (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
1196 (concat "\\(" tramp-host-regexp "\\)"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1197 tramp-prefix-port-regexp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1198 "\\(" tramp-port-regexp "\\)")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1199 "*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
1200
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1201 (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
1202 (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
1203 ((equal tramp-syntax 'sep) "]")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1204 ((equal tramp-syntax 'url) "")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1205 (t (error "Wrong `tramp-syntax' defined")))
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1206 "*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
1207 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
1208
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1209 (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
1210 (regexp-quote tramp-postfix-host-format)
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1211 "*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
1212 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
1213
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1214 (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
1215 ".*$"
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1216 "*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
1217
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1218 ;; File name format.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1219
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1220 (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
1221 (list
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1222 (concat
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1223 tramp-prefix-regexp
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1224 "\\(" "\\(" 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
1225 "\\(" "\\(" tramp-user-regexp "\\)" tramp-postfix-user-regexp "\\)?"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1226 "\\(" tramp-host-regexp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1227 "\\(" tramp-prefix-port-regexp tramp-port-regexp "\\)?" "\\)?"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1228 tramp-postfix-host-regexp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1229 "\\(" tramp-localname-regexp "\\)")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1230 2 4 5 7)
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1231
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1232 "*List of five elements (REGEXP METHOD USER HOST FILE), detailing \
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1233 the tramp file name structure.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1234
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1235 The first element REGEXP is a regular expression matching a tramp file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1236 name. The regex should contain parentheses around the method name,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1237 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
1238
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1239 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
1240 parentheses matches the method name. The third element USER is
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1241 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
1242 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
1243 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
1244 means the opening parentheses are counted to identify the pair.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
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 See also `tramp-file-name-regexp'.")
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1247
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1248 ;;;###autoload
46306
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1249 (defconst tramp-file-name-regexp-unified
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1250 "\\`/[^/:]+:"
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1251 "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
1252 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
1253 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
1254
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1255 ;;;###autoload
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1256 (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
1257 "\\`/\\[.*\\]"
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1258 "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
1259 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
1260 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
1261
66cce4969490 (tramp-default-method): New default method "sm"
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46166
diff changeset
1262 ;;;###autoload
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1263 (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
1264 "\\`/[^/:]+://"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1265 "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
1266 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
1267
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1268 ;;;###autoload
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1269 (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
1270 (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
1271 ((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
1272 ((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
1273 (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
1274 "*Regular expression matching file names handled by Tramp.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1275 This regexp should match tramp file names but no other file names.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1276 \(When tramp.el is loaded, this regular expression is prepended to
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1277 `file-name-handler-alist', and that is searched sequentially. Thus,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1278 if the tramp entry appears rather early in the `file-name-handler-alist'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1279 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
1280 files which are not really Tramp files.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1281
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1282 Please note that the entry in `file-name-handler-alist' is made when
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1283 this file (tramp.el) is loaded. This means that this variable must be set
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1284 before loading tramp.el. Alternatively, `file-name-handler-alist' can be
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1285 updated after changing this variable.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1286
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1287 Also see `tramp-file-name-structure'.")
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1288
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1289 ;;;###autoload
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1290 (defconst tramp-completion-file-name-regexp-unified
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1291 (if (memq system-type '(cygwin windows-nt))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1292 "^\\([a-zA-Z]:\\)?/$\\|^\\([a-zA-Z]:\\)?/[^/:][^/]*$"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1293 "^/$\\|^/[^/:][^/]*$")
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1294 "Value for `tramp-completion-file-name-regexp' for unified remoting.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1295 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
1296 Tramp. 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
1297
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1298 ;;;###autoload
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1299 (defconst tramp-completion-file-name-regexp-separate
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1300 (if (memq system-type '(cygwin windows-nt))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1301 "^\\([a-zA-Z]:\\)?/\\([[][^]]*\\)?$"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1302 "^/\\([[][^]]*\\)?$")
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1303 "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
1304 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
1305 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
1306
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1307 ;;;###autoload
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1308 (defconst 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
1309 (if (memq system-type '(cygwin windows-nt))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1310 "^\\([a-zA-Z]:\\)?/$\\|^\\([a-zA-Z]:\\)?/[^/:]+\\(:\\(/\\(/[^/]*\\)?\\)?\\)?$"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1311 "^/$\\|^/[^/:]+\\(:\\(/\\(/[^/]*\\)?\\)?\\)?$")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1312 "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
1313 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
1314
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1315 ;;;###autoload
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1316 (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
1317 (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
1318 ((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
1319 ((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
1320 (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
1321 "*Regular expression matching file names handled by tramp completion.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1322 This regexp should match partial tramp file names only.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1323
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1324 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
1325 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
1326 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
1327 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
1328
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1329 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
1330
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1331 (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
1332 '((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
1333 (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
1334 (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
1335 (shell-prompt-pattern tramp-action-succeed)
46998
9d6aef07c793 Version 2.0.14 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46992
diff changeset
1336 (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
1337 (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
1338 (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
1339 (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
1340 (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
1341 "List of pattern/action pairs.
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1342 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
1343 Each item looks like (PATTERN ACTION).
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1344
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1345 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
1346 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
1347 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
1348 appended to it.
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1349
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1350 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
1351 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
1352
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1353 (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
1354 '((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
1355 (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
1356 (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
1357 (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
1358 "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
1359 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
1360
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1361 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
1362
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1363 ;; 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
1364 ;; 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
1365 ;; 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
1366 ;; 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
1367 ;; 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
1368 (defcustom tramp-chunksize
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1369 (when (and (not (featurep 'xemacs))
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1370 (memq system-type '(hpux)))
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1371 500)
66561
742e40a6bf3c * net/tramp.el (tramp-chunksize): Escape parentheses in docstring
Michael Albinus <michael.albinus@gmx.de>
parents: 66496
diff changeset
1372 ;; 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
1373 ;; 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
1374 ;; `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
1375 "*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
1376 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
1377 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
1378 checked via the following code:
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1379
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1380 (with-temp-buffer
65925
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1381 (let* ((user \"xxx\") (host \"yyy\")
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1382 (init 0) (step 50)
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1383 (sent init) (received init))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1384 (while (= sent received)
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1385 (setq sent (+ sent step))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1386 (erase-buffer)
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1387 (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
1388 \"ssh\" \"-l\" user host \"wc\" \"-c\")))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1389 (when (memq (process-status proc) '(run open))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1390 (process-send-string proc (make-string sent ?\\ ))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1391 (process-send-eof proc)
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1392 (process-send-eof proc))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1393 (while (not (progn (goto-char (point-min))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1394 (re-search-forward \"\\\\w+\" (point-max) t)))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1395 (accept-process-output proc 1))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1396 (when (memq (process-status proc) '(run open))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1397 (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
1398 (delete-process proc)
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1399 (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
1400 (sit-for 0))))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1401 (if (> sent (+ init step))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1402 (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
1403 (- sent step))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1404 (message \"Test does not work\")
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1405 (display-buffer (current-buffer))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1406 (sit-for 30))))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1407
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1408 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
1409 \(replace \"xxx\" and \"yyy\" by the remote user and host name,
65925
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1410 respectively). You can do this, for example, by pasting it into
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1411 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
1412 last closing parenthesis. Note that it works only if you have configured
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1413 \"ssh\" to run without password query, see ssh-agent(1).
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1414
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1415 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
1416 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
1417 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
1418
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1419 When it is necessary to set `tramp-chunksize', you might consider to
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1420 use an out-of-the-band method (like \"scp\") instead of an internal one
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1421 \(like \"ssh\"), because setting `tramp-chunksize' to non-nil decreases
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1422 performance.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1423
65925
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1424 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
1425 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
1426 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
1427 in the third line of the code.
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
1428
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1429 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
1430 this variable to be set as well."
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1431 :group 'tramp
50338
155b4b78aa3b * tramp.el: Version 2.0.31 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49995
diff changeset
1432 :type '(choice (const nil) integer))
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
1433
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
1434 ;; 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
1435 ;; 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
1436 ;; 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
1437 ;; 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
1438 (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
1439 "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
1440 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
1441 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
1442 :group 'tramp
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
1443 :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
1444
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1445 ;;; Internal Variables:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1446
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
1447 (defvar 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
1448 (concat
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1449 "///" (md5 (concat
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1450 (prin1-to-string process-environment) (current-time-string))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1451 "String used to recognize end of output.")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1452
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1453 (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
1454 "Connection method for this *tramp* buffer.")
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1455
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1456 (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
1457 "Remote login name for this *tramp* buffer.")
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1458
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1459 (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
1460 "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
1461
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1462 (defconst tramp-uudecode
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1463 "(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
1464 cat /tmp/tramp.$$
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1465 rm -f /tmp/tramp.$$"
46802
10aa49b3d28a Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46801
diff changeset
1466 "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
1467 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
1468 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
1469 we have this shell function.")
46802
10aa49b3d28a Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46801
diff changeset
1470
10aa49b3d28a Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46801
diff changeset
1471 ;; 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
1472 ;; 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
1473 ;; 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
1474 ;; 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
1475 ;; The device number is returned as "-1", because there will be a virtual
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
1476 ;; 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
1477 (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
1478 "%s -e '
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1479 @stat = lstat($ARGV[0]);
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1480 if (($stat[2] & 0170000) == 0120000)
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1481 {
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1482 $type = readlink($ARGV[0]);
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1483 $type = \"\\\"$type\\\"\";
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1484 }
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1485 elsif (($stat[2] & 0170000) == 040000)
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1486 {
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1487 $type = \"t\";
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1488 }
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1489 else
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1490 {
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1491 $type = \"nil\"
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1492 };
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1493 $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
1494 $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
1495 printf(
82064
07bb0658401d * net/tramp.el (tramp-perl-file-attributes)
Michael Albinus <michael.albinus@gmx.de>
parents: 82025
diff changeset
1496 \"(%%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
1497 $type,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1498 $stat[3],
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1499 $uid,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1500 $gid,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1501 $stat[8] >> 16 & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1502 $stat[8] & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1503 $stat[9] >> 16 & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1504 $stat[9] & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1505 $stat[10] >> 16 & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1506 $stat[10] & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1507 $stat[7],
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1508 $stat[2],
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1509 $stat[1] >> 16 & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1510 $stat[1] & 0xffff
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1511 );' \"$1\" \"$2\" \"$3\" 2>/dev/null"
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1512 "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
1513 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
1514 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
1515 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
1516
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1517 (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
1518 "%s -e '
65926
e465f3508fd5 (tramp-perl-directory-files-and-attributes): Add error handling.
Lars Hansen <larsh@soem.dk>
parents: 65925
diff changeset
1519 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
1520 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
1521 @list = readdir(DIR);
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1522 closedir(DIR);
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1523 $n = scalar(@list);
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1524 printf(\"(\\n\");
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1525 for($i = 0; $i < $n; $i++)
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1526 {
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1527 $filename = $list[$i];
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1528 @stat = lstat($filename);
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1529 if (($stat[2] & 0170000) == 0120000)
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1530 {
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1531 $type = readlink($filename);
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1532 $type = \"\\\"$type\\\"\";
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1533 }
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1534 elsif (($stat[2] & 0170000) == 040000)
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1535 {
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1536 $type = \"t\";
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1537 }
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1538 else
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1539 {
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1540 $type = \"nil\"
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1541 };
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1542 $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
1543 $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
1544 printf(
82064
07bb0658401d * net/tramp.el (tramp-perl-file-attributes)
Michael Albinus <michael.albinus@gmx.de>
parents: 82025
diff changeset
1545 \"(\\\"%%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
1546 $filename,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1547 $type,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1548 $stat[3],
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1549 $uid,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1550 $gid,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1551 $stat[8] >> 16 & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1552 $stat[8] & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1553 $stat[9] >> 16 & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1554 $stat[9] & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1555 $stat[10] >> 16 & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1556 $stat[10] & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1557 $stat[7],
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1558 $stat[2],
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1559 $stat[1] >> 16 & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1560 $stat[1] & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1561 $stat[0] >> 16 & 0xffff,
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1562 $stat[0] & 0xffff);
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
1563 }
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1564 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
1565 "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
1566 output.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1567 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
1568 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
1569
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1570 ;; ;; These two use uu encoding.
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1571 ;; (defvar tramp-perl-encode "%s -e'\
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1572 ;; print qq(begin 644 xxx\n);
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1573 ;; my $s = q();
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1574 ;; my $res = q();
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1575 ;; while (read(STDIN, $s, 45)) {
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1576 ;; print pack(q(u), $s);
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1577 ;; }
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1578 ;; print qq(`\n);
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1579 ;; print qq(end\n);
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1580 ;; '"
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1581 ;; "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
1582 ;; 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
1583
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1584 ;; (defvar tramp-perl-decode "%s -ne '
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1585 ;; print unpack q(u), $_;
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1586 ;; '"
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1587 ;; "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
1588 ;; 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
1589
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1590 ;; 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
1591 (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
1592 "%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
1593 "Perl program to use for encoding a file.
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1594 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
1595 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
1596 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
1597 on the remote host.")
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1598
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1599 (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
1600 "%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
1601 "Perl program to use for decoding a file.
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1602 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
1603 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
1604 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
1605 on the remote host.")
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1606
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1607 (defconst tramp-perl-encode
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1608 "%s -e '
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1609 # This script is contributed by Juanma Barranquero <lektu@terra.es>.
75361
9cc44485654f (tramp-perl-encode, tramp-perl-decode): Update copyrights.
Glenn Morris <rgm@gnu.org>
parents: 75194
diff changeset
1610 # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
9cc44485654f (tramp-perl-encode, tramp-perl-decode): Update copyrights.
Glenn Morris <rgm@gnu.org>
parents: 75194
diff changeset
1611 # Free Software Foundation, Inc.
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1612 use strict;
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1613
46795
305403dc91a3 Version 2.0.7.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46790
diff changeset
1614 my %%trans = do {
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1615 my $i = 0;
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1616 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
1617 split //, q(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/);
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1618 };
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1619
46797
1c4af44cad8c Version 2.0.8.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46795
diff changeset
1620 binmode(\\*STDIN);
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1621
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1622 # 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
1623 # of 72 chars (plus end of line)
46797
1c4af44cad8c Version 2.0.8.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46795
diff changeset
1624 $/ = \\54;
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1625
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1626 while (my $data = <STDIN>) {
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1627 my $pad = q();
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1628
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1629 # 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
1630 if (eof) {
46795
305403dc91a3 Version 2.0.7.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46790
diff changeset
1631 my $mod = length($data) %% 3;
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1632 $pad = q(=) x (3 - $mod) if $mod;
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1633 }
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1634
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1635 # 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
1636 # 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
1637 # the translation table
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1638 print
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1639 join q(),
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1640 map($trans{$_},
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1641 (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
1642 $pad,
46797
1c4af44cad8c Version 2.0.8.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46795
diff changeset
1643 qq(\\n);
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1644 }' 2>/dev/null"
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1645 "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
1646 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
1647 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
1648
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1649 (defconst tramp-perl-decode
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1650 "%s -e '
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1651 # This script is contributed by Juanma Barranquero <lektu@terra.es>.
75361
9cc44485654f (tramp-perl-encode, tramp-perl-decode): Update copyrights.
Glenn Morris <rgm@gnu.org>
parents: 75194
diff changeset
1652 # Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
9cc44485654f (tramp-perl-encode, tramp-perl-decode): Update copyrights.
Glenn Morris <rgm@gnu.org>
parents: 75194
diff changeset
1653 # Free Software Foundation, Inc.
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1654 use strict;
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1655
46795
305403dc91a3 Version 2.0.7.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46790
diff changeset
1656 my %%trans = do {
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1657 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
1658 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
1659 split //, q(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/)
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1660 };
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1661
46795
305403dc91a3 Version 2.0.7.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46790
diff changeset
1662 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
1663
46797
1c4af44cad8c Version 2.0.8.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46795
diff changeset
1664 binmode(\\*STDOUT);
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1665
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1666 # 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
1667 # (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
1668 my $pending = q();
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1669
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1670 while (my $data = <STDIN>) {
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1671 chomp $data;
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1672
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1673 # 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
1674 # any following data is to be discarded
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1675 my $finished = $data =~ s/(==?).*/$1/;
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1676 $pending .= $data;
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1677
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1678 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
1679 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
1680 $pending = substr($pending, $len & ~3 + 1);
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1681
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1682 # 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
1683 # 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
1684 print join q(),
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1685 map $bytes{$_},
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1686 ((join q(), map {$trans{$_} || q()} split //, $chunk) =~ /......../g);
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1687
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
1688 last if $finished;
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1689 }' 2>/dev/null"
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
1690 "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
1691 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
1692 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
1693
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
1694 (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
1695 '((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
1696 (1 . "p") ; fifo
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
1697 (2 . "c") ; character device
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
1698 (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
1699 (4 . "d") ; directory
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
1700 (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
1701 (6 . "b") ; block device
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
1702 (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
1703 (8 . "-") ; regular file
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
1704 (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
1705 (10 . "l") ; symlink
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
1706 (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
1707 (12 . "s") ; socket
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
1708 (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
1709 (14 . "w")) ; whiteout (BSD)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1710 "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
1711 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
1712
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1713 ;; New handlers should be added here. The following operations can be
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1714 ;; handled using the normal primitives: file-name-as-directory,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1715 ;; file-name-sans-versions, get-file-buffer.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1716 (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
1717 '((load . tramp-handle-load)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1718 (make-symbolic-link . tramp-handle-make-symbolic-link)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1719 (file-name-directory . tramp-handle-file-name-directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1720 (file-name-nondirectory . tramp-handle-file-name-nondirectory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1721 (file-truename . tramp-handle-file-truename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1722 (file-exists-p . tramp-handle-file-exists-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1723 (file-directory-p . tramp-handle-file-directory-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1724 (file-executable-p . tramp-handle-file-executable-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1725 (file-readable-p . tramp-handle-file-readable-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1726 (file-regular-p . tramp-handle-file-regular-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1727 (file-symlink-p . tramp-handle-file-symlink-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1728 (file-writable-p . tramp-handle-file-writable-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1729 (file-ownership-preserved-p . tramp-handle-file-ownership-preserved-p)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1730 (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
1731 (file-attributes . tramp-handle-file-attributes)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1732 (file-modes . tramp-handle-file-modes)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1733 (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
1734 (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
1735 (file-name-all-completions . tramp-handle-file-name-all-completions)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1736 (file-name-completion . tramp-handle-file-name-completion)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1737 (add-name-to-file . tramp-handle-add-name-to-file)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1738 (copy-file . tramp-handle-copy-file)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1739 (rename-file . tramp-handle-rename-file)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1740 (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
1741 (set-file-times . tramp-handle-set-file-times)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1742 (make-directory . tramp-handle-make-directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1743 (delete-directory . tramp-handle-delete-directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1744 (delete-file . tramp-handle-delete-file)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1745 (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
1746 ;; `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
1747 (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
1748 (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
1749 (process-file . tramp-handle-process-file)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1750 (shell-command . tramp-handle-shell-command)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1751 (insert-directory . tramp-handle-insert-directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1752 (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
1753 (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
1754 (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
1755 (file-remote-p . tramp-handle-file-remote-p)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1756 (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
1757 (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
1758 . tramp-handle-insert-file-contents-literally)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1759 (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
1760 (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
1761 (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
1762 (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
1763 (dired-compress-file . tramp-handle-dired-compress-file)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1764 (dired-recursive-delete-directory
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1765 . tramp-handle-dired-recursive-delete-directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1766 (set-visited-file-modtime . tramp-handle-set-visited-file-modtime)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1767 (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime))
65248
0f994edbec5e Make `make-auto-save-file-name' a magic operation.
Michael Albinus <michael.albinus@gmx.de>
parents: 64772
diff changeset
1768 "Alist of handler functions.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1769 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
1770
70276
32b384911b4f tramp-file-name-handler-alist): Delete expand-file-name and other
Richard M. Stallman <rms@gnu.org>
parents: 70255
diff changeset
1771 ;; Handlers for partial tramp file names. For Emacs just
32b384911b4f tramp-file-name-handler-alist): Delete expand-file-name and other
Richard M. Stallman <rms@gnu.org>
parents: 70255
diff changeset
1772 ;; `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
1773 ;;;###autoload
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1774 (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
1775 '((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
1776 (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
1777 "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
1778 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
1779 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
1780 normal Emacs functions.")
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1781
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
1782 ;; 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
1783 (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
1784 ;; (identity . tramp-sh-file-name-handler) should always be the last
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
1785 ;; entry, since `identity' always matches.
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
1786 '((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
1787 "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
1788 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
1789 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
1790
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1791 ;;; Internal functions which must come first.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1792
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1793 (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
1794 "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
1795 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
1796 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
1797 (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
1798 (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
1799 (goto-char (point-max))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1800 (unless (bolp)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1801 (insert "\n"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1802 ;; Timestamp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1803 (insert (format-time-string "%T "))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1804 ;; Calling function
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1805 (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
1806 (while (not fn)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1807 (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
1808 (if (not btf)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1809 (setq fn "")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1810 (when (symbolp btf)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1811 (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
1812 (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
1813 (not (string-match
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1814 "^tramp\\(-debug\\)?\\(-message\\|-error\\)$"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1815 fn)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1816 (setq fn nil)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1817 (setq btn (1+ btn))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1818 ;; 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
1819 ;; 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
1820 ;; consuming.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1821 ; (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
1822 ; (insert
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1823 ; (format
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1824 ; "%s:%d: "
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1825 ; (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
1826 ; (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
1827 ; (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
1828 (insert (format "%s " fn)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1829 ;; The message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1830 (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
1831
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1832 (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
1833 "Emit a message depending on verbosity level.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1834 VEC-OR-PROC identifies the tramp buffer to use. It can be either a
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1835 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
1836 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
1837 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
1838
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1839 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
1840 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
1841
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1842 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
1843 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
1844 applicable)."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1845 (condition-case nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1846 (when (<= level tramp-verbose)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1847 ;; 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
1848 (save-match-data
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1849 ;; Display 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
1850 (when (<= level 3)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1851 (apply 'message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1852 (concat
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1853 (cond
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1854 ((= level 0) "")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1855 ((= level 1) "")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1856 ((= level 2) "Warning: ")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1857 (t "Tramp: "))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1858 fmt-string)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1859 args))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1860 ;; 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
1861 (when (>= tramp-verbose 4)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1862 (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
1863 (processp vec-or-proc)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1864 (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
1865 (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
1866 ;; Translate proc to vec.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1867 (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
1868 (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
1869 (apply 'tramp-debug-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1870 vec-or-proc
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1871 (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
1872 args)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1873 ;; Suppress all errors.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1874 (error nil)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1875
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1876 (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
1877 "Emit an error.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1878 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
1879 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
1880 `tramp-message'. Finally, signal SIGNAL is raised."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1881 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1882 vec-or-proc 1 "%s"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1883 (error-message-string
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1884 (list signal (get signal 'error-message) (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
1885 (signal signal (list (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
1886
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1887 (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
1888 (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
1889 "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
1890 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
1891 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
1892 (save-window-excursion
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1893 (unwind-protect
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1894 (apply 'tramp-error vec-or-proc signal fmt-string args)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1895 (when (and vec-or-proc (not (zerop tramp-verbose)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1896 (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
1897 (pop-to-buffer
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1898 (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
1899 (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
1900 (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
1901 (sit-for 30))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
1902
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1903 (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
1904 "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
1905
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1906 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
1907 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
1908 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
1909 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
1910 `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
1911 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
1912
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1913 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
1914 `progn').
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1915
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1916 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
1917 `host', `localname' to the components."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1918 `(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
1919 (,(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
1920 (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
1921 (,(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
1922 (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
1923 (,(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
1924 (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
1925 (,(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
1926 (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
1927 ,@body))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1928
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
1929 (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
1930 (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
1931 (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
1932
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1933 (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
1934 "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
1935 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
1936 `(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
1937 (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
1938 (when (eq value 'undef)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1939 ;; 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
1940 ;; `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
1941 ;; debug messages.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1942 (setq value (progn ,@body))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1943 (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
1944 value)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1945 ,@body))
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
1946
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1947 (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
1948 (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
1949 (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
1950
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1951 (defmacro with-connection-property (key property &rest body)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1952 "Checks in Tramp for property PROPERTY, otherwise executes BODY and set."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1953 `(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
1954 (when (eq value 'undef)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1955 ;; 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
1956 ;; `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
1957 ;; messages.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1958 (setq value (progn ,@body))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1959 (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
1960 value))
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
1961
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1962 (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
1963 (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
1964 (font-lock-add-keywords 'emacs-lisp-mode '("\\<with-connection-property\\>"))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
1965
55864
dc60eb9fbbdc Sync with Tramp.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 55844
diff changeset
1966 (defmacro tramp-let-maybe (variable value &rest body)
dc60eb9fbbdc Sync with Tramp.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 55844
diff changeset
1967 "Let-bind VARIABLE to VALUE in BODY, but only if VARIABLE is not obsolete.
dc60eb9fbbdc Sync with Tramp.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 55844
diff changeset
1968 BODY is executed whether or not the variable is obsolete.
dc60eb9fbbdc Sync with Tramp.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 55844
diff changeset
1969 The intent is to protect against `obsolete variable' warnings."
dc60eb9fbbdc Sync with Tramp.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 55844
diff changeset
1970 `(if (get ',variable 'byte-obsolete-variable)
dc60eb9fbbdc Sync with Tramp.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 55844
diff changeset
1971 (progn ,@body)
dc60eb9fbbdc Sync with Tramp.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 55844
diff changeset
1972 (let ((,variable ,value))
dc60eb9fbbdc Sync with Tramp.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 55844
diff changeset
1973 ,@body)))
dc60eb9fbbdc Sync with Tramp.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 55844
diff changeset
1974 (put 'tramp-let-maybe 'lisp-indent-function 2)
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
1975 (put 'tramp-let-maybe 'edebug-form-spec t)
55864
dc60eb9fbbdc Sync with Tramp.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 55844
diff changeset
1976
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
1977 (defsubst tramp-make-temp-file (filename)
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
1978 (concat
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
1979 (make-temp-name
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
1980 (expand-file-name
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
1981 tramp-temp-name-prefix (tramp-compat-temporary-file-directory)))
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
1982 (file-name-extension filename t)))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
1983
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
1984 (defsubst tramp-make-tramp-temp-file (vec)
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
1985 (format
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
1986 "/tmp/%s%s"
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
1987 tramp-temp-name-prefix
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
1988 (if (get-buffer-process (tramp-get-connection-buffer vec))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
1989 (process-id (get-buffer-process (tramp-get-connection-buffer vec)))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
1990 (emacs-pid))))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
1991
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
1992
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1993 ;;; Config Manipulation Functions:
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1994
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
1995 (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
1996 "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
1997 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
1998 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
1999 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
2000 Predefined FUNCTIONs are `tramp-parse-rhosts', `tramp-parse-shosts',
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
2001 `tramp-parse-sconfig',`tramp-parse-hosts', `tramp-parse-passwd',
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
2002 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
2003
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2004 Example:
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2005
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2006 (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
2007 \"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
2008 '((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
2009 (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
2010
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2011 (let ((r function-list)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2012 (v function-list))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2013 (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
2014 (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
2015 tramp-completion-function-alist))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2016
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2017 (while v
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2018 ;; Remove double entries.
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2019 (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
2020 (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
2021 ;; 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
2022 (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
2023 (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
2024 ;; Windows registry.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2025 (and (memq system-type '(cygwin windows-nt))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2026 (zerop (call-process "reg" nil nil nil "query" (nth 1 (car v)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2027 ;; Configuration file.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2028 (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
2029 (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
2030 (setq v (cdr v)))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2031
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
2032 (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
2033 (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
2034 (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
2035
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
2036 (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
2037 "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
2038 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
2039 (cons
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2040 ;; 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
2041 `(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
2042 ;; The method related defaults.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2043 (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
2044
84739
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2045
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2046 ;;; Fontification of `read-file-name'.
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2047
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2048 ;; rfn-eshadow.el is part of Emacs 22. Its is autoloaded.
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2049 (defvar tramp-rfn-eshadow-overlay)
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2050 (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
2051
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2052 (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
2053 "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
2054 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
2055 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
2056 (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
2057 (setq tramp-rfn-eshadow-overlay
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2058 (funcall (symbol-function 'make-overlay)
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2059 (funcall (symbol-function 'minibuffer-prompt-end))
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2060 (funcall (symbol-function 'minibuffer-prompt-end))))
84739
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2061 ;; Copy rfn-eshadow-overlay properties.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2062 (let ((props (funcall (symbol-function 'overlay-properties)
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2063 (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
2064 (while props
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2065 (funcall (symbol-function 'overlay-put)
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2066 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
2067
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2068 (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
2069 (add-hook 'rfn-eshadow-setup-minibuffer-hook
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2070 'tramp-rfn-eshadow-setup-minibuffer))
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2071
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2072 (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
2073 "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
2074 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
2075 `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
2076 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
2077 ;; In remote files name, there is a shadowing just for the local part.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2078 (let ((end (or (funcall (symbol-function 'overlay-end)
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2079 (symbol-value 'rfn-eshadow-overlay))
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2080 (funcall (symbol-function 'minibuffer-prompt-end)))))
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2081 (when (file-remote-p (buffer-substring-no-properties end (point-max)))
84739
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2082 (narrow-to-region
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2083 (1+ (or (string-match "/" (buffer-string) end) end)) (point-max))
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2084 (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay)
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2085 (rfn-eshadow-update-overlay-hook nil))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2086 (funcall (symbol-function 'rfn-eshadow-update-overlay)))
84739
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2087 (widen))))
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2088
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2089 (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
2090 (add-hook 'rfn-eshadow-update-overlay-hook
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2091 'tramp-rfn-eshadow-update-overlay))
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2092
ed643c57fe39 * rfn-eshadow.el (rfn-eshadow-setup-minibuffer-hook)
Michael Albinus <michael.albinus@gmx.de>
parents: 84406
diff changeset
2093
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2094 ;;; File Name Handler Functions:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2095
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2096 (defun tramp-handle-make-symbolic-link
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2097 (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
2098 "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
2099 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
2100 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
2101 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
2102
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
2103 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
2104 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
2105 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
2106 target of the symlink differ."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2107 (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
2108 (let ((ln (tramp-get-remote-ln l))
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
2109 (cwd (file-name-directory l-localname)))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2110 (unless ln
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2111 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2112 l 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2113 "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
2114
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2115 ;; 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
2116 (when (file-exists-p linkname)
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2117 ;; What to do?
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2118 (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
2119 (and (numberp ok-if-already-exists)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2120 (not (yes-or-no-p
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2121 (format
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2122 "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
2123 l-localname)))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2124 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2125 l 'file-already-exists "File %s already exists" l-localname)
46307
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
2126 (delete-file linkname)))
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
2127
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
2128 ;; 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
2129 (when (tramp-tramp-file-p filename)
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
2130 (setq filename (tramp-file-name-localname
46307
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
2131 (tramp-dissect-file-name
a2d047d50fb9 (tramp-handle-make-symbolic-link): Implement.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46306
diff changeset
2132 (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
2133
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2134 ;; 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
2135 ;; 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
2136 ;; that FILENAME belongs to.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2137 (zerop
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2138 (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
2139 l (format "cd %s && %s -sf %s %s" cwd ln filename l-localname) t)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2140
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2141
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2142 (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
2143 "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
2144 (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
2145 (unless nosuffix
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2146 (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
2147 (setq file (concat file ".elc")))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2148 ((file-exists-p (concat file ".el"))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2149 (setq file (concat file ".el")))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2150 (when must-suffix
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2151 ;; 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
2152 ;; Included for safety's sake.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2153 (unless (or (file-name-directory file)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2154 (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
2155 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2156 v 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2157 "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
2158 (unless noerror
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2159 (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
2160 (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
2161 (if (not (file-exists-p file))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2162 nil
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2163 (unless nomessage (tramp-message v 0 "Loading %s..." file))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2164 (let ((local-copy (file-local-copy file)))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2165 ;; MUST-SUFFIX doesn't exist on XEmacs, so let it default to nil.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2166 (load local-copy noerror t t)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2167 (delete-file local-copy))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2168 (unless nomessage (tramp-message v 0 "Loading %s...done" file))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2169 t)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2170
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
2171 ;; Localname manipulation functions that grok TRAMP localnames...
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2172 (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
2173 "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
2174 ;; 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
2175 ;; 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
2176 ;; 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
2177 ;; file name completion.
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
2178 (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
2179 ;; 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
2180 (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
2181 (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
2182 (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
2183 (tramp-file-name-host v)
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
2184 (file-name-directory (or (tramp-file-name-localname v) "")))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2185
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2186 (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
2187 "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
2188 (with-parsed-tramp-file-name file nil
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
2189 (file-name-nondirectory localname)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2190
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2191 (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
2192 "Like `file-truename' for Tramp files."
56644
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2193 (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
2194 (with-file-property v localname "file-truename"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2195 (let* ((steps (tramp-split-string localname "/"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2196 (localnamedir (tramp-let-maybe directory-sep-char ?/ ;for XEmacs
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2197 (file-name-as-directory localname)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2198 (is-dir (string= localname localnamedir))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2199 (thisstep nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2200 (numchase 0)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2201 ;; Don't make the following value larger than necessary.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2202 ;; People expect an error message in a timely fashion when
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2203 ;; something is wrong; otherwise they might think that Emacs
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2204 ;; is hung. Of course, correctness has to come first.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2205 (numchase-limit 20)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2206 (result nil) ;result steps in reverse order
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2207 symlink-target)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2208 (tramp-message v 4 "Finding true name for `%s'" filename)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2209 (while (and steps (< numchase numchase-limit))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2210 (setq thisstep (pop steps))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2211 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2212 v 5 "Check %s"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2213 (mapconcat 'identity
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2214 (append '("") (reverse result) (list thisstep))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2215 "/"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2216 (setq symlink-target
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2217 (nth 0 (file-attributes
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2218 (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
2219 method user host
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2220 (mapconcat 'identity
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2221 (append '("")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2222 (reverse result)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2223 (list thisstep))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2224 "/")))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2225 (cond ((string= "." thisstep)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2226 (tramp-message v 5 "Ignoring step `.'"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2227 ((string= ".." thisstep)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2228 (tramp-message v 5 "Processing step `..'")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2229 (pop result))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2230 ((stringp symlink-target)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2231 ;; It's a symlink, follow it.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2232 (tramp-message v 5 "Follow symlink to %s" symlink-target)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2233 (setq numchase (1+ numchase))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2234 (when (file-name-absolute-p symlink-target)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2235 (setq result nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2236 ;; If the symlink was absolute, we'll get a string like
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2237 ;; "/user@host:/some/target"; extract the
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2238 ;; "/some/target" part from it.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2239 (when (tramp-tramp-file-p symlink-target)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2240 (unless (tramp-equal-remote filename symlink-target)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2241 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2242 v 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2243 "Symlink target `%s' on wrong host" symlink-target))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2244 (setq symlink-target localname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2245 (setq steps
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2246 (append (tramp-split-string symlink-target "/")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2247 steps)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2248 (t
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2249 ;; It's a file.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2250 (setq result (cons thisstep result)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2251 (when (>= numchase numchase-limit)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2252 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2253 v 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2254 "Maximum number (%d) of symlinks exceeded" numchase-limit))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2255 (setq result (reverse result))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2256 ;; Combine list to form string.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2257 (setq result
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2258 (if result
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2259 (mapconcat 'identity (cons "" result) "/")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2260 "/"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2261 (when (and is-dir (or (string= "" result)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2262 (not (string= (substring result -1) "/"))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2263 (setq result (concat result "/")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2264 (tramp-message v 4 "True name of `%s' is `%s'" filename result)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2265 (tramp-make-tramp-file-name method user host result)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2266
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2267 ;; Basic functions.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2268
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2269 (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
2270 "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
2271 (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
2272 (with-file-property v localname "file-exists-p"
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2273 (zerop (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
2274 v
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2275 (format
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2276 "%s %s"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2277 (tramp-get-file-exists-command v)
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
2278 (tramp-shell-quote-argument localname)))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2279
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2280 ;; 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
2281 ;; 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
2282 ;; 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
2283 ;; 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
2284 ;; take time.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2285 (defvar tramp-inodes nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2286 "Keeps virtual inodes numbers.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2287
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
2288 ;; 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
2289 ;; 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
2290 ;; 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
2291 ;; EFS use device number "-1". In order to be different, we use device number
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2292 ;; (-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
2293 (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
2294 "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
2295
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2296 ;; 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
2297 ;; when something goes wrong.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2298 ;; Daniel Pittman <daniel@danann.net>
53206
0c19f1a19b2b (tramp-chunksize): Extend docstring. Suggested by
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 52401
diff changeset
2299 (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
2300 "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
2301 (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
2302 (with-parsed-tramp-file-name (expand-file-name filename) nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2303 (with-file-property v localname (format "file-attributes-%s" id-format)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2304 (when (file-exists-p filename)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2305 ;; file exists, find out stuff
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2306 (save-excursion
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2307 (tramp-convert-file-attributes
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2308 v
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2309 (if (tramp-get-remote-stat v)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2310 (tramp-handle-file-attributes-with-stat v localname id-format)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2311 (if (tramp-get-remote-perl v)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2312 (tramp-handle-file-attributes-with-perl v localname id-format)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2313 (tramp-handle-file-attributes-with-ls
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2314 v localname id-format)))))))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2315
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2316 (defun tramp-handle-file-attributes-with-ls (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
2317 "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
2318 (let (symlinkp dirp
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2319 res-inode res-filemodes res-numlinks
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2320 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
2321 (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
2322 (tramp-send-command
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2323 vec
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2324 (format "%s %s %s"
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2325 (tramp-get-ls-command vec)
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
2326 (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
2327 (tramp-shell-quote-argument localname)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2328 ;; 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
2329 (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
2330 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2331 ;; ... inode
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2332 (setq res-inode
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2333 (condition-case err
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2334 (read (current-buffer))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2335 (invalid-read-syntax
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2336 (when (and (equal (cadr err)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2337 "Integer constant overflow in reader")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2338 (string-match
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2339 "^[0-9]+\\([0-9][0-9][0-9][0-9][0-9]\\)\\'"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2340 (car (cddr err))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2341 (let* ((big (read (substring (car (cddr err)) 0
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2342 (match-beginning 1))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2343 (small (read (match-string 1 (car (cddr err)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2344 (twiddle (/ small 65536)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2345 (cons (+ big twiddle)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2346 (- small (* twiddle 65536))))))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2347 ;; ... file mode flags
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2348 (setq res-filemodes (symbol-name (read (current-buffer))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2349 ;; ... number links
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2350 (setq res-numlinks (read (current-buffer)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2351 ;; ... uid and gid
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2352 (setq res-uid (read (current-buffer)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2353 (setq res-gid (read (current-buffer)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2354 (if (eq id-format 'integer)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2355 (progn
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2356 (unless (numberp res-uid) (setq res-uid -1))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2357 (unless (numberp res-gid) (setq res-gid -1)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2358 (progn
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2359 (unless (stringp res-uid) (setq res-uid (symbol-name res-uid)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2360 (unless (stringp res-gid) (setq res-gid (symbol-name res-gid)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2361 ;; ... size
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2362 (setq res-size (read (current-buffer)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2363 ;; From the file modes, figure out other stuff.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2364 (setq symlinkp (eq ?l (aref res-filemodes 0)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2365 (setq dirp (eq ?d (aref res-filemodes 0)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2366 ;; if symlink, find out file name pointed to
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2367 (when symlinkp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2368 (search-forward "-> ")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2369 (setq res-symlink-target
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2370 (buffer-substring (point) (tramp-compat-line-end-position))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2371 ;; return data gathered
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2372 (list
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2373 ;; 0. t for directory, string (name linked to) for symbolic
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2374 ;; link, or nil.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2375 (or dirp res-symlink-target)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2376 ;; 1. Number of links to file.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2377 res-numlinks
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2378 ;; 2. File uid.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2379 res-uid
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2380 ;; 3. File gid.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2381 res-gid
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2382 ;; 4. Last access time, as a list of two integers. First
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2383 ;; integer has high-order 16 bits of time, second has low 16
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2384 ;; bits.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2385 ;; 5. Last modification time, likewise.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2386 ;; 6. Last status change time, likewise.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2387 '(0 0) '(0 0) '(0 0) ;CCC how to find out?
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2388 ;; 7. Size in bytes (-1, if number is out of range).
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2389 res-size
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2390 ;; 8. File modes, as a string of ten letters or dashes as in ls -l.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2391 res-filemodes
84942
437d3bb02139 * net/tramp.el (tramp-maybe-open-connection): Make test for alive
Michael Albinus <michael.albinus@gmx.de>
parents: 84833
diff changeset
2392 ;; 9. t if file's gid would change if file were deleted and
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2393 ;; recreated. Will be set in `tramp-convert-file-attributes'
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2394 t
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2395 ;; 10. inode number.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2396 res-inode
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2397 ;; 11. Device number. Will be replaced by a virtual device number.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2398 -1
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2399 ))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2400
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2401 (defun tramp-handle-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
2402 (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
2403 "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
2404 (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
2405 (tramp-maybe-send-script
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2406 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
2407 (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
2408 vec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2409 (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
2410 (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
2411
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2412 (defun tramp-handle-file-attributes-with-stat
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2413 (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
2414 "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
2415 (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
2416 (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
2417 vec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2418 (format
82064
07bb0658401d * net/tramp.el (tramp-perl-file-attributes)
Michael Albinus <michael.albinus@gmx.de>
parents: 82025
diff changeset
2419 "%s -c '((\"%%N\") %%h %s %s %%X.0 %%Y.0 %%Z.0 %%s.0 \"%%A\" t %%i.0 -1)' %s"
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2420 (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
2421 (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
2422 (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
2423 (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
2424
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2425 (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
2426 "Like `set-visited-file-modtime' for Tramp files."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2427 (unless (buffer-file-name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2428 (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
2429 (buffer-name)))
56644
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2430 (if time-list
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2431 (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
2432 (let ((f (buffer-file-name))
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
2433 coding-system-used)
56644
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2434 (with-parsed-tramp-file-name f nil
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2435 (let* ((attr (file-attributes f))
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2436 ;; '(-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
2437 (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
2438 (when (boundp 'last-coding-system-used)
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
2439 (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
2440 ;; We use '(0 0) as a don't-know value. See also
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2441 ;; `tramp-handle-file-attributes-with-ls'.
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2442 (if (not (equal modtime '(0 0)))
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2443 (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
2444 (progn
56644
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2445 (tramp-send-command
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2446 v
56644
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2447 (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
2448 (tramp-get-ls-command v)
56644
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2449 (tramp-shell-quote-argument localname)))
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2450 (setq attr (buffer-substring (point)
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
2451 (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
2452 (tramp-set-file-property
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2453 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
2454 (when (boundp 'last-coding-system-used)
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
2455 (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
2456 nil)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2457
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2458 ;; CCC continue here
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2459
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2460 ;; 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
2461 ;; `tramp-handle-set-visited-file-modtime'.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2462 (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
2463 "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
2464 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
2465 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
2466 `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
2467 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
2468 of."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2469 (with-current-buffer buf
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
2470 ;; There is no file visiting the buffer, or the buffer has no
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
2471 ;; recorded last modification time.
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
2472 (if (or (not (buffer-file-name))
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
2473 (eq (visited-file-modtime) 0))
64772
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
2474 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
2475 (let ((f (buffer-file-name)))
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
2476 (with-parsed-tramp-file-name f nil
82201
b3182f0c969c * net/tramp.el:
Michael Albinus <michael.albinus@gmx.de>
parents: 82140
diff changeset
2477 (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
2478 (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
2479 (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
2480 (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
2481
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
2482 (cond
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
2483 ;; file exists, and has a known 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
2484 ((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
2485 (< (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
2486 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
2487 ;; For compatibility, deal with both the old
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
2488 ;; (HIGH . LOW) and the new (HIGH LOW)
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
2489 ;; return values of `visited-file-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
2490 (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
2491 (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
2492 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
2493 2))
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
2494 ;; modtime has the don't know value.
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
2495 (attr
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2496 (tramp-send-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2497 v
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2498 (format "%s -ild %s"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2499 (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
2500 (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
2501 (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
2502 (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
2503 (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
2504 (equal
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2505 attr
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2506 (tramp-get-file-property
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2507 v localname "visited-file-modtime-ild" "")))
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
2508 ;; If file does not exist, say it is not modified
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
2509 ;; if and only if that agrees with the buffer's record.
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
2510 (t (equal mt '(-1 65535))))))))))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2511
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2512 (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
2513 "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
2514 (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
2515 (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
2516 (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
2517 v
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2518 (format "chmod %s %s"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2519 (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
2520 (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
2521 ;; 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
2522 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2523 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
2524
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
2525 (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
2526 "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
2527 (zerop
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2528 (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
2529 (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
2530 (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
2531 (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
2532 (current-time)
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
2533 time))
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
2534 (utc
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
2535 ;; With GNU Emacs, `format-time-string' has an
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
2536 ;; optional parameter UNIVERSAL. This is preferred,
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
2537 ;; because we could handle the case when the remote
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
2538 ;; host is located in a different time zone as the
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
2539 ;; local host.
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
2540 (and (functionp 'subr-arity)
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
2541 (subrp (symbol-function 'format-time-string))
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
2542 (= 3 (cdr (funcall (symbol-function 'subr-arity)
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
2543 (symbol-function
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
2544 'format-time-string)))))))
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
2545 (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
2546 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
2547 (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
2548 (if utc
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
2549 (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
2550 (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
2551 (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
2552
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
2553 ;; 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
2554 ;; 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
2555 ;; We are local, so we don't need the UTC settings.
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
2556 (call-process
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
2557 "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
2558 (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
2559 (tramp-shell-quote-argument filename)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2560
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2561 (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
2562 "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
2563 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
2564 and gid of the corresponding user is taken. Both parameters must be integers."
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2565 ;; CCC: Modern Unices allow chown only for root. So we might need
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2566 ;; another implementation, see `dired-do-chown'. OTOH, it is
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2567 ;; mostly working with su(do)? when it is needed, so it shall
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2568 ;; succeed in the majority of cases.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2569 (if (file-remote-p filename)
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2570 (with-parsed-tramp-file-name filename nil
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2571 (let ((uid (or (and (integerp uid) uid)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2572 (tramp-get-remote-uid v 'integer)))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2573 (gid (or (and (integerp gid) gid)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2574 (tramp-get-remote-gid v 'integer))))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2575 (tramp-send-command
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2576 v (format
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2577 "chown %d:%d %s" uid gid
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2578 (tramp-shell-quote-argument localname)))))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2579
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2580 ;; We handle also the local part, because there doesn't exist
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2581 ;; `set-file-uid-gid'.
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2582 (let ((uid (or (and (integerp uid) uid) (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
2583 (gid (or (and (integerp gid) gid) (tramp-get-local-uid 'integer)))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2584 (default-directory (tramp-compat-temporary-file-directory)))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2585 (call-process
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2586 "chown" nil nil nil
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2587 (format "%d:%d" uid gid) (tramp-shell-quote-argument filename)))))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2588
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2589 ;; Simple functions using the `test' command.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2590
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2591 (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
2592 "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
2593 (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
2594 (with-file-property v localname "file-executable-p"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2595 (zerop (tramp-run-test "-x" filename)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2596
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2597 (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
2598 "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
2599 (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
2600 (with-file-property v localname "file-readable-p"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2601 (zerop (tramp-run-test "-r" filename)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2602
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2603 ;; 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
2604 ;; 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
2605 ;; 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
2606 ;; 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
2607 ;; something smarter about it.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2608 (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
2609 "Like `file-newer-than-file-p' for Tramp files."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2610 (cond ((not (file-exists-p file1))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2611 nil)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2612 ((not (file-exists-p file2))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2613 t)
47577
20336ef6b20a Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47576
diff changeset
2614 ;; We are sure both files exist at this point.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2615 (t
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2616 (save-excursion
47577
20336ef6b20a Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47576
diff changeset
2617 ;; 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
2618 ;; 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
2619 ;; and obtain the result.
20336ef6b20a Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47576
diff changeset
2620 (let ((fa1 (file-attributes file1))
20336ef6b20a Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47576
diff changeset
2621 (fa2 (file-attributes file2)))
20336ef6b20a Version 2.0.21 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47576
diff changeset
2622 (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
2623 (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
2624 (> 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
2625 ;; 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
2626 ;; 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
2627 ;; 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
2628 ;; 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
2629 ;; host.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2630 (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
2631 (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
2632 (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
2633 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2634 v 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2635 "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
2636 file1 file2)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2637 (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
2638 (zerop (tramp-run-test2
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2639 (tramp-get-test-nt-command v) file1 file2)))))))))
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 ;; Functions implemented using the basic functions above.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2642
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2643 (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
2644 "Like `file-modes' for Tramp files."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2645 (when (file-exists-p filename)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2646 (tramp-mode-string-to-int
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2647 (nth 8 (file-attributes filename)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2648
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2649 (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
2650 "Like `file-directory-p' for Tramp files."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2651 ;; 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
2652 ;; pointing to directories. Surely the most obvious implementation
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2653 ;; 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
2654 ;; CCC: Stefan Monnier says that `test -d' follows symlinks. And
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2655 ;; 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
2656 ;; we?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2657 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2658 ;; 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
2659 (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
2660 (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
2661 (zerop (tramp-run-test "-d" filename)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2662
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2663 (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
2664 "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
2665 (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
2666 (eq ?- (aref (nth 8 (file-attributes filename)) 0))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2667
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2668 (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
2669 "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
2670 (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
2671 (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
2672 (when (stringp x)
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
2673 ;; 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
2674 ;; might do weird things.
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
2675 (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
2676 (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
2677 x)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2678
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2679 (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
2680 "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
2681 (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
2682 (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
2683 (if (file-exists-p filename)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2684 ;; Existing files must be writable.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2685 (zerop (tramp-run-test "-w" filename))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2686 ;; 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
2687 (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
2688 "-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
2689 (zerop (tramp-run-test
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2690 "-w" (file-name-directory filename))))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2691
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2692 (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
2693 "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
2694 (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
2695 (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
2696 (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
2697 ;; 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
2698 ;; 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
2699 (or (null attributes)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2700 (= (nth 2 attributes) (tramp-get-remote-uid v 'integer)))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2701
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2702 ;; Other file name ops.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2703
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2704 (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
2705 "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
2706 ;; 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
2707 ;; 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
2708 ;; 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
2709 ;; to avoid parsing the filename?
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2710 (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
2711 (if (and (not (zerop (length localname)))
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
2712 (eq (aref localname (1- (length localname))) ?/)
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
2713 (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
2714 (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
2715 directory)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2716
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2717 ;; Directory listings.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2718
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2719 (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
2720 (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
2721 "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
2722 ;; 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
2723 (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
2724 (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
2725 (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
2726 result item)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2727
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2728 (while temp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2729 (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
2730 (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
2731 (or (null files-only)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2732 ;; files only
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2733 (and (equal files-only t) (file-regular-p item))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2734 ;; directories only
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2735 (file-directory-p item)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2736 (push (if full (expand-file-name item directory) item)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2737 result)))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2738 result)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2739
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
2740 (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
2741 (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
2742 "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
2743 (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
2744 (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
2745 (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
2746 (let* ((temp
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2747 (tramp-compat-copy-tree
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2748 (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
2749 (with-file-property
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2750 v localname
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2751 (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
2752 (save-excursion
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2753 (mapcar
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2754 '(lambda (x)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2755 (cons (car x)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2756 (tramp-convert-file-attributes v (cdr x))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2757 (if (tramp-get-remote-stat v)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2758 (tramp-handle-directory-files-and-attributes-with-stat
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2759 v localname id-format)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2760 (if (tramp-get-remote-perl v)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2761 (tramp-handle-directory-files-and-attributes-with-perl
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2762 v localname id-format)))))))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2763 result item)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2764
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2765 (while temp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2766 (setq item (pop temp))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2767 (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
2768 (when full
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2769 (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
2770 (push item result)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2771
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2772 (if nosort
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2773 result
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2774 (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
2775
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2776 (defun tramp-handle-directory-files-and-attributes-with-perl
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2777 (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
2778 "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
2779 (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
2780 (tramp-maybe-send-script
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2781 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
2782 "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
2783 (let ((object
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2784 (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
2785 vec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2786 (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
2787 (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
2788 (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
2789 object))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2790
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2791 (defun tramp-handle-directory-files-and-attributes-with-stat
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2792 (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
2793 "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
2794 (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
2795 (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
2796 vec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2797 (format
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2798 (concat
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2799 "cd %s; echo \"(\"; (%s -ab | xargs "
82064
07bb0658401d * net/tramp.el (tramp-perl-file-attributes)
Michael Albinus <michael.albinus@gmx.de>
parents: 82025
diff changeset
2800 "%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
2801 "echo \")\"")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2802 (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
2803 (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
2804 (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
2805 (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
2806 (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
2807
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2808 ;; 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
2809 ;; files.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2810 (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
2811 "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
2812 (unless (save-match-data (string-match "/" filename))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2813 (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
2814 (all-completions
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2815 filename
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2816 (mapcar
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2817 'list
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2818 (with-file-property v localname "file-name-all-completions"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2819 (let (result)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2820 (tramp-barf-unless-okay
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2821 v
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2822 (format "cd %s" (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
2823 "tramp-handle-file-name-all-completions: Couldn't `cd %s'"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2824 (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
2825
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2826 ;; Get a list of directories and files, including reliably
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2827 ;; tagging the directories with a trailing '/'. Because I
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2828 ;; rock. --daniel@danann.net
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2829 (tramp-send-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2830 v
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2831 (format (concat "%s -ab 2>/dev/null | while read f; do "
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2832 "if %s -d \"$f\" 2>/dev/null; "
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2833 "then echo \"$f/\"; else echo \"$f\"; fi; done")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2834 (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
2835 (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
2836
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2837 ;; Now grab the output.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2838 (with-current-buffer (tramp-get-buffer v)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2839 (goto-char (point-max))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2840 (while (zerop (forward-line -1))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2841 (push (buffer-substring
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2842 (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
2843 result)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2844
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2845 result)))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2846
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2847 ;; The following isn't needed for Emacs 20 but for 19.34?
74766
ca4412906dbd * net/ange-ftp.el (ange-ftp-file-name-completion): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 74739
diff changeset
2848 (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
2849 (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
2850 "Like `file-name-completion' for Tramp files."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2851 (unless (tramp-tramp-file-p directory)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2852 (error
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2853 "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
2854 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
2855 (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
2856 filename
948c86bf6396 * net/tramp.el (tramp-default-method): We still need to check for
Michael Albinus <michael.albinus@gmx.de>
parents: 74766
diff changeset
2857 (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
2858 (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
2859 (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
2860
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2861 ;; cp, mv and ln
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2862
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2863 (defun tramp-handle-add-name-to-file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2864 (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
2865 "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
2866 (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
2867 (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
2868 (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
2869 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2870 v 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2871 "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
2872 "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
2873 (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
2874 (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
2875 (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
2876 (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
2877 (file-exists-p newname)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2878 (not (numberp ok-if-already-exists))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2879 (y-or-n-p
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2880 (format
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
2881 "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
2882 newname)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2883 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2884 v2 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2885 "add-name-to-file: file %s already exists" newname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2886 (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
2887 (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
2888 v1
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
2889 (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
2890 (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
2891 "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
2892 (buffer-name))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2893
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2894 (defun tramp-handle-copy-file
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2895 (filename newname &optional ok-if-already-exists keep-date preserve-uid-gid)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2896 "Like `copy-file' for Tramp files."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2897 ;; Check if both files are local -- invoke normal copy-file.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2898 ;; Otherwise, use Tramp from local system.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2899 (setq filename (expand-file-name filename))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2900 (setq newname (expand-file-name newname))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2901 (cond
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2902 ;; At least one file a tramp file?
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2903 ((or (tramp-tramp-file-p filename)
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2904 (tramp-tramp-file-p newname))
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2905 (tramp-do-copy-or-rename-file
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2906 'copy 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
2907 ;; Compat section.
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2908 (preserve-uid-gid
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2909 (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
2910 'copy-file
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2911 (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
2912 (t
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2913 (tramp-run-real-handler
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
2914 '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
2915
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2916 (defun tramp-handle-rename-file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2917 (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
2918 "Like `rename-file' for Tramp files."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2919 ;; Check if both files are local -- invoke normal rename-file.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2920 ;; Otherwise, use tramp from local system.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2921 (setq filename (expand-file-name filename))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2922 (setq newname (expand-file-name newname))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2923 ;; At least one file a tramp file?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2924 (if (or (tramp-tramp-file-p filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2925 (tramp-tramp-file-p newname))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2926 (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
2927 'rename filename newname ok-if-already-exists t t)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2928 (tramp-run-real-handler
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2929 'rename-file (list filename newname ok-if-already-exists))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2930
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2931 (defun 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
2932 (op filename newname &optional ok-if-already-exists keep-date preserve-uid-gid)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2933 "Copy or rename a remote file.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2934 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
2935 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
2936 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
2937 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
2938 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
2939 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
2940 the uid and gid if both files are on the same host.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2941
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2942 This function is invoked by `tramp-handle-copy-file' and
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2943 `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
2944 and `rename'. FILENAME and NEWNAME must be absolute file names."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2945 (unless (memq op '(copy rename))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
2946 (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
2947 (let ((t1 (tramp-tramp-file-p filename))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2948 (t2 (tramp-tramp-file-p newname)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2949
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2950 (unless ok-if-already-exists
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2951 (when (and t2 (file-exists-p newname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2952 (with-parsed-tramp-file-name newname nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2953 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2954 v 'file-already-exists "File %s already exists" newname))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2955
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2956 (prog1
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2957 (cond
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2958 ;; Both are Tramp files.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2959 ((and t1 t2)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2960 (with-parsed-tramp-file-name filename v1
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2961 (with-parsed-tramp-file-name newname v2
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2962 (cond
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2963 ;; Shortcut: if method, host, user are the same for both
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2964 ;; files, we invoke `cp' or `mv' on the remote host
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2965 ;; directly.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2966 ((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
2967 (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
2968 op filename newname
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2969 ok-if-already-exists keep-date preserve-uid-gid))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2970
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2971 ;; If both source and target are Tramp files,
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2972 ;; both are using the same copy-program, then we
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2973 ;; can invoke rcp directly. Note that
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2974 ;; default-directory should point to a local
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2975 ;; directory if we want to invoke rcp.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2976 ((and (equal v1-method v2-method)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2977 (tramp-method-out-of-band-p v1)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2978 (> (nth 7 (file-attributes filename))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2979 tramp-copy-size-limit))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2980 (tramp-do-copy-or-rename-file-out-of-band
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2981 op filename newname keep-date))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2982
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2983 ;; No shortcut was possible. So we copy the
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2984 ;; file first. If the operation was `rename', we go
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2985 ;; back and delete the original file (if the copy was
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2986 ;; successful). The approach is simple-minded: we
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2987 ;; create a new buffer, insert the contents of the
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2988 ;; source file into it, then write out the buffer to
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2989 ;; the target file. The advantage is that it doesn't
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2990 ;; matter which filename handlers are used for the
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2991 ;; source and target file.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2992 (t
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2993 (tramp-do-copy-or-rename-file-via-buffer
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2994 op filename newname keep-date))))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2995
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2996 ;; One file is a Tramp file, the other one is local.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2997 ((or t1 t2)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
2998 (with-parsed-tramp-file-name (if t1 filename newname) nil
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
2999 (cond
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3000 ;; Fast track on local machine.
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3001 ((tramp-local-host-p v)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3002 (tramp-do-copy-or-rename-file-directly
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3003 op filename newname
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3004 ok-if-already-exists keep-date preserve-uid-gid))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3005
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3006 ;; If the Tramp file has an out-of-band method, the corresponding
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3007 ;; copy-program can be invoked.
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3008 ((and (tramp-method-out-of-band-p v)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3009 (> (nth 7 (file-attributes filename))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3010 tramp-copy-size-limit))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3011 (tramp-do-copy-or-rename-file-out-of-band
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3012 op filename newname keep-date))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3013
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3014 ;; Use the inline method via a Tramp buffer.
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3015 (t (tramp-do-copy-or-rename-file-via-buffer
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3016 op filename newname keep-date)))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3017
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3018 (t
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3019 ;; One of them must be a Tramp file.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3020 (error "Tramp implementation says this cannot happen")))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3021
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3022 ;; When newname did exist, we have wrong cached values.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3023 (when t2
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3024 (with-parsed-tramp-file-name newname nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3025 (tramp-flush-file-property v localname))))))
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
3026
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
3027 (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
3028 "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
3029 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
3030 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
3031 KEEP-DATE is non-nil if NEWNAME should have the same timestamp as FILENAME."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3032 (let ((modtime (nth 5 (file-attributes filename))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3033 (unwind-protect
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3034 (with-temp-buffer
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3035 (let ((coding-system-for-read 'binary))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3036 (insert-file-contents-literally filename))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3037 ;; We don't want the target file to be compressed, so we
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3038 ;; let-bind `jka-compr-inhibit' to t.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3039 (let ((coding-system-for-write 'binary)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3040 (jka-compr-inhibit t))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3041 (write-region (point-min) (point-max) newname))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3042 ;; KEEP-DATE handling.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3043 (when keep-date (set-file-times newname modtime))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3044 ;; Set the mode.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3045 (set-file-modes newname (file-modes filename))
46584
f548d7d0c651 Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46347
diff changeset
3046 ;; If the operation was `rename', delete the original file.
f548d7d0c651 Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46347
diff changeset
3047 (unless (eq op 'copy)
f548d7d0c651 Bump version to 2.0.2.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46347
diff changeset
3048 (delete-file filename))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3049
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3050 (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
3051 (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
3052 "Invokes `cp' or `mv' on the remote system.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3053 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
3054 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
3055 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
3056 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
3057 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
3058 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
3059 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
3060 (let ((t1 (tramp-tramp-file-p filename))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3061 (t2 (tramp-tramp-file-p newname)))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3062 (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
3063 (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
3064 ((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
3065 ((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
3066 (t (tramp-error
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3067 v 'file-error
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3068 "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
3069 op))))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3070 (localname1
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3071 (if t1 (tramp-handle-file-remote-p filename 'localname) filename))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3072 (localname2
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3073 (if t2 (tramp-handle-file-remote-p newname 'localname) newname))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3074 (prefix (file-remote-p (if t1 filename newname)))
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3075 (tmpfile (tramp-make-temp-file localname1)))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3076
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3077 (cond
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3078 ;; 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
3079 ((and t1 t2)
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3080 (tramp-send-command
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3081 v
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3082 (format "%s %s %s" cmd
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3083 (tramp-shell-quote-argument localname1)
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3084 (tramp-shell-quote-argument localname2)))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3085 (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
3086 (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
3087 (unless
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3088 (or
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3089 (and keep-date
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3090 ;; 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
3091 (re-search-forward
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3092 tramp-operation-not-permitted-regexp nil t))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3093 (zerop (tramp-send-command-and-check v nil)))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3094 (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
3095 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
3096 "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
3097 (buffer-name)))))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3098
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3099 ;; 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
3100 ((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
3101 (cond
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3102 ;; We can do it directly.
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3103 ((and (file-readable-p localname1)
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3104 (file-writable-p (file-name-directory localname2)))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3105 (if (eq op 'copy)
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3106 (tramp-compat-copy-file
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3107 localname1 localname2 ok-if-already-exists
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3108 keep-date preserve-uid-gid)
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3109 (rename-file localname1 localname2 ok-if-already-exists)))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3110
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3111 ;; We can do it directly with `tramp-send-command'
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3112 ((and (file-readable-p (concat prefix localname1))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3113 (file-writable-p
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3114 (file-name-directory (concat prefix localname2))))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3115 (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
3116 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
3117 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
3118 ;; 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
3119 (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
3120 (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
3121 (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
3122 (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
3123
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3124 ;; 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
3125 (t
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3126 ;; Create the temporary file.
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3127 (cond
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3128 (t1
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3129 (tramp-send-command
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3130 v (format
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3131 "%s %s %s" cmd
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3132 (tramp-shell-quote-argument localname1)
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3133 (tramp-shell-quote-argument tmpfile)))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3134 ;; We must change the ownership as remote user.
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3135 (tramp-set-file-uid-gid
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3136 (concat prefix tmpfile)
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3137 (tramp-get-local-uid 'integer)
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3138 (tramp-get-local-gid 'integer)))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3139 (t2
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3140 (if (eq op 'copy)
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3141 (tramp-compat-copy-file
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3142 localname1 tmpfile ok-if-already-exists
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3143 keep-date preserve-uid-gid)
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3144 (rename-file localname1 tmpfile ok-if-already-exists))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3145 ;; We must change the ownership as local user.
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3146 (tramp-set-file-uid-gid
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3147 tmpfile
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3148 (tramp-get-remote-uid v 'integer)
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3149 (tramp-get-remote-gid v 'integer))))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3150
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3151 ;; Move the temporary file to its destination.
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3152 (cond
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3153 (t2
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3154 (tramp-send-command
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3155 v (format
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
3156 "mv -f %s %s"
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3157 (tramp-shell-quote-argument tmpfile)
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3158 (tramp-shell-quote-argument localname2))))
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
3159 (t1
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
3160 (rename-file tmpfile localname2 ok-if-already-exists))))))))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3161
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3162 ;; 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
3163 ;; Won't be applied for 'rename.
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3164 (condition-case nil
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3165 (when (and keep-date (not preserve-uid-gid))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3166 (set-file-times newname (nth 5 (file-attributes filename)))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3167 (set-file-modes newname (file-modes filename)))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3168 (error)))))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3169
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3170
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3171 (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
3172 "Invoke rcp program to copy.
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
3173 One of FILENAME and NEWNAME must be a Tramp name, the other must
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
3174 be a local filename. 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
3175 (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
3176 (t2 (tramp-tramp-file-p newname))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3177 copy-program copy-args copy-keep-date port spec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3178 source target)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3179
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3180 (with-parsed-tramp-file-name (if t1 filename newname) nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3181
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3182 ;; Expand hops. Might be necessary for gateway methods.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3183 (setq v (car (tramp-compute-multi-hops v)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3184 (aset v 3 localname)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3185
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3186 ;; Check which ones of source and target are Tramp files.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3187 (setq source (if t1 (tramp-make-copy-program-file-name v) filename)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3188 target (if t2 (tramp-make-copy-program-file-name v) newname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3189
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3190 ;; Check for port number. Until now, there's no need for handling
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3191 ;; like method, user, host.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3192 (setq host (tramp-file-name-real-host v)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3193 port (tramp-file-name-port v)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3194 port (or (and port (number-to-string port)) ""))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3195
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3196 ;; Compose copy command.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3197 (setq spec `((?h . ,host) (?u . ,user) (?p . ,port)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3198 (?t . ,(tramp-make-tramp-temp-file v))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3199 (?k . ,(if keep-date " " "")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3200 copy-program (tramp-get-method-parameter
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3201 method 'tramp-copy-program)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3202 copy-keep-date (tramp-get-method-parameter
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3203 method 'tramp-copy-keep-date)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3204 copy-args
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3205 (delq
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3206 nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3207 (mapcar
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3208 '(lambda (x)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3209 (setq
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3210 ;; " " is indication for keep-date argument.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3211 x (delete " " (mapcar '(lambda (y) (format-spec y spec)) x)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3212 (unless (member "" x) (mapconcat 'identity x " ")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3213 (tramp-get-method-parameter
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3214 method 'tramp-copy-args))))
59031
1fbbe0bcfaac Sync with Tramp 2.0.46.
Michael Albinus <michael.albinus@gmx.de>
parents: 58776
diff changeset
3215
1fbbe0bcfaac Sync with Tramp 2.0.46.
Michael Albinus <michael.albinus@gmx.de>
parents: 58776
diff changeset
3216 ;; Check for program.
1fbbe0bcfaac Sync with Tramp 2.0.46.
Michael Albinus <michael.albinus@gmx.de>
parents: 58776
diff changeset
3217 (when (and (fboundp 'executable-find)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3218 (not (let ((default-directory
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3219 (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
3220 (executable-find copy-program))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3221 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3222 v 'file-error "Cannot find copy program: %s" copy-program))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3223
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3224 (tramp-message v 0 "Transferring %s to %s..." filename newname)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3225
74166
5b973e5dc882 (tramp-default-method): Under Windows, change from plink to pscp.
Lars Hansen <larsh@soem.dk>
parents: 74052
diff changeset
3226 (unwind-protect
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3227 (with-temp-buffer
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3228 ;; The default directory must be remote.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3229 (let ((default-directory
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3230 (file-name-directory (if t1 filename newname))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3231 ;; Set the transfer process properties.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3232 (tramp-set-connection-property
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3233 v "process-name" (buffer-name (current-buffer)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3234 (tramp-set-connection-property
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3235 v "process-buffer" (current-buffer))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3236
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3237 ;; Use an asynchronous process. By this, password can
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3238 ;; be handled. The default directory must be local, in
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3239 ;; order to apply the correct `copy-program'. We don't
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3240 ;; set a timeout, because the copying of large files can
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3241 ;; last longer than 60 secs.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3242 (let ((p (let ((default-directory
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3243 (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
3244 (apply 'start-process
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3245 (tramp-get-connection-property
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3246 v "process-name" nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3247 (tramp-get-connection-property
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3248 v "process-buffer" nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3249 copy-program
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3250 (append copy-args (list source target))))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3251 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3252 v 6 "%s" (mapconcat 'identity (process-command p) " "))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3253 (set-process-sentinel p 'tramp-flush-connection-property)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3254 (tramp-set-process-query-on-exit-flag p nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3255 (tramp-process-actions p v tramp-actions-copy-out-of-band))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3256
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3257 ;; Reset the transfer process properties.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3258 (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
3259 (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
3260
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3261 (tramp-message v 0 "Transferring %s to %s...done" filename newname)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3262
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3263 ;; Handle KEEP-DATE argument.
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
3264 (when (and keep-date (not copy-keep-date))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3265 (set-file-times newname (nth 5 (file-attributes filename))))
59582
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
3266
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
3267 ;; Set the mode.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3268 (unless (and keep-date copy-keep-date)
59582
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
3269 (set-file-modes newname (file-modes filename))))
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3270
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3271 ;; If the operation was `rename', delete the original file.
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3272 (unless (eq op 'copy)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3273 (delete-file filename))))
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
3274
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3275 (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
3276 "Like `make-directory' for Tramp files."
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
3277 (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
3278 (with-parsed-tramp-file-name dir nil
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
3279 (save-excursion
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
3280 (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
3281 v
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
3282 (format " %s %s"
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
3283 (if parents "mkdir -p" "mkdir")
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
3284 (tramp-shell-quote-argument localname))
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
3285 "Couldn't make directory %s" dir))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3286
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3287 (defun tramp-handle-delete-directory (directory)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3288 "Like `delete-directory' for Tramp files."
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
3289 (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
3290 (with-parsed-tramp-file-name directory nil
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3291 (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
3292 (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
3293 v
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3294 (format "rmdir %s"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3295 (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
3296 (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
3297
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3298 (defun tramp-handle-delete-file (filename)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3299 "Like `delete-file' for Tramp files."
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
3300 (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
3301 (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
3302 (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
3303 (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
3304 v
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3305 (format "rm -f %s"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3306 (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
3307 (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
3308
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3309 ;; Dired.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3310
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3311 ;; CCC: This does not seem to be enough. Something dies when
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3312 ;; we try and delete two directories under TRAMP :/
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3313 (defun tramp-handle-dired-recursive-delete-directory (filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3314 "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
3315 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
3316 (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
3317 (tramp-flush-directory-property v filename)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3318 ;; Run a shell command 'rm -r <localname>'
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3319 ;; Code shamelessly stolen for 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
3320 (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
3321 (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
3322 ;; 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
3323 (tramp-send-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3324 v
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3325 (format "rm -r %s" (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
3326 ;; 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
3327 nil t)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3328 ;; Wait for the remote system to return to us...
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3329 ;; 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
3330 (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
3331 ;; Make sure that it worked...
56460
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3332 (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
3333 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3334 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
3335
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3336 (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
3337 "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
3338 ;; 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
3339 ;; 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
3340 (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
3341 (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
3342 (save-excursion
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3343 (let ((suffixes
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3344 (if (not (featurep 'xemacs))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3345 ;; Emacs case
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3346 (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
3347 ;; 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
3348 ;; 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
3349 (mapcar
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3350 '(lambda (x)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3351 (list (concat (regexp-quote (nth 1 x)) "\\'")
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3352 nil
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3353 (mapconcat 'identity (nth 3 x) " ")))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3354 (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
3355 suffix)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3356 ;; 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
3357 (while suffixes
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3358 (let (case-fold-search)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3359 (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
3360 (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
3361 (setq suffixes (cdr suffixes))))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3362
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3363 (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
3364 nil)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3365 ((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
3366 ;; We found an uncompression rule.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3367 (tramp-message v 0 "Uncompressing %s..." file)
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3368 (when (zerop (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
3369 v (concat (nth 2 suffix) " " localname)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3370 (tramp-message v 0 "Uncompressing %s...done" file)
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
3371 ;; `dired-remove-file' is not defined in XEmacs
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
3372 (funcall (symbol-function 'dired-remove-file) file)
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3373 (string-match (car suffix) file)
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3374 (concat (substring file 0 (match-beginning 0)))))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3375 (t
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3376 ;; 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
3377 ;; Try gzip.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3378 (tramp-message v 0 "Compressing %s..." file)
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3379 (when (zerop (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
3380 v (concat "gzip -f " localname)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3381 (tramp-message v 0 "Compressing %s...done" file)
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
3382 ;; `dired-remove-file' is not defined in XEmacs
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
3383 (funcall (symbol-function 'dired-remove-file) file)
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3384 (cond ((file-exists-p (concat file ".gz"))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3385 (concat file ".gz"))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3386 ((file-exists-p (concat file ".z"))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3387 (concat file ".z"))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3388 (t nil)))))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3389
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3390 ;; 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
3391 ;; 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
3392 ;; 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
3393 ;; achieve this.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3394 ;;(eval-when-compile
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3395 ;; (unless (fboundp 'dired-insert-set-properties)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3396 ;; (fset 'dired-insert-set-properties 'ignore)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3397 ;; Gerd suggests this:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3398 (eval-when-compile (require 'dired))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3399 ;; 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
3400 ;; It is only needed on XEmacs for the function
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3401 ;; `dired-insert-set-properties'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3402
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3403 (defun tramp-handle-insert-directory
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3404 (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
3405 "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
3406 (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
3407 (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
3408 (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
3409 (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
3410 (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
3411 (tramp-run-real-handler
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3412 'insert-directory (list filename switches wildcard full-directory-p))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3413 ;; For the moment, we assume that the remote "ls" program does not
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3414 ;; grok "--dired". In the future, we should detect this on
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3415 ;; connection setup.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3416 (when (string-match "^--dired\\s-+" switches)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3417 (setq switches (replace-match "" nil t switches)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3418 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3419 v 4 "Inserting directory `ls %s %s', wildcard %s, fulldir %s"
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
3420 switches filename (if wildcard "yes" "no")
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
3421 (if full-directory-p "yes" "no"))
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
3422 (when wildcard
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
3423 (setq wildcard (file-name-nondirectory localname))
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
3424 (setq localname (file-name-directory localname)))
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
3425 (when (listp switches)
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
3426 (setq switches (mapconcat 'identity switches " ")))
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
3427 (unless full-directory-p
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
3428 (setq switches (concat "-d " switches)))
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
3429 (when wildcard
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
3430 (setq switches (concat switches " " wildcard)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3431 ;; 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
3432 ;; 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
3433 (if full-directory-p
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3434 (tramp-send-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3435 v
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3436 (format "%s %s %s"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3437 (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
3438 switches
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3439 (if wildcard
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3440 localname
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3441 (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
3442 (tramp-barf-unless-okay
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3443 v
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3444 (format "cd %s" (tramp-shell-quote-argument
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3445 (file-name-directory localname)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3446 "Couldn't `cd %s'"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3447 (tramp-shell-quote-argument (file-name-directory localname)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3448 (tramp-send-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3449 v
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3450 (format "%s %s %s"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3451 (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
3452 switches
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3453 (if (or wildcard
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3454 (zerop (length (file-name-nondirectory localname))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3455 ""
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3456 (tramp-shell-quote-argument
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3457 (file-name-nondirectory localname))))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3458 ;; We cannot use `insert-buffer-substring' because the tramp buffer
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3459 ;; changes its contents before insertion due to calling
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3460 ;; `expand-file' and alike.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3461 (insert
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3462 (with-current-buffer (tramp-get-buffer v)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3463 (buffer-string))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3464
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3465 ;; CCC is this the right thing to do?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3466 (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
3467 "Like `unhandled-file-name-directory' 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
3468 (expand-file-name "~/"))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3469
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3470 ;; Canonicalization of file names.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3471
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3472 (defun tramp-drop-volume-letter (name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3473 "Cut off unnecessary drive letter from file NAME.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3474 The function `tramp-handle-expand-file-name' calls `expand-file-name'
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3475 locally on a remote file name. When the local system is a W32 system
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3476 but the remote system is Unix, this introduces a superfluous drive
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3477 letter into the file name. This function removes it.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3478
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3479 Doesn't do anything if the NAME does not start with a drive letter."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3480 (if (and (> (length name) 1)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3481 (char-equal (aref name 1) ?:)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3482 (let ((c1 (aref name 0)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3483 (or (and (>= c1 ?A) (<= c1 ?Z))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3484 (and (>= c1 ?a) (<= c1 ?z)))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3485 (substring name 2)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3486 name))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3487
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3488 (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
3489 "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
3490 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
3491 the result will be a local, non-Tramp, filename."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3492 ;; If DIR is not given, use DEFAULT-DIRECTORY or "/".
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3493 (setq dir (or dir default-directory "/"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3494 ;; Unless NAME is absolute, concat DIR and NAME.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3495 (unless (file-name-absolute-p name)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3496 (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
3497 ;; If NAME is not a Tramp file, run the real handler.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3498 (if (not (tramp-tramp-file-p name))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3499 (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
3500 ;; Dissect NAME.
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3501 (with-parsed-tramp-file-name name nil
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
3502 (unless (file-name-absolute-p localname)
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
3503 (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
3504 ;; 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
3505 ;; 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
3506 ;; 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
3507 ;; 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
3508 (when (string-match "\\`\\(~[^/]*\\)\\(.*\\)\\'" localname)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3509 (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
3510 (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
3511 ;; 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
3512 ;; 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
3513 ;; 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
3514 ;; 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
3515 ;; 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
3516 ;; 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
3517 (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
3518 (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
3519 (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
3520 (setq uname
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3521 (with-connection-property v uname
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3522 (tramp-send-command v (format "cd %s; pwd" uname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3523 (with-current-buffer (tramp-get-buffer v)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3524 (goto-char (point-min))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3525 (buffer-substring (point) (tramp-compat-line-end-position)))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3526 (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
3527 ;; There might be a double slash, for example when "~/"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3528 ;; expands to "/". Remove this.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3529 (while (string-match "//" localname)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3530 (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
3531 ;; No tilde characters in file name, do normal
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3532 ;; expand-file-name (this does "/./" and "/../"). We bind
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3533 ;; `directory-sep-char' here for XEmacs on Windows, which
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3534 ;; would otherwise use backslash. `default-directory' is
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3535 ;; bound, because on Windows there would be problems with UNC
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3536 ;; shares or Cygwin mounts.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3537 (tramp-let-maybe directory-sep-char ?/
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3538 (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
3539 (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
3540 method user host
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3541 (tramp-drop-volume-letter
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3542 (tramp-run-real-handler 'expand-file-name
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3543 (list localname)))))))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3544
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3545 (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
3546 "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
3547 \"//\" 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
3548 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
3549 beginning of local filename are not substituted."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3550 (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
3551 (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
3552 ;; 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
3553 ;; "//" or "/~".
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3554 (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
3555 (or (string-match "//" localname)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3556 (string-match "/~" localname 1)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3557 (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
3558 (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
3559 (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
3560 (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
3561 (when host (substitute-in-file-name host))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3562 (when localname (substitute-in-file-name localname))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3563 ;; 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
3564 (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
3565 (setq filename
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3566 (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
3567 method user host (replace-match "\\1" nil nil localname)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3568 ;; "/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
3569 (when (string-match "~$" filename)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3570 (setq filename (concat filename "/"))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3571 (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
3572
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3573 ;; 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
3574 ;; 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
3575 (when (fboundp 'minibuffer-electric-separator)
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3576 (mapc
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3577 '(lambda (x)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3578 (eval
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3579 `(defadvice ,x
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3580 (around ,(intern (format "tramp-advice-%s" x)) activate)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3581 "Invoke `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
3582 (if (and (symbol-value 'minibuffer-electric-file-name-behavior)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3583 (tramp-tramp-file-p (buffer-substring)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3584 ;; We don't need to handle `last-input-event', because
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3585 ;; due to the key map we know it must be ?/ or ?~.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3586 (let ((s (concat (buffer-substring (point-min) (point))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3587 (string last-command-char))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3588 (delete-region (point-min) (point))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3589 (insert (substitute-in-file-name s))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3590 (setq ad-return-value last-command-char))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3591 ad-do-it))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3592
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3593 '(minibuffer-electric-separator
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3594 minibuffer-electric-tilde)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3595
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3596
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3597 ;;; Remote commands.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3598
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3599 (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
3600 "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
3601 (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
3602 (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
3603
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3604 ;; 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
3605 ;; 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
3606 ;; connection has been setup.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3607 (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
3608 "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
3609 (with-parsed-tramp-file-name default-directory nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3610 (unwind-protect
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3611 (progn
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3612 ;; 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
3613 (tramp-set-connection-property v "process-name" name)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3614 (tramp-set-connection-property
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3615 v "process-buffer"
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3616 ;; BUFFER can be nil.
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3617 (get-buffer-create (or buffer (current-buffer))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3618 ;; Activate narrowing in order to save BUFFER contents.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3619 (with-current-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
3620 (narrow-to-region (point-max) (point-max)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3621 ;; Goto working directory. `tramp-send-command' opens a new
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3622 ;; connection.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3623 (tramp-send-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3624 v (format "cd %s" (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
3625 ;; Send the command.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3626 (tramp-send-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3627 v
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3628 (format "%s; exit"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3629 (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
3630 (cons program args) " "))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3631 nil t) ; nooutput
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3632 ;; Return process.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3633 (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
3634 ;; Save exit.
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3635 (with-current-buffer (tramp-get-connection-buffer v)
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3636 (widen)
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3637 (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
3638 (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
3639 (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
3640
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3641 (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
3642 (program &optional infile destination display &rest args)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3643 "Like `process-file' for Tramp files."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3644 ;; 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
3645 (when (and (numberp destination) (zerop destination))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3646 (error "Implementation does not handle immediate return"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3647
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3648 (with-parsed-tramp-file-name default-directory nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3649 (let ((temp-name-prefix (tramp-make-tramp-temp-file v))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3650 command input stderr outbuf ret)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3651 ;; Compute command.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3652 (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
3653 (cons program args) " "))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3654 ;; Determine input.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3655 (if (null infile)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3656 (setq input "/dev/null")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3657 (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
3658 (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
3659 ;; 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
3660 (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
3661 ;; INFILE must be copied to remote host.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3662 (setq input (concat temp-name-prefix ".in"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3663 (copy-file
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3664 infile
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3665 (tramp-make-tramp-file-name method user host input)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3666 t)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3667 (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
3668
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3669 ;; Determine output.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3670 (cond
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3671 ;; Just a buffer
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3672 ((bufferp destination)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3673 (setq outbuf destination))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3674 ;; A buffer name
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3675 ((stringp destination)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3676 (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
3677 ;; (REAL-DESTINATION ERROR-DESTINATION)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3678 ((consp destination)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3679 ;; output
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3680 (cond
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3681 ((bufferp (car destination))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3682 (setq outbuf (car destination)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3683 ((stringp (car destination))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3684 (setq outbuf (get-buffer-create (car destination)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3685 ;; stderr
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3686 (cond
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3687 ((stringp (cadr destination))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3688 (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
3689 (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
3690 ;; 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
3691 (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
3692 (cadr destination) nil localname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3693 ;; 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
3694 ;; file must be deleted after execution.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3695 (setq stderr (concat temp-name-prefix ".err"))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3696 ;; stderr to be discarded
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3697 ((null (cadr destination))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3698 (setq stderr "/dev/null"))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3699 ;; 't
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3700 (destination
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3701 (setq outbuf (current-buffer))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3702 (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
3703
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3704 ;; If we have a temporary file, it must be removed after operation.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3705 (when (and input (string-match temp-name-prefix input))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3706 (setq command (format "%s; rm %s" command input)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3707 ;; Goto working directory.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3708 (tramp-send-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3709 v (format "cd %s" (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
3710 ;; 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
3711 (condition-case nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3712 (unwind-protect
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3713 (tramp-send-command v command)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3714 ;; 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
3715 (when outbuf
82324
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
3716 (let ((output-string
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
3717 (with-current-buffer (tramp-get-connection-buffer v)
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
3718 (buffer-substring (point-min) (point-max)))))
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
3719 (with-current-buffer outbuf
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
3720 (insert output-string)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3721 (when display (display-buffer outbuf))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3722 ;; When the user did interrupt, we should do it also.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3723 (error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3724 (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
3725 (setq ret 1)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3726 (unless ret
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3727 ;; Check return code.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3728 (setq ret (tramp-send-command-and-check v nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3729 ;; Provide error file.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3730 (when (and stderr (string-match temp-name-prefix stderr))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3731 (rename-file (tramp-make-tramp-file-name method user host stderr)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3732 (cadr destination) t)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3733 ;; Return exit status.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3734 ret)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3735
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3736 (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
3737 (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
3738 "Like `call-process-region' for Tramp files."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3739 (let ((tmpfile (tramp-make-temp-file "")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3740 (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
3741 (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
3742 (unwind-protect
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3743 (apply 'call-process program tmpfile buffer display args)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3744 (delete-file tmpfile))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3745
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3746 (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
3747 (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
3748 "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
3749 (let* ((asynchronous (string-match "[ \t]*&[ \t]*\\'" command))
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3750 (args (split-string (substring command 0 asynchronous) " "))
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3751 (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
3752 (cond
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
3753 ((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
3754 ((stringp output-buffer) (get-buffer-create output-buffer))
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
3755 (output-buffer (current-buffer))
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
3756 (t (generate-new-buffer
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
3757 (if asynchronous
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
3758 "*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
3759 "*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
3760 (error-buffer
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
3761 (cond
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
3762 ((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
3763 ((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
3764 (buffer
82324
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
3765 (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
3766 (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
3767 (list output-buffer (tramp-make-tramp-temp-file v)))
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3768 output-buffer)))
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3769
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3770 (prog1
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3771 ;; Run the process. We cannot use `process-file' and
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3772 ;; `start-file-process', because these functions might not
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3773 ;; exist in older Emacsen.
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3774 (if (integerp asynchronous)
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3775 (apply 'tramp-handle-start-file-process
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3776 "*Async Shell*" buffer args)
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3777 (apply 'process-file
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3778 (car args) nil buffer nil (cdr args)))
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3779 ;; Insert error messages if they were separated.
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3780 (when (listp buffer)
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3781 (with-current-buffer error-buffer
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3782 (insert-file-contents (cadr buffer)))
82324
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
3783 (delete-file (buffer-file-name (cadr buffer))))
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
3784 ;; There's some output, display it.
5399c02bfd07 * net/tramp.el (tramp-wrong-passwd-regexp): Make the regexp more
Michael Albinus <michael.albinus@gmx.de>
parents: 82201
diff changeset
3785 (when (with-current-buffer output-buffer (> (point-max) (point-min)))
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
3786 (if (functionp 'display-message-or-buffer)
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
3787 (funcall (symbol-function 'display-message-or-buffer) output-buffer)
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
3788 (pop-to-buffer output-buffer))))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3789
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3790 ;; File Editing.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3791
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3792 (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
3793 "Normal hook to be run at the end of `tramp-handle-file-local-copy'.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3794
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3795 (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
3796 "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
3797
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3798 (with-parsed-tramp-file-name filename nil
82808
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3799 (let ((rem-enc (tramp-get-remote-coding v "remote-encoding"))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3800 (loc-dec (tramp-get-local-coding v "local-decoding"))
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
3801 (tmpfile (tramp-make-temp-file filename)))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
3802 (unless (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
3803 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3804 v 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3805 "Cannot make local copy of non-existing file `%s'" filename))
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
3806
82808
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3807 (cond
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3808 ;; `copy-file' handles direct copy and out-of-band methods.
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3809 ((or (tramp-local-host-p v)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3810 (and (tramp-method-out-of-band-p v)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3811 (> (nth 7 (file-attributes filename)) tramp-copy-size-limit)))
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
3812 (copy-file filename tmpfile t t))
82808
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3813
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3814 ;; Use inline encoding for file transfer.
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3815 (rem-enc
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3816 (save-excursion
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3817 (tramp-message v 5 "Encoding remote file %s..." filename)
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3818 (tramp-barf-unless-okay
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3819 v (format "%s < %s" rem-enc (tramp-shell-quote-argument localname))
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3820 "Encoding remote file failed")
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3821 (tramp-message v 5 "Encoding remote file %s...done" filename)
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3822
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3823 (tramp-message v 5 "Decoding remote file %s..." filename)
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3824 (if (and (symbolp loc-dec) (fboundp loc-dec))
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3825 ;; If local decoding is a function, we call it. We must
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3826 ;; disable multibyte, because `uudecode-decode-region'
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3827 ;; doesn't handle it correctly.
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3828 (unwind-protect
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3829 (with-temp-buffer
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3830 (set-buffer-multibyte nil)
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3831 (insert-buffer-substring (tramp-get-buffer v))
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3832 (tramp-message
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3833 v 5 "Decoding remote file %s with function %s..."
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3834 filename loc-dec)
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3835 (funcall loc-dec (point-min) (point-max))
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3836 (let ((coding-system-for-write 'binary))
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
3837 (write-region (point-min) (point-max) tmpfile))))
82808
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3838 ;; If tramp-decoding-function is not defined for this
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3839 ;; method, we invoke tramp-decoding-command instead.
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
3840 (let ((tmpfile2 (tramp-make-temp-file filename)))
82808
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3841 (let ((coding-system-for-write 'binary))
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
3842 (write-region (point-min) (point-max) tmpfile2))
82808
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3843 (tramp-message
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3844 v 5 "Decoding remote file %s with command %s..."
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3845 filename loc-dec)
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
3846 (tramp-call-local-coding-command loc-dec tmpfile2 tmpfile)
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
3847 (delete-file tmpfile2)))
82808
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3848 (tramp-message v 5 "Decoding remote file %s...done" filename)
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3849 ;; Set proper permissions.
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
3850 (set-file-modes tmpfile (file-modes filename))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3851 ;; Set local user ownership.
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
3852 (tramp-set-file-uid-gid tmpfile)))
82808
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3853
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3854 ;; Oops, I don't know what to do.
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3855 (t (tramp-error
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3856 v 'file-error "Wrong method specification for `%s'" method)))
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
3857
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3858 (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
3859 tmpfile)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3860
82201
b3182f0c969c * net/tramp.el:
Michael Albinus <michael.albinus@gmx.de>
parents: 82140
diff changeset
3861 (defun tramp-handle-file-remote-p (filename &optional identification connected)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3862 "Like `file-remote-p' for Tramp files."
56261
d863bc830907 (tramp-handle-file-remote-p): New implementation to
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 55864
diff changeset
3863 (when (tramp-tramp-file-p filename)
d863bc830907 (tramp-handle-file-remote-p): New implementation to
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 55864
diff changeset
3864 (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
3865 (and (or (not connected)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3866 (let ((p (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
3867 (and p (processp p) (memq (process-status p) '(run open)))))
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3868 (cond
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3869 ((eq identification 'method) method)
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3870 ((eq identification 'user) user)
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3871 ((eq identification 'host) host)
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3872 ((eq identification 'localname) localname)
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
3873 (t (tramp-make-tramp-file-name method user host "")))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3874
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3875 (defun tramp-handle-insert-file-contents
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3876 (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
3877 "Like `insert-file-contents' for Tramp files."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3878 (barf-if-buffer-read-only)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3879 (setq filename (expand-file-name filename))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3880 (let (coding-system-used result)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3881 (with-parsed-tramp-file-name filename nil
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3882
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3883 (if (not (file-exists-p filename))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3884 (progn
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3885 (when visit
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3886 (setq buffer-file-name filename)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3887 (set-visited-file-modtime)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3888 (set-buffer-modified-p nil))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3889 (tramp-error
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3890 v 'file-error "File %s not found on remote host" filename)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3891 (list (expand-file-name filename) 0))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3892
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3893 (if (and (tramp-local-host-p v)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3894 (file-readable-p localname))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3895 ;; Short track: if we are on the local host, we can run directly.
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
3896 (setq result (insert-file-contents localname visit beg end replace))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3897
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3898 ;; `insert-file-contents-literally' takes care to avoid calling
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3899 ;; jka-compr. By let-binding inhibit-file-name-operation, we
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3900 ;; propagate that care to the file-local-copy operation.
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3901 (let ((local-copy
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3902 (let ((inhibit-file-name-operation
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3903 (when (eq inhibit-file-name-operation
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3904 'insert-file-contents)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3905 'file-local-copy)))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3906 (file-local-copy filename))))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3907 (tramp-message v 4 "Inserting local temp file `%s'..." local-copy)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3908 (setq result (insert-file-contents local-copy nil beg end replace))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3909 ;; Now `last-coding-system-used' has right value. Remember it.
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3910 (when (boundp 'last-coding-system-used)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3911 (setq coding-system-used (symbol-value 'last-coding-system-used)))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3912 (tramp-message v 4 "Inserting local temp file `%s'...done" local-copy)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3913 (delete-file local-copy)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3914 (when (boundp 'last-coding-system-used)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3915 (set 'last-coding-system-used coding-system-used))))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3916
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3917 (when visit
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
3918 (setq buffer-read-only (file-writable-p filename))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3919 (setq buffer-file-name filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3920 (set-visited-file-modtime)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3921 (set-buffer-modified-p nil))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3922 (list (expand-file-name filename)
77986
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
3923 (cadr result))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
3924
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
3925 ;; 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
3926 (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
3927 (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
3928 "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
3929 (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
3930 (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
3931 (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
3932 (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
3933 (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
3934 (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
3935 (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
3936 nil))
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
3937 (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
3938 (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
3939 (unwind-protect
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
3940 (progn
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
3941 (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
3942 (insert-file-contents filename 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
3943 (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
3944 (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
3945 (fmakunbound '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
3946
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
3947 (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
3948 "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
3949 (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
3950 ;; We set both variables. It doesn't matter whether it is
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3951 ;; Emacs or XEmacs
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3952 (let ((backup-directory-alist
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3953 ;; Emacs case
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3954 (when (boundp 'backup-directory-alist)
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3955 (if (boundp 'tramp-backup-directory-alist)
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3956 (mapcar
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3957 '(lambda (x)
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3958 (cons
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3959 (car x)
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3960 (if (and (stringp (cdr x))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3961 (file-name-absolute-p (cdr x))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3962 (not (tramp-file-name-p (cdr x))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3963 (tramp-make-tramp-file-name method user host (cdr x))
56460
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3964 (cdr x))))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3965 (symbol-value 'tramp-backup-directory-alist))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3966 (symbol-value 'backup-directory-alist))))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3967
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3968 (bkup-backup-directory-info
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3969 ;; XEmacs case
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3970 (when (boundp 'bkup-backup-directory-info)
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3971 (if (boundp 'tramp-bkup-backup-directory-info)
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3972 (mapcar
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3973 '(lambda (x)
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3974 (nconc
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3975 (list (car x))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3976 (list
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3977 (if (and (stringp (car (cdr x)))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3978 (file-name-absolute-p (car (cdr x)))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3979 (not (tramp-file-name-p (car (cdr x)))))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3980 (tramp-make-tramp-file-name
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3981 method user host (car (cdr x)))
56460
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3982 (car (cdr x))))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3983 (cdr (cdr x))))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3984 (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
3985 (symbol-value 'bkup-backup-directory-info)))))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3986
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
3987 (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
3988
65248
0f994edbec5e Make `make-auto-save-file-name' a magic operation.
Michael Albinus <michael.albinus@gmx.de>
parents: 64772
diff changeset
3989 (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
3990 "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
3991 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
3992 (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
3993 (buffer-file-name
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3994 (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
3995 '(("_" . "|")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3996 ("/" . "_a")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3997 (":" . "_b")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3998 ("|" . "__")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
3999 ("[" . "_l")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4000 ("]" . "_r"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4001 (buffer-file-name))))
72569
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
4002 ;; 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
4003 ;; 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
4004 ;; 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
4005 (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
4006 (mapc
72569
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
4007 '(lambda (x)
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
4008 (when (and (string-match (car x) buffer-file-name)
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
4009 (not (car (cddr x))))
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
4010 (setq tramp-auto-save-directory
77986
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
4011 (or tramp-auto-save-directory
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4012 (tramp-compat-temporary-file-directory)))))
72569
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
4013 (symbol-value 'auto-save-file-name-transforms)))
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
4014 ;; Create directory.
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
4015 (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
4016 (setq buffer-file-name
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4017 (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
4018 (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
4019 (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
4020 ;; 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
4021 ;; 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
4022 ;; 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
4023 (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
4024 (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
4025 ;; else
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4026 (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
4027 (prog1
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4028 (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
4029 (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
4030
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4031 (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
4032 "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
4033
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4034 ;; CCC grok APPEND, LOCKNAME
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4035 (defun tramp-handle-write-region
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4036 (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
4037 "Like `write-region' for Tramp files."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4038 (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
4039 (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
4040 (unless (null append)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4041 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4042 v 'file-error "Cannot append to file using Tramp (`%s')" filename))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4043 ;; 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
4044 ;; 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
4045 ;; 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
4046 ;; (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
4047 ;; (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
4048 ;; (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
4049 ;; (string= lockname filename))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4050 ;; (error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4051 ;; "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
4052
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4053 ;; 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
4054 (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
4055 (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
4056 (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
4057
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4058 (let ((rem-dec (tramp-get-remote-coding v "remote-decoding"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4059 (loc-enc (tramp-get-local-coding v "local-encoding"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4060 (modes (save-excursion (file-modes filename)))
65925
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
4061 ;; We use this to save the value of `last-coding-system-used'
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
4062 ;; after writing the tmp file. At the end of the function,
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
4063 ;; we set `last-coding-system-used' to this saved value.
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
4064 ;; This way, any intermediary coding systems used while
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
4065 ;; talking to the remote shell or suchlike won't hose this
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
4066 ;; variable. This approach was snarfed from ange-ftp.el.
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
4067 coding-system-used
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4068 ;; Write region into a tmp file. This isn't really needed if we
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4069 ;; use an encoding function, but currently we use it always
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4070 ;; because this makes the logic simpler.
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4071 (tmpfile (tramp-make-temp-file filename)))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4072
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4073 (if (and (tramp-local-host-p v)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4074 (file-writable-p (file-name-directory localname)))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4075 ;; Short track: if we are on the local host, we can run directly.
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4076 (if confirm
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4077 (write-region
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4078 start end localname append 'no-message lockname confirm)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4079 (write-region start end localname append 'no-message lockname))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4080
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4081 ;; We say `no-message' here because we don't want the visited file
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4082 ;; modtime data to be clobbered from the temp file. We call
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4083 ;; `set-visited-file-modtime' ourselves later on.
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4084 (tramp-run-real-handler
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4085 'write-region
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4086 (if confirm ; don't pass this arg unless defined for backward compat.
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4087 (list start end tmpfile append 'no-message lockname confirm)
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4088 (list start end tmpfile append 'no-message lockname)))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4089 ;; Now, `last-coding-system-used' has the right value. Remember it.
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4090 (when (boundp 'last-coding-system-used)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4091 (setq coding-system-used (symbol-value 'last-coding-system-used)))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4092 ;; The permissions of the temporary file should be set. If
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4093 ;; filename does not exist (eq modes nil) it has been renamed to
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4094 ;; the backup file. This case `save-buffer' handles
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4095 ;; permissions.
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4096 (when modes (set-file-modes tmpfile modes))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4097
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4098 ;; This is a bit lengthy due to the different methods possible for
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4099 ;; file transfer. First, we check whether the method uses an rcp
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4100 ;; program. If so, we call it. Otherwise, both encoding and
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4101 ;; decoding command must be specified. However, if the method
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4102 ;; _also_ specifies an encoding function, then that is used for
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4103 ;; encoding the contents of the tmp file.
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4104 (cond
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4105 ;; `rename-file' handles direct copy and out-of-band methods.
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4106 ((or (tramp-local-host-p v)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4107 (and (tramp-method-out-of-band-p v)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4108 (integerp start)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4109 (> (- end start) tramp-copy-size-limit)))
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4110 (rename-file tmpfile filename t))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4111
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4112 ;; Use inline file transfer
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4113 (rem-dec
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4114 ;; Encode tmpfile
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4115 (tramp-message v 5 "Encoding region...")
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4116 (unwind-protect
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4117 (with-temp-buffer
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4118 ;; Use encoding function or command.
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4119 (if (and (symbolp loc-enc) (fboundp loc-enc))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4120 (progn
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4121 (tramp-message
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4122 v 5 "Encoding region using function `%s'..."
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4123 (symbol-name loc-enc))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4124 (let ((coding-system-for-read 'binary))
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4125 (insert-file-contents-literally tmpfile))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4126 ;; CCC. The following `let' is a workaround for
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4127 ;; the base64.el that comes with pgnus-0.84. If
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4128 ;; both of the following conditions are
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4129 ;; satisfied, it tries to write to a local file
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4130 ;; in default-directory, but at this point,
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4131 ;; default-directory is remote.
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4132 ;; (CALL-PROCESS-REGION can't write to remote
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4133 ;; files, it seems.) The file in question is a
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4134 ;; tmp file anyway.
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4135 (let ((default-directory
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4136 (tramp-compat-temporary-file-directory)))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4137 (funcall loc-enc (point-min) (point-max))))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4138
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4139 (tramp-message
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4140 v 5 "Encoding region using command `%s'..." loc-enc)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4141 (unless (equal 0 (tramp-call-local-coding-command
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4142 loc-enc tmpfile t))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4143 (tramp-error
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4144 v 'file-error
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4145 "Cannot write to `%s', local encoding command `%s' failed"
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4146 filename loc-enc)))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4147
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4148 ;; Send buffer into remote decoding command which
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4149 ;; writes to remote file. Because this happens on the
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4150 ;; remote host, we cannot use the function.
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4151 (goto-char (point-max))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4152 (unless (bolp) (newline))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4153 (tramp-message
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4154 v 5 "Decoding region into remote file %s..." filename)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4155 (tramp-send-command
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4156 v
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4157 (format
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4158 "%s >%s <<'EOF'\n%sEOF"
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4159 rem-dec
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4160 (tramp-shell-quote-argument localname)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4161 (buffer-string)))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4162 (tramp-barf-unless-okay
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4163 v nil
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4164 "Couldn't write region to `%s', decode using `%s' failed"
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4165 filename rem-dec)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4166 ;; When `file-precious-flag' is set, the region is
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4167 ;; written to a temporary file. Check that the
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4168 ;; checksum is equal to that from the local tmpfile.
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4169 (when file-precious-flag
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4170 (erase-buffer)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4171 (and
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4172 ;; cksum runs locally
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4173 (let ((default-directory
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4174 (tramp-compat-temporary-file-directory)))
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4175 (zerop (call-process "cksum" tmpfile t)))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4176 ;; cksum runs remotely
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4177 (zerop
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4178 (tramp-send-command-and-check
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4179 v
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4180 (format "cksum <%s" (tramp-shell-quote-argument localname))))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4181 ;; ... they are different
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4182 (not
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4183 (string-equal
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4184 (buffer-string)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4185 (with-current-buffer (tramp-get-buffer v) (buffer-string))))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4186 (tramp-error
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4187 v 'file-error
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4188 (concat "Couldn't write region to `%s',"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4189 " decode using `%s' failed")
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4190 filename rem-dec)))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4191 (tramp-message
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4192 v 5 "Decoding region into remote file %s...done" filename)
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4193 (tramp-flush-file-property v localname))
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4194
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4195 ;; 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
4196 (delete-file tmpfile)))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4197
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4198 ;; That's not expected.
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4199 (t
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4200 (tramp-error
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4201 v 'file-error
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4202 (concat "Method `%s' should specify both encoding and "
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4203 "decoding command or an rcp program")
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4204 method))))
82808
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
4205
56644
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
4206 (when (or (eq visit t) (stringp visit))
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
4207 (set-visited-file-modtime
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
4208 ;; We must pass modtime explicitely, because filename can be different
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
4209 ;; from (buffer-file-name), f.e. if `file-precious-flag' is set.
0cee455027ed Sync with Tramp 2.0.44.
Michael Albinus <michael.albinus@gmx.de>
parents: 56465
diff changeset
4210 (nth 5 (file-attributes filename))))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4211 ;; Set the ownership.
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4212 (tramp-set-file-uid-gid filename)
65925
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
4213 ;; Make `last-coding-system-used' have the right value.
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
4214 (when coding-system-used
65925
da00cdf6de37 Sync with Tramp 2.0.51.
Michael Albinus <michael.albinus@gmx.de>
parents: 65792
diff changeset
4215 (set 'last-coding-system-used coding-system-used))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4216 (when (or (eq visit t) (null visit) (stringp visit))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4217 (tramp-message v 0 "Wrote %s" filename))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4218 (run-hooks 'tramp-handle-write-region-hook))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4219
70318
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4220 ;;;###autoload
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4221 (progn (defun tramp-run-real-handler (operation args)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4222 "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
4223 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
4224 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
4225 (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
4226 `(tramp-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
4227 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
4228 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
4229 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
4230 .
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4231 ,(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
4232 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
4233 (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
4234 (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
4235
70318
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4236 ;;;###autoload
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4237 (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
4238 "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
4239 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
4240 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
4241 (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
4242 `(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
4243 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
4244 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
4245 .
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4246 ,(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
4247 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
4248 (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
4249 (apply operation args))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4250
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4251 ;; 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
4252 ;; name as first parameter; nevertheless we check for them explicitly
55844
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
4253 ;; in order to be signalled 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
4254 ;; 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
4255 ;; 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
4256 ;; 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
4257 ;; 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
4258 (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
4259 "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
4260 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
4261 (cond
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4262 ; FILE resp DIRECTORY
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4263 ((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
4264 (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
4265 '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
4266 '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
4267 '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
4268 '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
4269 'file-directory-p 'file-executable-p 'file-exists-p
55844
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
4270 'file-local-copy 'file-remote-p 'file-modes
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
4271 '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
4272 '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
4273 '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
4274 '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
4275 '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
4276 '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
4277 'load 'make-directory 'make-directory-internal
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
4278 '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
4279 'unhandled-file-name-directory 'vc-registered
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
4280 ; Emacs 22 only
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
4281 'set-file-times
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4282 ; XEmacs only
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4283 '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
4284 '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
4285 '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
4286 'dired-shell-unhandle-file-name 'dired-uucode-file
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4287 'insert-file-contents-literally 'recover-file
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4288 '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
4289 (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
4290 (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
4291 (expand-file-name (nth 0 args))))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4292 ; FILE DIRECTORY resp FILE1 FILE2
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4293 ((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
4294 (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
4295 '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
4296 'file-newer-than-file-p 'make-symbolic-link 'rename-file
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4297 ; XEmacs only
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4298 '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
4299 '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
4300 (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
4301 (cond
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4302 ((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
4303 ((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
4304 (t (buffer-file-name (current-buffer))))))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4305 ; START END FILE
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4306 ((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
4307 (nth 2 args))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4308 ; BUF
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4309 ((member operation
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4310 (list 'set-visited-file-modtime 'verify-visited-file-modtime
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4311 ; Emacs 22 only
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4312 '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
4313 ; 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
4314 '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
4315 (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
4316 (if (bufferp (nth 0 args)) (nth 0 args) (current-buffer))))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4317 ; COMMAND
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4318 ((member operation
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4319 (list ; not in Emacs 23
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4320 'dired-call-process
59582
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
4321 ; Emacs only
60287
865aec6814c3 (tramp-file-name-for-operation): Fix misapplied
Andreas Schwab <schwab@suse.de>
parents: 60156
diff changeset
4322 'shell-command
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4323 ; since 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
4324 'process-file
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4325 ; since Emacs 23 only
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4326 'start-file-process
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4327 ; XEmacs only
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4328 'dired-print-file 'dired-shell-call-process
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4329 ; nowhere yet
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4330 'executable-find 'start-process 'call-process))
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4331 default-directory)
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4332 ; unknown 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
4333 (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
4334
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4335 (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
4336 "Return foreign file name handler if exists."
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
4337 (when (and (stringp filename) (tramp-tramp-file-p filename))
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
4338 (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
4339 (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
4340 elt res)
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
4341 ;; 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
4342 ;; 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
4343 (when (or (tramp-file-name-method v) (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
4344 (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
4345 (while handler
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
4346 (setq elt (car handler)
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
4347 handler (cdr handler))
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
4348 (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
4349 (setq handler nil
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
4350 res (cdr elt))))
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
4351 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
4352
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4353 ;; Main function.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4354 ;;;###autoload
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4355 (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
4356 "Invoke Tramp file name handler.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4357 Falls back to normal file name handler if no tramp file name handler exists."
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4358 (save-match-data
51603
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
4359 (let* ((filename (apply 'tramp-file-name-for-operation operation args))
84833
b8f420afb6df * net/tramp.el (tramp-completion-mode-p): Rename from
Michael Albinus <michael.albinus@gmx.de>
parents: 84739
diff changeset
4360 (completion (tramp-completion-mode-p))
76242
1882543dfe9f (tramp-file-name-handler): Revert last change.
Chong Yidong <cyd@stupidchicken.com>
parents: 76206
diff changeset
4361 (foreign (tramp-find-foreign-file-name-handler filename)))
70318
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4362 (with-parsed-tramp-file-name filename nil
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4363 (cond
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4364 ;; When we are in completion mode, some operations shouldn't be
70318
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4365 ;; handled by backend.
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4366 ((and completion (zerop (length localname))
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4367 (memq operation '(file-exists-p file-directory-p)))
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4368 t)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4369 ((and completion (zerop (length localname))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4370 (memq operation '(file-name-as-directory)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4371 filename)
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
4372 ;; Call the backend function.
82808
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
4373 (foreign (apply foreign operation args))
70318
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4374 ;; Nothing to do for us.
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4375 (t (tramp-run-real-handler operation args)))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4376
56460
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
4377 ;; 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
4378 ;; 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
4379 ;; 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
4380 ;; 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
4381 ;; 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
4382 ;; 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
4383 ;; 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
4384 ;; `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
4385 ;; (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
4386 ;; 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
4387 ;; 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
4388 ;; -- 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
4389 ;; 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
4390 ;; 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
4391 ;; 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
4392 ;; 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
4393
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
4394 (defvar tramp-locked nil
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
4395 "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
4396 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
4397 preventing reentrant calls of Tramp.")
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
4398
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
4399 (defvar tramp-locker nil
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
4400 "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
4401 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
4402 preventing reentrant calls of Tramp.")
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
4403
51603
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
4404 (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
4405 "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
4406 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
4407 (when (and tramp-locked (not tramp-locker))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4408 (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
4409 (let ((tl tramp-locked))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
4410 (unwind-protect
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
4411 (progn
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
4412 (setq tramp-locked t)
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
4413 (let ((tramp-locker t))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
4414 (save-match-data
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
4415 (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
4416 (if fn
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
4417 (apply (cdr fn) args)
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
4418 (tramp-run-real-handler operation args))))))
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
4419 (setq tramp-locked tl))))
51603
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
4420
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4421 ;;;###autoload
70255
d57fb8c98714 * net/tramp.el (tramp-completion-file-name-handler): Disable
Michael Albinus <michael.albinus@gmx.de>
parents: 70191
diff changeset
4422 (progn (defun tramp-completion-file-name-handler (operation &rest args)
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4423 "Invoke tramp file name completion handler.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4424 Falls back to normal file name handler if no tramp file name handler exists."
70318
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4425 ;; (setq edebug-trace t)
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4426 ;; (edebug-trace "%s" (with-output-to-string (backtrace)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4427
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4428 ;; (mapcar 'trace-function-background
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4429 ;; (mapcar 'intern
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4430 ;; (all-completions "tramp-" obarray 'functionp)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4431
70318
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4432 (let ((fn (assoc operation tramp-completion-file-name-handler-alist)))
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4433 (if fn
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4434 (save-match-data (apply (cdr fn) args))
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4435 (tramp-completion-run-real-handler operation args)))))
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4436
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4437 ;;;###autoload
76846
d55ab93ab5bf * net/tramp.el (tramp-register-file-name-handler)
Michael Albinus <michael.albinus@gmx.de>
parents: 76326
diff changeset
4438 (defsubst tramp-register-file-name-handler ()
d55ab93ab5bf * net/tramp.el (tramp-register-file-name-handler)
Michael Albinus <michael.albinus@gmx.de>
parents: 76326
diff changeset
4439 "Add tramp file name handler to `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
4440 ;; Remove autoloaded handler from file name handler alist. Useful,
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4441 ;; 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
4442 (let ((a1 (rassq 'tramp-file-name-handler file-name-handler-alist)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4443 (setq file-name-handler-alist (delete a1 file-name-handler-alist)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4444 ;; Add the handler.
70318
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4445 (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
4446 (cons tramp-file-name-regexp 'tramp-file-name-handler))
76846
d55ab93ab5bf * net/tramp.el (tramp-register-file-name-handler)
Michael Albinus <michael.albinus@gmx.de>
parents: 76326
diff changeset
4447 ;; If jka-compr is already loaded, move it to the front of
d55ab93ab5bf * net/tramp.el (tramp-register-file-name-handler)
Michael Albinus <michael.albinus@gmx.de>
parents: 76326
diff changeset
4448 ;; `file-name-handler-alist'.
d55ab93ab5bf * net/tramp.el (tramp-register-file-name-handler)
Michael Albinus <michael.albinus@gmx.de>
parents: 76326
diff changeset
4449 (let ((jka (rassoc 'jka-compr-handler file-name-handler-alist)))
d55ab93ab5bf * net/tramp.el (tramp-register-file-name-handler)
Michael Albinus <michael.albinus@gmx.de>
parents: 76326
diff changeset
4450 (when jka
d55ab93ab5bf * net/tramp.el (tramp-register-file-name-handler)
Michael Albinus <michael.albinus@gmx.de>
parents: 76326
diff changeset
4451 (setq file-name-handler-alist
d55ab93ab5bf * net/tramp.el (tramp-register-file-name-handler)
Michael Albinus <michael.albinus@gmx.de>
parents: 76326
diff changeset
4452 (cons jka (delete jka file-name-handler-alist))))))
d55ab93ab5bf * net/tramp.el (tramp-register-file-name-handler)
Michael Albinus <michael.albinus@gmx.de>
parents: 76326
diff changeset
4453
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4454 ;; `tramp-file-name-handler' must be registered before evaluation of
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4455 ;; site-start and init files, because there might exist remote files
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4456 ;; already, f.e. files kept via recentf-mode.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4457 ;;;###autoload(tramp-register-file-name-handler)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4458 (tramp-register-file-name-handler)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4459
76846
d55ab93ab5bf * net/tramp.el (tramp-register-file-name-handler)
Michael Albinus <michael.albinus@gmx.de>
parents: 76326
diff changeset
4460 ;;;###autoload
d55ab93ab5bf * net/tramp.el (tramp-register-file-name-handler)
Michael Albinus <michael.albinus@gmx.de>
parents: 76326
diff changeset
4461 (defsubst tramp-register-completion-file-name-handler ()
d55ab93ab5bf * net/tramp.el (tramp-register-file-name-handler)
Michael Albinus <michael.albinus@gmx.de>
parents: 76326
diff changeset
4462 "Add tramp completion file name handler to `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
4463 ;; Remove autoloaded handler from file name handler alist. Useful,
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4464 ;; 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
4465 (let ((a1 (rassq
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4466 'tramp-completion-file-name-handler file-name-handler-alist)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4467 (setq file-name-handler-alist (delete a1 file-name-handler-alist)))
72569
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
4468 ;; `partial-completion-mode' is unknown in XEmacs. So we should
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
4469 ;; load it unconditionally there. In the GNU Emacs case, method/
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
4470 ;; user/host name completion shall be bound to `partial-completion-mode'.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4471 ;; `ido-mode' and `icy-mode' are other packages which extend file
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4472 ;; name completion.
72569
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
4473 (when (or (not (boundp 'partial-completion-mode))
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
4474 (symbol-value 'partial-completion-mode)
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4475 (featurep 'ido)
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4476 (featurep 'icicles))
70191
3a3093f77da8 * net/tramp.el (tramp-register-file-name-handlers): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 70073
diff changeset
4477 (add-to-list 'file-name-handler-alist
3a3093f77da8 * net/tramp.el (tramp-register-file-name-handlers): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 70073
diff changeset
4478 (cons tramp-completion-file-name-regexp
3a3093f77da8 * net/tramp.el (tramp-register-file-name-handlers): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 70073
diff changeset
4479 'tramp-completion-file-name-handler))
70318
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4480 (put 'tramp-completion-file-name-handler 'safe-magic t))
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4481 ;; If jka-compr is already loaded, move it to the front of
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4482 ;; `file-name-handler-alist'.
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4483 (let ((jka (rassoc 'jka-compr-handler file-name-handler-alist)))
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4484 (when jka
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4485 (setq file-name-handler-alist
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4486 (cons jka (delete jka file-name-handler-alist))))))
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4487
77201b466c80 * net/tramp.el (tramp-completion-file-name-handler-alist)
Michael Albinus <michael.albinus@gmx.de>
parents: 70276
diff changeset
4488 ;; During autoload, it shall be checked whether
76846
d55ab93ab5bf * net/tramp.el (tramp-register-file-name-handler)
Michael Albinus <michael.albinus@gmx.de>
parents: 76326
diff changeset
4489 ;; `partial-completion-mode' is active. Therefore registering of
d55ab93ab5bf * net/tramp.el (tramp-register-file-name-handler)
Michael Albinus <michael.albinus@gmx.de>
parents: 76326
diff changeset
4490 ;; `tramp-completion-file-name-handler' will be delayed.
70191
3a3093f77da8 * net/tramp.el (tramp-register-file-name-handlers): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 70073
diff changeset
4491 ;;;###autoload(add-hook
70255
d57fb8c98714 * net/tramp.el (tramp-completion-file-name-handler): Disable
Michael Albinus <michael.albinus@gmx.de>
parents: 70191
diff changeset
4492 ;;;###autoload 'after-init-hook
76846
d55ab93ab5bf * net/tramp.el (tramp-register-file-name-handler)
Michael Albinus <michael.albinus@gmx.de>
parents: 76326
diff changeset
4493 ;;;###autoload '(lambda () (tramp-register-completion-file-name-handler)))
d55ab93ab5bf * net/tramp.el (tramp-register-file-name-handler)
Michael Albinus <michael.albinus@gmx.de>
parents: 76326
diff changeset
4494 (tramp-register-completion-file-name-handler)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4495
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
4496 ;;;###autoload
70191
3a3093f77da8 * net/tramp.el (tramp-register-file-name-handlers): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 70073
diff changeset
4497 (defun tramp-unload-file-name-handlers ()
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
4498 (setq file-name-handler-alist
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
4499 (delete (rassoc 'tramp-file-name-handler
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
4500 file-name-handler-alist)
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
4501 (delete (rassoc 'tramp-completion-file-name-handler
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
4502 file-name-handler-alist)
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
4503 file-name-handler-alist))))
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
4504
70191
3a3093f77da8 * net/tramp.el (tramp-register-file-name-handlers): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 70073
diff changeset
4505 (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
4506
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4507 ;;; Interactions with other packages:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4508
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4509 ;; -- complete.el --
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4510
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4511 ;; This function contributed by Ed Sabol
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4512 (defun tramp-handle-expand-many-files (name)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4513 "Like `PC-expand-many-files' for Tramp files."
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4514 (with-parsed-tramp-file-name name nil
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4515 (save-match-data
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4516 (if (or (string-match "\\*" name)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4517 (string-match "\\?" name)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4518 (string-match "\\[.*\\]" name))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4519 (progn
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4520 (let (bufstr)
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4521 ;; CCC: To do it right, we should quote certain characters
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4522 ;; in the file name, but since the echo command is going to
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4523 ;; break anyway when there are spaces in the file names, we
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4524 ;; don't bother.
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4525 ;;-(let ((comint-file-name-quote-list
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4526 ;;- (set-difference tramp-file-name-quote-list
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4527 ;;- '(?\* ?\? ?[ ?]))))
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4528 ;;- (tramp-send-command
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4529 ;;- method user host
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4530 ;;- (format "echo %s" (comint-quote-filename localname))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4531 (tramp-send-command v (format "echo %s" localname))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4532 (setq bufstr (buffer-substring
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4533 (point-min) (tramp-compat-line-end-position)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4534 (with-current-buffer (tramp-get-buffer v)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4535 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4536 (if (string-equal localname bufstr)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4537 nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4538 (insert "(\"")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4539 (while (search-forward " " nil t)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4540 (delete-backward-char 1)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4541 (insert "\" \""))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4542 (goto-char (point-max))
46009
72200622ada8 (tramp-ftp-method): New user option.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 45861
diff changeset
4543 (delete-backward-char 1)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4544 (insert "\")")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4545 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4546 (mapcar
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4547 (function (lambda (x)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4548 (tramp-make-tramp-file-name method user host x)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4549 (read (current-buffer)))))))
56460
9459300bf43b Sync with Tramp 2.0.43.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 56424
diff changeset
4550 (list (expand-file-name name))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4551
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
4552 (eval-after-load "complete"
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
4553 '(progn
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
4554 (defadvice PC-expand-many-files
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
4555 (around tramp-advice-PC-expand-many-files (name) activate)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4556 "Invoke `tramp-handle-expand-many-files' for Tramp files."
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
4557 (if (tramp-tramp-file-p name)
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
4558 (setq ad-return-value (tramp-handle-expand-many-files name))
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
4559 ad-do-it))
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
4560 (add-hook 'tramp-unload-hook
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
4561 '(lambda () (ad-unadvise 'PC-expand-many-files)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
4562
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4563 ;;; File name handler functions for completion mode
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4564
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4565 ;; 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
4566 ;; `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
4567 ;; 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
4568 ;; 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
4569 ;; `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
4570 ;; 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
4571 ;; 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
4572 ;; variable. On the other hand, those files shouldn't have partial
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4573 ;; tramp file name syntax. Maybe another variable should be introduced
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4574 ;; overwriting this check in such cases. Or we change tramp file name
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4575 ;; 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
4576 (defun tramp-completion-mode-p ()
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4577 "Checks 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
4578 (or
b8f420afb6df * net/tramp.el (tramp-completion-mode-p): Rename from
Michael Albinus <michael.albinus@gmx.de>
parents: 84739
diff changeset
4579 ;; Emacs
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4580 (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
4581 (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
4582 (or
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4583 ;; ?\t has event-modifier 'control
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4584 (char-equal last-input-event ?\t)
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4585 (and (not (event-modifiers last-input-event))
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4586 (or (char-equal last-input-event ?\?)
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4587 (char-equal last-input-event ?\ )))))
84833
b8f420afb6df * net/tramp.el (tramp-completion-mode-p): Rename from
Michael Albinus <michael.albinus@gmx.de>
parents: 84739
diff changeset
4588 ;; XEmacs
b8f420afb6df * net/tramp.el (tramp-completion-mode-p): Rename from
Michael Albinus <michael.albinus@gmx.de>
parents: 84739
diff changeset
4589 (and (featurep 'xemacs)
b8f420afb6df * net/tramp.el (tramp-completion-mode-p): Rename from
Michael Albinus <michael.albinus@gmx.de>
parents: 84739
diff changeset
4590 ;; `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
4591 (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
4592 ;; `last-input-event' may have no character approximation.
b8f420afb6df * net/tramp.el (tramp-completion-mode-p): Rename from
Michael Albinus <michael.albinus@gmx.de>
parents: 84739
diff changeset
4593 (funcall (symbol-function '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
4594 (or
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4595 ;; ?\t has event-modifier 'control
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4596 (char-equal
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4597 (funcall (symbol-function 'event-to-character)
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4598 last-input-event) ?\t)
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4599 (and (not (event-modifiers last-input-event))
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4600 (or (char-equal
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4601 (funcall (symbol-function 'event-to-character)
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4602 last-input-event) ?\?)
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4603 (char-equal
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4604 (funcall (symbol-function 'event-to-character)
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
4605 last-input-event) ?\ )))))))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4606
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4607 ;; 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
4608 ;; `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
4609 ;; 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
4610 ;;;###autoload
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4611 (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
4612 "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
4613
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4614 (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
4615 (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
4616 ;; Possible completion structures.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4617 (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
4618 result result1)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4619
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4620 (while v
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4621 (let* ((car (car v))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4622 (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
4623 (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
4624 (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
4625 (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
4626 (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
4627 (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
4628 all-user-hosts)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4629
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4630 (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
4631
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4632 (if (or user host)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4633
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4634 ;; 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
4635 (progn
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4636 (mapc
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4637 (lambda (x)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4638 (setq all-user-hosts
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4639 (append all-user-hosts
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4640 (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
4641 (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
4642
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4643 (setq result
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4644 (append result
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4645 (mapcar
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4646 (lambda (x)
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4647 (tramp-get-completion-user-host
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4648 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
4649 (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
4650
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4651 ;; Possible methods.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4652 (setq result
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4653 (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
4654
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4655 (setq v (cdr v))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4656
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4657 ;; 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
4658 (while result
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4659 (let ((car (car result)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4660 (when car
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4661 (add-to-list
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4662 'result1
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4663 (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
4664 (setq result (cdr result))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4665
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4666 ;; Complete local parts.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4667 (append
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4668 result1
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4669 (condition-case nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4670 (tramp-completion-run-real-handler
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4671 'file-name-all-completions (list filename directory))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4672 (error nil)))))
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4673
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4674 ;; 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
4675 ;;;###autoload
74766
ca4412906dbd * net/ange-ftp.el (ange-ftp-file-name-completion): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 74739
diff changeset
4676 (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
4677 (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
4678 "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
4679 (try-completion
ca4412906dbd * net/ange-ftp.el (ange-ftp-file-name-completion): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 74739
diff changeset
4680 filename
ca4412906dbd * net/ange-ftp.el (ange-ftp-file-name-completion): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 74739
diff changeset
4681 (mapcar 'list (file-name-all-completions 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
4682 (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
4683 (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
4684
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4685 ;; 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
4686 ;; 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
4687 ;; 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
4688 ;; 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
4689 ;; 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
4690
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4691 ;; Expected results:
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4692
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4693 ;; "/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
4694 ;; [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
4695 ;; [nil "x" nil nil]
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4696 ;; ["x" nil nil nil]
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4697
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4698 ;; "/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
4699 ;; [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
4700 ;; "/[x/" "/[x/y"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4701 ;; ["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
4702 ;; ["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
4703
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4704 ;; "/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
4705 ;; [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
4706 ;; "/[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
4707 ;; ["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
4708 (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
4709 "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
4710 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
4711
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4712 (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
4713 (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
4714 ;; "/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
4715 (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
4716 (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
4717 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
4718 ;; "/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
4719 (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
4720 (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
4721 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
4722 ;; "/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
4723 (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
4724 (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
4725 nil nil 1 nil))
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4726 ;; "/user@host" "/[user@host"
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4727 (tramp-completion-file-name-structure4
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4728 (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
4729 "\\(" 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
4730 "\\(" 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
4731 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
4732 ;; "/method:user" "/[method/user" "/method://user"
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4733 (tramp-completion-file-name-structure5
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4734 (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
4735 "\\(" 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
4736 "\\(" 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
4737 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
4738 ;; "/method:host" "/[method/host" "/method://host"
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4739 (tramp-completion-file-name-structure6
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4740 (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
4741 "\\(" 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
4742 "\\(" 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
4743 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
4744 ;; "/method:user@host" "/[method/user@host" "/method://user@host"
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4745 (tramp-completion-file-name-structure7
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4746 (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
4747 "\\(" 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
4748 "\\(" 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
4749 "\\(" 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
4750 1 2 3 nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4751 ;; "/method: "/method:/"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4752 (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
4753 (list
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4754 (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
4755 (concat tramp-prefix-regexp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4756 "\\(" tramp-method-regexp "\\)"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4757 "\\(" (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
4758 "\\|" (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
4759 "\\(" "\\)$")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4760 ;; 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
4761 (concat tramp-prefix-regexp "/$"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4762 1 3 nil nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4763 ;; "/method: "/method:/"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4764 (tramp-completion-file-name-structure9
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4765 (list
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4766 (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
4767 (concat tramp-prefix-regexp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4768 "\\(" tramp-method-regexp "\\)"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4769 "\\(" (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
4770 "\\|" (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
4771 "\\(" "\\)$")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4772 ;; 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
4773 (concat tramp-prefix-regexp "/$"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4774 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
4775
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4776 (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
4777 (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
4778 (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
4779 (list
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4780 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
4781 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
4782 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
4783 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
4784 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
4785 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
4786 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
4787 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
4788 tramp-completion-file-name-structure9
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4789 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
4790
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4791 (delq nil result)))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4792
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4793 (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
4794 "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
4795 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
4796 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
4797
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4798 (save-match-data
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4799 (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
4800 (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
4801 (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
4802 (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
4803 (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
4804 (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
4805 (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
4806 (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
4807 (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
4808 (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
4809
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4810 ;; 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
4811 ;; trailing method delimeter.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4812 (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
4813 "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
4814 (mapcar
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
4815 (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
4816 (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
4817 (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
4818 (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
4819 (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
4820
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4821 ;; 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
4822 (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
4823 "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
4824 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
4825 (cond
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4826
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4827 ((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
4828 (if (and host
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4829 (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
4830 (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
4831 (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
4832 (setq user nil
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4833 host nil)))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4834
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4835 (partial-user
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4836 (setq host nil)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4837 (unless
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4838 (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
4839 (setq user nil)))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4840
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4841 (partial-host
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4842 (setq user nil)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4843 (unless
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4844 (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
4845 (setq host nil)))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4846
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4847 (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
4848 host nil)))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4849
47578
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
4850 (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
4851 (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
4852
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4853 (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
4854 "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
4855 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
4856 ;; 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
4857 ;; `default-directory' is remote.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4858 (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
4859 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
4860 (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
4861 (with-temp-buffer
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4862 (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
4863 (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
4864 (while (not (eobp))
47578
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
4865 (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
4866 res))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4867
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4868 (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
4869 "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
4870 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
4871 (let ((result)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4872 (regexp
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4873 (concat
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4874 "^\\(" tramp-host-regexp "\\)"
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4875 "\\([ \t]+" "\\(" tramp-user-regexp "\\)" "\\)?")))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4876 (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
4877 (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
4878 (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
4879 (widen)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4880 (forward-line 1)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4881 result))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4882
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4883 (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
4884 "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
4885 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
4886 ;; 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
4887 ;; `default-directory' is remote.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4888 (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
4889 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
4890 (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
4891 (with-temp-buffer
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4892 (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
4893 (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
4894 (while (not (eobp))
47578
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
4895 (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
4896 res))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4897
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4898 (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
4899 "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
4900 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
4901 (let ((result)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4902 (regexp (concat "^\\(" tramp-host-regexp "\\)")))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4903 (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
4904 (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
4905 (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
4906 (widen)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4907 (or
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4908 (> (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
4909 (forward-line 1))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4910 result))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4911
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
4912 (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
4913 "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
4914 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
4915 ;; 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
4916 ;; `default-directory' is remote.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4917 (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
4918 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
4919 (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
4920 (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
4921 (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
4922 (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
4923 (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
4924 (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
4925 res))
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
4926
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
4927 (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
4928 "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
4929 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
4930 (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
4931 (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
4932 (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
4933 (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
4934 (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
4935 (widen)
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
4936 (or
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
4937 (> (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
4938 (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
4939 result))
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
4940
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4941 (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
4942 "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
4943 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
4944 ;; 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
4945 ;; `default-directory' is remote.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4946 (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
4947 (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
4948 (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
4949 result)
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4950 (while files
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4951 (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
4952 (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
4953 (setq files (cdr files)))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4954 result))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4955
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4956 (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
4957 "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
4958 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
4959 ;; 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
4960 ;; `default-directory' is remote.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4961 (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
4962 (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
4963 "\\)\\.ssh-\\(dss\\|rsa\\)\\.pub$"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
4964 (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
4965 result)
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4966 (while files
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4967 (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
4968 (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
4969 (setq files (cdr files)))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4970 result))
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
4971
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4972 (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
4973 "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
4974 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
4975 ;; 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
4976 ;; `default-directory' is remote.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4977 (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
4978 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
4979 (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
4980 (with-temp-buffer
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4981 (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
4982 (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
4983 (while (not (eobp))
47578
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
4984 (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
4985 res))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4986
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4987 (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
4988 "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
4989 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
4990 (let ((result)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4991 (regexp (concat "^\\(" tramp-host-regexp "\\)")))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
4992 (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
4993 (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
4994 (unless (char-equal (or (char-after) ?\n) ?:) ; no IPv6
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4995 (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
4996 (widen)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4997 (or
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
4998 (> (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
4999 (forward-line 1))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5000 result))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5001
49612
407d6516031a 2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49598
diff changeset
5002 ;; 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
5003 ;; 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
5004 ;; 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
5005 ;; 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
5006 (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
5007 "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
5008 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
5009 ;; 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
5010 ;; `default-directory' is remote.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
5011 (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
5012 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
5013 (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
5014 '(("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
5015 (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
5016 (with-temp-buffer
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5017 (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
5018 (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
5019 (while (not (eobp))
47578
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
5020 (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
5021 res)))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5022
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5023 (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
5024 "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
5025 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
5026 (let ((result)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5027 (regexp (concat "^\\(" tramp-user-regexp "\\):")))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
5028 (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
5029 (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
5030 (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
5031 (widen)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5032 (forward-line 1)
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5033 result))
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5034
47578
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
5035 (defun tramp-parse-netrc (filename)
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
5036 "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
5037 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
5038 ;; 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
5039 ;; `default-directory' is remote.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
5040 (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
5041 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
5042 (when (file-readable-p filename)
47578
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
5043 (with-temp-buffer
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
5044 (insert-file-contents filename)
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
5045 (goto-char (point-min))
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
5046 (while (not (eobp))
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
5047 (push (tramp-parse-netrc-group) res))))
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
5048 res))
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
5049
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
5050 (defun tramp-parse-netrc-group ()
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
5051 "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
5052 User may be nil."
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
5053 (let ((result)
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
5054 (regexp
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
5055 (concat
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
5056 "^[ \t]*machine[ \t]+" "\\(" tramp-host-regexp "\\)"
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
5057 "\\([ \t]+login[ \t]+" "\\(" tramp-user-regexp "\\)" "\\)?")))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
5058 (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
5059 (when (re-search-forward regexp nil t)
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
5060 (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
5061 (widen)
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
5062 (forward-line 1)
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
5063 result))
6e910ba94c42 Version 2.0.22 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47577
diff changeset
5064
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5065 (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
5066 "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
5067 User is always nil."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5068 ;; 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
5069 ;; `default-directory' is remote.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
5070 (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
5071 res)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5072 (with-temp-buffer
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5073 (when (zerop (call-process "reg" nil t nil "query" registry))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5074 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5075 (while (not (eobp))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5076 (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
5077 res))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5078
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5079 (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
5080 "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
5081 User is always nil."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5082 (let ((result)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5083 (regexp (concat (regexp-quote registry) "\\\\\\(.+\\)")))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
5084 (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
5085 (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
5086 (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
5087 (widen)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5088 (forward-line 1)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5089 result))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5090
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5091 ;;; Internal Functions:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5092
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5093 (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
5094 "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
5095 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
5096 (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
5097 (scripts (tramp-get-connection-property p "scripts" nil)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5098 (unless (memq name scripts)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5099 (tramp-message vec 5 "Sending script `%s'..." name)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5100 ;; The script could contain a call of Perl. This is masked with `%s'.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5101 (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
5102 vec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5103 (format "%s () {\n%s\n}" name
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5104 (format script (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
5105 (tramp-set-connection-property p "scripts" (cons name scripts))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5106 (tramp-message vec 5 "Sending script `%s'...done." name))))
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
5107
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5108 (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
5109 (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
5110 (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
5111 'tramp-sh-file-name-handler)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5112 auto-save-default)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5113 (auto-save-mode 1)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5114 (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
5115 (add-hook 'tramp-unload-hook
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
5116 '(lambda ()
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
5117 (remove-hook 'find-file-hooks 'tramp-set-auto-save)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5118
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5119 (defun tramp-run-test (switch filename)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5120 "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
5121 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
5122 (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
5123 (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
5124 v
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5125 (format
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5126 "%s %s %s"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5127 (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
5128 switch
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5129 (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
5130
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5131 (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
5132 "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
5133 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
5134 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
5135 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
5136 (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
5137 (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
5138 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5139 v 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5140 "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
5141 (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
5142 (with-parsed-tramp-file-name file1 v2
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5143 (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
5144 v1
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5145 (format format-string
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5146 (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
5147 (tramp-shell-quote-argument v2-localname))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5148
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5149 (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
5150 "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
5151 ;; 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
5152 ;; 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
5153 ;; tamper the name.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5154 (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
5155 (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
5156 (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
5157 (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
5158 (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
5159 (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
5160
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5161 (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
5162 "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
5163 (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
5164 (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
5165 (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
5166 (setq default-directory
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5167 (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
5168 (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
5169 (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
5170 (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
5171 "/"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5172 (current-buffer))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5173
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5174 (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
5175 "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
5176 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
5177 from `tramp-get-buffer'."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5178 (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
5179 (tramp-get-buffer vec)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5180
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5181 (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
5182 "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
5183 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
5184 from the default one."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5185 (get-process
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5186 (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
5187 (tramp-buffer-name vec))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5188
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5189 (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
5190 "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
5191 ;; 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
5192 ;; 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
5193 ;; tamper the name.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5194 (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
5195 (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
5196 (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
5197 (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
5198 (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
5199 (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
5200
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5201 (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
5202 "Get the debug buffer for VEC."
59582
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
5203 (with-current-buffer
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5204 (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
5205 (when (bobp)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5206 (setq buffer-undo-list t)
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
5207 ;; Activate outline-mode. This runs `text-mode-hook' and
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
5208 ;; `outline-mode-hook'. We must prevent that local processes
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
5209 ;; die. Yes: I've seen `flyspell-mode', which starts "ispell"
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
5210 ;; ...
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
5211 (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
5212 (outline-mode))
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
5213 (set (make-local-variable 'outline-regexp)
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
5214 "[0-9]+:[0-9]+:[0-9]+ [a-z0-9-]+ (\\([0-9]+\\)) #")
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
5215 ; (set (make-local-variable 'outline-regexp)
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
5216 ; "[a-z.-]+:[0-9]+: [a-z0-9-]+ (\\([0-9]+\\)) #")
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
5217 (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
5218 (current-buffer)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5219
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5220 (defun tramp-outline-level ()
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5221 "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
5222 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
5223
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5224 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
5225 (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
5226
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5227 (defun tramp-find-executable
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5228 (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
5229 "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
5230 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
5231 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
5232 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
5233 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
5234 only in DIRLIST.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5235
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
5236 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
5237
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5238 This function expects to be in the right *tramp* buffer."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5239 (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
5240 (let (result)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5241 ;; 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
5242 ;; 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
5243 ;; 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
5244 (unless ignore-path
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5245 (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
5246 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5247 (if (looking-at "^1$")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5248 (setq result (concat "\\" progname))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5249 (unless result
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5250 (when ignore-tilde
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5251 ;; Remove all ~/foo directories from dirlist. In Emacs 20,
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5252 ;; `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
5253 (let (newdl d)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5254 (while dirlist
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5255 (setq d (car dirlist))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5256 (setq dirlist (cdr dirlist))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5257 (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
5258 (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
5259 (setq dirlist (nreverse newdl))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5260 (tramp-send-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5261 vec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5262 (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
5263 "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
5264 "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
5265 "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
5266 "%s\nEOF")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5267 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
5268 (goto-char (point-max))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5269 (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
5270 (skip-chars-forward "^ ")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5271 (skip-chars-forward " ")
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
5272 (setq result (buffer-substring
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
5273 (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
5274 result)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5275
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5276 (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
5277 "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
5278 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
5279 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
5280 variable PATH."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5281 (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
5282 (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
5283 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
5284 (mapconcat 'identity (tramp-get-remote-path vec) ":"))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5285
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5286 ;; -- communication with external shell --
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5287
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5288 (defun tramp-find-file-exists-command (vec)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5289 "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
5290 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
5291 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
5292 (let ((existing "/")
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5293 (nonexisting
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5294 (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
5295 result)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5296 ;; 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
5297 ;; For each command, we first run `$cmd /' -- this should return
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5298 ;; 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
5299 ;; `$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
5300 ;; 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
5301 ;; command we find that seems to work.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5302 ;; 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
5303 ;; `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
5304 ;; 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
5305 ;; 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
5306 ;; `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
5307 ;; 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
5308 ;; `/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
5309 ;; 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
5310 ;; 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
5311 ;; `/usr/bin/test'.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5312 ;; `/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
5313 (unless (or
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5314 (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
5315 (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
5316 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
5317 (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
5318 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
5319 (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
5320 (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
5321 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
5322 (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
5323 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
5324 (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
5325 (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
5326 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
5327 (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
5328 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
5329 (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
5330 (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
5331 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
5332 (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
5333 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
5334 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5335 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
5336 result))
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
5337
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5338
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5339 ;; 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
5340 (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
5341 "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
5342 (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
5343 (let (shell)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5344 (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
5345 (tramp-send-command vec "echo ~root")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5346 (cond
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5347 ((string-match "^~root$" (buffer-string))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5348 (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
5349 (or (tramp-find-executable
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
5350 vec "bash" (tramp-get-remote-path vec) t)
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
5351 (tramp-find-executable
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
5352 vec "ksh" (tramp-get-remote-path vec) t)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5353 (unless shell
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5354 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5355 vec 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5356 "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
5357 ;; 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
5358 (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
5359 item extra-args)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5360 (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
5361 (setq item (pop alist))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5362 (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
5363 (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
5364 (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
5365 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5366 vec 5 "Starting remote shell `%s' for tilde expansion..." shell)
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
5367 (tramp-send-command-internal
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
5368 vec (concat "PROMPT_COMMAND='' PS1='$ ' exec " shell))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5369 (tramp-message vec 5 "Setting remote shell prompt...")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5370 ;; Douglas Gray Stephens <DGrayStephens@slb.com> says that we
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5371 ;; must use "\n" here, not tramp-rsh-end-of-line. Kai left the
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5372 ;; last tramp-rsh-end-of-line, Douglas wanted to replace that,
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5373 ;; as well.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5374 (tramp-send-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5375 vec
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
5376 (format "PROMPT_COMMAND=''; PS1='%s%s%s'; PS2=''; PS3=''"
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5377 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
5378 tramp-end-of-output
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5379 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
5380 (tramp-message vec 5 "Setting remote shell prompt...done"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5381 (t (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5382 vec 5 "Remote `%s' groks tilde expansion, good"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5383 (tramp-get-method-parameter
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5384 (tramp-file-name-method vec) 'tramp-remote-sh))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5385 (tramp-set-connection-property
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5386 vec "remote-shell"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5387 (tramp-get-method-parameter
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5388 (tramp-file-name-method vec) 'tramp-remote-sh))))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5389
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
5390 ;; ------------------------------------------------------------
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
5391 ;; -- 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
5392 ;; ------------------------------------------------------------
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5393
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
5394 ;; 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
5395 ;; 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
5396 ;; `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
5397
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5398 (defun tramp-action-login (proc vec)
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
5399 "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
5400 (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
5401 (save-window-excursion
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5402 (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
5403 (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
5404 (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
5405 (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
5406 (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
5407 (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
5408 (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
5409
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5410 (defun tramp-action-password (proc vec)
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
5411 "Query the user for a password."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5412 (tramp-message vec 3 "Sending password")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5413 (tramp-enter-password proc))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5414
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5415 (defun tramp-action-succeed (proc vec)
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
5416 "Signal success in finding shell prompt."
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
5417 (throw 'tramp-action 'ok))
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
5418
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5419 (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
5420 "Signal permission denied."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5421 (kill-process proc)
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
5422 (throw 'tramp-action 'permission-denied))
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
5423
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5424 (defun tramp-action-yesno (proc vec)
46992
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
5425 "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
5426 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
5427 See also `tramp-action-yn'."
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
5428 (save-window-excursion
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5429 (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
5430 (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
5431 (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
5432 (kill-process proc)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5433 (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
5434 (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
5435 (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
5436 (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
5437
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5438 (defun tramp-action-yn (proc vec)
46992
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
5439 "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
5440 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
5441 See also `tramp-action-yesno'."
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
5442 (save-window-excursion
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5443 (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
5444 (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
5445 (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
5446 (kill-process proc)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5447 (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
5448 (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
5449 (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
5450 (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
5451
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5452 (defun tramp-action-terminal (proc vec)
47771
ac3dfc909b56 Version 2.0.25 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47683
diff changeset
5453 "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
5454 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
5455 (tramp-message vec 5 "Setting `%s' as terminal type." tramp-terminal-type)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5456 (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
5457
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5458 (defun tramp-action-process-alive (proc vec)
55844
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
5459 "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
5460 (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
5461 (throw 'tramp-action 'process-died)))
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
5462
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5463 (defun tramp-action-out-of-band (proc vec)
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
5464 "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
5465 (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
5466 (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
5467 (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
5468 (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
5469 ((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
5470 (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
5471 (memq (process-status proc) '(signal)))
59582
92796330257a Sync with Tramp 2.0.47.
Michael Albinus <michael.albinus@gmx.de>
parents: 59031
diff changeset
5472 ;; `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
5473 ;; 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
5474 (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
5475 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5476 (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
5477 (progn
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5478 (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
5479 (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
5480 (throw 'tramp-action 'ok))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5481 (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
5482 (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
5483 (t nil)))
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
5484
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
5485 ;; Functions for processing the actions.
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
5486
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5487 (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
5488 "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
5489 (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
5490 (while (not found)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5491 ;; 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
5492 ;; 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
5493 (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
5494 (setq todo actions)
bdffb0038313 * net/tramp.el: (tramp-process-one-action): Remove `with-timeout'.
Michael Albinus <michael.albinus@gmx.de>
parents: 75007
diff changeset
5495 (while todo
bdffb0038313 * net/tramp.el: (tramp-process-one-action): Remove `with-timeout'.
Michael Albinus <michael.albinus@gmx.de>
parents: 75007
diff changeset
5496 (setq item (pop todo))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5497 (setq pattern (concat (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
5498 (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
5499 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5500 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
5501 (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
5502 (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
5503 (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
5504 found))
bdffb0038313 * net/tramp.el: (tramp-process-one-action): Remove `with-timeout'.
Michael Albinus <michael.albinus@gmx.de>
parents: 75007
diff changeset
5505
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5506 (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
5507 "Perform actions until success or TIMEOUT."
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
5508 (let (exit)
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
5509 (while (not exit)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5510 (tramp-message proc 3 "Waiting for prompts from remote shell")
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
5511 (setq exit
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
5512 (catch 'tramp-action
75148
bdffb0038313 * net/tramp.el: (tramp-process-one-action): Remove `with-timeout'.
Michael Albinus <michael.albinus@gmx.de>
parents: 75007
diff changeset
5513 (if timeout
bdffb0038313 * net/tramp.el: (tramp-process-one-action): Remove `with-timeout'.
Michael Albinus <michael.albinus@gmx.de>
parents: 75007
diff changeset
5514 (with-timeout (timeout)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5515 (tramp-process-one-action proc vec actions))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5516 (tramp-process-one-action proc vec actions)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5517 (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
5518 (tramp-message vec 6 "\n%s" (buffer-string)))
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
5519 (unless (eq exit 'ok)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5520 (tramp-clear-passwd)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5521 (tramp-error-with-buffer
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5522 nil vec 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5523 (cond
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5524 ((eq exit 'permission-denied) "Permission denied")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5525 ((eq exit 'process-died) "Process died")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5526 (t "Login failed"))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5527
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5528 ;; Utility functions.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5529
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5530 (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
5531 "Like `accept-process-output' for Tramp processes.
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
5532 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
5533 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
5534 (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
5535 (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
5536 (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
5537 ;; 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
5538 ;; 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
5539 (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
5540 (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
5541 (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
5542
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5543 (defun 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
5544 "Check whether REGEXP is contained in process buffer of PROC.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5545 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
5546 (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
5547 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5548 ;; 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
5549 (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
5550 (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
5551 (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
5552 (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
5553 ;; 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
5554 (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
5555 (tramp-message proc 5 "echo-mark found")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5556 (forward-line)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5557 (delete-region begin (point))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5558 (goto-char (point-min)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5559 ;; No echo to be handled, now we can look for the regexp.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5560 (when (not (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
5561 (re-search-forward regexp nil t))))
64772
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
5562
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5563 (defun tramp-wait-for-regexp (proc timeout regexp)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5564 "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
5565 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
5566 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
5567 nil."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5568 (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
5569 (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
5570 (start-time (current-time)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5571 (cond (timeout
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5572 ;; 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
5573 ;; 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
5574 ;; 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
5575 (while (and (not found)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5576 (< (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
5577 timeout))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5578 (with-timeout (timeout)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5579 (while (not found)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5580 (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
5581 (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
5582 (tramp-error-with-buffer
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5583 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
5584 (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
5585 (t
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5586 (while (not found)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5587 (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
5588 (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
5589 (tramp-error-with-buffer
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5590 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
5591 (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
5592 (tramp-message proc 6 "\n%s" (buffer-string))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5593 (when (not found)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5594 (if timeout
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5595 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5596 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
5597 regexp timeout)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5598 (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
5599 found)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5600
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
5601 (defun tramp-wait-for-shell-prompt (proc timeout)
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
5602 "Wait for the shell prompt to appear from process PROC within TIMEOUT seconds.
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
5603 See `tramp-wait-for-regexp' for more details.
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
5604 Shell prompt pattern is determined by variables `shell-prompt-pattern'
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
5605 and `tramp-shell-prompt-pattern'."
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
5606 (tramp-wait-for-regexp
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
5607 proc timeout
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
5608 (format "\\(%s\\|%s\\)\\'"
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
5609 shell-prompt-pattern tramp-shell-prompt-pattern)))
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
5610
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
5611 (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
5612 "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
5613 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
5614 seconds. If not, it produces an error message with the given ERROR-ARGS."
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
5615 (unless (tramp-wait-for-shell-prompt proc timeout)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5616 (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
5617
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5618 ;; We don't call `tramp-send-string' in order to hide the password from the
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5619 ;; debug buffer, and because end-of-line handling of the string.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5620 (defun tramp-enter-password (p)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5621 "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
5622 (process-send-string
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5623 p (concat (tramp-read-passwd p)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5624 (or (tramp-get-method-parameter
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5625 tramp-current-method
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5626 'tramp-password-end-of-line)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5627 tramp-default-password-end-of-line))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5628
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5629 (defun tramp-open-connection-setup-interactive-shell (proc vec)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5630 "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
5631 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
5632 process to set up. VEC specifies the connection."
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5633 ;; It is useful to set the prompt in the following command because
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5634 ;; some people have a setting for $PS1 which /bin/sh doesn't know
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5635 ;; about and thus /bin/sh will display a strange prompt. For
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5636 ;; example, if $PS1 has "${CWD}" in the value, then ksh will display
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5637 ;; the current working directory but /bin/sh will display a dollar
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5638 ;; sign. The following command line sets $PS1 to a sane value, and
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5639 ;; works under Bourne-ish shells as well as csh-like shells. Daniel
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5640 ;; Pittman reports that the unusual positioning of the single quotes
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
5641 ;; makes it work under `rc', too. We also unset the variable $ENV
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
5642 ;; because that is read by some sh implementations (eg, bash when
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
5643 ;; called as sh) on startup; this way, we avoid the startup file
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
5644 ;; clobbering $PS1. $PROMP_COMMAND is another way to set the prompt
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
5645 ;; in /bin/bash, it must be discarded as well.
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
5646 (tramp-send-command-internal
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5647 vec
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
5648 (format "exec env 'ENV=' 'PROMPT_COMMAND=' 'PS1=$ ' %s"
53206
0c19f1a19b2b (tramp-chunksize): Extend docstring. Suggested by
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 52401
diff changeset
5649 (tramp-get-method-parameter
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5650 (tramp-file-name-method vec) 'tramp-remote-sh)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5651 (tramp-message vec 5 "Setting up remote shell environment")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5652 (tramp-send-command-internal vec "stty -inlcr -echo kill '^U' erase '^H'")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5653 ;; Check whether the echo has really been disabled. Some
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5654 ;; implementations, like busybox of embedded GNU/Linux, don't
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5655 ;; support disabling.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5656 (tramp-send-command-internal vec "echo foo")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5657 (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
5658 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5659 (when (looking-at "echo foo")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5660 (tramp-set-connection-property vec "remote-echo" t)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5661 (tramp-message vec 5 "Remote echo still on. Ok.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5662 ;; Make sure backspaces and their echo are enabled and no line
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5663 ;; width magic interferes with them.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5664 (tramp-send-command-internal vec "stty icanon erase ^H cols 32767")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5665 ;; Try to set up the coding system correctly.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5666 ;; CCC this can't be the right way to do it. Hm.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5667 (tramp-message vec 5 "Determining coding system")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5668 (tramp-send-command-internal vec "echo foo ; echo bar")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5669 (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
5670 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5671 (if (featurep 'mule)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5672 ;; 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
5673 ;; with the process.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5674 (let* ((cs (or (process-coding-system proc)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5675 (cons 'undecided 'undecided)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5676 cs-decode cs-encode)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5677 (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
5678 (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
5679 (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
5680 (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
5681 (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
5682 (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
5683 cs-encode 'unix))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5684 (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
5685 (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
5686 cs-decode 'dos)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5687 (set-buffer-process-coding-system cs-decode cs-encode))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5688 ;; Look for ^M and do something useful if found.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5689 (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
5690 ;; 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
5691 ;; 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
5692 ;; stty, instead.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5693 (tramp-send-command-internal vec "stty -onlcr"))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5694 (tramp-send-command-internal vec "set +o vi +o emacs")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5695 (tramp-message vec 5 "Setting shell prompt")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5696 ;; Douglas Gray Stephens <DGrayStephens@slb.com> says that we must
84942
437d3bb02139 * net/tramp.el (tramp-maybe-open-connection): Make test for alive
Michael Albinus <michael.albinus@gmx.de>
parents: 84833
diff changeset
5697 ;; use "\n" here, not 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
5698 (tramp-send-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5699 vec
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
5700 (format "PROMPT_COMMAND=''; PS1='%s%s%s'; PS2=''; PS3=''"
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5701 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
5702 tramp-end-of-output
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5703 tramp-rsh-end-of-line))
62344
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
5704 ;; Check whether the remote host suffers from buggy `send-process-string'.
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
5705 ;; This is known for FreeBSD (see comment in `send_process', file process.c).
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
5706 ;; I've tested sending 624 bytes successfully, sending 625 bytes failed.
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
5707 ;; Emacs makes a hack when this host type is detected locally. It cannot
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
5708 ;; handle remote hosts, though.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5709 (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
5710 (cond
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5711 ((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
5712 tramp-chunksize)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5713 (t
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5714 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5715 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
5716 (if (string-match
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5717 "^FreeBSD"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5718 (with-connection-property vec "uname"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5719 (tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\"")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5720 500 0))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5721 ;; Set remote PATH variable.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5722 (tramp-set-remote-path vec)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5723 ;; 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
5724 ;; 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
5725 ;; "test foo; echo $?" to check if various conditions hold, and
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5726 ;; 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
5727 ;; "echo $?" part if the "test" part has an error. In particular,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5728 ;; the Solaris /bin/sh is a problem. I'm betting that all systems
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5729 ;; with buggy /bin/sh implementations will have a working bash or
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5730 ;; ksh. Whee...
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5731 (tramp-find-shell vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5732 ;; Disable unexpected output.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5733 (tramp-send-command vec "mesg n; biff n")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5734 ;; Set the environment.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5735 (tramp-message vec 5 "Setting default environment")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5736 (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
5737 unset item)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5738 (while env
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5739 (setq item (split-string (car env) "="))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5740 (if (and (stringp (cadr item)) (not (string-equal (cadr item) "")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5741 (tramp-send-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5742 vec (format "%s=%s; export %s" (car item) (cadr item) (car item)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5743 (push (car item) unset))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5744 (setq env (cdr env)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5745 (when unset
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5746 (tramp-send-command
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5747 vec (format "unset %s" (mapconcat 'identity unset " "))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
5748
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
5749 ;; 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
5750 ;; 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
5751 ;; 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
5752 ;; 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
5753 ;;
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5754 ;; 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
5755 ;; 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
5756 ;; 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
5757 ;; 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
5758 ;; 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
5759 ;; 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
5760 ;; 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
5761 ;; 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
5762 ;;
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5763 ;; 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
5764 ;;
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5765 ;; 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
5766
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5767 (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
5768 '((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
5769 (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
5770 (pack
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5771 "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
5772 "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
5773 "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
5774 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
5775
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5776 \(FORMAT ENCODING DECODING)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5777
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5778 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
5779 `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
5780
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5781 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
5782 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
5783 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
5784 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
5785 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
5786 input.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5787
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5788 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
5789 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
5790 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
5791
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5792 (defconst tramp-remote-coding-commands
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5793 '((b64 "mimencode -b" "mimencode -u -b")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5794 (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
5795 (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
5796 (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
5797 (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
5798 (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
5799 (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
5800 (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
5801 (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
5802 (pack
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5803 "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
5804 "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
5805 "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
5806 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
5807
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5808 \(FORMAT ENCODING DECODING)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5809
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5810 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
5811 `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
5812
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5813 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
5814 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
5815 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
5816 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
5817 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
5818 input.
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 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
5821 implementation for this functionality. This Perl program will be transferred
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5822 to the remote host, and it is avalible as shell function with the same name.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5823
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5824 (defun tramp-find-inline-encoding (vec)
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
5825 "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
5826 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
5827 `tramp-remote-coding-commands'."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5828 (save-excursion
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5829 (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
5830 (magic "xyzzy")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5831 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
5832 (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
5833 (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
5834 (catch 'wont-work-local
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5835 (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
5836 (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
5837 (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
5838 (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
5839 ;; 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
5840 ;; 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
5841 (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
5842 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5843 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
5844 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5845 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
5846 (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
5847 loc-enc nil nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5848 (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
5849 (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
5850 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5851 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
5852 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5853 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
5854 (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
5855 loc-dec nil nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5856 (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
5857 ;; 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
5858 (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
5859 (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
5860 (catch 'wont-work-remote
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5861 (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
5862 (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
5863 (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
5864 ;; 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
5865 ;; 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
5866 ;; 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
5867 ;; 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
5868 ;; 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
5869 ;; 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
5870 ;; 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
5871 ;; 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
5872 (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
5873 (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
5874 (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
5875 (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
5876 (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
5877 (setq rem-enc name)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5878 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5879 vec 5
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5880 "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
5881 (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
5882 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
5883 (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
5884
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5885 (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
5886 (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
5887 (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
5888 (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
5889 (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
5890 (setq rem-dec name)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5891 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5892 vec 5
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5893 "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
5894 (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
5895 vec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5896 (format "echo %s | %s | %s"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5897 magic rem-enc rem-dec) t))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5898 (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
5899
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5900 (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
5901 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5902 (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
5903 (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
5904
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5905 ;; `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
5906 (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
5907 (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
5908 (setq found t)))))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5909
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5910 ;; Did we find something? If not, issue an error.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5911 (unless found
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5912 (kill-process (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
5913 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5914 vec 'file-error "Couldn't find an inline transfer encoding"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5915
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5916 ;; Set connection properties.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5917 (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
5918 (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
5919 (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
5920 (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
5921 (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
5922 (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
5923 (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
5924 (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
5925
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
5926 (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
5927 "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
5928 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
5929 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
5930 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
5931 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
5932 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
5933 means discard it)."
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
5934 (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
5935 (call-process
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5936 tramp-encoding-shell ;program
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5937 (when (and input (not (string-match "%s" cmd)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5938 input) ;input
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5939 (if (eq output t) t nil) ;output
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5940 nil ;redisplay
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5941 tramp-encoding-command-switch
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5942 ;; actual shell command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5943 (concat
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5944 (if (string-match "%s" cmd) (format cmd input) cmd)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5945 (if (stringp output) (concat "> " output) "")))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5946
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5947 (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
5948 "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
5949 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
5950 (let ((target-alist `(,vec))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5951 (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
5952 item proxy)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5953
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5954 ;; 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
5955 (while choices
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5956 (setq item (pop choices)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5957 proxy (nth 2 item))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5958 (when (and
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5959 ;; host
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5960 (string-match (or (nth 0 item) "")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5961 (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
5962 ;; user
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5963 (string-match (or (nth 1 item) "")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5964 (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
5965 (if (null proxy)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5966 ;; No more hops needed.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5967 (setq choices nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5968 ;; Replace placeholders.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5969 (setq proxy
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5970 (format-spec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5971 proxy
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5972 `((?u . ,(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
5973 (?h . ,(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
5974 (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
5975 ;; Add the hop.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5976 (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
5977 ;; Start next search.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5978 (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
5979
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5980 ;; Handle gateways.
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
5981 (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
5982 (string-match (format
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
5983 "^\\(%s\\|%s\\)$"
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
5984 (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
5985 (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
5986 (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
5987 (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
5988 (hop (pop target-alist)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5989 ;; 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
5990 (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
5991 (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
5992 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5993 vec 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5994 "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
5995 (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
5996 ;; 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
5997 (unless
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5998 (string-match
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
5999 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
6000 (aset hop 2
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6001 (concat
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6002 (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
6003 (number-to-string
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6004 (tramp-get-method-parameter
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6005 (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
6006 ;; Open the gateway connection.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6007 (add-to-list
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6008 'target-alist
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6009 (vector
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6010 (tramp-file-name-method hop) (tramp-file-name-user hop)
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6011 (funcall (symbol-function '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
6012 ;; 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
6013 ;; 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
6014 ;; 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
6015 ;; 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
6016 (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
6017
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6018 ;; 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
6019 (when (cdr target-alist)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6020 (setq choices target-alist)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6021 (while choices
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6022 (setq item (pop choices))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6023 (when
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6024 (or
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6025 (not
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6026 (tramp-get-method-parameter
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6027 (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
6028 (tramp-get-method-parameter
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6029 (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
6030 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6031 vec 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6032 "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
6033 (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
6034
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6035 ;; Result.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6036 target-alist))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6037
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6038 (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
6039 "Maybe open a connection VEC.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6040 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
6041 connection if a previous connection has died for some reason."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6042 (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
6043
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6044 ;; If too much time has passed since last command was sent, look
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6045 ;; whether process is still alive. If it isn't, kill it. When
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6046 ;; using ssh, it can sometimes happen that the remote end has hung
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6047 ;; up but the local ssh client doesn't recognize this until it
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6048 ;; tries to send some data to the remote end. So that's why we
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6049 ;; try to send a command from time to time, then look again
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6050 ;; whether the process is really alive.
84942
437d3bb02139 * net/tramp.el (tramp-maybe-open-connection): Make test for alive
Michael Albinus <michael.albinus@gmx.de>
parents: 84833
diff changeset
6051 (condition-case nil
437d3bb02139 * net/tramp.el (tramp-maybe-open-connection): Make test for alive
Michael Albinus <michael.albinus@gmx.de>
parents: 84833
diff changeset
6052 (when (and (> (tramp-time-diff
437d3bb02139 * net/tramp.el (tramp-maybe-open-connection): Make test for alive
Michael Albinus <michael.albinus@gmx.de>
parents: 84833
diff changeset
6053 (current-time)
437d3bb02139 * net/tramp.el (tramp-maybe-open-connection): Make test for alive
Michael Albinus <michael.albinus@gmx.de>
parents: 84833
diff changeset
6054 (tramp-get-connection-property
437d3bb02139 * net/tramp.el (tramp-maybe-open-connection): Make test for alive
Michael Albinus <michael.albinus@gmx.de>
parents: 84833
diff changeset
6055 p "last-cmd-time" '(0 0 0)))
437d3bb02139 * net/tramp.el (tramp-maybe-open-connection): Make test for alive
Michael Albinus <michael.albinus@gmx.de>
parents: 84833
diff changeset
6056 60)
437d3bb02139 * net/tramp.el (tramp-maybe-open-connection): Make test for alive
Michael Albinus <michael.albinus@gmx.de>
parents: 84833
diff changeset
6057 p (processp p) (memq (process-status p) '(run open)))
437d3bb02139 * net/tramp.el (tramp-maybe-open-connection): Make test for alive
Michael Albinus <michael.albinus@gmx.de>
parents: 84833
diff changeset
6058 (tramp-send-command vec "echo are you awake" t t)
437d3bb02139 * net/tramp.el (tramp-maybe-open-connection): Make test for alive
Michael Albinus <michael.albinus@gmx.de>
parents: 84833
diff changeset
6059 (unless (and (memq (process-status p) '(run open))
437d3bb02139 * net/tramp.el (tramp-maybe-open-connection): Make test for alive
Michael Albinus <michael.albinus@gmx.de>
parents: 84833
diff changeset
6060 (tramp-wait-for-output p 10))
437d3bb02139 * net/tramp.el (tramp-maybe-open-connection): Make test for alive
Michael Albinus <michael.albinus@gmx.de>
parents: 84833
diff changeset
6061 ;; The error will be catched locally.
437d3bb02139 * net/tramp.el (tramp-maybe-open-connection): Make test for alive
Michael Albinus <michael.albinus@gmx.de>
parents: 84833
diff changeset
6062 (tramp-error vec 'file-error "Awake did fail")))
437d3bb02139 * net/tramp.el (tramp-maybe-open-connection): Make test for alive
Michael Albinus <michael.albinus@gmx.de>
parents: 84833
diff changeset
6063 (file-error
437d3bb02139 * net/tramp.el (tramp-maybe-open-connection): Make test for alive
Michael Albinus <michael.albinus@gmx.de>
parents: 84833
diff changeset
6064 (tramp-flush-connection-property vec nil)
437d3bb02139 * net/tramp.el (tramp-maybe-open-connection): Make test for alive
Michael Albinus <michael.albinus@gmx.de>
parents: 84833
diff changeset
6065 (tramp-flush-connection-property p nil)
437d3bb02139 * net/tramp.el (tramp-maybe-open-connection): Make test for alive
Michael Albinus <michael.albinus@gmx.de>
parents: 84833
diff changeset
6066 (delete-process p)
437d3bb02139 * net/tramp.el (tramp-maybe-open-connection): Make test for alive
Michael Albinus <michael.albinus@gmx.de>
parents: 84833
diff changeset
6067 (setq p nil)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6068
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6069 ;; New connection must be opened.
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6070 (unless (and p (processp p) (memq (process-status p) '(run open)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6071
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6072 ;; We call `tramp-get-buffer' in order to get a debug buffer for
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6073 ;; messages from the beginning.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6074 (tramp-get-buffer vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6075 (if (zerop (length (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
6076 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6077 vec 3 "Opening connection for %s using %s..."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6078 (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
6079 (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
6080 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6081 vec 3 "Opening connection for %s@%s using %s..."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6082 (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
6083 (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
6084 (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
6085
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6086 ;; Start new process.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6087 (when (and p (processp p))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6088 (delete-process p))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6089 (setenv "TERM" tramp-terminal-type)
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
6090 (setenv "PROMPT_COMMAND")
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6091 (setenv "PS1" "$ ")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6092 (let* ((target-alist (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
6093 (process-environment (copy-sequence process-environment))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6094 (process-connection-type tramp-process-connection-type)
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
6095 (process-adaptive-read-buffering nil)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6096 (coding-system-for-read nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6097 ;; This must be done in order to avoid our file name handler.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6098 (p (let ((default-directory
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6099 (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
6100 (start-process
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6101 (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
6102 (tramp-buffer-name vec))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6103 (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
6104 tramp-encoding-shell)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6105 (first-hop t))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6106
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6107 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6108 vec 6 "%s" (mapconcat 'identity (process-command p) " "))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6109
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6110 ;; Check whether process is alive.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6111 (set-process-sentinel p 'tramp-flush-connection-property)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6112 (tramp-set-process-query-on-exit-flag p nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6113 (tramp-message vec 3 "Waiting 60s for local shell to come up...")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6114 (tramp-barf-if-no-shell-prompt
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6115 p 60 "Couldn't find local shell prompt %s" tramp-encoding-shell)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6116
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6117 ;; Now do all the connections as specified.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6118 (while target-alist
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6119 (let* ((hop (car target-alist))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6120 (l-method (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
6121 (l-user (tramp-file-name-user hop))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6122 (l-host (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
6123 (l-port nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6124 (login-program
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6125 (tramp-get-method-parameter l-method 'tramp-login-program))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6126 (login-args
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6127 (tramp-get-method-parameter l-method 'tramp-login-args))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6128 (gw-args
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6129 (tramp-get-method-parameter l-method 'tramp-gw-args))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6130 (gw (tramp-get-file-property hop "" "gateway" nil))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6131 (g-method (and gw (tramp-file-name-method gw)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6132 (g-user (and gw (tramp-file-name-user gw)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6133 (g-host (and gw (tramp-file-name-host gw)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6134 (command login-program)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6135 spec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6136
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6137 ;; Add gateway arguments if necessary.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6138 (when (and gw gw-args)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6139 (setq login-args (append login-args gw-args)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6140
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6141 ;; Check for port number. Until now, there's no need for handling
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6142 ;; like method, user, host.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6143 (when (string-match tramp-host-with-port-regexp l-host)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6144 (setq l-port (match-string 2 l-host)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6145 l-host (match-string 1 l-host)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6146
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6147 ;; Set variables for computing the prompt for reading password.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6148 ;; They can also be derived from a gatewy.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6149 (setq tramp-current-method (or g-method l-method)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6150 tramp-current-user (or g-user l-user)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6151 tramp-current-host (or g-host l-host))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6152
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6153 ;; Replace login-args place holders.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6154 (setq
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6155 l-host (or l-host "")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6156 l-user (or l-user "")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6157 l-port (or l-port "")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6158 spec `((?h . ,l-host) (?u . ,l-user) (?p . ,l-port)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6159 (?t . ,(tramp-make-tramp-temp-file vec)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6160 command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6161 (concat
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6162 command " "
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6163 (mapconcat
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6164 '(lambda (x)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6165 (setq x (mapcar '(lambda (y) (format-spec y spec)) x))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6166 (unless (member "" x) (mapconcat 'identity x " ")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6167 login-args " ")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6168 ;; String to detect failed connection. Every single word must
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6169 ;; be enclosed with '\"'; otherwise it is detected
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6170 ;; during connection setup.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6171 ;; Local shell could be a Windows COMSPEC. It doesn't know
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6172 ;; the ";" syntax, but we must exit always for `start-process'.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6173 ;; "exec" does not work either.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6174 (if first-hop
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6175 " && exit || exit"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6176 "; echo \"Tramp\" \"connection\" \"closed\"; sleep 1"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6177 ;; We don't reach a Windows shell. Could be initial only.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6178 first-hop nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6179
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6180 ;; Send the command.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6181 (tramp-message vec 3 "Sending command `%s'" command)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6182 (tramp-send-command vec command t t)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6183 (tramp-process-actions p vec tramp-actions-before-shell 60)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6184 (tramp-message vec 3 "Found remote shell prompt on `%s'" l-host))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6185 ;; Next hop.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6186 (setq target-alist (cdr target-alist)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6187
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6188 ;; Make initial shell settings.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6189 (tramp-open-connection-setup-interactive-shell p vec)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6190
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6191 (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
6192 "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
6193 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
6194 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
6195 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
6196 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
6197 (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
6198 (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
6199 (when (tramp-get-connection-property vec "remote-echo" nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6200 ;; 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
6201 (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
6202 (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
6203 (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
6204 (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
6205 (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
6206
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6207 (defun tramp-send-command-internal (vec command)
51177
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
6208 "Send command to remote host and wait for success.
6234a4fe96f9 Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 50494
diff changeset
6209 Sends COMMAND, then waits 30 seconds for shell prompt."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6210 (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
6211 (when (tramp-get-connection-property vec "remote-echo" nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6212 ;; 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
6213 (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
6214 (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
6215 (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
6216 (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
6217 (tramp-barf-if-no-shell-prompt
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6218 p 30 "Couldn't `%s', see buffer `%s'" command (buffer-name))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6219
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6220 (defun tramp-wait-for-output (proc &optional timeout)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6221 "Wait for output from remote rsh command."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6222 (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
6223 (let ((found
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6224 (tramp-wait-for-regexp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6225 proc timeout
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6226 (format "^%s\r?$" (regexp-quote tramp-end-of-output)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6227 (if found
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6228 (let (buffer-read-only)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6229 (goto-char (point-max))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6230 (forward-line -2)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6231 (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
6232 (if timeout
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6233 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6234 proc 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6235 "[[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
6236 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
6237 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6238 proc 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6239 "[[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
6240 ;; 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
6241 found)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6242
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6243 (defun tramp-send-command-and-check (vec command &optional subshell)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6244 "Run COMMAND and check its exit status.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6245 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
6246 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
6247
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6248 If the optional argument SUBSHELL is non-nil, the command is executed in
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6249 a subshell, ie surrounded by parentheses."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6250 (tramp-send-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6251 vec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6252 (concat (if subshell "( " "")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6253 command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6254 (if command " 2>/dev/null; " "")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6255 "echo tramp_exit_status $?"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6256 (if subshell " )" " ")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6257 (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
6258 (goto-char (point-max))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6259 (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
6260 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6261 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
6262 (skip-chars-forward "^ ")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6263 (prog1
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6264 (read (current-buffer))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6265 (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
6266
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6267 (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
6268 "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
6269 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
6270 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
6271 (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
6272 (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
6273
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6274 (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
6275 "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
6276 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
6277 (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
6278 (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
6279 ;; Read the expression.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6280 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6281 (condition-case nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6282 (prog1 (read (current-buffer))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6283 ;; Error handling.
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6284 (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
6285 (error nil)))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6286 (error (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6287 vec 'file-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6288 "`%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
6289 command (buffer-string))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6290
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
6291 ;; 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
6292 ;; 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
6293 ;; `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
6294 ;; 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
6295 (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
6296 "Send the STRING via connection VEC.
49995
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
6297
a0e8a85259ed Version 2.0.30 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 49612
diff changeset
6298 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
6299 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
6300 `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
6301 (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
6302 (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
6303 (unless p
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6304 (tramp-error
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6305 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
6306 (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
6307 (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
6308 (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
6309 ;; 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
6310 ;; 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
6311 (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
6312 ;; 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
6313 (setq string
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6314 (mapconcat 'identity
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6315 (split-string string "\n")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6316 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
6317 (unless (or (string= string "")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6318 (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
6319 (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
6320 ;; Send the string.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6321 (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
6322 (let ((pos 0)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6323 (end (length string)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6324 (while (< pos end)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6325 (tramp-message
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6326 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
6327 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
6328 (process-send-string
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6329 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
6330 (setq pos (+ pos chunksize))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6331 (process-send-string p string)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6332
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6333 (defun tramp-mode-string-to-int (mode-string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6334 "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
6335 (let* (case-fold-search
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6336 (mode-chars (string-to-vector mode-string))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6337 (owner-read (aref mode-chars 1))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6338 (owner-write (aref mode-chars 2))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6339 (owner-execute-or-setid (aref mode-chars 3))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6340 (group-read (aref mode-chars 4))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6341 (group-write (aref mode-chars 5))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6342 (group-execute-or-setid (aref mode-chars 6))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6343 (other-read (aref mode-chars 7))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6344 (other-write (aref mode-chars 8))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6345 (other-execute-or-sticky (aref mode-chars 9)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6346 (save-match-data
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6347 (logior
77986
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6348 (cond
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6349 ((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
6350 ((char-equal owner-read ?-) 0)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6351 (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
6352 (cond
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6353 ((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
6354 ((char-equal owner-write ?-) 0)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6355 (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
6356 (cond
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6357 ((char-equal owner-execute-or-setid ?x)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6358 (tramp-octal-to-decimal "00100"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6359 ((char-equal owner-execute-or-setid ?S)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6360 (tramp-octal-to-decimal "04000"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6361 ((char-equal owner-execute-or-setid ?s)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6362 (tramp-octal-to-decimal "04100"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6363 ((char-equal owner-execute-or-setid ?-) 0)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6364 (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
6365 owner-execute-or-setid)))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6366 (cond
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6367 ((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
6368 ((char-equal group-read ?-) 0)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6369 (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
6370 (cond
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6371 ((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
6372 ((char-equal group-write ?-) 0)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6373 (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
6374 (cond
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6375 ((char-equal group-execute-or-setid ?x)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6376 (tramp-octal-to-decimal "00010"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6377 ((char-equal group-execute-or-setid ?S)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6378 (tramp-octal-to-decimal "02000"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6379 ((char-equal group-execute-or-setid ?s)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6380 (tramp-octal-to-decimal "02010"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6381 ((char-equal group-execute-or-setid ?-) 0)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6382 (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
6383 group-execute-or-setid)))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6384 (cond
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6385 ((char-equal other-read ?r)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6386 (tramp-octal-to-decimal "00004"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6387 ((char-equal other-read ?-) 0)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6388 (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
6389 (cond
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6390 ((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
6391 ((char-equal other-write ?-) 0)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6392 (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
6393 (cond
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6394 ((char-equal other-execute-or-sticky ?x)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6395 (tramp-octal-to-decimal "00001"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6396 ((char-equal other-execute-or-sticky ?T)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6397 (tramp-octal-to-decimal "01000"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6398 ((char-equal other-execute-or-sticky ?t)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6399 (tramp-octal-to-decimal "01001"))
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6400 ((char-equal other-execute-or-sticky ?-) 0)
0cc9b64806d2 Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents: 76846
diff changeset
6401 (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
6402 other-execute-or-sticky)))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6403
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6404 (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
6405 "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
6406 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
6407 Return ATTR."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6408 ;; Convert last access time.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6409 (unless (listp (nth 4 attr))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6410 (setcar (nthcdr 4 attr)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6411 (list (floor (nth 4 attr) 65536)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6412 (floor (mod (nth 4 attr) 65536)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6413 ;; Convert last modification time.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6414 (unless (listp (nth 5 attr))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6415 (setcar (nthcdr 5 attr)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6416 (list (floor (nth 5 attr) 65536)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6417 (floor (mod (nth 5 attr) 65536)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6418 ;; Convert last status change time.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6419 (unless (listp (nth 6 attr))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6420 (setcar (nthcdr 6 attr)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6421 (list (floor (nth 6 attr) 65536)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6422 (floor (mod (nth 6 attr) 65536)))))
82064
07bb0658401d * net/tramp.el (tramp-perl-file-attributes)
Michael Albinus <michael.albinus@gmx.de>
parents: 82025
diff changeset
6423 ;; Convert file size.
07bb0658401d * net/tramp.el (tramp-perl-file-attributes)
Michael Albinus <michael.albinus@gmx.de>
parents: 82025
diff changeset
6424 (when (< (nth 7 attr) 0)
07bb0658401d * net/tramp.el (tramp-perl-file-attributes)
Michael Albinus <michael.albinus@gmx.de>
parents: 82025
diff changeset
6425 (setcar (nthcdr 7 attr) -1))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6426 (when (and (floatp (nth 7 attr))
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6427 (<= (nth 7 attr) (tramp-compat-most-positive-fixnum)))
82064
07bb0658401d * net/tramp.el (tramp-perl-file-attributes)
Michael Albinus <michael.albinus@gmx.de>
parents: 82025
diff changeset
6428 (setcar (nthcdr 7 attr) (round (nth 7 attr))))
68527
e66f443e6371 * net/tramp.el (tramp-convert-file-attributes): Set file's gid
Michael Albinus <michael.albinus@gmx.de>
parents: 68335
diff changeset
6429 ;; Convert file mode bits to string.
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
6430 (unless (stringp (nth 8 attr))
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
6431 (setcar (nthcdr 8 attr) (tramp-file-mode-from-int (nth 8 attr))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6432 ;; Convert directory indication bit.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6433 (if (string-match "^d" (nth 8 attr))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6434 (setcar attr t)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6435 (if (and (listp (car attr)) (stringp (caar attr))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6436 (string-match ".+ -> .\\(.+\\)." (caar attr)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6437 (setcar attr (match-string 1 (caar attr)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6438 (setcar attr nil)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6439 ;; Set file's gid change bit.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6440 (setcar (nthcdr 9 attr)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6441 (if (numberp (nth 3 attr))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6442 (not (= (nth 3 attr)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6443 (tramp-get-remote-gid vec 'integer)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6444 (not (string-equal
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6445 (nth 3 attr)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6446 (tramp-get-remote-gid vec 'string)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6447 ;; Convert inode.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6448 (unless (listp (nth 10 attr))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6449 (setcar (nthcdr 10 attr)
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
6450 (condition-case nil
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
6451 (list (floor (nth 10 attr) 65536)
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
6452 (floor (mod (nth 10 attr) 65536)))
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
6453 ;; Inodes can be incredible huge. We must hide this.
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
6454 (error (tramp-get-inode vec)))))
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
6455 ;; Set virtual device number.
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
6456 (setcar (nthcdr 11 attr)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6457 (tramp-get-device vec))
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
6458 attr)
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
6459
81938
26330ef1aa46 * net/tramp.el (tramp-handle-file-remote-p): Handle optional
Michael Albinus <michael.albinus@gmx.de>
parents: 81758
diff changeset
6460 (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
6461 "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
6462 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
6463 (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
6464 (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
6465 (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
6466 (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
6467 "")))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6468 (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
6469 (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
6470 (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
6471 (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
6472
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6473 (defun tramp-get-device (vec)
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
6474 "Returns the virtual device number.
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
6475 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
6476 (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
6477 (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
6478 (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
6479 (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
6480 "")))
58540
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
6481 (unless (assoc string tramp-devices)
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
6482 (add-to-list 'tramp-devices
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
6483 (list string (length tramp-devices))))
d3f76ef9ad46 (tramp-handle-directory-files-and-attributes): New function.
Lars Hansen <larsh@soem.dk>
parents: 58005
diff changeset
6484 (list -1 (nth 1 (assoc string tramp-devices)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6485
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6486 (defun tramp-file-mode-from-int (mode)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6487 "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
6488 (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
6489 (user (logand (lsh mode -6) 7))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6490 (group (logand (lsh mode -3) 7))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6491 (other (logand (lsh mode -0) 7))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6492 (suid (> (logand (lsh mode -9) 4) 0))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6493 (sgid (> (logand (lsh mode -9) 2) 0))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6494 (sticky (> (logand (lsh mode -9) 1) 0)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6495 (setq user (tramp-file-mode-permissions user suid "s"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6496 (setq group (tramp-file-mode-permissions group sgid "s"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6497 (setq other (tramp-file-mode-permissions other sticky "t"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6498 (concat type user group other)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6499
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6500 (defun tramp-file-mode-permissions (perm suid suid-text)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6501 "Convert a permission bitset into a string.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6502 This is used internally by `tramp-file-mode-from-int'."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6503 (let ((r (> (logand perm 4) 0))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6504 (w (> (logand perm 2) 0))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6505 (x (> (logand perm 1) 0)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6506 (concat (or (and r "r") "-")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6507 (or (and w "w") "-")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6508 (or (and suid x suid-text) ; suid, execute
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6509 (and suid (upcase suid-text)) ; suid, !execute
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6510 (and x "x") "-")))) ; !suid
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6511
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6512 (defun tramp-decimal-to-octal (i)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6513 "Return a string consisting of the octal digits of I.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6514 Not actually used. Use `(format \"%o\" i)' instead?"
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6515 (cond ((< i 0) (error "Cannot convert negative number to octal"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6516 ((not (integerp i)) (error "Cannot convert non-integer to octal"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6517 ((zerop i) "0")
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6518 (t (concat (tramp-decimal-to-octal (/ i 8))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6519 (number-to-string (% i 8))))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6520
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6521
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6522 ;; Kudos to Gerd Moellmann for this suggestion.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6523 (defun tramp-octal-to-decimal (ostr)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6524 "Given a string of octal digits, return a decimal number."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6525 (let ((x (or ostr "")))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6526 ;; `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
6527 (unless (string-match "\\`[0-7]*\\'" x)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6528 (error "Non-octal junk in string `%s'" x))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6529 (string-to-number ostr 8)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6530
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6531 (defun tramp-shell-case-fold (string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6532 "Converts STRING to shell glob pattern which ignores case."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6533 (mapconcat
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6534 (lambda (c)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6535 (if (equal (downcase c) (upcase c))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6536 (vector c)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6537 (format "[%c%c]" (downcase c) (upcase c))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6538 string
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6539 ""))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6540
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6541
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
6542 ;; ------------------------------------------------------------
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
6543 ;; -- TRAMP file names --
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
6544 ;; ------------------------------------------------------------
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6545 ;; Conversion functions between external representation and
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6546 ;; internal data structure. Convenience functions for internal
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6547 ;; data structure.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6548
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6549 (defun tramp-file-name-p (vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6550 "Check whether VEC is a Tramp object."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6551 (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
6552
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6553 (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
6554 "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
6555 (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
6556
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6557 (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
6558 "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
6559 (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
6560
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6561 (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
6562 "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
6563 (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
6564
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6565 (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
6566 "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
6567 (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
6568
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6569 ;; 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
6570 ;; "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
6571 (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
6572 "Return the host name of VEC without port."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6573 (let ((host (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
6574 (if (and (stringp host)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6575 (string-match tramp-host-with-port-regexp host))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6576 (match-string 1 host)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6577 host)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6578
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
6579 (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
6580 "Return the port number of VEC."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6581 (let ((host (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
6582 (and (stringp host)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6583 (string-match tramp-host-with-port-regexp host)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6584 (string-to-number (match-string 2 host)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6585
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6586 (defun tramp-tramp-file-p (name)
84942
437d3bb02139 * net/tramp.el (tramp-maybe-open-connection): Make test for alive
Michael Albinus <michael.albinus@gmx.de>
parents: 84833
diff changeset
6587 "Return t if NAME is a tramp file."
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6588 (save-match-data
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6589 (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
6590
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
6591 (defun tramp-find-method (method user host)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6592 "Return the right method string to use.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6593 This is METHOD, 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
6594 `tramp-default-method-alist'."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6595 (or method
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6596 (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
6597 lmethod item)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6598 (while choices
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6599 (setq item (pop choices))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6600 (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
6601 (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
6602 (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
6603 (setq choices nil)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6604 lmethod)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6605 tramp-default-method))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6606
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
6607 (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
6608 "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
6609 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
6610 `tramp-default-user-alist'."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6611 (or user
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6612 (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
6613 luser item)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6614 (while choices
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6615 (setq item (pop choices))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6616 (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
6617 (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
6618 (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
6619 (setq choices nil)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6620 luser)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6621 tramp-default-user))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6622
84406
38bcf4ef30c3 * net/tramp.el (top): Remove declarations of `tramp-gw-*' symbols,
Michael Albinus <michael.albinus@gmx.de>
parents: 82942
diff changeset
6623 (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
6624 "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
6625 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
6626 (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
6627 tramp-default-host))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6628
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
6629 (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
6630 "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
6631 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
6632 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
6633 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
6634 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
6635 (save-match-data
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6636 (let ((match (string-match (nth 0 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
6637 (unless match (error "Not a tramp file name: %s" name))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6638 (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
6639 (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
6640 (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
6641 (localname (match-string (nth 4 tramp-file-name-structure) name)))
84966
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
6642 (if nodefault
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
6643 (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
6644 (vector
fa9dd0b54e54 * net/tramp.el (with-file-property, with-connection-property):
Michael Albinus <michael.albinus@gmx.de>
parents: 84942
diff changeset
6645 (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
6646 (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
6647 (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
6648 localname))))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6649
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6650 (defun 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
6651 "Checks, whether the remote parts of FILE1 and FILE2 are identical.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6652 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
6653 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
6654 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
6655 account.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6656
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6657 Example:
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6658
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6659 (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
6660
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6661 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
6662
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6663 (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
6664 (and (stringp (file-remote-p file1))
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6665 (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
6666 (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
6667
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6668 (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
6669 "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
6670 (concat tramp-prefix-format
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6671 (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
6672 (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
6673 (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
6674 (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
6675 (when host host) tramp-postfix-host-format
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6676 (when localname localname)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6677
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6678 (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
6679 "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
6680 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
6681 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
6682 (concat tramp-prefix-format
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6683 (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
6684 (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
6685 (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
6686 (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
6687 (when (not (zerop (length host)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6688 (concat host tramp-postfix-host-format))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6689 (when localname localname)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6690
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6691 (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
6692 "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
6693 (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
6694 (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
6695 (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
6696 (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
6697 (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
6698 (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
6699 (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
6700
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6701 (defun tramp-method-out-of-band-p (vec)
55420
c44f9de543e3 2004-05-07 Kai Grossjohann <kai@emptydomain.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 54198
diff changeset
6702 "Return t if this is an out-of-band method, nil otherwise."
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6703 (tramp-get-method-parameter (tramp-file-name-method vec) 'tramp-copy-program))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6704
82808
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
6705 (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
6706 "Return t if this points to the local host, nil otherwise."
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
6707 (let ((host (tramp-file-name-real-host vec)))
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
6708 (and
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
6709 (stringp host)
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
6710 (string-match
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
6711 (concat "^" (regexp-opt (list "localhost" (system-name)) t) "$") host))))
6e5814967ffb * net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents: 82603
diff changeset
6712
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6713 ;; Variables local to connection.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6714
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
6715 (defun tramp-get-remote-path (vec)
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
6716 (with-connection-property vec "remote-path"
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
6717 (let* ((remote-path (tramp-compat-copy-tree tramp-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
6718 (elt (memq '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
6719 (default-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
6720 (when elt
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
6721 (condition-case 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
6722 (symbol-name
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
6723 (tramp-send-command-and-read vec "getconf 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
6724 ;; 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
6725 (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
6726 (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
6727 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
6728 "`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
6729 "/bin:/usr/bin")
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
6730 "/bin:/usr/bin")))))
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
6731 (when elt
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
6732 ;; Replace place holder `tramp-default-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
6733 (setcdr elt
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
6734 (append
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
6735 (tramp-split-string default-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
6736 (cdr elt)))
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
6737 (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
6738
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
6739 ;; 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
6740 (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
6741 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
6742 (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
6743 (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
6744 (and
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
6745 (with-connection-property vec 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
6746 (file-directory-p
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
6747 (tramp-make-tramp-file-name
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
6748 (tramp-file-name-method vec)
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
6749 (tramp-file-name-user vec)
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
6750 (tramp-file-name-host vec)
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
6751 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
6752 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
6753 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
6754
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6755 (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
6756 (with-connection-property vec "ls"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6757 (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
6758 (tramp-message vec 5 "Finding a suitable `ls' command")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6759 (or
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6760 (catch 'ls-found
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6761 (dolist (cmd '("ls" "gnuls" "gls"))
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
6762 (let ((dl (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
6763 result)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6764 (while
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6765 (and
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6766 dl
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6767 (setq result
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6768 (tramp-find-executable vec cmd dl t t)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6769 ;; Check parameter.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6770 (when (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
6771 vec (format "%s -lnd /" result)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6772 (throw 'ls-found result))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6773 (setq dl (cdr dl))))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6774 (tramp-error vec 'file-error "Couldn't find a proper `ls' command")))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6775
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6776 (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
6777 (with-connection-property vec "test"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6778 (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
6779 (tramp-message vec 5 "Finding a suitable `test' command")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6780 (if (zerop (tramp-send-command-and-check vec "test 0"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6781 "test"
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
6782 (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
6783
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6784 (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
6785 ;; 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
6786 ;; 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
6787 ;; 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
6788 (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
6789 (or
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6790 (progn
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6791 (tramp-send-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6792 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
6793 (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
6794 (goto-char (point-min))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6795 (when (looking-at
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6796 (format "\n%s\r?\n" (regexp-quote tramp-end-of-output)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6797 (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
6798 (progn
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6799 (tramp-send-command
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6800 vec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6801 (format
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6802 "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
6803 (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
6804 "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
6805
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6806 (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
6807 (with-connection-property vec "file-exists"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6808 (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
6809 (tramp-message vec 5 "Finding 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
6810 (tramp-find-file-exists-command vec))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6811
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6812 (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
6813 (with-connection-property vec "ln"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6814 (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
6815 (tramp-message vec 5 "Finding a suitable `ln' command")
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
6816 (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
6817
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6818 (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
6819 (with-connection-property vec "perl"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6820 (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
6821 (tramp-message vec 5 "Finding a suitable `perl' command")
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
6822 (or (tramp-find-executable vec "perl5" (tramp-get-remote-path vec))
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
6823 (tramp-find-executable vec "perl" (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
6824
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6825 (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
6826 (with-connection-property vec "stat"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6827 (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
6828 (tramp-message vec 5 "Finding a suitable `stat' command")
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
6829 (let ((result (tramp-find-executable
d0c9cce4628c * net/tramp.el (top): Require cl.el, when `copy-tree' is not available
Michael Albinus <michael.albinus@gmx.de>
parents: 82324
diff changeset
6830 vec "stat" (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
6831 tmp)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6832 ;; Check whether stat(1) returns usable syntax.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6833 (when result
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6834 (setq tmp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6835 ;; We don't want to display an error message.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6836 (with-temp-message (or (current-message) "")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6837 (condition-case nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6838 (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
6839 vec (format "%s -c '(\"%%N\")' /" result))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6840 (error nil))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6841 (unless (and (listp tmp) (stringp (car tmp))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6842 (string-match "^./.$" (car tmp)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6843 (setq result nil)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6844 result))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6845
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6846 (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
6847 (with-connection-property vec "id"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6848 (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
6849 (tramp-message vec 5 "Finding POSIX `id' command")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6850 (or
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6851 (catch 'id-found
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
6852 (let ((dl (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
6853 result)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6854 (while
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6855 (and
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6856 dl
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6857 (setq result
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6858 (tramp-find-executable vec "id" dl t t)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6859 ;; Check POSIX parameter.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6860 (when (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
6861 vec (format "%s -u" result)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6862 (throw 'id-found result))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6863 (setq dl (cdr dl)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6864 (tramp-error vec 'file-error "Couldn't find a POSIX `id' command")))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6865
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6866 (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
6867 (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
6868 (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
6869 vec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6870 (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
6871 (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
6872 (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
6873 (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
6874 "" "| 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
6875 ;; 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
6876 (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
6877
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6878 (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
6879 (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
6880 (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
6881 vec
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6882 (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
6883 (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
6884 (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
6885 (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
6886 "" "| 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
6887 ;; 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
6888 (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
6889
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
6890 (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
6891 (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
6892
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
6893 (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
6894 (nth 3 (tramp-compat-file-attributes "~/" id-format)))
82942
5cf3cd03cb50 * net/tramp.el (tramp-handle-set-file-times): Flush the file
Michael Albinus <michael.albinus@gmx.de>
parents: 82808
diff changeset
6895
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
6896 ;; Some predefined connection properties.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6897 (defun tramp-get-remote-coding (vec prop)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6898 ;; Local coding handles properties like remote coding. So we could
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6899 ;; call it without pain.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6900 (let ((ret (tramp-get-local-coding vec prop)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6901 ;; The connection property might have been cached. So we must send
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6902 ;; the script - maybe.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6903 (when (not (stringp ret))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6904 (let ((name (symbol-name ret)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6905 (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
6906 (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
6907 (tramp-maybe-send-script vec (symbol-value ret) name)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6908 (setq ret name)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6909 ;; Return the value.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6910 ret))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6911
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6912 (defun tramp-get-local-coding (vec prop)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6913 (or
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6914 (tramp-get-connection-property vec prop nil)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6915 (progn
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6916 (tramp-find-inline-encoding vec)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6917 (tramp-get-connection-property vec prop nil))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6918
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6919 (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
6920 "Return the method parameter PARAM.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6921 If the `tramp-methods' entry does not exist, return NIL."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6922 (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
6923 (when entry (cadr entry))))
51968
e4c4c45ea013 Tramp 2.0.36 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51603
diff changeset
6924
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6925 ;; Auto saving to a special directory.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6926
65304
379e08762d65 * net/tramp.el (tramp-handle-make-auto-save-file-name): Deactivate
Michael Albinus <michael.albinus@gmx.de>
parents: 65254
diff changeset
6927 (defun tramp-exists-file-name-handler (operation &rest args)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6928 "Checks whether OPERATION runs a file name handler."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6929 ;; 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
6930 ;; 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
6931 (condition-case nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6932 (let* ((buffer-file-name "/")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6933 (default-directory "/")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6934 (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
6935 (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
6936 (file-name-handler-alist
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6937 (list
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6938 (cons "/"
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6939 '(lambda (operation &rest args)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6940 "Returns OPERATION if it is the one to be checked."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6941 (if (equal 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
6942 operation
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6943 (let ((file-name-handler-alist fnha))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6944 (apply operation args))))))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
6945 (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
6946 (error nil)))
65248
0f994edbec5e Make `make-auto-save-file-name' a magic operation.
Michael Albinus <michael.albinus@gmx.de>
parents: 64772
diff changeset
6947
0f994edbec5e Make `make-auto-save-file-name' a magic operation.
Michael Albinus <michael.albinus@gmx.de>
parents: 64772
diff changeset
6948 (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
6949 (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
6950 (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
6951 "Invoke `tramp-handle-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
6952 (if (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))
65304
379e08762d65 * net/tramp.el (tramp-handle-make-auto-save-file-name): Deactivate
Michael Albinus <michael.albinus@gmx.de>
parents: 65254
diff changeset
6953 (setq ad-return-value (tramp-handle-make-auto-save-file-name))
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
6954 ad-do-it))
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
6955 (add-hook 'tramp-unload-hook
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
6956 '(lambda () (ad-unadvise 'make-auto-save-file-name))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6957
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
6958 ;; In Emacs < 22 and XEmacs < 21.5 autosaved remote files have
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
6959 ;; permission 0666 minus umask. This is a security threat.
57463
40298ea4d83f Sync with Tramp 2.0.45.
Michael Albinus <michael.albinus@gmx.de>
parents: 56644
diff changeset
6960
40298ea4d83f Sync with Tramp 2.0.45.
Michael Albinus <michael.albinus@gmx.de>
parents: 56644
diff changeset
6961 (defun tramp-set-auto-save-file-modes ()
40298ea4d83f Sync with Tramp 2.0.45.
Michael Albinus <michael.albinus@gmx.de>
parents: 56644
diff changeset
6962 "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
6963 (let ((bfn (buffer-file-name)))
40298ea4d83f Sync with Tramp 2.0.45.
Michael Albinus <michael.albinus@gmx.de>
parents: 56644
diff changeset
6964 (when (and (stringp bfn)
40298ea4d83f Sync with Tramp 2.0.45.
Michael Albinus <michael.albinus@gmx.de>
parents: 56644
diff changeset
6965 (tramp-tramp-file-p bfn)
40298ea4d83f Sync with Tramp 2.0.45.
Michael Albinus <michael.albinus@gmx.de>
parents: 56644
diff changeset
6966 (stringp buffer-auto-save-file-name)
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
6967 (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
6968 (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
6969 (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
6970 ;; 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
6971 ;; 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
6972 ;; be a security threat.
62344
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
6973 (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
6974 (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
6975
40298ea4d83f Sync with Tramp 2.0.45.
Michael Albinus <michael.albinus@gmx.de>
parents: 56644
diff changeset
6976 (unless (or (> emacs-major-version 21)
40298ea4d83f Sync with Tramp 2.0.45.
Michael Albinus <michael.albinus@gmx.de>
parents: 56644
diff changeset
6977 (and (featurep 'xemacs)
40298ea4d83f Sync with Tramp 2.0.45.
Michael Albinus <michael.albinus@gmx.de>
parents: 56644
diff changeset
6978 (= emacs-major-version 21)
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
6979 (> emacs-minor-version 4)))
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
6980 (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
6981 (add-hook 'tramp-unload-hook
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
6982 '(lambda ()
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
6983 (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
6984
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6985 (defun tramp-subst-strs-in-string (alist string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6986 "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
6987 ALIST is of the form ((FROM . TO) ...)."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6988 (save-match-data
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6989 (while alist
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6990 (let* ((pr (car alist))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6991 (from (car pr))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6992 (to (cdr pr)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6993 (while (string-match (regexp-quote from) string)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6994 (setq string (replace-match to t t string)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6995 (setq alist (cdr alist))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6996 string))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6997
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6998 ;; ------------------------------------------------------------
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
6999 ;; -- Compatibility functions section --
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7000 ;; ------------------------------------------------------------
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7001
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7002 (defun tramp-read-passwd (proc &optional prompt)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7003 "Read a password from user (compat function).
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
7004 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
7005 (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
7006 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
7007 tramp-current-host ""))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7008 (pw-prompt
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7009 (or prompt
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7010 (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
7011 (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
7012 (format "%s for %s " (capitalize (match-string 1)) key)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7013 (if (functionp 'password-read)
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
7014 (let ((password (funcall (symbol-function 'password-read)
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
7015 pw-prompt key)))
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
7016 (funcall (symbol-function 'password-cache-add) key password)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7017 password)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7018 (read-passwd pw-prompt))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7019
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7020 (defun tramp-clear-passwd ()
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7021 "Clear password cache for connection related to current-buffer.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7022 If METHOD, USER or HOST is given, take then for computing the key."
54198
c1bfc266f10a Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 53206
diff changeset
7023 (interactive)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7024 (when (functionp 'password-cache-remove)
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
7025 (funcall (symbol-function 'password-cache-remove)
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
7026 (tramp-make-tramp-file-name
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
7027 tramp-current-method
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
7028 tramp-current-user
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
7029 tramp-current-host
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
7030 ""))))
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7031
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7032 ;; 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
7033
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7034 (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
7035 "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
7036
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7037 (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
7038 '(("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
7039 ("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
7040 ("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
7041 ("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
7042 "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
7043
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7044 (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
7045 "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
7046 (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
7047 (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
7048 (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
7049 (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
7050 (< (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
7051
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7052 (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
7053 "Subtract two time values.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7054 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
7055 (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
7056 (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
7057 (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
7058 (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
7059 (- (+ (if borrow 65536 0) (cadr t1)) (cadr t2)))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7060
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7061 (defun tramp-time-diff (t1 t2)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7062 "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
7063 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
7064 ;; 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
7065 (cond ((and (fboundp 'subtract-time)
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
7066 (fboundp 'float-time))
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
7067 (funcall (symbol-function 'float-time)
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
7068 (funcall (symbol-function 'subtract-time) t1 t2)))
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
7069 ((and (fboundp 'subtract-time)
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
7070 (fboundp 'time-to-seconds))
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
7071 (funcall (symbol-function 'time-to-seconds)
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
7072 (funcall (symbol-function 'subtract-time) t1 t2)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7073 ((fboundp 'itimer-time-difference)
72569
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
7074 (funcall (symbol-function 'itimer-time-difference)
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
7075 (if (< (length t1) 3) (append t1 '(0)) t1)
7457615d594a Sync with Tramp 2.0.54.
Michael Albinus <michael.albinus@gmx.de>
parents: 71561
diff changeset
7076 (if (< (length t2) 3) (append t2 '(0)) t2)))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7077 (t
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7078 (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
7079 (+ (* (car time) 65536.0)
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
7080 (cadr time)
978e262c8f3a Version 2.0.35 of Tramp released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 51177
diff changeset
7081 (/ (or (nth 2 time) 0) 1000000.0))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7082
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7083 (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
7084 "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
7085 EOL-TYPE can be one of `dos', `unix', or `mac'."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7086 (cond ((fboundp 'coding-system-change-eol-conversion)
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
7087 (funcall (symbol-function 'coding-system-change-eol-conversion)
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
7088 coding-system eol-type))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7089 ((fboundp 'subsidiary-coding-system)
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
7090 (funcall (symbol-function 'subsidiary-coding-system)
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
7091 coding-system
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
7092 (cond ((eq eol-type 'dos) 'crlf)
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
7093 ((eq eol-type 'unix) 'lf)
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
7094 ((eq eol-type 'mac) 'cr)
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
7095 (t
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
7096 (error "Unknown EOL-TYPE `%s', must be %s"
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
7097 eol-type
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
7098 "`dos', `unix', or `mac'")))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7099 (t (error "Can't change EOL conversion -- is MULE missing?"))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7100
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7101 (defun tramp-split-string (string pattern)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7102 "Like `split-string' but omit empty strings.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7103 In Emacs, (split-string \"/foo/bar\" \"/\") returns (\"foo\" \"bar\").
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7104 This is, the first, empty, element is omitted. In XEmacs, the first
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7105 element is not omitted.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7106
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7107 Note: this function has been written for `tramp-handle-file-truename'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7108 If you want to use it for something else, you'll have to check whether
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7109 it does the right thing."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7110 (delete "" (split-string string pattern)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7111
55844
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
7112 (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
7113 "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
7114 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
7115 exiting if process is running."
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
7116 (if (fboundp 'set-process-query-on-exit-flag)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7117 (funcall (symbol-function 'set-process-query-on-exit-flag) process flag)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7118 (funcall (symbol-function '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
7119
4bc6cb45c326 Version 2.0.41 of Tramp released.
Michael Albinus <michael.albinus@gmx.de>
parents: 55420
diff changeset
7120
59996
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
7121 ;; ------------------------------------------------------------
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
7122 ;; -- Kludges section --
aac0a33f5772 Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents: 59582
diff changeset
7123 ;; ------------------------------------------------------------
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7124
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7125 ;; 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
7126 ;; 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
7127 ;; 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
7128 ;; 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
7129 ;; completely omitting the newline. This is not what was intended.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7130 ;; 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
7131 ;; `shell-quote-argument' work with newlines without making it
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7132 ;; 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
7133 ;; 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
7134 ;; groks newlines.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7135 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7136 ;; The approach is simple: we call `shell-quote-argument', then
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7137 ;; massage the newline part of the result.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7138 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7139 ;; 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
7140 ;; 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
7141 ;; 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
7142 ;; `shell-quote-arguments' behaves as if on Unix.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7143 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7144 ;; 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
7145 ;; function to work with Bourne-like shells.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7146 ;;
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7147 ;; CCC: This function should be rewritten so that
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7148 ;; `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
7149 ;; changes in `shell-quote-argument'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7150 (defun tramp-shell-quote-argument (s)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7151 "Similar to `shell-quote-argument', but groks newlines.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7152 Only works for Bourne-like shells."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7153 (let ((system-type 'not-windows))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7154 (save-match-data
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7155 (let ((result (shell-quote-argument s))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7156 (nl (regexp-quote (format "\\%s" tramp-rsh-end-of-line))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7157 (when (and (>= (length result) 2)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7158 (string= (substring result 0 2) "\\~"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7159 (setq result (substring result 1)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7160 (while (string-match nl result)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7161 (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
7162 t t result)))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7163 result))))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7164
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7165 ;; We currently (sometimes) use "[" and "]" in the filename format.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7166 ;; This means that Emacs wants to expand wildcards if
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7167 ;; `find-file-wildcards' is non-nil, and then barfs because no
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7168 ;; expansion could be found. We detect this situation and do
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7169 ;; something really awful: we have `file-expand-wildcards' return the
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7170 ;; original filename if it can't expand anything. Let's just hope
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7171 ;; that this doesn't break anything else.
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7172 ;; CCC: This check is now also really awful; we should search all
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7173 ;; of the filename format, not just the prefix.
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7174 (when (string-match "\\[" tramp-prefix-format)
64772
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7175 (defadvice file-expand-wildcards (around tramp-fix activate)
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7176 (let ((name (ad-get-arg 0)))
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7177 (if (tramp-tramp-file-p name)
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7178 ;; If it's a Tramp file, dissect it and look if wildcards
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7179 ;; need to be expanded at all.
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7180 (let ((v (tramp-dissect-file-name name)))
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7181 (if (string-match "[[*?]" (tramp-file-name-localname v))
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7182 (let ((res ad-do-it))
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7183 (setq ad-return-value (or res (list name))))
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7184 (setq ad-return-value (list name))))
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7185 ;; If it is not a Tramp file, just run the original function.
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7186 (let ((res ad-do-it))
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
7187 (setq ad-return-value (or res (list name)))))))
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
7188 (add-hook 'tramp-unload-hook
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
7189 '(lambda () (ad-unadvise 'file-expand-wildcards))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7190
46752
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
7191 ;; Tramp version is useful in a number of situations.
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
7192
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
7193 (defun tramp-version (arg)
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
7194 "Print version number of tramp.el in minibuffer or current buffer."
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
7195 (interactive "P")
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
7196 (if arg (insert tramp-version) (message tramp-version)))
54b975949d6a New version 2.0.5.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46584
diff changeset
7197
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7198 ;; Make the `reporter` functionality available for making bug reports about
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7199 ;; the package. A most useful piece of code.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7200
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7201 (unless (fboundp 'reporter-submit-bug-report)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7202 (autoload 'reporter-submit-bug-report "reporter"))
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7203
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7204 (defun tramp-bug ()
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7205 "Submit a bug report to the TRAMP developers."
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7206 (interactive)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7207 (require 'reporter)
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7208 (catch 'dont-send
64772
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7209 (let ((reporter-prompt-for-summary-p t))
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7210 (reporter-submit-bug-report
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7211 tramp-bug-report-address ; to-address
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7212 (format "tramp (%s)" tramp-version) ; package name and version
64772
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7213 (delq nil
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7214 `(;; Current state
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7215 tramp-current-method
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7216 tramp-current-user
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7217 tramp-current-host
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7218
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7219 ;; System defaults
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7220 tramp-auto-save-directory ; vars to dump
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7221 tramp-default-method
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7222 tramp-default-method-alist
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7223 tramp-default-host
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7224 tramp-default-proxies-alist
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7225 tramp-default-user
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7226 tramp-default-user-alist
64772
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7227 tramp-rsh-end-of-line
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7228 tramp-default-password-end-of-line
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7229 tramp-login-prompt-regexp
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7230 ;; Mask non-7bit characters
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7231 (tramp-password-prompt-regexp . tramp-reporter-dump-variable)
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7232 tramp-wrong-passwd-regexp
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7233 tramp-yesno-prompt-regexp
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7234 tramp-yn-prompt-regexp
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7235 tramp-terminal-prompt-regexp
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7236 tramp-temp-name-prefix
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7237 tramp-file-name-structure
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7238 tramp-file-name-regexp
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7239 tramp-methods
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7240 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
7241 tramp-local-coding-commands
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7242 tramp-remote-coding-commands
64772
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7243 tramp-actions-before-shell
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7244 tramp-actions-copy-out-of-band
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7245 tramp-terminal-type
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7246 ;; Mask non-7bit characters
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7247 (tramp-shell-prompt-pattern . tramp-reporter-dump-variable)
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7248 ,(when (boundp 'tramp-backup-directory-alist)
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7249 'tramp-backup-directory-alist)
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7250 ,(when (boundp 'tramp-bkup-backup-directory-info)
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7251 'tramp-bkup-backup-directory-info)
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7252 ;; Dump cache.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7253 (tramp-cache-data . tramp-reporter-dump-variable)
64772
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7254
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7255 ;; Non-tramp variables of interest
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7256 ;; Mask non-7bit characters
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7257 (shell-prompt-pattern . tramp-reporter-dump-variable)
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7258 backup-by-copying
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7259 backup-by-copying-when-linked
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7260 backup-by-copying-when-mismatch
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7261 ,(when (boundp 'backup-by-copying-when-privileged-mismatch)
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7262 'backup-by-copying-when-privileged-mismatch)
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7263 ,(when (boundp 'password-cache)
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7264 'password-cache)
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7265 ,(when (boundp 'password-cache-expiry)
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7266 'password-cache-expiry)
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7267 ,(when (boundp 'backup-directory-alist)
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7268 'backup-directory-alist)
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7269 ,(when (boundp 'bkup-backup-directory-info)
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7270 'bkup-backup-directory-info)
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7271 file-name-handler-alist))
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7272
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7273 'tramp-load-report-modules ; pre-hook
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7274 'tramp-append-tramp-buffers ; post-hook
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7275 "\
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7276 Enter your bug report in this message, including as much detail
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7277 as you possibly can about the problem, what you did to cause it
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7278 and what the local and remote machines are.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7279
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7280 If you can give a simple set of instructions to make this bug
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7281 happen reliably, please include those. Thank you for helping
85024
ef71cdab0d5c * net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents: 84985
diff changeset
7282 kill bugs in Tramp.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7283
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7284 Another useful thing to do is to put
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7285
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7286 (setq tramp-verbose 8)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7287
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7288 in the ~/.emacs file and to repeat the bug. Then, include the
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7289 contents of the *tramp/foo* buffer and the *debug tramp/foo*
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7290 buffer in your bug report.
46801
3fafc6fca8a8 Version 2.0.9 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46799
diff changeset
7291
46802
10aa49b3d28a Version 2.0.10 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46801
diff changeset
7292 --bug report follows this line--
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7293 "))))
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7294
64772
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7295 (defun tramp-reporter-dump-variable (varsym mailbuf)
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7296 "Pretty-print the value of the variable in symbol VARSYM.
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7297 Used for non-7bit chars in strings."
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7298 (let* ((reporter-eval-buffer (symbol-value 'reporter-eval-buffer))
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7299 (val (with-current-buffer reporter-eval-buffer
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7300 (symbol-value varsym))))
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7301
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7302 (if (hash-table-p val)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7303 ;; Pretty print the cache.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7304 (set varsym (read (format "(%s)" (tramp-cache-print val))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7305 ;; There are characters to be masked.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7306 (when (and (boundp 'mm-7bit-chars)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7307 (string-match
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7308 (concat "[^" (symbol-value 'mm-7bit-chars) "]") val))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7309 (with-current-buffer reporter-eval-buffer
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7310 (set varsym (format "(base64-decode-string \"%s\""
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7311 (base64-encode-string val))))))
64772
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7312
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7313 ;; Dump variable.
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7314 (funcall (symbol-function 'reporter-dump-variable) varsym mailbuf)
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7315
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7316 (unless (hash-table-p val)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7317 ;; Remove string quotation.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7318 (forward-line -1)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7319 (when (looking-at
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7320 (concat "\\(^.*\\)" "\"" ;; \1 "
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7321 "\\((base64-decode-string \\)" "\\\\" ;; \2 \
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7322 "\\(\".*\\)" "\\\\" ;; \3 \
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7323 "\\(\")\\)" "\"$")) ;; \4 "
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7324 (replace-match "\\1\\2\\3\\4")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7325 (beginning-of-line)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7326 (insert " ;; variable encoded due to non-printable characters\n"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7327 (forward-line 1))
64772
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7328
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7329 ;; Reset VARSYM to old value.
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7330 (with-current-buffer reporter-eval-buffer
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7331 (set varsym val))))
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7332
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7333 (defun tramp-load-report-modules ()
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7334 "Load needed modules for reporting."
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7335
62344
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7336 ;; We load message.el and mml.el from Gnus.
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7337 (if (featurep 'xemacs)
62344
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7338 (progn
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7339 (load "message" 'noerror)
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7340 (load "mml" 'noerror))
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7341 (require 'message nil 'noerror)
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7342 (require 'mml nil 'noerror))
62344
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7343 (when (functionp 'message-mode)
64772
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7344 (funcall (symbol-function 'message-mode)))
62344
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7345 (when (functionp 'mml-mode)
64772
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7346 (funcall (symbol-function 'mml-mode) t)))
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7347
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7348 (defun tramp-append-tramp-buffers ()
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7349 "Append Tramp buffers and buffer local variables into the bug report."
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7350
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7351 (goto-char (point-max))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7352
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7353 ;; Dump buffer local variables.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7354 (dolist (buffer
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7355 (delq nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7356 (mapcar
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7357 '(lambda (b)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7358 (when (string-match "\\*tramp/" (buffer-name b)) b))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7359 (buffer-list))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7360 (let ((reporter-eval-buffer buffer)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7361 (buffer-name (buffer-name buffer))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7362 (elbuf (get-buffer-create " *tmp-reporter-buffer*")))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7363 (with-current-buffer elbuf
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7364 (emacs-lisp-mode)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7365 (erase-buffer)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7366 (insert "\n(setq\n")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7367 (lisp-indent-line)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7368 (funcall (symbol-function 'reporter-dump-variable)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7369 'buffer-name (current-buffer))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7370 (dolist (varsym-or-cons-cell (buffer-local-variables buffer))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7371 (let ((varsym (or (car-safe varsym-or-cons-cell)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7372 varsym-or-cons-cell)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7373 (when (string-match "tramp" (symbol-name varsym))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7374 (funcall
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7375 (symbol-function 'reporter-dump-variable)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7376 varsym (current-buffer)))))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7377 (lisp-indent-line)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7378 (insert ")\n"))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7379 (insert-buffer-substring elbuf)))
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7380
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7381 ;; Append buffers only when we are in message mode.
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7382 (when (and
62344
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7383 (eq major-mode 'message-mode)
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7384 (boundp 'mml-mode)
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7385 (symbol-value 'mml-mode))
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7386
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7387 (let* ((tramp-buf-regexp "\\*\\(debug \\)?tramp/")
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7388 (buffer-list
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7389 (delq nil
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7390 (mapcar '(lambda (b)
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7391 (when (string-match tramp-buf-regexp (buffer-name b)) b))
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7392 (buffer-list))))
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7393 (curbuf (current-buffer)))
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7394
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7395 ;; There is at least one Tramp buffer.
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7396 (when buffer-list
62344
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7397 (switch-to-buffer (list-buffers-noselect nil))
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7398 (delete-other-windows)
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7399 (setq buffer-read-only nil)
62344
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7400 (goto-char (point-min))
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7401 (while (not (eobp))
84985
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
7402 (if (re-search-forward
f7642749252b * net/tramp-compat.el: New file.
Michael Albinus <michael.albinus@gmx.de>
parents: 84966
diff changeset
7403 tramp-buf-regexp (tramp-compat-line-end-position) t)
62344
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7404 (forward-line 1)
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7405 (forward-line 0)
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7406 (let ((start (point)))
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7407 (forward-line 1)
5a19ff64befb Sync with Tramp 2.0.49.
Michael Albinus <michael.albinus@gmx.de>
parents: 60763
diff changeset
7408 (kill-region start (point)))))
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7409 (insert "
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7410 The buffer(s) above will be appended to this message. If you
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7411 don't want to append a buffer because it contains sensitive data,
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7412 or because the buffer is too large, you should delete the
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7413 respective buffer. The buffer(s) will contain user and host
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7414 names. Passwords will never be included there.")
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7415
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7416 (when (>= tramp-verbose 6)
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7417 (insert "\n\n")
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7418 (let ((start (point)))
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7419 (insert "\
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7420 Please note that you have set `tramp-verbose' to a value of at
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7421 least 6. Therefore, the contents of files might be included in
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7422 the debug buffer(s).")
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7423 (add-text-properties start (point) (list 'face 'italic))))
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7424
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7425 (set-buffer-modified-p nil)
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7426 (setq buffer-read-only t)
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7427 (goto-char (point-min))
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7428
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7429 (if (y-or-n-p "Do you want to append the buffer(s)? ")
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7430 ;; OK, let's send. First we delete the buffer list.
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7431 (progn
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7432 (kill-buffer nil)
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7433 (switch-to-buffer curbuf)
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7434 (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
7435 (insert "\n\
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7436 This is a special notion of the `gnus/message' package. If you
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7437 use another mail agent (by copying the contents of this buffer)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7438 please ensure that the buffers are attached to your email.\n\n")
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7439 (dolist (buffer buffer-list)
64772
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7440 (funcall (symbol-function 'mml-insert-empty-tag)
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7441 'part 'type "text/plain" 'encoding "base64"
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7442 'disposition "attachment" 'buffer (buffer-name buffer)
060177e931f8 Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents: 64701
diff changeset
7443 'description (buffer-name buffer)))
60763
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7444 (set-buffer-modified-p nil))
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7445
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7446 ;; Don't send. Delete the message buffer.
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7447 (set-buffer curbuf)
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7448 (set-buffer-modified-p nil)
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7449 (kill-buffer nil)
3ba8f94e9cfa Sync with Tramp 2.0.48.
Michael Albinus <michael.albinus@gmx.de>
parents: 60287
diff changeset
7450 (throw 'dont-send nil))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7451
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7452 (defalias 'tramp-submit-bug 'tramp-bug)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7453
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
7454 ;; Checklist for `tramp-unload-hook'
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
7455 ;; - Unload all `tramp-*' packages
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
7456 ;; - Reset `file-name-handler-alist'
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
7457 ;; - Cleanup hooks where Tramp functions are in
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
7458 ;; - Cleanup advised functions
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
7459 ;; - Cleanup autoloads
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
7460 ;;;###autoload
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
7461 (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
7462 "Discard Tramp from loading remote files."
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
7463 (interactive)
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
7464 ;; 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
7465 (tramp-unload-file-name-handlers)
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
7466 ;; ange-ftp settings must be enabled.
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
7467 (when (functionp 'tramp-ftp-enable-ange-ftp)
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
7468 (funcall (symbol-function '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
7469 ;; 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
7470 (condition-case nil
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7471 (unload-feature 'tramp 'force)
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
7472 (error nil)))
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
7473
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7474 (provide 'tramp)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7475
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7476 ;; Make sure that we get integration with the VC package.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7477 ;; When it is loaded, we need to pull in the integration module.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7478 ;; This must come after (provide 'tramp) because tramp-vc.el
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7479 ;; requires tramp. Not necessary in Emacs 23.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7480 (eval-after-load "vc"
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7481 '(unless (functionp 'start-file-process)
68335
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
7482 (require 'tramp-vc)
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
7483 (add-hook 'tramp-unload-hook
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
7484 '(lambda ()
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
7485 (when (featurep 'tramp-vc)
118ceefc8263 Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents: 66630
diff changeset
7486 (unload-feature 'tramp-vc 'force))))))
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7487
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7488 ;;; TODO:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7489
48973
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
7490 ;; * Allow putting passwords in the filename.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
7491 ;; This should be implemented via a general mechanism to add
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
7492 ;; parameters in filenames. There is currently a kludge for
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
7493 ;; putting the port number into the filename for ssh and ftp
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
7494 ;; files. This could be subsumed by the new mechanism as well.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
7495 ;; Another approach is to read a netrc file like ~/.authinfo
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
7496 ;; from Gnus.
09acf3f65bb5 * net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47771
diff changeset
7497 ;; * 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
7498 ;; * 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
7499 ;; 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
7500 ;; 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
7501 ;; 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
7502 ;; 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
7503 ;; (Stefan Monnier).
47576
b31c8ab7336a Sync with version 2.0.20. Lengthy ChangeLog follows:
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 47205
diff changeset
7504 ;; * Autodetect if remote `ls' groks the "--dired" switch.
46790
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
7505 ;; * Add fallback for inline encodings. This should be used
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
7506 ;; if the remote end doesn't support mimencode or a similar program.
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
7507 ;; For reading files from the remote host, we can just parse the output
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
7508 ;; of `od -b'. For writing files to the remote host, we construct
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
7509 ;; a shell program which contains only "safe" ascii characters
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
7510 ;; and which writes the right bytes to the file. We can use printf(1)
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
7511 ;; or "echo -e" or the printf function in awk and use octal escapes
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
7512 ;; for the "dangerous" characters. The null byte might be a problem.
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
7513 ;; On some systems, the octal escape doesn't work. So we try the following
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
7514 ;; two commands to write a null byte:
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
7515 ;; dd if=/dev/zero bs=1 count=1
c217aa0214e2 Version 2.0.6.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46752
diff changeset
7516 ;; echo | tr '\n' '\000'
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7517 ;; * Cooperate with PCL-CVS. It uses start-process, which doesn't
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7518 ;; work for remote files.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7519 ;; * 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
7520 ;; `shell-quote-argument'.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7521 ;; * Completion gets confused when you leave out the method name.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7522 ;; * 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
7523 ;; by the files in that directory. Add this here.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7524 ;; * Avoid screen blanking when hitting `g' in dired. (Eli Tziperman)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7525 ;; * Make ffap.el grok Tramp filenames. (Eli Tziperman)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7526 ;; * When logging in, keep looking for questions according to an alist
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7527 ;; and then invoke the right function.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7528 ;; * Case-insensitive filename completion. (Norbert Goevert.)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7529 ;; * Running CVS remotely doesn't appear to work right. It thinks
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7530 ;; files are locked by somebody else even if I'm the locking user.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7531 ;; Sometimes, one gets `No CVSROOT specified' errors from CVS.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7532 ;; (Skip Montanaro)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7533 ;; * 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
7534 ;; 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
7535 ;; long command lines.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7536 ;; * `vc-directory' does not work. It never displays any files, even
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7537 ;; if it does show files when run locally.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7538 ;; * Allow correction of passwords, if the remote end allows this.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7539 ;; (Mark Hershberger)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7540 ;; * 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
7541 ;; * Grok `append' parameter for `write-region'.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7542 ;; * 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
7543 ;; * abbreviate-file-name
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7544 ;; * better error checking. At least whenever we see something
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7545 ;; 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
7546 ;; again. (Greg Stark)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7547 ;; * Provide a local cache of old versions of remote files for the rsync
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7548 ;; transfer method to use. (Greg Stark)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7549 ;; * Remove unneeded parameters from methods.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7550 ;; * Invoke rsync once for copying a whole directory hierarchy.
82201
b3182f0c969c * net/tramp.el:
Michael Albinus <michael.albinus@gmx.de>
parents: 82140
diff changeset
7551 ;; (Francesco Potortì)
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7552 ;; * 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
7553 ;; encodings, too. (Daniel Pittman)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7554 ;; * Clean up unused *tramp/foo* buffers after a while. (Pete Forman)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7555 ;; * Progress reports while copying files. (Michael Kifer)
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7556 ;; * 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
7557 ;; 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
7558 ;; * 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
7559 ;; 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
7560 ;; the workaround doesn't work.
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7561 ;; * Change `copy-file' to grok the case where the filename handler
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7562 ;; for the source and the target file are different. Right now,
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7563 ;; it looks at the source file and then calls that handler, if
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7564 ;; there is one. But since ange-ftp, for instance, does not know
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7565 ;; about Tramp, it does not do the right thing if the target file
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7566 ;; name is a Tramp name.
46992
6529728ddf05 Version 2.0.13 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 46835
diff changeset
7567 ;; * Username and hostname completion.
84833
b8f420afb6df * net/tramp.el (tramp-completion-mode-p): Rename from
Michael Albinus <michael.albinus@gmx.de>
parents: 84739
diff changeset
7568 ;; ** 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
7569 ;; ** 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
7570 ;; Code is nearly identical.
53206
0c19f1a19b2b (tramp-chunksize): Extend docstring. Suggested by
Kai Großjohann <kgrossjo@eu.uu.net>
parents: 52401
diff changeset
7571 ;; * Allow out-of-band methods as _last_ multi-hop.
81758
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7572 ;; * 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
7573 ;; 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
7574 ;; just call
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7575 ;; trampclient filename.c
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7576 ;; 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
7577 ;; 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
7578 ;; 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
7579 ;; 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
7580 ;; 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
7581 ;; 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
7582 ;; 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
7583 ;; 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
7584 ;; 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
7585 ;; 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
7586 ;; 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
7587 ;; be nice.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7588 ;; Likely the corresponding tramp server should not allow the
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7589 ;; 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
7590 ;; 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
7591 ;; way of passing credentials, like by using an SSL socket or
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7592 ;; something. (David Kastrup)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7593 ;; * Could Tramp reasonably look for a prompt after ^M rather than
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7594 ;; only after ^J ? (Stefan Monnier)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7595 ;; * WIBNI there was an interactive command prompting for tramp
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7596 ;; method, hostname, username and filename and translates the user
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7597 ;; input into the correct filename syntax (depending on the Emacs
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7598 ;; flavor) (Reiner Steib)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7599 ;; * Let the user edit the connection properties interactively.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7600 ;; Something like `gnus-server-edit-server' in Gnus' *Server* buffer.
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7601 ;; * Reconnect directly to a compliant shell without first going
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7602 ;; through the user's default shell. (Pete Forman)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7603 ;; * It's just that when I come to Customize `tramp-default-user-alist'
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7604 ;; I'm presented with a mismatch and raw lisp for a value. It is my
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7605 ;; understanding that a variable declared with defcustom is a User
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7606 ;; Option and should not be modified by the code. add-to-list is
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7607 ;; called in several places. One way to handle that is to have a new
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7608 ;; ordinary variable that gets its initial value from
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7609 ;; tramp-default-user-alist and then is added to. (Pete Forman)
f03856eb136b * files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents: 77986
diff changeset
7610 ;; * Make `tramp-default-user' obsolete.
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7611
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7612 ;; Functions for file-name-handler-alist:
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7613 ;; diff-latest-backup-file -- in diff.el
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7614 ;; dired-uncache -- this will be needed when we do insert-directory caching
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7615 ;; file-name-as-directory -- use primitive?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7616 ;; file-name-sans-versions -- use primitive?
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7617 ;; get-file-buffer -- use primitive
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7618 ;; vc-registered
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7619
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 51968
diff changeset
7620 ;;; arch-tag: 3a21a994-182b-48fa-b0cd-c1d9fede424a
45861
7b663a89ef2a *** empty log message ***
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff changeset
7621 ;;; tramp.el ends here