Mercurial > emacs
annotate lisp/net/tramp-ftp.el @ 82724:3e342b7c26dc
Move tutorials from etc/ to etc/tutorials/
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Wed, 22 Aug 2007 07:41:21 +0000 |
parents | b3182f0c969c |
children | 6e5814967ffb 539530fa389c |
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 |
77986
0cc9b64806d2
Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents:
75347
diff
changeset
|
3 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, |
0cc9b64806d2
Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents:
75347
diff
changeset
|
4 ;; 2007 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 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
11 ;; GNU Emacs is free software; you can redistribute it and/or modify |
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 |
78230
84cf1e2214c5
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
77986
diff
changeset
|
13 ;; the Free Software Foundation; either version 3, or (at your option) |
48973
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
14 ;; any later version. |
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 |
81758
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
22 ;; 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
|
23 ;; <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
|
24 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
25 ;;; Commentary: |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
26 |
54198
c1bfc266f10a
Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
53206
diff
changeset
|
27 ;; 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
|
28 ;; 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
|
29 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
30 ;;; Code: |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
31 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
32 (require 'tramp) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
33 |
77986
0cc9b64806d2
Sync with Tramp 2.0.56.
Michael Albinus <michael.albinus@gmx.de>
parents:
75347
diff
changeset
|
34 (eval-when-compile (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
|
35 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
36 ;; 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
|
37 ;; 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
|
38 ;; |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
39 ;; * 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
|
40 ;; * 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
|
41 ;; 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
|
42 ;; * 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
|
43 ;; |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
44 ;; 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
|
45 ;; 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
|
46 (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
|
47 "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
|
48 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
|
49 `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
|
50 `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
|
51 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
|
52 `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
|
53 `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
|
54 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
55 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
|
56 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
|
57 (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
|
58 (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
|
59 (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
|
60 (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
|
61 |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
62 (eval-after-load "ange-ftp" |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
63 '(when (functionp 'tramp-disable-ange-ftp) |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
64 (tramp-disable-ange-ftp))) |
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 ;;;###autoload |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
67 (defun tramp-ftp-enable-ange-ftp () |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
68 ;; 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
|
69 |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
70 ;;; 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
|
71 ;;; and colon). |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
72 ;;; 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
|
73 (or (assoc "^/[^/:]*[^/:.]:" file-name-handler-alist) |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
74 (setq file-name-handler-alist |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
75 (cons '("^/[^/:]*[^/:.]:" . ange-ftp-hook-function) |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
76 file-name-handler-alist))) |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
77 |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
78 ;;; 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
|
79 ;;; for the sake of hostname completion. |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
80 (or (assoc "^/[^/:]*\\'" file-name-handler-alist) |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
81 (setq file-name-handler-alist |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
82 (cons '("^/[^/:]*\\'" . ange-ftp-completion-hook-function) |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
83 file-name-handler-alist))) |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
84 |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
85 ;;; 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
|
86 ;;; 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
|
87 (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
|
88 (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
|
89 (setq file-name-handler-alist |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
90 (cons '("^[a-zA-Z]:/[^/:]*\\'" . |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
91 ange-ftp-completion-hook-function) |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
92 file-name-handler-alist))))) |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
93 |
118ceefc8263
Sync with Tramp 2.0.52.
Michael Albinus <michael.albinus@gmx.de>
parents:
64772
diff
changeset
|
94 (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
|
95 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
96 ;; 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
|
97 (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
|
98 "*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
|
99 :group 'tramp |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
100 :type 'string) |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
101 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
102 ;; ... 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
|
103 (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
|
104 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
105 ;; 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
|
106 (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
|
107 (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
|
108 (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
|
109 (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
|
110 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
111 ;; 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
|
112 (tramp-set-completion-function |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
113 tramp-ftp-method |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
114 '((tramp-parse-netrc "~/.netrc"))) |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
115 |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
116 ;; 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
|
117 ;; handling. |
f03856eb136b
* files.el (file-remote-p): Introduce optional parameter CONNECTED.
Michael Albinus <michael.albinus@gmx.de>
parents:
77986
diff
changeset
|
118 (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
|
119 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
120 (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
|
121 "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
|
122 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
|
123 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
|
124 (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
|
125 (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
|
126 (require 'ange-ftp)) |
50494
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
127 (let ((ange-ftp-name-format |
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
128 (list (nth 0 tramp-file-name-structure) |
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
129 (nth 3 tramp-file-name-structure) |
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
130 (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
|
131 (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
|
132 ;; 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
|
133 ;; 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
|
134 ;; 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
|
135 ;; "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
|
136 ;; those values. |
c1bfc266f10a
Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
53206
diff
changeset
|
137 (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
|
138 (ange-ftp-ftp-name-res nil)) |
50494
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
139 (cond |
54198
c1bfc266f10a
Tramp: sync with upstream version 2.0.39.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
53206
diff
changeset
|
140 ;; If argument is a symlink, `file-directory-p' and `file-exists-p' |
50494
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
141 ;; call the traversed file recursively. So we cannot disable the |
51177
6234a4fe96f9
Version 2.0.34 (of Tramp) released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
50494
diff
changeset
|
142 ;; file-name-handler this case. |
50494
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
143 ((memq operation '(file-directory-p file-exists-p)) |
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
144 (apply 'ange-ftp-hook-function operation args)) |
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
145 ;; Normally, the handlers must be discarded |
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
146 (t (let* ((inhibit-file-name-handlers |
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
147 (list 'tramp-file-name-handler |
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
148 'tramp-completion-file-name-handler |
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
149 (and (eq inhibit-file-name-operation operation) |
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
150 inhibit-file-name-handlers))) |
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
151 (inhibit-file-name-operation operation)) |
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
152 (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
|
153 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
154 (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
|
155 "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
|
156 (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
|
157 (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
|
158 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
159 (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
|
160 (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
|
161 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
162 (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
|
163 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
164 ;;; TODO: |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
165 |
09acf3f65bb5
* net/tramp*.el: Sync with upstream version 2.0.28. Bugfixes.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
diff
changeset
|
166 ;; * 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
|
167 ;; 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
|
168 ;; pretended in `tramp-file-name-handler' otherwise. |
5b6aaf393205
Version 2.0.33 released.
Kai Großjohann <kgrossjo@eu.uu.net>
parents:
49612
diff
changeset
|
169 ;; 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
|
170 ;; 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
|
171 |
52401 | 172 ;;; 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
|
173 ;;; tramp-ftp.el ends here |