Mercurial > emacs
annotate lisp/net/tramp-ftp.el @ 95079:3068b2728aa4
(Todo): Add known problems.
(vc-dir-backend): New variable.
(vc-dir): Set it.
(vc-make-backend-object, vc-generic-status-printer)
(vc-generic-state, vc-generic-status-fileinfo-extra)
(vc-dir-extra-menu): Use it.
(vc-generic-dir-headers): Remove, unused.
author | Dan Nicolaescu <dann@ics.uci.edu> |
---|---|
date | Sun, 18 May 2008 07:53:08 +0000 |
parents | 91e5880a36c1 |
children | c114f6a4c246 |
rev | line source |
---|---|
82201 | 1 ;;; tramp-ftp.el --- Tramp convenience functions for Ange-FTP |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
2 |
91488
26d030db0d70
*** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents:
87649
diff
changeset
|
3 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, |
26d030db0d70
*** empty log message ***
Michael Albinus <michael.albinus@gmx.de>
parents:
87649
diff
changeset
|
4 ;; 2008 Free Software Foundation, Inc. |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
5 |
64772
060177e931f8
Sync with Tramp 2.0.50.
Michael Albinus <michael.albinus@gmx.de>
parents:
64085
diff
changeset
|
6 ;; Author: Michael Albinus <michael.albinus@gmx.de> |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
7 ;; Keywords: comm, processes |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
8 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
10 |
94677
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
94677
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
14 ;; (at your option) any later version. |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
15 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
20 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
94677
91e5880a36c1
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
23 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
24 ;;; Commentary: |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
25 |
54198
c1bfc266f10a
Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
53206
diff
changeset
|
26 ;; Convenience functions for calling Ange-FTP from Tramp. |
c1bfc266f10a
Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
53206
diff
changeset
|
27 ;; Most of them are displaced from tramp.el. |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
28 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
29 ;;; Code: |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
30 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
31 (require 'tramp) |
82808
6e5814967ffb
* net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
32 (autoload 'tramp-set-connection-property "tramp-cache") |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
33 |
93388
bc76dffd89c0
* net/tramp-ftp.el: Require 'cl when byte-compiling.
Michael Albinus <michael.albinus@gmx.de>
parents:
91488
diff
changeset
|
34 (eval-when-compile |
bc76dffd89c0
* net/tramp-ftp.el: Require 'cl when byte-compiling.
Michael Albinus <michael.albinus@gmx.de>
parents:
91488
diff
changeset
|
35 |
bc76dffd89c0
* net/tramp-ftp.el: Require 'cl when byte-compiling.
Michael Albinus <michael.albinus@gmx.de>
parents:
91488
diff
changeset
|
36 ;; Pacify byte-compiler. |
bc76dffd89c0
* net/tramp-ftp.el: Require 'cl when byte-compiling.
Michael Albinus <michael.albinus@gmx.de>
parents:
91488
diff
changeset
|
37 (require 'cl) |
bc76dffd89c0
* net/tramp-ftp.el: Require 'cl when byte-compiling.
Michael Albinus <michael.albinus@gmx.de>
parents:
91488
diff
changeset
|
38 (require 'custom)) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
39 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
40 ;; Disable Ange-FTP from file-name-handler-alist. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
41 ;; To handle EFS, the following functions need to be dealt with: |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
42 ;; |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
43 ;; * dired-before-readin-hook contains efs-dired-before-readin |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
44 ;; * file-name-handler-alist contains efs-file-handler-function |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
45 ;; and efs-root-handler-function and efs-sifn-handler-function |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
46 ;; * find-file-hooks contains efs-set-buffer-mode |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
47 ;; |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
48 ;; But it won't happen for EFS since the XEmacs maintainers |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
49 ;; don't want to use a unified filename syntax. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
50 (defun tramp-disable-ange-ftp () |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
51 "Turn Ange-FTP off. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
52 This is useful for unified remoting. See |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
53 `tramp-file-name-structure-unified' and |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
54 `tramp-file-name-structure-separate' for details. Requests suitable |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
55 for Ange-FTP will be forwarded to Ange-FTP. Also see the variables |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
56 `tramp-ftp-method', `tramp-default-method', and |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
57 `tramp-default-method-alist'. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
58 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
59 This function is not needed in Emacsen which include Tramp, but is |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
60 present for backward compatibility." |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
61 (let ((a1 (rassq 'ange-ftp-hook-function file-name-handler-alist)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
62 (a2 (rassq 'ange-ftp-completion-hook-function file-name-handler-alist))) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
63 (setq file-name-handler-alist |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
64 (delete a1 (delete a2 file-name-handler-alist))))) |
68335
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
65 |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
66 (eval-after-load "ange-ftp" |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
67 '(when (functionp 'tramp-disable-ange-ftp) |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
68 (tramp-disable-ange-ftp))) |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
69 |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
70 ;;;###autoload |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
71 (defun tramp-ftp-enable-ange-ftp () |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
72 ;; The following code is commented out in Ange-FTP. |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
73 |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
74 ;;; This regexp takes care of real ange-ftp file names (with a slash |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
75 ;;; and colon). |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
76 ;;; Don't allow the host name to end in a period--some systems use /.: |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
77 (or (assoc "^/[^/:]*[^/:.]:" file-name-handler-alist) |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
78 (setq file-name-handler-alist |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
79 (cons '("^/[^/:]*[^/:.]:" . ange-ftp-hook-function) |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
80 file-name-handler-alist))) |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
81 |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
82 ;;; This regexp recognizes absolute filenames with only one component, |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
83 ;;; for the sake of hostname completion. |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
84 (or (assoc "^/[^/:]*\\'" file-name-handler-alist) |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
85 (setq file-name-handler-alist |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
86 (cons '("^/[^/:]*\\'" . ange-ftp-completion-hook-function) |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
87 file-name-handler-alist))) |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
88 |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
89 ;;; This regexp recognizes absolute filenames with only one component |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
90 ;;; on Windows, for the sake of hostname completion. |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
91 (and (memq system-type '(ms-dos windows-nt)) |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
92 (or (assoc "^[a-zA-Z]:/[^/:]*\\'" file-name-handler-alist) |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
93 (setq file-name-handler-alist |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
94 (cons '("^[a-zA-Z]:/[^/:]*\\'" . |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
95 ange-ftp-completion-hook-function) |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
96 file-name-handler-alist))))) |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
97 |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
98 (add-hook 'tramp-ftp-unload-hook 'tramp-ftp-enable-ange-ftp) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
99 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
100 ;; Define FTP method ... |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
101 (defcustom tramp-ftp-method "ftp" |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
102 "*When this method name is used, forward all calls to Ange-FTP." |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
103 :group 'tramp |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
104 :type 'string) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
105 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
106 ;; ... and add it to the method list. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
107 (add-to-list 'tramp-methods (cons tramp-ftp-method nil)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
108 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
109 ;; Add some defaults for `tramp-default-method-alist' |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
110 (add-to-list 'tramp-default-method-alist |
49612
407d6516031a
2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
48973
diff
changeset
|
111 (list "\\`ftp\\." "" tramp-ftp-method)) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
112 (add-to-list 'tramp-default-method-alist |
49612
407d6516031a
2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
48973
diff
changeset
|
113 (list "" "\\`\\(anonymous\\|ftp\\)\\'" tramp-ftp-method)) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
114 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
115 ;; Add completion function for FTP method. |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
116 (tramp-set-completion-function |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
117 tramp-ftp-method |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
118 '((tramp-parse-netrc "~/.netrc"))) |
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 ;; If there is URL syntax, `substitute-in-file-name' needs special |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
121 ;; handling. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
122 (put 'substitute-in-file-name 'ange-ftp 'tramp-handle-substitute-in-file-name) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
123 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
124 (defun tramp-ftp-file-name-handler (operation &rest args) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
125 "Invoke the Ange-FTP handler for OPERATION. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
126 First arg specifies the OPERATION, second arg is a list of arguments to |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
127 pass to the OPERATION." |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
128 (save-match-data |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
129 (or (boundp 'ange-ftp-name-format) |
49612
407d6516031a
2003-02-05 Kai Gro?ohann <kai.grossjohann@uni-duisburg.de>
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
48973
diff
changeset
|
130 (require 'ange-ftp)) |
50494
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
131 (let ((ange-ftp-name-format |
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
132 (list (nth 0 tramp-file-name-structure) |
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
133 (nth 3 tramp-file-name-structure) |
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
134 (nth 2 tramp-file-name-structure) |
54198
c1bfc266f10a
Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
53206
diff
changeset
|
135 (nth 4 tramp-file-name-structure))) |
c1bfc266f10a
Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
53206
diff
changeset
|
136 ;; ange-ftp uses `ange-ftp-ftp-name-arg' and `ange-ftp-ftp-name-res' |
c1bfc266f10a
Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
53206
diff
changeset
|
137 ;; for optimization in `ange-ftp-ftp-name'. If Tramp wasn't active, |
c1bfc266f10a
Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
53206
diff
changeset
|
138 ;; there could be incorrect values from previous calls in case the |
c1bfc266f10a
Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
53206
diff
changeset
|
139 ;; "ftp" method is used in the Tramp file name. So we unset |
c1bfc266f10a
Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
53206
diff
changeset
|
140 ;; those values. |
c1bfc266f10a
Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
53206
diff
changeset
|
141 (ange-ftp-ftp-name-arg "") |
c1bfc266f10a
Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
53206
diff
changeset
|
142 (ange-ftp-ftp-name-res nil)) |
50494
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
143 (cond |
82808
6e5814967ffb
* net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
144 ;; If argument is a symlink, `file-directory-p' and |
6e5814967ffb
* net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
145 ;; `file-exists-p' call the traversed file recursively. So we |
6e5814967ffb
* net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
146 ;; cannot disable the file-name-handler this case. We set the |
6e5814967ffb
* net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
147 ;; connection property "started" in order to put the remote |
6e5814967ffb
* net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
148 ;; location into the cache, which is helpful for further |
85962
7f134b676a0c
* net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents:
85041
diff
changeset
|
149 ;; completion. We don't use `with-parsed-tramp-file-name', |
7f134b676a0c
* net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents:
85041
diff
changeset
|
150 ;; because this returns another user but the one declared in |
7f134b676a0c
* net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents:
85041
diff
changeset
|
151 ;; "~/.netrc". |
50494
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
152 ((memq operation '(file-directory-p file-exists-p)) |
82808
6e5814967ffb
* net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
153 (if (apply 'ange-ftp-hook-function operation args) |
85962
7f134b676a0c
* net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents:
85041
diff
changeset
|
154 (let ((v (tramp-dissect-file-name (car args) t))) |
7f134b676a0c
* net/tramp.el (tramp-handle-substitute-in-file-name): Don't
Michael Albinus <michael.albinus@gmx.de>
parents:
85041
diff
changeset
|
155 (aset v 0 tramp-ftp-method) |
82808
6e5814967ffb
* net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
156 (tramp-set-connection-property v "started" t)) |
6e5814967ffb
* net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
157 nil)) |
86204
7d7472ea9c0a
* net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents:
85962
diff
changeset
|
158 |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
82808
diff
changeset
|
159 ;; If the second argument of `copy-file' or `rename-file' is a |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
82808
diff
changeset
|
160 ;; remote file name but via FTP, ange-ftp doesn't check this. |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
82808
diff
changeset
|
161 ;; We must copy it locally first, because there is no place in |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
82808
diff
changeset
|
162 ;; ange-ftp for correct handling. |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
82808
diff
changeset
|
163 ((and (memq operation '(copy-file rename-file)) |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
82808
diff
changeset
|
164 (file-remote-p (cadr args)) |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
82808
diff
changeset
|
165 (not (tramp-ftp-file-name-p (cadr args)))) |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
82808
diff
changeset
|
166 (let* ((filename (car args)) |
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
82808
diff
changeset
|
167 (newname (cadr args)) |
85041
a42b8750a992
* net/tramp.el (tramp-make-temp-file): Move to tramp-compat.el.
Michael Albinus <michael.albinus@gmx.de>
parents:
85024
diff
changeset
|
168 (tmpfile (tramp-compat-make-temp-file filename)) |
85024
ef71cdab0d5c
* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'.
Michael Albinus <michael.albinus@gmx.de>
parents:
82808
diff
changeset
|
169 (args (cddr args))) |
86204
7d7472ea9c0a
* net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents:
85962
diff
changeset
|
170 ;; We must set `ok-if-already-exists' to t in the first |
7d7472ea9c0a
* net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents:
85962
diff
changeset
|
171 ;; step, because the temp file has been created already. |
7d7472ea9c0a
* net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents:
85962
diff
changeset
|
172 (if (eq operation 'copy-file) |
7d7472ea9c0a
* net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents:
85962
diff
changeset
|
173 (apply operation filename tmpfile t (cdr args)) |
7d7472ea9c0a
* net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents:
85962
diff
changeset
|
174 (apply operation filename tmpfile t)) |
7d7472ea9c0a
* net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents:
85962
diff
changeset
|
175 (unwind-protect |
7d7472ea9c0a
* net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents:
85962
diff
changeset
|
176 (rename-file tmpfile newname (car args)) |
7d7472ea9c0a
* net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents:
85962
diff
changeset
|
177 ;; Cleanup. |
7d7472ea9c0a
* net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents:
85962
diff
changeset
|
178 (ignore-errors (delete-file tmpfile))))) |
7d7472ea9c0a
* net/tramp.el (tramp-completion-reread-directory-timeout): New
Michael Albinus <michael.albinus@gmx.de>
parents:
85962
diff
changeset
|
179 |
82808
6e5814967ffb
* net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
180 ;; Normally, the handlers must be discarded. |
6e5814967ffb
* net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
181 (t (let* ((inhibit-file-name-handlers |
6e5814967ffb
* net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
182 (list 'tramp-file-name-handler |
6e5814967ffb
* net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
183 'tramp-completion-file-name-handler |
6e5814967ffb
* net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
184 (and (eq inhibit-file-name-operation operation) |
6e5814967ffb
* net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
185 inhibit-file-name-handlers))) |
6e5814967ffb
* net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
186 (inhibit-file-name-operation operation)) |
6e5814967ffb
* net/tramp.el (tramp-local-host-p): New defun.
Michael Albinus <michael.albinus@gmx.de>
parents:
82201
diff
changeset
|
187 (apply 'ange-ftp-hook-function operation args))))))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
188 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
189 (defun tramp-ftp-file-name-p (filename) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
190 "Check if it's a filename that should be forwarded to Ange-FTP." |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
191 (let ((v (tramp-dissect-file-name filename))) |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
192 (string= (tramp-file-name-method v) tramp-ftp-method))) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
193 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
194 (add-to-list 'tramp-foreign-file-name-handler-alist |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
195 (cons 'tramp-ftp-file-name-p 'tramp-ftp-file-name-handler)) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
196 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
197 (provide 'tramp-ftp) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
198 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
199 ;;; TODO: |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
200 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
201 ;; * In case of "/ftp:host:file" this works only for functions which |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
202 ;; are defined in `tramp-file-name-handler-alist'. Call has to be |
50494
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
203 ;; pretended in `tramp-file-name-handler' otherwise. |
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
204 ;; Furthermore, there are no backup files on FTP hosts. |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
205 ;; Worth further investigations. |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
206 |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93388
diff
changeset
|
207 ;; arch-tag: 759fb338-5c63-4b99-bd36-b4d59db91cff |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
208 ;;; tramp-ftp.el ends here |