/[emacs]/emacs/lisp/net/tramp.el
ViewVC logotype

Diff of /emacs/lisp/net/tramp.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by schwab, Wed Jul 3 18:42:23 2002 UTC revision 1.8 by kai, Thu Jul 11 19:59:07 2002 UTC
# Line 774  various functions for details." Line 774  various functions for details."
774    :group 'tramp    :group 'tramp
775    :type '(repeat (list string function string)))    :type '(repeat (list string function string)))
776    
777  (defcustom tramp-default-method "rcp"  (defcustom tramp-default-method "sm"
778      ;;(if (featurep 'xemacs) "sm" "ftp")
779    "*Default method to use for transferring files.    "*Default method to use for transferring files.
780  See `tramp-methods' for possibilities.  See `tramp-methods' for possibilities.
781  Also see `tramp-default-method-alist'."  Also see `tramp-default-method-alist'.
782    
783    Emacs uses a unified filename syntax for Tramp and Ange-FTP.
784    For backward compatibility, the default value of this variable
785    is \"ftp\" on Emacs.  But XEmacs uses a separate filename syntax
786    for Tramp and EFS, so there the default method is \"sm\"."
787    :group 'tramp    :group 'tramp
788    :type 'string)    :type 'string)
789    
790  (defcustom tramp-default-method-alist nil  (defcustom tramp-default-method-alist
791      (if (featurep 'xemacs)
792          nil
793        '(("\\`ftp\\." "" "ftp")
794          ("" "\\`\\(anonymous\\|ftp\\)\\'" "ftp")))
795    "*Default method to use for specific user/host pairs.    "*Default method to use for specific user/host pairs.
796  This is an alist of items (HOST USER METHOD).  The first matching item  This is an alist of items (HOST USER METHOD).  The first matching item
797  specifies the method to use for a file name which does not specify a  specifies the method to use for a file name which does not specify a
# Line 877  shell from reading its init file." Line 887  shell from reading its init file."
887    
888  ;; File name format.  ;; File name format.
889    
890  (defcustom tramp-file-name-structure  (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.
897    On Emacs (not XEmacs), the Tramp and Ange-FTP packages use a unified
898    filename space.  This value is used for this unified namespace.")
899    
900    (defconst tramp-file-name-structure-separate
901    (list (concat "\\`/\\[\\(\\([a-zA-Z0-9]+\\)/\\)?" ;method    (list (concat "\\`/\\[\\(\\([a-zA-Z0-9]+\\)/\\)?" ;method
902                  "\\(\\([-a-zA-Z0-9_#/:]+\\)@\\)?" ;user                  "\\(\\([-a-zA-Z0-9_#/:]+\\)@\\)?" ;user
903                  "\\([-a-zA-Z0-9_#/:@.]+\\)\\]" ;host                  "\\([-a-zA-Z0-9_#/:@.]+\\)\\]" ;host
904                  "\\(.*\\)\\'")          ;path                  "\\(.*\\)\\'")          ;path
905          2 4 5 6)          2 4 5 6)
906      "Default value for `tramp-file-name-structure' for separate remoting.
907    On XEmacs, the Tramp and EFS packages use a separate namespace for
908    remote filenames.  This value is used in that case.  It is designed
909    not 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)
915    "*List of five elements (REGEXP METHOD USER HOST FILE), detailing \    "*List of five elements (REGEXP METHOD USER HOST FILE), detailing \
916  the tramp file name structure.  the tramp file name structure.
917    
# Line 906  See also `tramp-file-name-regexp' and `t Line 935  See also `tramp-file-name-regexp' and `t
935                 (integer :tag "Paren pair for file name  ")))                 (integer :tag "Paren pair for file name  ")))
936    
937  ;;;###autoload  ;;;###autoload
938  (defcustom tramp-file-name-regexp "\\`/\\[.*\\]"  (defconst tramp-file-name-regexp-unified
939      "\\`/[^/:]+:"
940      "Value for `tramp-file-name-regexp' for unified remoting.
941    Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and
942    Tramp.  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.
948    XEmacs uses a separate filename syntax for Tramp and EFS.
949    See `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)
956    "*Regular expression matching file names handled by tramp.    "*Regular expression matching file names handled by tramp.
957  This regexp should match tramp file names but no other file names.  This regexp should match tramp file names but no other file names.
958  \(When tramp.el is loaded, this regular expression is prepended to  \(When tramp.el is loaded, this regular expression is prepended to
# Line 924  Also see `tramp-file-name-structure' and Line 970  Also see `tramp-file-name-structure' and
970    :group 'tramp    :group 'tramp
971    :type 'regexp)    :type 'regexp)
972    
973  (defcustom tramp-make-tramp-file-format "/[%m/%u@%h]%p"  (defconst tramp-make-tramp-file-format-unified
974       "/%m:%u@%h:%p"
975       "Value for `tramp-make-tramp-file-format' for unified remoting.
976    Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.
977    See `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.
982    XEmacs uses a separate filename syntax for EFS and Tramp.
983    See `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)
989    "*Format string saying how to construct tramp file name.    "*Format string saying how to construct tramp file name.
990  `%m' is replaced by the method name.  `%m' is replaced by the method name.
991  `%u' is replaced by the user name.  `%u' is replaced by the user name.
# Line 936  Also see `tramp-file-name-structure' and Line 997  Also see `tramp-file-name-structure' and
997    :group 'tramp    :group 'tramp
998    :type 'string)    :type 'string)
999    
1000  (defcustom tramp-make-tramp-file-user-nil-format "/[%m/%h]%p"  (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.
1003    Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.
1004    See `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.
1009    XEmacs uses a separate filename syntax for EFS and Tramp.
1010    See `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)
1016    "*Format string saying how to construct tramp file name when the user name is not known.    "*Format string saying how to construct tramp file name when the user name is not known.
1017  `%m' is replaced by the method name.  `%m' is replaced by the method name.
1018  `%h' is replaced by the host name.  `%h' is replaced by the host name.
# Line 947  Also see `tramp-make-tramp-file-format', Line 1023  Also see `tramp-make-tramp-file-format',
1023    :group 'tramp    :group 'tramp
1024    :type 'string)    :type 'string)
1025    
1026  (defcustom tramp-multi-file-name-structure  (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.
1032    Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.
1033    See `tramp-file-name-structure-unified' for details.")
1034    
1035    (defconst tramp-file-name-structure-separate
1036    (list (concat    (list (concat
1037           ;; prefix           ;; prefix
1038           "\\`/\\[\\(\\([a-z0-9]+\\)\\)?"           "\\`/\\[\\(\\([a-z0-9]+\\)\\)?"
# Line 958  Also see `tramp-make-tramp-file-format', Line 1043  Also see `tramp-make-tramp-file-format',
1043          2                               ;number of pair to match method          2                               ;number of pair to match method
1044          3                               ;number of pair to match hops          3                               ;number of pair to match hops
1045          -1)                             ;number of pair to match path          -1)                             ;number of pair to match path
1046      "Value of `tramp-multi-file-name-structure' for separate remoting.
1047    XEmacs uses a separate filename syntax for EFS and Tramp.
1048    See `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)
1054    "*Describes the file name structure of `multi' files.    "*Describes the file name structure of `multi' files.
1055  Multi files allow you to contact a remote host in several hops.  Multi files allow you to contact a remote host in several hops.
1056  This is a list of four elements (REGEXP METHOD HOP PATH).  This is a list of four elements (REGEXP METHOD HOP PATH).
# Line 985  string, but I haven't actually tried wha Line 1078  string, but I haven't actually tried wha
1078                 (integer :tag "Paren pair for hops")                 (integer :tag "Paren pair for hops")
1079                 (integer :tag "Paren pair to match path")))                 (integer :tag "Paren pair to match path")))
1080    
1081  (defcustom tramp-multi-file-name-hop-structure  (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.
1087    Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.
1088    See `tramp-file-name-structure-unified' for details.")
1089    
1090    (defconst tramp-multi-file-name-hop-structure-separate
1091    (list (concat "/\\([a-z0-9_]+\\):"    ;hop method    (list (concat "/\\([a-z0-9_]+\\):"    ;hop method
1092                  "\\([a-z0-9_]+\\)@"     ;user                  "\\([a-z0-9_]+\\)@"     ;user
1093                  "\\([a-z0-9.-]+\\)")    ;host                  "\\([a-z0-9.-]+\\)")    ;host
1094          1 2 3)          1 2 3)
1095      "Value of `tramp-multi-file-name-hop-structure' for separate remoting.
1096    XEmacs uses a separate filename syntax for EFS and Tramp.
1097    See `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)
1103    "*Describes the structure of a hop in multi files.    "*Describes the structure of a hop in multi files.
1104  This is a list of four elements (REGEXP METHOD USER HOST).  First  This is a list of four elements (REGEXP METHOD USER HOST).  First
1105  element REGEXP is used to match against the hop.  Pair number METHOD  element REGEXP is used to match against the hop.  Pair number METHOD
# Line 1003  This regular expression should match exa Line 1113  This regular expression should match exa
1113                 (integer :tag "Paren pair for user name")                 (integer :tag "Paren pair for user name")
1114                 (integer :tag "Paren pair for host name")))                 (integer :tag "Paren pair for host name")))
1115    
1116  (defcustom tramp-make-multi-tramp-file-format  (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.
1119    Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.
1120    See `tramp-file-name-structure-unified' for details.")
1121    
1122    (defconst tramp-make-multi-tramp-file-format-separate
1123    (list "/[%m" "/%m:%u@%h" "]%p")    (list "/[%m" "/%m:%u@%h" "]%p")
1124      "Value of `tramp-make-multi-tramp-file-format' for separate remoting.
1125    XEmacs uses a separate filename syntax for EFS and Tramp.
1126    See `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)
1132    "*Describes how to construct a `multi' file name.    "*Describes how to construct a `multi' file name.
1133  This is a list of three elements PREFIX, HOP and PATH.  This is a list of three elements PREFIX, HOP and PATH.
1134    
# Line 1469  The LINKNAME argument should look like \ Line 1593  The LINKNAME argument should look like \
1593    (with-parsed-tramp-file-name file nil    (with-parsed-tramp-file-name file nil
1594      (when (tramp-ange-ftp-file-name-p multi-method method)      (when (tramp-ange-ftp-file-name-p multi-method method)
1595        (tramp-invoke-ange-ftp 'file-name-directory file))        (tramp-invoke-ange-ftp 'file-name-directory file))
1596      (if (or (string= path "") (string= path "/"))      ;; 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 "")
1604          ;; For a filename like "/[foo]", we return "/".  The `else'          ;; For a filename like "/[foo]", we return "/".  The `else'
1605          ;; case would return "/[foo]" unchanged.  But if we do that,          ;; case would return "/[foo]" unchanged.  But if we do that,
1606          ;; then `file-expand-wildcards' ceases to work.  It's not          ;; then `file-expand-wildcards' ceases to work.  It's not
# Line 2971  Falls back to normal file name handler i Line 3102  Falls back to normal file name handler i
3102  (add-to-list 'file-name-handler-alist  (add-to-list 'file-name-handler-alist
3103               (cons tramp-file-name-regexp 'tramp-file-name-handler))               (cons tramp-file-name-regexp 'tramp-file-name-handler))
3104    
3105  ;;;###autoload  ;; To handle EFS, the following functions need to be dealt with:
3106  (defun tramp-handle-ange-ftp ()  ;;
3107    "Turn Ange-FTP off and an Ange-FTP-like filename format.  ;; * dired-before-readin-hook contains efs-dired-before-readin
3108  Requests suitable for Ange-FTP will be forwarded to Ange-FTP.  ;; * file-name-handler-alist contains efs-file-handler-function
3109  Also see the variables `tramp-ftp-method', `tramp-default-method',  ;;   and efs-root-handler-function and efs-sifn-handler-function
3110  and `tramp-default-method-alist'."  ;; * find-file-hooks contains efs-set-buffer-mode
3111    (interactive)  ;;
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.
3116    This is useful for unified remoting.  See
3117    `tramp-file-name-structure-unified' and
3118    `tramp-file-name-structure-separate' for details.  Requests suitable
3119    for 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    
3123    This function is not needed in Emacsen which include Tramp, but is
3124    present for backward compatibility."
3125    (let ((a1 (rassq 'ange-ftp-hook-function file-name-handler-alist))    (let ((a1 (rassq 'ange-ftp-hook-function file-name-handler-alist))
3126          (a2 (rassq 'ange-ftp-completion-hook-function file-name-handler-alist))          (a2 (rassq 'ange-ftp-completion-hook-function file-name-handler-alist)))
         (a3 (rassq 'tramp-file-name-handler file-name-handler-alist)))  
3127      (setq file-name-handler-alist      (setq file-name-handler-alist
3128            (delete a1 (delete a2 (delete a3 file-name-handler-alist)))))            (delete a1 (delete a2 file-name-handler-alist)))))
3129    (setq tramp-file-name-structure  (tramp-disable-ange-ftp)
         (list (concat "\\`/\\(\\([a-zA-Z0-9]+\\)#\\)?" ;method  
                       "\\(\\([^:@/]+\\)@\\)?" ;user  
                       "\\([^:/]+\\):"   ;host  
                       "\\(.*\\)\\'")    ;path  
               2 4 5 6)  
         tramp-file-name-regexp "\\`/[^/:]+:"  
         tramp-make-tramp-file-format "/%m#%u@%h:%p"  
         tramp-make-tramp-file-user-nil-format "/%m#%h:%p"  
         tramp-multi-file-name-structure  
         (list (concat "\\`\\([a-zA-Z0-9]+\\)\\)?" ;method  
                       "\\(\\(%s\\)+\\)" ;hops  
                       ":\\(.*\\)\\'")   ;path  
               2 3 -1)  
         tramp-multi-file-name-hop-structure  
         (list (concat ":\\([a-zA-z0-9_]+\\):" ;hop method  
                       "\\([^@:/]+\\)@"  ;user  
                       "\\([^:/]+\\)")   ;host  
               1 2 3)  
         tramp-make-multi-tramp-file-format  
         (list "/%m" ":%m:%u@%h" ":%p"))  
   (add-to-list 'file-name-handler-alist  
                (cons tramp-file-name-regexp 'tramp-file-name-handler))  
   (tramp-repair-jka-compr))  
3130    
3131  (defun tramp-repair-jka-compr ()  (defun tramp-repair-jka-compr ()
3132    "If jka-compr is already loaded, move it to the front of    "If jka-compr is already loaded, move it to the front of

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26