]> code.delx.au - gnu-emacs/blobdiff - lisp/net/tramp-ftp.el
* lisp/net/tramp-sh.el (tramp-methods) <doas>: Add. (Bug#22542)
[gnu-emacs] / lisp / net / tramp-ftp.el
index 7d266d4d172e25e0850ec3a241f4a9421ee9d44e..caca3c0cb4c6d5c2d932f35796b39489b49ce98e 100644 (file)
@@ -1,6 +1,6 @@
 ;;; tramp-ftp.el --- Tramp convenience functions for Ange-FTP
 
-;; Copyright (C) 2002-2013 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2016 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
 
 (require 'tramp)
 
+;; Pacify byte-compiler.
 (eval-when-compile
-
-  ;; Pacify byte-compiler.
   (require 'cl)
   (require 'custom))
+(defvar ange-ftp-ftp-name-arg)
+(defvar ange-ftp-ftp-name-res)
+(defvar ange-ftp-name-format)
 
 ;; Disable Ange-FTP from file-name-handler-alist.
-;; To handle EFS, the following functions need to be dealt with:
-;;
-;; * dired-before-readin-hook contains efs-dired-before-readin
-;; * file-name-handler-alist contains efs-file-handler-function
-;;   and efs-root-handler-function and efs-sifn-handler-function
-;; * find-file-hooks contains efs-set-buffer-mode
-;;
-;; But it won't happen for EFS since the XEmacs maintainers
-;; don't want to use a unified filename syntax.
 (defun tramp-disable-ange-ftp ()
   "Turn Ange-FTP off.
 This is useful for unified remoting.  See
@@ -102,14 +95,15 @@ present for backward compatibility."
 
 ;; ... and add it to the method list.
 ;;;###tramp-autoload
-(unless (featurep 'xemacs)
-  (add-to-list 'tramp-methods (cons tramp-ftp-method nil))
+(add-to-list 'tramp-methods (cons tramp-ftp-method nil))
 
-  ;; Add some defaults for `tramp-default-method-alist'.
-  (add-to-list 'tramp-default-method-alist
-              (list "\\`ftp\\." nil tramp-ftp-method))
-  (add-to-list 'tramp-default-method-alist
-              (list nil "\\`\\(anonymous\\|ftp\\)\\'" tramp-ftp-method)))
+;; Add some defaults for `tramp-default-method-alist'.
+;;;###tramp-autoload
+(add-to-list 'tramp-default-method-alist
+            (list "\\`ftp\\." nil tramp-ftp-method))
+;;;###tramp-autoload
+(add-to-list 'tramp-default-method-alist
+            (list nil "\\`\\(anonymous\\|ftp\\)\\'" tramp-ftp-method))
 
 ;; Add completion function for FTP method.
 ;;;###tramp-autoload
@@ -118,17 +112,6 @@ present for backward compatibility."
      tramp-ftp-method
      '((tramp-parse-netrc "~/.netrc"))))
 
-;; If there is URL syntax, `substitute-in-file-name' needs special
-;; handling.
-(put 'substitute-in-file-name 'ange-ftp 'tramp-handle-substitute-in-file-name)
-(add-hook 'tramp-ftp-unload-hook
-         (lambda ()
-            (setplist 'substitute-in-file-name
-                      (delete 'ange-ftp
-                              (delete 'tramp-handle-substitute-in-file-name
-                                      (symbol-plist
-                                       'substitute-in-file-name))))))
-
 ;;;###tramp-autoload
 (defun tramp-ftp-file-name-handler (operation &rest args)
   "Invoke the Ange-FTP handler for OPERATION.
@@ -170,7 +153,7 @@ pass to the OPERATION."
        ;; We must copy it locally first, because there is no place in
        ;; ange-ftp for correct handling.
        ((and (memq operation '(copy-file rename-file))
-            (file-remote-p (cadr args))
+            (tramp-tramp-file-p (cadr args))
             (not (tramp-ftp-file-name-p (cadr args))))
        (let* ((filename (car args))
               (newname (cadr args))
@@ -187,12 +170,7 @@ pass to the OPERATION."
            (ignore-errors (delete-file tmpfile)))))
 
        ;; Normally, the handlers must be discarded.
-       ;; `inhibit-file-name-handlers' isn't sufficient, because the
-       ;; local file name could be in Tramp syntax as well (for
-       ;; example, returning VMS file names like "/DISK$CAM:/AAA").
-       ;; That's why we set also `tramp-mode' to nil.
-       (t (let* (;(tramp-mode nil)
-                (inhibit-file-name-handlers
+       (t (let* ((inhibit-file-name-handlers
                  (list 'tramp-file-name-handler
                        'tramp-completion-file-name-handler
                        (and (eq inhibit-file-name-operation operation)
@@ -209,9 +187,8 @@ pass to the OPERATION."
           tramp-ftp-method))
 
 ;;;###tramp-autoload
-(unless (featurep 'xemacs)
-  (add-to-list 'tramp-foreign-file-name-handler-alist
-              (cons 'tramp-ftp-file-name-p 'tramp-ftp-file-name-handler)))
+(add-to-list 'tramp-foreign-file-name-handler-alist
+            (cons 'tramp-ftp-file-name-p 'tramp-ftp-file-name-handler))
 
 (add-hook 'tramp-unload-hook
          (lambda ()