Mercurial > emacs
comparison lisp/net/tramp-ftp.el @ 88155:d7ddb3e565de
sync with trunk
author | Henrik Enberg <henrik.enberg@telia.com> |
---|---|
date | Mon, 16 Jan 2006 00:03:54 +0000 |
parents | 407d6516031a |
children |
comparison
equal
deleted
inserted
replaced
88154:8ce476d3ba36 | 88155:d7ddb3e565de |
---|---|
1 ;;; tramp-ftp.el --- Tramp convenience functions for Ange-FTP and EFS -*- coding: iso-8859-1; -*- | 1 ;;; tramp-ftp.el --- Tramp convenience functions for Ange-FTP -*- coding: iso-8859-1; -*- |
2 | 2 |
3 ;; Copyright (C) 2002, 2003 Free Software Foundation, Inc. | 3 ;; Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: Michael Albinus <Michael.Albinus@alcatel.de> | 5 ;; Author: Michael Albinus <michael.albinus@gmx.de> |
6 ;; Keywords: comm, processes | 6 ;; Keywords: comm, processes |
7 | 7 |
8 ;; This file is part of GNU Emacs. | 8 ;; This file is part of GNU Emacs. |
9 | 9 |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | 10 ;; GNU Emacs is free software; you can redistribute it and/or modify |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 ;; GNU General Public License for more details. | 18 ;; GNU General Public License for more details. |
19 | 19 |
20 ;; You should have received a copy of the GNU General Public License | 20 ;; You should have received a copy of the GNU General Public License |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the | 21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
23 ;; Boston, MA 02111-1307, USA. | 23 ;; Boston, MA 02110-1301, USA. |
24 | 24 |
25 ;;; Commentary: | 25 ;;; Commentary: |
26 | 26 |
27 ;; Convenience functions for calling Ange-FTP (and maybe EFS, later on) | 27 ;; Convenience functions for calling Ange-FTP from Tramp. |
28 ;; from Tramp. Most of them are displaced from tramp.el. | 28 ;; Most of them are displaced from tramp.el. |
29 | 29 |
30 ;;; Code: | 30 ;;; Code: |
31 | 31 |
32 (require 'tramp) | 32 (require 'tramp) |
33 | 33 |
92 First arg specifies the OPERATION, second arg is a list of arguments to | 92 First arg specifies the OPERATION, second arg is a list of arguments to |
93 pass to the OPERATION." | 93 pass to the OPERATION." |
94 (save-match-data | 94 (save-match-data |
95 (or (boundp 'ange-ftp-name-format) | 95 (or (boundp 'ange-ftp-name-format) |
96 (require 'ange-ftp)) | 96 (require 'ange-ftp)) |
97 (let* ((ange-ftp-name-format | 97 (let ((ange-ftp-name-format |
98 (list (nth 0 tramp-file-name-structure) | 98 (list (nth 0 tramp-file-name-structure) |
99 (nth 3 tramp-file-name-structure) | 99 (nth 3 tramp-file-name-structure) |
100 (nth 2 tramp-file-name-structure) | 100 (nth 2 tramp-file-name-structure) |
101 (nth 4 tramp-file-name-structure))) | 101 (nth 4 tramp-file-name-structure))) |
102 (inhibit-file-name-handlers | 102 ;; ange-ftp uses `ange-ftp-ftp-name-arg' and `ange-ftp-ftp-name-res' |
103 (list 'tramp-file-name-handler | 103 ;; for optimization in `ange-ftp-ftp-name'. If Tramp wasn't active, |
104 'tramp-completion-file-name-handler | 104 ;; there could be incorrect values from previous calls in case the |
105 (and (eq inhibit-file-name-operation operation) | 105 ;; "ftp" method is used in the Tramp file name. So we unset |
106 inhibit-file-name-handlers))) | 106 ;; those values. |
107 (inhibit-file-name-operation operation)) | 107 (ange-ftp-ftp-name-arg "") |
108 (apply 'ange-ftp-hook-function operation args)))) | 108 (ange-ftp-ftp-name-res nil)) |
109 (cond | |
110 ;; If argument is a symlink, `file-directory-p' and `file-exists-p' | |
111 ;; call the traversed file recursively. So we cannot disable the | |
112 ;; file-name-handler this case. | |
113 ((memq operation '(file-directory-p file-exists-p)) | |
114 (apply 'ange-ftp-hook-function operation args)) | |
115 ;; Normally, the handlers must be discarded | |
116 (t (let* ((inhibit-file-name-handlers | |
117 (list 'tramp-file-name-handler | |
118 'tramp-completion-file-name-handler | |
119 (and (eq inhibit-file-name-operation operation) | |
120 inhibit-file-name-handlers))) | |
121 (inhibit-file-name-operation operation)) | |
122 (apply 'ange-ftp-hook-function operation args))))))) | |
109 | 123 |
110 (defun tramp-ftp-file-name-p (filename) | 124 (defun tramp-ftp-file-name-p (filename) |
111 "Check if it's a filename that should be forwarded to Ange-FTP." | 125 "Check if it's a filename that should be forwarded to Ange-FTP." |
112 (let ((v (tramp-dissect-file-name filename))) | 126 (let ((v (tramp-dissect-file-name filename))) |
113 (string= | 127 (string= |
125 | 139 |
126 ;;; TODO: | 140 ;;; TODO: |
127 | 141 |
128 ;; * In case of "/ftp:host:file" this works only for functions which | 142 ;; * In case of "/ftp:host:file" this works only for functions which |
129 ;; are defined in `tramp-file-name-handler-alist'. Call has to be | 143 ;; are defined in `tramp-file-name-handler-alist'. Call has to be |
130 ;; pretended in `tramp-file-name-handler' otherwise. Looks like | 144 ;; pretended in `tramp-file-name-handler' otherwise. |
131 ;; `ange-ftp-completion-hook-function' and `ange-ftp-hook-function' | 145 ;; Furthermore, there are no backup files on FTP hosts. |
132 ;; are active temporarily in `file-name-handler-alist'. | |
133 ;; Furthermore, there are no backup files on FTP hosts this case. | |
134 ;; Worth further investigations. | 146 ;; Worth further investigations. |
147 ;; * Map /multi:ssh:out@gate:ftp:kai@real.host:/path/to.file | |
148 ;; on Ange-FTP gateways. | |
135 | 149 |
150 ;;; arch-tag: 759fb338-5c63-4b99-bd36-b4d59db91cff | |
136 ;;; tramp-ftp.el ends here | 151 ;;; tramp-ftp.el ends here |