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

Diff of /tramp/lisp/tramp.el

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

revision 2.179.2.3 by albinus, Sun Sep 1 19:17:59 2002 UTC revision 2.179.2.4 by albinus, Wed Sep 4 20:49:51 2002 UTC
# Line 772  shell from reading its init file." Line 772  shell from reading its init file."
772    :group 'tramp    :group 'tramp
773    :type '(alist :key-type string :value-type string))    :type '(alist :key-type string :value-type string))
774    
775  ;; File name format.  (defcustom tramp-prefix-format
776      (if (featurep 'xemacs) "/[" "/")
777      "*String matching the method, user and host name beginning tramp file names."
778      :group 'tramp
779      :type 'string)
780    
781    (defcustom tramp-prefix-regexp
782      (concat "^" (regexp-quote tramp-prefix-format))
783      "*Regexp matching the very beginning of tramp file names.
784    Should always start with \"^\"."
785      :group 'tramp
786      :type 'regexp)
787    
788    (defcustom tramp-method-regexp
789      "[a-zA-Z_0-9-]+"
790      "*Regexp matching methods identifiers."
791      :group 'tramp
792      :type 'regexp)
793    
794    ;; no `tramp-postfix-single-method-format' needed because no special regexp char
795    (defcustom tramp-postfix-single-method-regexp
796      (if (featurep 'xemacs) "/" ":")
797      "*Regexp matching delimeter between method and user or host names.
798    Applicable for single-hop methods."
799      :group 'tramp
800      :type 'regexp)
801    
802    ;; no `tramp-postfix-multi-method-format' needed because no special regexp char
803    (defcustom tramp-postfix-multi-method-regexp
804      ":"
805      "*Regexp matching delimeter between method and user or host names.
806    Applicable for multi-hop methods."
807      :group 'tramp
808      :type 'regexp)
809    
810    ;; no `tramp-postfix-multi-hop-format' needed because no special regexp char
811    (defcustom tramp-postfix-multi-hop-regexp
812      (if (featurep 'xemacs) "/" ":")
813      "*Regexp matching delimeter between path and next method.
814    Applicable for multi-hop methods."
815      :group 'tramp
816      :type 'regexp)
817    
818  (defconst tramp-file-name-structure-unified  (defcustom tramp-user-regexp
819    (list (concat "\\`/\\(\\([a-zA-Z0-9-]+\\):\\)?" ;method    "[^:@/]+"
820                        "\\(\\([^:@/]+\\)@\\)?" ;user    "*Regexp matching user names."
821                        "\\([^:/]+\\):"   ;host    :group 'tramp
822                        "\\(.*\\)\\'")    ;path    :type 'regexp)
823                2 4 5 6)  
824    "Default value for `tramp-file-name-structure' for unified remoting.  ;; no `tramp-postfix-user-format' needed because no special regexp char
825  On Emacs (not XEmacs), the Tramp and Ange-FTP packages use a unified  (defcustom tramp-postfix-user-regexp
826  filename space.  This value is used for this unified namespace.")    "@"
827      "*Regexp matching delimeter between user and host names."
828  (defconst tramp-file-name-structure-separate    :group 'tramp
829    (list (concat "\\`/\\[\\(\\([a-zA-Z0-9-]+\\)/\\)?" ;method    :type 'regexp)
830                  "\\(\\([-a-zA-Z0-9_#/:]+\\)@\\)?" ;user  
831                  "\\([-a-zA-Z0-9_#/:@.]+\\)\\]" ;host  (defcustom tramp-host-regexp
832                  "\\(.*\\)\\'")          ;path    "[a-zA-Z0-9_.-]+"
833          2 4 5 6)    "*Regexp matching host names."
834    "Default value for `tramp-file-name-structure' for separate remoting.    :group 'tramp
835  On XEmacs, the Tramp and EFS packages use a separate namespace for    :type 'regexp)
836  remote filenames.  This value is used in that case.  It is designed  
837  not to clash with the EFS filename syntax.")  (defcustom tramp-postfix-host-format
838      (if (featurep 'xemacs) "]" ":")
839      "*String matching delimeter between host and names and paths."
840      :group 'tramp
841      :type 'string)
842    
843    (defcustom tramp-postfix-host-regexp
844      (regexp-quote tramp-postfix-host-format)
845      "*Regexp matching delimeter between host and names and paths."
846      :group 'tramp
847      :type 'regexp)
848    
849    (defcustom tramp-path-regexp
850      ".*$"
851      "*Regexp matching paths."
852      :group 'tramp
853      :type 'regexp)
854    
855    ;; File name format.
856    
857  (defcustom tramp-file-name-structure  (defcustom tramp-file-name-structure
858    (if (featurep 'xemacs)    (list
859        tramp-file-name-structure-separate     (concat
860      tramp-file-name-structure-unified)      tramp-prefix-regexp
861        "\\(" "\\(" tramp-method-regexp "\\)" tramp-postfix-single-method-regexp "\\)?"
862        "\\(" "\\(" tramp-user-regexp   "\\)" tramp-postfix-user-regexp   "\\)?"
863              "\\(" tramp-host-regexp   "\\)" tramp-postfix-host-regexp
864              "\\(" tramp-path-regexp   "\\)")
865       2 4 5 6)
866    
867    "*List of five elements (REGEXP METHOD USER HOST FILE), detailing \    "*List of five elements (REGEXP METHOD USER HOST FILE), detailing \
868  the tramp file name structure.  the tramp file name structure.
869    
# Line 813  but for the host name.  The fifth elemen Line 878  but for the host name.  The fifth elemen
878  These numbers are passed directly to `match-string', which see.  That  These numbers are passed directly to `match-string', which see.  That
879  means the opening parentheses are counted to identify the pair.  means the opening parentheses are counted to identify the pair.
880    
881  See also `tramp-file-name-regexp' and `tramp-make-tramp-file-format'."  See also `tramp-file-name-regexp'."
882    :group 'tramp    :group 'tramp
883    :type '(list (regexp :tag "File name regexp")    :type '(list (regexp :tag "File name regexp")
884                 (integer :tag "Paren pair for method name")                 (integer :tag "Paren pair for method name")
# Line 853  this file (tramp.el) is loaded.  This me Line 918  this file (tramp.el) is loaded.  This me
918  before loading tramp.el.  Alternatively, `file-name-handler-alist' can be  before loading tramp.el.  Alternatively, `file-name-handler-alist' can be
919  updated after changing this variable.  updated after changing this variable.
920    
921  Also see `tramp-file-name-structure' and `tramp-make-tramp-file-format'."  Also see `tramp-file-name-structure'."
922    :group 'tramp    :group 'tramp
923    :type 'regexp)    :type 'regexp)
924    
# Line 884  this file (tramp.el) is loaded.  This me Line 949  this file (tramp.el) is loaded.  This me
949  before loading tramp.el.  Alternatively, `file-name-handler-alist' can be  before loading tramp.el.  Alternatively, `file-name-handler-alist' can be
950  updated after changing this variable.  updated after changing this variable.
951    
952  Also see `tramp-file-name-structure' and `tramp-make-tramp-file-format'."  Also see `tramp-file-name-structure'."
953    :group 'tramp    :group 'tramp
954    :type 'regexp)    :type 'regexp)
955    
 (defconst tramp-make-tramp-file-format-unified  
    "/%m:%u@%h:%p"  
    "Value for `tramp-make-tramp-file-format' for unified remoting.  
 Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.  
 See `tramp-file-name-structure-unified' for more details.")  
   
 (defconst tramp-make-tramp-file-format-separate  
   "/[%m/%u@%h]%p"  
   "Value for `tramp-make-tramp-file-format' for separate remoting.  
 XEmacs uses a separate filename syntax for EFS and Tramp.  
 See `tramp-file-name-structure-separate' for more details.")  
   
 (defcustom tramp-make-tramp-file-format  
   (if (featurep 'xemacs)  
       tramp-make-tramp-file-format-separate  
     tramp-make-tramp-file-format-unified)  
   "*Format string saying how to construct tramp file name.  
 `%m' is replaced by the method name.  
 `%u' is replaced by the user name.  
 `%h' is replaced by the host name.  
 `%p' is replaced by the file name.  
 `%%' is replaced by %.  
   
 Also see `tramp-file-name-structure' and `tramp-file-name-regexp'."  
   :group 'tramp  
   :type 'string)  
   
 (defconst tramp-make-tramp-file-user-nil-format-unified  
   "/%m:%h:%p"  
   "Value of `tramp-make-tramp-file-user-nil-format' for unified remoting.  
 Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.  
 See `tramp-file-name-structure-unified' for details.")  
   
 (defconst tramp-make-tramp-file-user-nil-format-separate  
   "/[%m/%h]%p"  
   "Value of `tramp-make-tramp-file-user-nil-format' for separate remoting.  
 XEmacs uses a separate filename syntax for EFS and Tramp.  
 See `tramp-file-name-structure-separate' for details.")  
   
 (defcustom tramp-make-tramp-file-user-nil-format  
   (if (featurep 'xemacs)  
       tramp-make-tramp-file-user-nil-format-separate  
     tramp-make-tramp-file-user-nil-format-unified)  
   "*Format string saying how to construct tramp file name when the user name is not known.  
 `%m' is replaced by the method name.  
 `%h' is replaced by the host name.  
 `%p' is replaced by the file name.  
 `%%' is replaced by %.  
   
 Also see `tramp-make-tramp-file-format', `tramp-file-name-structure', and `tramp-file-name-regexp'."  
   :group 'tramp  
   :type 'string)  
   
 (defconst tramp-multi-file-name-structure-unified  
   (list (concat "\\`/\\(\\([a-zA-Z0-9]+\\)?:\\)" ;method  
                 "\\(\\(%s\\)+\\)"       ;hops  
                 "\\(.*\\)\\'")          ;path  
         2 3 -1)  
   "Value for `tramp-multi-file-name-structure' for unified remoting.  
 Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.  
 See `tramp-file-name-structure-unified' for details.")  
   
 (defconst tramp-multi-file-name-structure-separate  
   (list (concat  
          ;; prefix  
          "\\`/\\[\\(\\([a-z0-9]+\\)?\\)"  
          ;; regexp specifying the hops  
          "\\(\\(%s\\)+\\)"  
          ;; path name  
          "\\]\\(.*\\)\\'")  
         2                               ;number of pair to match method  
         3                               ;number of pair to match hops  
         -1)                             ;number of pair to match path  
   "Value of `tramp-multi-file-name-structure' for separate remoting.  
 XEmacs uses a separate filename syntax for EFS and Tramp.  
 See `tramp-file-name-structure-separate' for details.")  
   
956  (defcustom tramp-multi-file-name-structure  (defcustom tramp-multi-file-name-structure
957    (if (featurep 'xemacs)    (list
958        tramp-multi-file-name-structure-separate     (concat
959      tramp-multi-file-name-structure-unified)      tramp-prefix-regexp
960        "\\(" "\\(" tramp-method-regexp "\\)" "\\)?"
961        "\\(" "\\(" tramp-postfix-multi-hop-regexp "%s" "\\)+" "\\)?"
962        tramp-postfix-host-regexp "\\(" tramp-path-regexp "\\)")
963       2 3 -1)
964    "*Describes the file name structure of `multi' files.    "*Describes the file name structure of `multi' files.
965  Multi files allow you to contact a remote host in several hops.  Multi files allow you to contact a remote host in several hops.
966  This is a list of four elements (REGEXP METHOD HOP PATH).  This is a list of four elements (REGEXP METHOD HOP PATH).
# Line 996  string, but I haven't actually tried wha Line 988  string, but I haven't actually tried wha
988                 (integer :tag "Paren pair for hops")                 (integer :tag "Paren pair for hops")
989                 (integer :tag "Paren pair to match path")))                 (integer :tag "Paren pair to match path")))
990    
 (defconst tramp-multi-file-name-hop-structure-unified  
   (list (concat "\\([a-zA-z0-9_]+\\):" ;hop method  
                 "\\([^@:/]+\\)@"        ;user  
                 "\\([^:/]+\\):")        ;host  
         1 2 3)  
   "Value of `tramp-multi-file-name-hop-structure' for unified remoting.  
 Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.  
 See `tramp-file-name-structure-unified' for details.")  
   
 (defconst tramp-multi-file-name-hop-structure-separate  
   (list (concat "/\\([a-z0-9_]+\\):"    ;hop method  
                 "\\([a-z0-9_]+\\)@"     ;user  
                 "\\([a-z0-9.-]+\\)")    ;host  
         1 2 3)  
   "Value of `tramp-multi-file-name-hop-structure' for separate remoting.  
 XEmacs uses a separate filename syntax for EFS and Tramp.  
 See `tramp-file-name-structure-separate' for details.")  
   
991  (defcustom tramp-multi-file-name-hop-structure  (defcustom tramp-multi-file-name-hop-structure
992    (if (featurep 'xemacs)    (list
993        tramp-multi-file-name-hop-structure-separate     (concat
994      tramp-multi-file-name-hop-structure-unified)      "\\(" tramp-method-regexp "\\)" tramp-postfix-multi-method-regexp
995        "\\(" tramp-user-regexp   "\\)" tramp-postfix-user-regexp
996        "\\(" tramp-host-regexp   "\\)")
997       1 2 3)
998    "*Describes the structure of a hop in multi files.    "*Describes the structure of a hop in multi files.
999  This is a list of four elements (REGEXP METHOD USER HOST).  First  This is a list of four elements (REGEXP METHOD USER HOST).  First
1000  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 1031  This regular expression should match exa Line 1008  This regular expression should match exa
1008                 (integer :tag "Paren pair for user name")                 (integer :tag "Paren pair for user name")
1009                 (integer :tag "Paren pair for host name")))                 (integer :tag "Paren pair for host name")))
1010    
 (defconst tramp-make-multi-tramp-file-format-unified  
   (list "/%m" ":%m:%u@%h" ":%p")  
   "Value of `tramp-make-multi-tramp-file-format' for unified remoting.  
 Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.  
 See `tramp-file-name-structure-unified' for details.")  
   
 (defconst tramp-make-multi-tramp-file-format-separate  
   (list "/[%m" "/%m:%u@%h" "]%p")  
   "Value of `tramp-make-multi-tramp-file-format' for separate remoting.  
 XEmacs uses a separate filename syntax for EFS and Tramp.  
 See `tramp-file-name-structure-separate' for details.")  
   
1011  (defcustom tramp-make-multi-tramp-file-format  (defcustom tramp-make-multi-tramp-file-format
1012    (if (featurep 'xemacs)    (list
1013        tramp-make-multi-tramp-file-format-separate     (concat tramp-prefix-regexp "%m")
1014      tramp-make-multi-tramp-file-format-unified)     (concat tramp-postfix-multi-hop-regexp
1015        "%m" tramp-postfix-multi-method-regexp
1016        "%u" tramp-postfix-user-regexp
1017        "%h")
1018       (concat tramp-postfix-host-regexp "%p"))
1019    "*Describes how to construct a `multi' file name.    "*Describes how to construct a `multi' file name.
1020  This is a list of three elements PREFIX, HOP and PATH.  This is a list of three elements PREFIX, HOP and PATH.
1021    
# Line 3402  Return (nil) if arg is nil." Line 3371  Return (nil) if arg is nil."
3371    (cond    (cond
3372     ((featurep 'xemacs) t)     ((featurep 'xemacs) t)
3373     ((string-match "^/.*:.*:$" file) nil)     ((string-match "^/.*:.*:$" file) nil)
3374     ((string-match "^/\\([a-zA-Z0-9_-]+\\):$" file)     ((string-match
3375         (concat
3376          tramp-prefix-regexp
3377          tramp-method-regexp tramp-postfix-single-method-regexp "$")
3378         file)
3379      (member (match-string 1 file)      (member (match-string 1 file)
3380              (cons tramp-ftp-method (mapcar 'car tramp-methods))))              (cons tramp-ftp-method (mapcar 'car tramp-methods))))
3381     ((or (equal last-input-char 'tab)     ((or (equal last-input-char 'tab)
# Line 3526  Return (nil) if arg is nil." Line 3499  Return (nil) if arg is nil."
3499  They are collected by `tramp-completion-dissect-file-name1'."  They are collected by `tramp-completion-dissect-file-name1'."
3500    
3501    (let* ((result)    (let* ((result)
          (x-start (if (featurep 'xemacs) "^/\\[" "^/"))  
          (x-method "[a-zA-Z0-9-]+")  
          (x-stop-method (if (featurep 'xemacs) "/" ":"))  
          (x-user "[^:@/]+")  
          (x-stop-user "@")  
          (x-host "[a-zA-Z0-9_-]+")  
          (x-stop-host (if (featurep 'xemacs) "\\]" ":"))  
3502           (x-nil "\\|\\(\\)"))           (x-nil "\\|\\(\\)"))
3503    
     ;; Local regexps. Maybe general definitions are better?  
3504      ;; "/method" "/[method"      ;; "/method" "/[method"
3505      (defconst tramp-completion-file-name-structure1      (defconst tramp-completion-file-name-structure1
3506        (list (concat x-start "\\(" x-method x-nil "\\)$")        (list (concat tramp-prefix-regexp "\\(" tramp-method-regexp x-nil "\\)$")
3507              1 9 9 9))              1 9 9 9))
   
3508      ;; "/user" "/[user"      ;; "/user" "/[user"
3509      (defconst tramp-completion-file-name-structure2      (defconst tramp-completion-file-name-structure2
3510        (list (concat x-start "\\(" x-user x-nil "\\)$")        (list (concat tramp-prefix-regexp "\\(" tramp-user-regexp x-nil   "\\)$")
3511              9 1 9 9))              9 1 9 9))
3512      ;; "/host" "/[host"      ;; "/host" "/[host"
3513      (defconst tramp-completion-file-name-structure3      (defconst tramp-completion-file-name-structure3
3514        (list (concat x-start "\\(" x-host x-nil "\\)$")        (list (concat tramp-prefix-regexp "\\(" tramp-host-regexp x-nil   "\\)$")
3515              9 9 1 9))              9 9 1 9))
3516      ;; "/user@host" "/[user@host"      ;; "/user@host" "/[user@host"
3517      (defconst tramp-completion-file-name-structure4      (defconst tramp-completion-file-name-structure4
3518        (list (concat x-start        (list (concat tramp-prefix-regexp
3519                      "\\(" x-user "\\)" x-stop-user                      "\\(" tramp-user-regexp "\\)"   tramp-postfix-user-regexp
3520                      "\\(" x-host x-nil "\\)$")                      "\\(" tramp-host-regexp x-nil   "\\)$")
3521              9 1 2 9))              9 1 2 9))
3522      ;; "/method:user" "/[method/user"      ;; "/method:user" "/[method/user"
3523      (defconst tramp-completion-file-name-structure5      (defconst tramp-completion-file-name-structure5
3524        (list (concat x-start        (list (concat tramp-prefix-regexp
3525                      "\\(" x-method "\\)" x-stop-method                      "\\(" tramp-method-regexp "\\)" tramp-postfix-single-method-regexp
3526                      "\\(" x-user x-nil "\\)$")                      "\\(" tramp-user-regexp x-nil   "\\)$")
3527              1 2 9 9))              1 2 9 9))
3528      ;; "/method:host" "/[method/host"      ;; "/method:host" "/[method/host"
3529      (defconst tramp-completion-file-name-structure6      (defconst tramp-completion-file-name-structure6
3530        (list (concat x-start        (list (concat tramp-prefix-regexp
3531                      "\\(" x-method "\\)" x-stop-method                      "\\(" tramp-method-regexp "\\)" tramp-postfix-single-method-regexp
3532                      "\\(" x-host x-nil "\\)$")                      "\\(" tramp-host-regexp x-nil   "\\)$")
3533              1 9 2 9))              1 9 2 9))
3534      ;; "/method:user@host" "/[method/user@host"      ;; "/method:user@host" "/[method/user@host"
3535      (defconst tramp-completion-file-name-structure7      (defconst tramp-completion-file-name-structure7
3536        (list (concat x-start        (list (concat tramp-prefix-regexp
3537                      "\\(" x-method "\\)" x-stop-method                      "\\(" tramp-method-regexp "\\)" tramp-postfix-single-method-regexp
3538                      "\\(" x-user "\\)" x-stop-user                      "\\(" tramp-user-regexp "\\)"   tramp-postfix-user-regexp
3539                      "\\(" x-host x-nil "\\)$")                      "\\(" tramp-host-regexp x-nil   "\\)$")
3540              1 2 3 9))              1 2 3 9))
3541        
3542      (mapcar '(lambda (regexp)      (mapcar '(lambda (regexp)
# Line 3595  They are collected by `tramp-completion- Line 3559  They are collected by `tramp-completion-
3559  The structure consists of multi-method, remote method, remote user,  The structure consists of multi-method, remote method, remote user,
3560  remote host and remote path name."  remote host and remote path name."
3561    
 ;;  (message "tramp-completion-dissect-file-name1 '%s'" structure)  
   
3562    (let (method)    (let (method)
3563      (save-match-data      (save-match-data
3564        (when (string-match (nth 0 structure) name)        (when (string-match (nth 0 structure) name)
# Line 3623  remote host and remote path name." Line 3585  remote host and remote path name."
3585  ;; trailing method delimeter.  ;; trailing method delimeter.
3586  ;; In case of Emacs, `tramp-ftp-method' is handled as well because it doesn't  ;; In case of Emacs, `tramp-ftp-method' is handled as well because it doesn't
3587  ;; belong to `tramp-methods'.  ;; belong to `tramp-methods'.
3588  (defun tramp-get-completion-methods (method)  (defun tramp-get-completion-methods (partial-method)
3589    "Returns all method completions for METHOD."    "Returns all method completions for PARTIAL-METHOD."
3590    (let ((all-methods (delete "multi" (mapcar 'car tramp-methods))))    (let ((all-methods (delete "multi" (mapcar 'car tramp-methods))))
3591    
3592      (mapcar      (mapcar
3593       '(lambda (string)       '(lambda (method)
3594          (and          (and method
3595           (<= (length method) (length string))           (<= (length partial-method) (length method))
3596           (string-equal method           (string-equal
3597                         (substring string 0 (length method)))            partial-method (substring method 0 (length partial-method)))
3598           (concat           (substring (tramp-make-tramp-file-name nil method nil nil nil) 1)))
3599            (when (featurep 'xemacs) "[")  
           string  
           (if (featurep 'xemacs) "/" ":"))))  
3600       (add-to-list 'all-methods (unless (featurep 'xemacs) tramp-ftp-method)))))       (add-to-list 'all-methods (unless (featurep 'xemacs) tramp-ftp-method)))))
3601    
3602  ;; Compares partial user and host names with possible completions.  ;; Compares partial user and host names with possible completions.
# Line 3647  PARTIAL-USER must match USER, PARTIAL-HO Line 3607  PARTIAL-USER must match USER, PARTIAL-HO
3607     ((and partial-user partial-host)     ((and partial-user partial-host)
3608      (unless      (unless
3609          (and user host          (and user host
3610                 (<= (length partial-user) (length user))           (<= (length partial-user) (length user))
3611                 (string-equal           (string-equal
3612                  partial-user (substring user 0 (length partial-user)))            partial-user (substring user 0 (length partial-user)))
3613                 (<= (length partial-host) (length host))           (<= (length partial-host) (length host))
3614                 (string-equal           (string-equal
3615                  partial-host (substring host 0 (length partial-host))))            partial-host (substring host 0 (length partial-host))))
3616              (setq user nil        (setq user nil
3617                    host nil)))              host nil)))
3618           (partial-user     (partial-user
3619            (setq host nil)      (setq host nil)
3620            (unless      (unless
3621                (and user                          (and user                      
3622                 (<= (length partial-user) (length user))           (<= (length partial-user) (length user))
3623                 (string-equal           (string-equal
3624                  partial-user (substring user 0 (length partial-user))))            partial-user (substring user 0 (length partial-user))))
3625              (setq user nil)))        (setq user nil)))
3626           (partial-host     (partial-host
3627            (setq user nil)      (setq user nil)
3628            (unless      (unless
3629                (and host          (and host
3630                 (<= (length partial-host) (length host))           (<= (length partial-host) (length host))
3631                 (string-equal           (string-equal
3632                  partial-host (substring host 0 (length partial-host))))            partial-host (substring host 0 (length partial-host))))
3633              (setq host nil)))        (setq host nil)))
3634           (t (setq user nil     (t (setq user nil
3635                    host nil)))              host nil)))
3636    
3637          (when (or user host)    (when (or user host)
3638            (concat      (substring (tramp-make-tramp-file-name nil method user host nil) 1)))
            (when (featurep 'xemacs) "[")  
            (when method (concat method (if (featurep 'xemacs) "/" ":")))  
            (when user (concat user "@"))  
            (when host (concat host (if (featurep 'xemacs) "]" ":"))))))  
3639    
3640  ;; This function isn't as good as it should because necessary information is  ;; This function isn't as good as it should because necessary information is
3641  ;; accessible on remote hosts where we want to go. So we use the local files,  ;; accessible on remote hosts where we want to go. So we use the local files,
# Line 3723  Either user or host may be nil" Line 3679  Either user or host may be nil"
3679     "Return a (user host) tuple allowed to access.     "Return a (user host) tuple allowed to access.
3680  Either user or host may be nil"  Either user or host may be nil"
3681    
3682     (let ((regexp "^\\([a-zA-Z0-9_][a-zA-Z0-9_.-]*\\)\\([ \t]+\\([a-zA-Z_-][a-zA-Z0-9_.-]*\\)\\)?")     (let ((result)
3683           result)           (regexp
3684              (concat
3685               "^\\(" tramp-host-regexp "\\)"
3686               "\\([ \t]+" "\\(" tramp-user-regexp "\\)" "\\)?")))
3687    
3688       (narrow-to-region (point) (tramp-point-at-eol))       (narrow-to-region (point) (tramp-point-at-eol))
3689       (when (re-search-forward regexp nil t)       (when (re-search-forward regexp nil t)
# Line 3768  User is always nil." Line 3727  User is always nil."
3727     "Return a (user host) tuple allowed to access.     "Return a (user host) tuple allowed to access.
3728  User is always nil."  User is always nil."
3729    
3730     (let ((regexp "^\\([a-zA-Z0-9_][a-zA-Z0-9_.-]*\\)")     (let ((result)
3731           result)           (regexp (concat "^\\(" tramp-host-regexp "\\)")))
3732    
3733       (narrow-to-region (point) (tramp-point-at-eol))       (narrow-to-region (point) (tramp-point-at-eol))
3734       (when (re-search-forward regexp nil t)       (when (re-search-forward regexp nil t)
# Line 3809  User is always nil." Line 3768  User is always nil."
3768     "Return a (user host) tuple allowed to access.     "Return a (user host) tuple allowed to access.
3769  User is always nil."  User is always nil."
3770    
3771     (let ((regexp (concat     (let ((result)
3772             "^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\s-"           (regexp (concat "^\\(" tramp-host-regexp "\\)")))
            "\\([a-zA-Z0-9_][a-zA-Z0-9_.-]*\\)"))  
          result)  
3773    
3774       (narrow-to-region (point) (tramp-point-at-eol))       (narrow-to-region (point) (tramp-point-at-eol))
3775       (when (re-search-forward regexp nil t)       (when (re-search-forward regexp nil t)
3776         (setq result (list nil (match-string 1))))         (setq result (list nil (match-string 1))))
3777       (widen)       (widen)
3778       (forward-line 1)       (or
3779          (> (skip-chars-forward " \t") 0)
3780          (forward-line 1))
3781       result))       result))
3782    
3783  ;; Expand user names names from "/etc/passwd". Not very clever bacuase of  ;; Expand user names names from "/etc/passwd". Not very clever bacuase of
# Line 3857  Host is always \"localhost\"." Line 3816  Host is always \"localhost\"."
3816     "Return a (user host) tuple allowed to access.     "Return a (user host) tuple allowed to access.
3817  User is always nil."  User is always nil."
3818    
3819     (let ((regexp "^\\([a-zA-Z0-9_][a-zA-Z0-9_.-]*\\):")     (let ((result)
3820           result)           (regexp (concat "^\\(" tramp-user-regexp "\\):")))
3821    
3822       (narrow-to-region (point) (tramp-point-at-eol))       (narrow-to-region (point) (tramp-point-at-eol))
3823       (when (re-search-forward regexp nil t)       (when (re-search-forward regexp nil t)
# Line 5768  remote path name." Line 5727  remote path name."
5727    
5728  (defun tramp-make-tramp-file-name (multi-method method user host path)  (defun tramp-make-tramp-file-name (multi-method method user host path)
5729    "Constructs a tramp file name from METHOD, USER, HOST and PATH."    "Constructs a tramp file name from METHOD, USER, HOST and PATH."
   (unless tramp-make-tramp-file-format  
     (error "`tramp-make-tramp-file-format' is nil"))  
5730    (if multi-method    (if multi-method
5731        (tramp-make-tramp-multi-file-name multi-method method user host path)        (tramp-make-tramp-multi-file-name multi-method method user host path)
5732      (if user      (format-spec
5733          (format-spec tramp-make-tramp-file-format       (concat tramp-prefix-format
5734                       `((?m . ,method) (?u . ,user) (?h . ,host) (?p . ,path)))        (when method (concat "%m" tramp-postfix-single-method-regexp))
5735        (format-spec tramp-make-tramp-file-user-nil-format        (when user   (concat "%u" tramp-postfix-user-regexp))
5736                     `((?m . ,method) (?h . ,host) (?p . ,path))))))        (when host   (concat "%h" tramp-postfix-host-format))
5737          (when path   (concat "%p")))
5738        `((?m . ,method) (?u . ,user) (?h . ,host) (?p . ,path)))))
5739    
5740  ;; CCC: Henrik Holm: Not Changed.  Multi Method.  What should be done  ;; CCC: Henrik Holm: Not Changed.  Multi Method.  What should be done
5741  ;; with this when USER is nil?  ;; with this when USER is nil?
# Line 6273  Only works for Bourne-like shells." Line 6232  Only works for Bourne-like shells."
6232         tramp-multi-file-name-hop-structure         tramp-multi-file-name-hop-structure
6233         tramp-multi-methods         tramp-multi-methods
6234         tramp-multi-connection-function-alist         tramp-multi-connection-function-alist
        tramp-make-tramp-file-format  
6235         tramp-end-of-output         tramp-end-of-output
6236         tramp-coding-commands         tramp-coding-commands
6237         tramp-actions-before-shell         tramp-actions-before-shell

Legend:
Removed from v.2.179.2.3  
changed lines
  Added in v.2.179.2.4

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