aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Großjohann2002-07-11 19:59:07 +0000
committerKai Großjohann2002-07-11 19:59:07 +0000
commit505edaeb0e37f1a92bb5a22ec7e7a4e8c83f7615 (patch)
treea27da9d89bf50a36570feb1364b70b2df2c9ead6
parent74a54b047727b5209e93a99f80134643fc4636f6 (diff)
downloademacs-505edaeb0e37f1a92bb5a22ec7e7a4e8c83f7615.tar.gz
emacs-505edaeb0e37f1a92bb5a22ec7e7a4e8c83f7615.zip
(tramp-default-method): New default method "sm"
which I guess to be good for most people. (tramp-default-method-alist): Use "ftp" method (ie, forwarding to Ange-FTP) for some user/host combinations. (tramp-file-name-structure, tramp-file-name-regexp) (tramp-make-tramp-file-format) (tramp-make-tramp-file-user-nil-format) (tramp-multi-file-name-structure) (tramp-multi-file-name-hop-structure) (tramp-make-multi-tramp-file-format): New default value which unifies the filename syntax between Tramp and Ange-FTP. The new syntax is "/method:user@host:path". Note the colon after the method. (tramp-handle-file-name-directory): Don't return "/" when completing a remote root directory (where the filename looks like "/method:user@host:/"). (tramp-handle-ange-ftp): Deleted. (tramp-disable-ange-ftp): New function, called at toplevel, deletes Ange-FTP from file-name-handler-alist.
-rw-r--r--lisp/ChangeLog22
-rw-r--r--lisp/net/tramp.el210
2 files changed, 187 insertions, 45 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b6cf752a663..2664bf148f1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,25 @@
12002-07-11 Kai Gro,b_(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
2
3 * net/tramp.el (tramp-default-method): New default method "sm"
4 which I guess to be good for most people.
5 (tramp-default-method-alist): Use "ftp" method (ie, forwarding to
6 Ange-FTP) for some user/host combinations.
7 (tramp-file-name-structure, tramp-file-name-regexp)
8 (tramp-make-tramp-file-format)
9 (tramp-make-tramp-file-user-nil-format)
10 (tramp-multi-file-name-structure)
11 (tramp-multi-file-name-hop-structure)
12 (tramp-make-multi-tramp-file-format): New default value which
13 unifies the filename syntax between Tramp and Ange-FTP. The new
14 syntax is "/method:user@host:path". Note the colon after the
15 method.
16 (tramp-handle-file-name-directory): Don't return "/" when
17 completing a remote root directory (where the filename looks like
18 "/method:user@host:/").
19 (tramp-handle-ange-ftp): Deleted.
20 (tramp-disable-ange-ftp): New function, called at toplevel,
21 deletes Ange-FTP from file-name-handler-alist.
22
12002-07-10 Juanma Barranquero <lektu@terra.es> 232002-07-10 Juanma Barranquero <lektu@terra.es>
2 24
3 * ido.el (ido-enter-single-matching-directory): Delete leftover comment. 25 * ido.el (ido-enter-single-matching-directory): Delete leftover comment.
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 8917c62ac02..b29d478f17d 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -774,14 +774,24 @@ various functions for details."
774 :group 'tramp 774 :group 'tramp
775 :type '(repeat (list string function string))) 775 :type '(repeat (list string function string)))
776 776
777(defcustom tramp-default-method "rcp" 777(defcustom tramp-default-method "sm"
778 ;;(if (featurep 'xemacs) "sm" "ftp")
778 "*Default method to use for transferring files. 779 "*Default method to use for transferring files.
779See `tramp-methods' for possibilities. 780See `tramp-methods' for possibilities.
780Also see `tramp-default-method-alist'." 781Also see `tramp-default-method-alist'.
782
783Emacs uses a unified filename syntax for Tramp and Ange-FTP.
784For backward compatibility, the default value of this variable
785is \"ftp\" on Emacs. But XEmacs uses a separate filename syntax
786for Tramp and EFS, so there the default method is \"sm\"."
781 :group 'tramp 787 :group 'tramp
782 :type 'string) 788 :type 'string)
783 789
784(defcustom tramp-default-method-alist nil 790(defcustom tramp-default-method-alist
791 (if (featurep 'xemacs)
792 nil
793 '(("\\`ftp\\." "" "ftp")
794 ("" "\\`\\(anonymous\\|ftp\\)\\'" "ftp")))
785 "*Default method to use for specific user/host pairs. 795 "*Default method to use for specific user/host pairs.
786This is an alist of items (HOST USER METHOD). The first matching item 796This is an alist of items (HOST USER METHOD). The first matching item
787specifies the method to use for a file name which does not specify a 797specifies the method to use for a file name which does not specify a
@@ -877,12 +887,31 @@ shell from reading its init file."
877 887
878;; File name format. 888;; File name format.
879 889
880(defcustom tramp-file-name-structure 890(defconst tramp-file-name-structure-unified
891 (list (concat "\\`/\\(\\([a-zA-Z0-9]+\\):\\)?" ;method
892 "\\(\\([^:@/]+\\)@\\)?" ;user
893 "\\([^:/]+\\):" ;host
894 "\\(.*\\)\\'") ;path
895 2 4 5 6)
896 "Default value for `tramp-file-name-structure' for unified remoting.
897On Emacs (not XEmacs), the Tramp and Ange-FTP packages use a unified
898filename space. This value is used for this unified namespace.")
899
900(defconst tramp-file-name-structure-separate
881 (list (concat "\\`/\\[\\(\\([a-zA-Z0-9]+\\)/\\)?" ;method 901 (list (concat "\\`/\\[\\(\\([a-zA-Z0-9]+\\)/\\)?" ;method
882 "\\(\\([-a-zA-Z0-9_#/:]+\\)@\\)?" ;user 902 "\\(\\([-a-zA-Z0-9_#/:]+\\)@\\)?" ;user
883 "\\([-a-zA-Z0-9_#/:@.]+\\)\\]" ;host 903 "\\([-a-zA-Z0-9_#/:@.]+\\)\\]" ;host
884 "\\(.*\\)\\'") ;path 904 "\\(.*\\)\\'") ;path
885 2 4 5 6) 905 2 4 5 6)
906 "Default value for `tramp-file-name-structure' for separate remoting.
907On XEmacs, the Tramp and EFS packages use a separate namespace for
908remote filenames. This value is used in that case. It is designed
909not to clash with the EFS filename syntax.")
910
911(defcustom tramp-file-name-structure
912 (if (featurep 'xemacs)
913 tramp-file-name-structure-separate
914 tramp-file-name-structure-unified)
886 "*List of five elements (REGEXP METHOD USER HOST FILE), detailing \ 915 "*List of five elements (REGEXP METHOD USER HOST FILE), detailing \
887the tramp file name structure. 916the tramp file name structure.
888 917
@@ -906,7 +935,24 @@ See also `tramp-file-name-regexp' and `tramp-make-tramp-file-format'."
906 (integer :tag "Paren pair for file name "))) 935 (integer :tag "Paren pair for file name ")))
907 936
908;;;###autoload 937;;;###autoload
909(defcustom tramp-file-name-regexp "\\`/\\[.*\\]" 938(defconst tramp-file-name-regexp-unified
939 "\\`/[^/:]+:"
940 "Value for `tramp-file-name-regexp' for unified remoting.
941Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and
942Tramp. See `tramp-file-name-structure-unified' for more explanations.")
943
944;;;###autoload
945(defconst tramp-file-name-regexp-separate
946 "\\`/\\[.*\\]"
947 "Value for `tramp-file-name-regexp' for separate remoting.
948XEmacs uses a separate filename syntax for Tramp and EFS.
949See `tramp-file-name-structure-separate' for more explanations.")
950
951;;;###autoload
952(defcustom tramp-file-name-regexp
953 (if (featurep 'xemacs)
954 tramp-file-name-regexp-separate
955 tramp-file-name-regexp-unified)
910 "*Regular expression matching file names handled by tramp. 956 "*Regular expression matching file names handled by tramp.
911This regexp should match tramp file names but no other file names. 957This regexp should match tramp file names but no other file names.
912\(When tramp.el is loaded, this regular expression is prepended to 958\(When tramp.el is loaded, this regular expression is prepended to
@@ -924,7 +970,22 @@ Also see `tramp-file-name-structure' and `tramp-make-tramp-file-format'."
924 :group 'tramp 970 :group 'tramp
925 :type 'regexp) 971 :type 'regexp)
926 972
927(defcustom tramp-make-tramp-file-format "/[%m/%u@%h]%p" 973(defconst tramp-make-tramp-file-format-unified
974 "/%m:%u@%h:%p"
975 "Value for `tramp-make-tramp-file-format' for unified remoting.
976Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.
977See `tramp-file-name-structure-unified' for more details.")
978
979(defconst tramp-make-tramp-file-format-separate
980 "/[%m/%u@%h]%p"
981 "Value for `tramp-make-tramp-file-format' for separate remoting.
982XEmacs uses a separate filename syntax for EFS and Tramp.
983See `tramp-file-name-structure-separate' for more details.")
984
985(defcustom tramp-make-tramp-file-format
986 (if (featurep 'xemacs)
987 tramp-make-tramp-file-format-separate
988 tramp-make-tramp-file-format-unified)
928 "*Format string saying how to construct tramp file name. 989 "*Format string saying how to construct tramp file name.
929`%m' is replaced by the method name. 990`%m' is replaced by the method name.
930`%u' is replaced by the user name. 991`%u' is replaced by the user name.
@@ -936,7 +997,22 @@ Also see `tramp-file-name-structure' and `tramp-file-name-regexp'."
936 :group 'tramp 997 :group 'tramp
937 :type 'string) 998 :type 'string)
938 999
939(defcustom tramp-make-tramp-file-user-nil-format "/[%m/%h]%p" 1000(defconst tramp-make-tramp-file-user-nil-format-unified
1001 "/%m:%h:%p"
1002 "Value of `tramp-make-tramp-file-user-nil-format' for unified remoting.
1003Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.
1004See `tramp-file-name-structure-unified' for details.")
1005
1006(defconst tramp-make-tramp-file-user-nil-format-separate
1007 "/[%m/%h]%p"
1008 "Value of `tramp-make-tramp-file-user-nil-format' for separate remoting.
1009XEmacs uses a separate filename syntax for EFS and Tramp.
1010See `tramp-file-name-structure-separate' for details.")
1011
1012(defcustom tramp-make-tramp-file-user-nil-format
1013 (if (featurep 'xemacs)
1014 tramp-make-tramp-file-user-nil-format-separate
1015 tramp-make-tramp-file-user-nil-format-unified)
940 "*Format string saying how to construct tramp file name when the user name is not known. 1016 "*Format string saying how to construct tramp file name when the user name is not known.
941`%m' is replaced by the method name. 1017`%m' is replaced by the method name.
942`%h' is replaced by the host name. 1018`%h' is replaced by the host name.
@@ -947,7 +1023,16 @@ Also see `tramp-make-tramp-file-format', `tramp-file-name-structure', and `tramp
947 :group 'tramp 1023 :group 'tramp
948 :type 'string) 1024 :type 'string)
949 1025
950(defcustom tramp-multi-file-name-structure 1026(defconst tramp-multi-file-name-structure-unified
1027 (list (concat "\\`\\([a-zA-Z0-9]+\\)\\)?" ;method
1028 "\\(\\(%s\\)+\\)" ;hops
1029 ":\\(.*\\)\\'") ;path
1030 2 3 -1)
1031 "Value for `tramp-multi-file-name-structure' for unified remoting.
1032Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.
1033See `tramp-file-name-structure-unified' for details.")
1034
1035(defconst tramp-file-name-structure-separate
951 (list (concat 1036 (list (concat
952 ;; prefix 1037 ;; prefix
953 "\\`/\\[\\(\\([a-z0-9]+\\)\\)?" 1038 "\\`/\\[\\(\\([a-z0-9]+\\)\\)?"
@@ -958,6 +1043,14 @@ Also see `tramp-make-tramp-file-format', `tramp-file-name-structure', and `tramp
958 2 ;number of pair to match method 1043 2 ;number of pair to match method
959 3 ;number of pair to match hops 1044 3 ;number of pair to match hops
960 -1) ;number of pair to match path 1045 -1) ;number of pair to match path
1046 "Value of `tramp-multi-file-name-structure' for separate remoting.
1047XEmacs uses a separate filename syntax for EFS and Tramp.
1048See `tramp-file-name-structure-separate' for details.")
1049
1050(defcustom tramp-multi-file-name-structure
1051 (if (featurep 'xemacs)
1052 tramp-multi-file-name-structure-separate
1053 tramp-multi-file-name-structure-unified)
961 "*Describes the file name structure of `multi' files. 1054 "*Describes the file name structure of `multi' files.
962Multi files allow you to contact a remote host in several hops. 1055Multi files allow you to contact a remote host in several hops.
963This is a list of four elements (REGEXP METHOD HOP PATH). 1056This is a list of four elements (REGEXP METHOD HOP PATH).
@@ -985,11 +1078,28 @@ string, but I haven't actually tried what happens if it doesn't..."
985 (integer :tag "Paren pair for hops") 1078 (integer :tag "Paren pair for hops")
986 (integer :tag "Paren pair to match path"))) 1079 (integer :tag "Paren pair to match path")))
987 1080
988(defcustom tramp-multi-file-name-hop-structure 1081(defconst tramp-multi-file-name-hop-structure-unified
1082 (list (concat ":\\([a-zA-z0-9_]+\\):" ;hop method
1083 "\\([^@:/]+\\)@" ;user
1084 "\\([^:/]+\\)") ;host
1085 1 2 3)
1086 "Value of `tramp-multi-file-name-hop-structure' for unified remoting.
1087Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.
1088See `tramp-file-name-structure-unified' for details.")
1089
1090(defconst tramp-multi-file-name-hop-structure-separate
989 (list (concat "/\\([a-z0-9_]+\\):" ;hop method 1091 (list (concat "/\\([a-z0-9_]+\\):" ;hop method
990 "\\([a-z0-9_]+\\)@" ;user 1092 "\\([a-z0-9_]+\\)@" ;user
991 "\\([a-z0-9.-]+\\)") ;host 1093 "\\([a-z0-9.-]+\\)") ;host
992 1 2 3) 1094 1 2 3)
1095 "Value of `tramp-multi-file-name-hop-structure' for separate remoting.
1096XEmacs uses a separate filename syntax for EFS and Tramp.
1097See `tramp-file-name-structure-separate' for details.")
1098
1099(defcustom tramp-multi-file-name-hop-structure
1100 (if (featurep 'xemacs)
1101 tramp-multi-file-name-hop-structure-separate
1102 tramp-multi-file-name-hop-structure-unified)
993 "*Describes the structure of a hop in multi files. 1103 "*Describes the structure of a hop in multi files.
994This is a list of four elements (REGEXP METHOD USER HOST). First 1104This is a list of four elements (REGEXP METHOD USER HOST). First
995element REGEXP is used to match against the hop. Pair number METHOD 1105element REGEXP is used to match against the hop. Pair number METHOD
@@ -1003,8 +1113,22 @@ This regular expression should match exactly all of one hop."
1003 (integer :tag "Paren pair for user name") 1113 (integer :tag "Paren pair for user name")
1004 (integer :tag "Paren pair for host name"))) 1114 (integer :tag "Paren pair for host name")))
1005 1115
1006(defcustom tramp-make-multi-tramp-file-format 1116(defconst tramp-make-multi-tramp-file-format-unified
1117 (list "/%m" ":%m:%u@%h" ":%p")
1118 "Value of `tramp-make-multi-tramp-file-format' for unified remoting.
1119Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.
1120See `tramp-file-name-structure-unified' for details.")
1121
1122(defconst tramp-make-multi-tramp-file-format-separate
1007 (list "/[%m" "/%m:%u@%h" "]%p") 1123 (list "/[%m" "/%m:%u@%h" "]%p")
1124 "Value of `tramp-make-multi-tramp-file-format' for separate remoting.
1125XEmacs uses a separate filename syntax for EFS and Tramp.
1126See `tramp-file-name-structure-separate' for details.")
1127
1128(defcustom tramp-make-multi-tramp-file-format
1129 (if (featurep 'xemacs)
1130 tramp-make-multi-tramp-file-format-separate
1131 tramp-make-multi-tramp-file-format-unified)
1008 "*Describes how to construct a `multi' file name. 1132 "*Describes how to construct a `multi' file name.
1009This is a list of three elements PREFIX, HOP and PATH. 1133This is a list of three elements PREFIX, HOP and PATH.
1010 1134
@@ -1469,7 +1593,14 @@ The LINKNAME argument should look like \"/path/to/target\" or
1469 (with-parsed-tramp-file-name file nil 1593 (with-parsed-tramp-file-name file nil
1470 (when (tramp-ange-ftp-file-name-p multi-method method) 1594 (when (tramp-ange-ftp-file-name-p multi-method method)
1471 (tramp-invoke-ange-ftp 'file-name-directory file)) 1595 (tramp-invoke-ange-ftp 'file-name-directory file))
1472 (if (or (string= path "") (string= path "/")) 1596 ;; For the following condition, two possibilities should be tried:
1597 ;; (1) (string= path "")
1598 ;; (2) (or (string= path "") (string= path "/"))
1599 ;; The second variant fails when completing a "/" directory on
1600 ;; the remote host, that is a filename which looks like
1601 ;; "/user@host:/". But maybe wildcards fail with the first variant.
1602 ;; We should do some investigation.
1603 (if (string= path "")
1473 ;; For a filename like "/[foo]", we return "/". The `else' 1604 ;; For a filename like "/[foo]", we return "/". The `else'
1474 ;; case would return "/[foo]" unchanged. But if we do that, 1605 ;; case would return "/[foo]" unchanged. But if we do that,
1475 ;; then `file-expand-wildcards' ceases to work. It's not 1606 ;; then `file-expand-wildcards' ceases to work. It's not
@@ -2971,42 +3102,31 @@ Falls back to normal file name handler if no tramp file name handler exists."
2971(add-to-list 'file-name-handler-alist 3102(add-to-list 'file-name-handler-alist
2972 (cons tramp-file-name-regexp 'tramp-file-name-handler)) 3103 (cons tramp-file-name-regexp 'tramp-file-name-handler))
2973 3104
2974;;;###autoload 3105;; To handle EFS, the following functions need to be dealt with:
2975(defun tramp-handle-ange-ftp () 3106;;
2976 "Turn Ange-FTP off and an Ange-FTP-like filename format. 3107;; * dired-before-readin-hook contains efs-dired-before-readin
2977Requests suitable for Ange-FTP will be forwarded to Ange-FTP. 3108;; * file-name-handler-alist contains efs-file-handler-function
2978Also see the variables `tramp-ftp-method', `tramp-default-method', 3109;; and efs-root-handler-function and efs-sifn-handler-function
2979and `tramp-default-method-alist'." 3110;; * find-file-hooks contains efs-set-buffer-mode
2980 (interactive) 3111;;
3112;; But it won't happen for EFS since the XEmacs maintainers
3113;; don't want to use a unified filename syntax.
3114(defun tramp-disable-ange-ftp ()
3115 "Turn Ange-FTP off.
3116This is useful for unified remoting. See
3117`tramp-file-name-structure-unified' and
3118`tramp-file-name-structure-separate' for details. Requests suitable
3119for Ange-FTP will be forwarded to Ange-FTP. Also see the variables
3120`tramp-ftp-method', `tramp-default-method', and
3121`tramp-default-method-alist'.
3122
3123This function is not needed in Emacsen which include Tramp, but is
3124present for backward compatibility."
2981 (let ((a1 (rassq 'ange-ftp-hook-function file-name-handler-alist)) 3125 (let ((a1 (rassq 'ange-ftp-hook-function file-name-handler-alist))
2982 (a2 (rassq 'ange-ftp-completion-hook-function file-name-handler-alist)) 3126 (a2 (rassq 'ange-ftp-completion-hook-function file-name-handler-alist)))
2983 (a3 (rassq 'tramp-file-name-handler file-name-handler-alist)))
2984 (setq file-name-handler-alist 3127 (setq file-name-handler-alist
2985 (delete a1 (delete a2 (delete a3 file-name-handler-alist))))) 3128 (delete a1 (delete a2 file-name-handler-alist)))))
2986 (setq tramp-file-name-structure 3129(tramp-disable-ange-ftp)
2987 (list (concat "\\`/\\(\\([a-zA-Z0-9]+\\)#\\)?" ;method
2988 "\\(\\([^:@/]+\\)@\\)?" ;user
2989 "\\([^:/]+\\):" ;host
2990 "\\(.*\\)\\'") ;path
2991 2 4 5 6)
2992 tramp-file-name-regexp "\\`/[^/:]+:"
2993 tramp-make-tramp-file-format "/%m#%u@%h:%p"
2994 tramp-make-tramp-file-user-nil-format "/%m#%h:%p"
2995 tramp-multi-file-name-structure
2996 (list (concat "\\`\\([a-zA-Z0-9]+\\)\\)?" ;method
2997 "\\(\\(%s\\)+\\)" ;hops
2998 ":\\(.*\\)\\'") ;path
2999 2 3 -1)
3000 tramp-multi-file-name-hop-structure
3001 (list (concat ":\\([a-zA-z0-9_]+\\):" ;hop method
3002 "\\([^@:/]+\\)@" ;user
3003 "\\([^:/]+\\)") ;host
3004 1 2 3)
3005 tramp-make-multi-tramp-file-format
3006 (list "/%m" ":%m:%u@%h" ":%p"))
3007 (add-to-list 'file-name-handler-alist
3008 (cons tramp-file-name-regexp 'tramp-file-name-handler))
3009 (tramp-repair-jka-compr))
3010 3130
3011(defun tramp-repair-jka-compr () 3131(defun tramp-repair-jka-compr ()
3012 "If jka-compr is already loaded, move it to the front of 3132 "If jka-compr is already loaded, move it to the front of