/[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.190 by kai, Sun Sep 1 20:29:20 2002 UTC revision 2.191 by kai, Tue Sep 3 12:50:21 2002 UTC
# Line 103  Line 103 
103  (unless (boundp 'custom-print-functions)  (unless (boundp 'custom-print-functions)
104    (defvar custom-print-functions nil))  ; not autoloaded before Emacs 20.4    (defvar custom-print-functions nil))  ; not autoloaded before Emacs 20.4
105    
106    ;; XEmacs is distributed with few Lisp packages.  Further packages are
107    ;; installed using EFS.  If we use a unified filename format, then
108    ;; Tramp is required in addition to EFS.  (But why can't Tramp just
109    ;; disable EFS when Tramp is loaded?  Then XEmacs can ship with EFS
110    ;; just like before.)  Another reason for using a separate filename
111    ;; syntax on XEmacs is that EFS hooks into XEmacs in many places, but
112    ;; Tramp only knows how to deal with `file-name-handler-alist', not
113    ;; the other places.
114    (defvar tramp-unified-filenames (not (featurep 'xemacs))
115      "Non-nil means to use unified Ange-FTP/Tramp filename syntax.
116    Nil means to use a separate filename syntax for Tramp.")
117    
118  ;;; User Customizable Internal Variables:  ;;; User Customizable Internal Variables:
119    
120  (defgroup tramp nil  (defgroup tramp nil
# Line 629  for Tramp and EFS, so there the default Line 641  for Tramp and EFS, so there the default
641    :type 'string)    :type 'string)
642    
643  (defcustom tramp-default-method-alist  (defcustom tramp-default-method-alist
644    (if (featurep 'xemacs)    (when tramp-unified-filenames
       nil  
645      '(("\\`ftp\\." "" "ftp")      '(("\\`ftp\\." "" "ftp")
646        ("" "\\`\\(anonymous\\|ftp\\)\\'" "ftp")))        ("" "\\`\\(anonymous\\|ftp\\)\\'" "ftp")))
647    "*Default method to use for specific user/host pairs.    "*Default method to use for specific user/host pairs.
# Line 798  remote filenames.  This value is used in Line 809  remote filenames.  This value is used in
809  not to clash with the EFS filename syntax.")  not to clash with the EFS filename syntax.")
810    
811  (defcustom tramp-file-name-structure  (defcustom tramp-file-name-structure
812    (if (featurep 'xemacs)    (if tramp-unified-filenames
813        tramp-file-name-structure-separate        tramp-file-name-structure-unified
814      tramp-file-name-structure-unified)      tramp-file-name-structure-separate)
815    "*List of five elements (REGEXP METHOD USER HOST FILE), detailing \    "*List of five elements (REGEXP METHOD USER HOST FILE), detailing \
816  the tramp file name structure.  the tramp file name structure.
817    
# Line 839  See `tramp-file-name-structure-separate' Line 850  See `tramp-file-name-structure-separate'
850    
851  ;;;###autoload  ;;;###autoload
852  (defcustom tramp-file-name-regexp  (defcustom tramp-file-name-regexp
853    (if (featurep 'xemacs)    (if tramp-unified-filenames
854        tramp-file-name-regexp-separate        tramp-file-name-regexp-unified
855      tramp-file-name-regexp-unified)      tramp-file-name-regexp-separate)
856    "*Regular expression matching file names handled by tramp.    "*Regular expression matching file names handled by tramp.
857  This regexp should match tramp file names but no other file names.  This regexp should match tramp file names but no other file names.
858  \(When tramp.el is loaded, this regular expression is prepended to  \(When tramp.el is loaded, this regular expression is prepended to
# Line 872  XEmacs uses a separate filename syntax f Line 883  XEmacs uses a separate filename syntax f
883  See `tramp-file-name-structure-separate' for more details.")  See `tramp-file-name-structure-separate' for more details.")
884    
885  (defcustom tramp-make-tramp-file-format  (defcustom tramp-make-tramp-file-format
886    (if (featurep 'xemacs)    (if tramp-unified-filenames
887        tramp-make-tramp-file-format-separate        tramp-make-tramp-file-format-unified
888      tramp-make-tramp-file-format-unified)      tramp-make-tramp-file-format-separate)
889    "*Format string saying how to construct tramp file name.    "*Format string saying how to construct tramp file name.
890  `%m' is replaced by the method name.  `%m' is replaced by the method name.
891  `%u' is replaced by the user name.  `%u' is replaced by the user name.
# Line 899  XEmacs uses a separate filename syntax f Line 910  XEmacs uses a separate filename syntax f
910  See `tramp-file-name-structure-separate' for details.")  See `tramp-file-name-structure-separate' for details.")
911    
912  (defcustom tramp-make-tramp-file-user-nil-format  (defcustom tramp-make-tramp-file-user-nil-format
913    (if (featurep 'xemacs)    (if tramp-unified-filenames
914        tramp-make-tramp-file-user-nil-format-separate        tramp-make-tramp-file-user-nil-format-unified
915      tramp-make-tramp-file-user-nil-format-unified)      tramp-make-tramp-file-user-nil-format-separate)
916    "*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.
917  `%m' is replaced by the method name.  `%m' is replaced by the method name.
918  `%h' is replaced by the host name.  `%h' is replaced by the host name.
# Line 937  XEmacs uses a separate filename syntax f Line 948  XEmacs uses a separate filename syntax f
948  See `tramp-file-name-structure-separate' for details.")  See `tramp-file-name-structure-separate' for details.")
949    
950  (defcustom tramp-multi-file-name-structure  (defcustom tramp-multi-file-name-structure
951    (if (featurep 'xemacs)    (if tramp-unified-filenames
952        tramp-multi-file-name-structure-separate        tramp-multi-file-name-structure-unified
953      tramp-multi-file-name-structure-unified)      tramp-multi-file-name-structure-separate)
954    "*Describes the file name structure of `multi' files.    "*Describes the file name structure of `multi' files.
955  Multi files allow you to contact a remote host in several hops.  Multi files allow you to contact a remote host in several hops.
956  This is a list of four elements (REGEXP METHOD HOP PATH).  This is a list of four elements (REGEXP METHOD HOP PATH).
# Line 986  XEmacs uses a separate filename syntax f Line 997  XEmacs uses a separate filename syntax f
997  See `tramp-file-name-structure-separate' for details.")  See `tramp-file-name-structure-separate' for details.")
998    
999  (defcustom tramp-multi-file-name-hop-structure  (defcustom tramp-multi-file-name-hop-structure
1000    (if (featurep 'xemacs)    (if tramp-unified-filenames
1001        tramp-multi-file-name-hop-structure-separate        tramp-multi-file-name-hop-structure-unified
1002      tramp-multi-file-name-hop-structure-unified)      tramp-multi-file-name-hop-structure-separate)
1003    "*Describes the structure of a hop in multi files.    "*Describes the structure of a hop in multi files.
1004  This is a list of four elements (REGEXP METHOD USER HOST).  First  This is a list of four elements (REGEXP METHOD USER HOST).  First
1005  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 1015  XEmacs uses a separate filename syntax f Line 1026  XEmacs uses a separate filename syntax f
1026  See `tramp-file-name-structure-separate' for details.")  See `tramp-file-name-structure-separate' for details.")
1027    
1028  (defcustom tramp-make-multi-tramp-file-format  (defcustom tramp-make-multi-tramp-file-format
1029    (if (featurep 'xemacs)    (if tramp-unified-filenames
1030        tramp-make-multi-tramp-file-format-separate        tramp-make-multi-tramp-file-format-unified
1031      tramp-make-multi-tramp-file-format-unified)      tramp-make-multi-tramp-file-format-separate)
1032    "*Describes how to construct a `multi' file name.    "*Describes how to construct a `multi' file name.
1033  This is a list of three elements PREFIX, HOP and PATH.  This is a list of three elements PREFIX, HOP and PATH.
1034    
# Line 1398  This variable is buffer-local in every b Line 1409  This variable is buffer-local in every b
1409  ;; This variable does not have the right value in XEmacs.  What should  ;; This variable does not have the right value in XEmacs.  What should
1410  ;; I use instead of find-operation-coding-system in XEmacs?  ;; I use instead of find-operation-coding-system in XEmacs?
1411  (defvar tramp-feature-write-region-fix  (defvar tramp-feature-write-region-fix
1412    (unless (featurep 'xemacs)    (when (fboundp 'find-operation-coding-system)
1413      (let ((file-coding-system-alist '(("test" emacs-mule))))      (let ((file-coding-system-alist '(("test" emacs-mule))))
1414        (find-operation-coding-system 'write-region 0 0 "" nil "test")))        (find-operation-coding-system 'write-region 0 0 "" nil "test")))
1415      "Internal variable to say if `write-region' chooses the right coding.      "Internal variable to say if `write-region' chooses the right coding.
# Line 2607  This is like `dired-recursive-delete-dir Line 2618  This is like `dired-recursive-delete-dir
2618                     (file-name-nondirectory path)))))                     (file-name-nondirectory path)))))
2619        (sit-for 1)                       ;needed for rsh but not ssh?        (sit-for 1)                       ;needed for rsh but not ssh?
2620        (tramp-wait-for-output))        (tramp-wait-for-output))
2621      (insert-buffer (tramp-get-buffer multi-method method user host))      (let ((old-pos (point)))
2622      ;; On XEmacs, we want to call (exchange-point-and-mark t), but        (insert-buffer-substring
2623      ;; that doesn't exist on Emacs, so we use this workaround instead.         (tramp-get-buffer multi-method method user host))
2624      ;; Since zmacs-region-stays doesn't exist in Emacs, this ought to        ;; On XEmacs, we want to call (exchange-point-and-mark t), but
2625      ;; be safe.  Thanks to Daniel Pittman <daniel@danann.net>.        ;; that doesn't exist on Emacs, so we use this workaround instead.
2626      (let ((zmacs-region-stays t))        ;; Since zmacs-region-stays doesn't exist in Emacs, this ought to
2627        (exchange-point-and-mark))        ;; be safe.  Thanks to Daniel Pittman <daniel@danann.net>.
2628      (save-excursion        ;;     (let ((zmacs-region-stays t))
2629        (tramp-send-command multi-method method user host "cd")        ;;       (exchange-point-and-mark))
       (tramp-wait-for-output))  
     ;; Another XEmacs specialty follows.  What's the right way to do  
     ;; it?  
     (when (and (featurep 'xemacs)  
                (eq major-mode 'dired-mode))  
2630        (save-excursion        (save-excursion
2631          (require 'dired)          (tramp-send-command multi-method method user host "cd")
2632          (dired-insert-set-properties (point) (mark t))))))          (tramp-wait-for-output))
2633          ;; Another XEmacs specialty follows.  What's the right way to do
2634          ;; it?
2635          (when (and (featurep 'xemacs)
2636                     (eq major-mode 'dired-mode))
2637            (save-excursion
2638              (require 'dired)
2639              (dired-insert-set-properties old-pos (point)))))))
2640    
2641  ;; Continuation of kluge to pacify byte-compiler.  ;; Continuation of kluge to pacify byte-compiler.
2642  ;;(eval-when-compile  ;;(eval-when-compile
# Line 3228  necessary anymore." Line 3241  necessary anymore."
3241    
3242  (defun tramp-ange-ftp-file-name-p (multi-method method)  (defun tramp-ange-ftp-file-name-p (multi-method method)
3243    "Check if it's a filename that should be forwarded to Ange-FTP."    "Check if it's a filename that should be forwarded to Ange-FTP."
3244    (and (not (featurep 'xemacs))    (and tramp-unified-filenames
3245         (null multi-method)         (null multi-method)
3246         (string= method tramp-ftp-method)))         (string= method tramp-ftp-method)))
3247    
# Line 3810  Maybe the different regular expressions Line 3823  Maybe the different regular expressions
3823      (let ((process-environment (copy-sequence process-environment)))      (let ((process-environment (copy-sequence process-environment)))
3824        (setenv "TERM" tramp-terminal-type)        (setenv "TERM" tramp-terminal-type)
3825        (let* ((default-directory (tramp-temporary-file-directory))        (let* ((default-directory (tramp-temporary-file-directory))
3826                 ;; If we omit the conditional here, then we would use
3827                 ;; `undecided-dos' in some cases.  With the conditional,
3828                 ;; we use nil in these cases.  Which one is right?
3829               (coding-system-for-read (unless (and (not (featurep 'xemacs))               (coding-system-for-read (unless (and (not (featurep 'xemacs))
3830                                                    (> emacs-major-version 20))                                                    (> emacs-major-version 20))
3831                                         tramp-dos-coding-system))                                         tramp-dos-coding-system))
# Line 3876  arguments, and xx will be used as the ho Line 3892  arguments, and xx will be used as the ho
3892          (setq host (match-string 1 host)))          (setq host (match-string 1 host)))
3893        (setenv "TERM" tramp-terminal-type)        (setenv "TERM" tramp-terminal-type)
3894        (let* ((default-directory (tramp-temporary-file-directory))        (let* ((default-directory (tramp-temporary-file-directory))
3895                 ;; If we omit the conditional, we would use
3896                 ;; `undecided-dos' in some cases.  With the conditional,
3897                 ;; we use nil in these cases.  Which one is right?
3898               (coding-system-for-read (unless (and (not (featurep 'xemacs))               (coding-system-for-read (unless (and (not (featurep 'xemacs))
3899                                                    (> emacs-major-version 20))                                                    (> emacs-major-version 20))
3900                                         tramp-dos-coding-system))                                         tramp-dos-coding-system))
# Line 3924  prompt than you do, so it is not at all Line 3943  prompt than you do, so it is not at all
3943      (let ((process-environment (copy-sequence process-environment)))      (let ((process-environment (copy-sequence process-environment)))
3944        (setenv "TERM" tramp-terminal-type)        (setenv "TERM" tramp-terminal-type)
3945        (let* ((default-directory (tramp-temporary-file-directory))        (let* ((default-directory (tramp-temporary-file-directory))
3946                 ;; If we omit the conditional, we use `undecided-dos' in
3947                 ;; some cases.  With the conditional, we use nil in these
3948                 ;; cases.  What's the difference?  Which one is right?
3949               (coding-system-for-read (unless (and (not (featurep 'xemacs))               (coding-system-for-read (unless (and (not (featurep 'xemacs))
3950                                                    (> emacs-major-version 20))                                                    (> emacs-major-version 20))
3951                                         tramp-dos-coding-system))                                         tramp-dos-coding-system))
# Line 3979  log in as u2 to h2." Line 4001  log in as u2 to h2."
4001      (let ((process-environment (copy-sequence process-environment)))      (let ((process-environment (copy-sequence process-environment)))
4002        (setenv "TERM" tramp-terminal-type)        (setenv "TERM" tramp-terminal-type)
4003        (let* ((default-directory (tramp-temporary-file-directory))        (let* ((default-directory (tramp-temporary-file-directory))
4004                 ;; If we omit the conditional, we use `undecided-dos' in
4005                 ;; some cases.  With the conditional, we use nil in these
4006                 ;; cases.  What's the difference?  Which one is right?
4007               (coding-system-for-read (unless (and (not (featurep 'xemacs))               (coding-system-for-read (unless (and (not (featurep 'xemacs))
4008                                                    (> emacs-major-version 20))                                                    (> emacs-major-version 20))
4009                                         tramp-dos-coding-system))                                         tramp-dos-coding-system))
# Line 5463  Only works for Bourne-like shells." Line 5488  Only works for Bourne-like shells."
5488  ;;       nil  ;;       nil
5489  ;;     ad-do-it))  ;;     ad-do-it))
5490    
5491  ;; We currently use "[" and "]" in the filename format.  In Emacs  ;; We currently (sometimes) use "[" and "]" in the filename format.
5492  ;; 20.x, this means that Emacs wants to expand wildcards if  ;; This means that Emacs wants to expand wildcards if
5493  ;; `find-file-wildcards' is non-nil, and then barfs because no  ;; `find-file-wildcards' is non-nil, and then barfs because no
5494  ;; expansion could be found.  We detect this situation and do  ;; expansion could be found.  We detect this situation and do
5495  ;; something really awful: we have `file-expand-wildcards' return the  ;; something really awful: we have `file-expand-wildcards' return the
5496  ;; original filename if it can't expand anything.  Let's just hope  ;; original filename if it can't expand anything.  Let's just hope
5497  ;; that this doesn't break anything else.  ;; that this doesn't break anything else.
5498  ;;  (when (string-match "\\[" tramp-make-tramp-file-format)
 ;; Another problem is that the check is done by Emacs version, which  
 ;; is really not what we want to do.  Oh, well.  
   
 ;;(when (and (not (featurep 'xemacs))  
 ;;         (= emacs-major-version 20))  
 ;; It seems that this advice is needed in Emacs 21, too.  
5499  (defadvice file-expand-wildcards (around tramp-fix activate)  (defadvice file-expand-wildcards (around tramp-fix activate)
5500    (let ((name (ad-get-arg 0)))    (let ((name (ad-get-arg 0)))
5501      (if (tramp-tramp-file-p name)      (if (tramp-tramp-file-p name)
# Line 5490  Only works for Bourne-like shells." Line 5509  Only works for Bourne-like shells."
5509        ;; If it is not a Tramp file, just run the original function.        ;; If it is not a Tramp file, just run the original function.
5510        (let ((res ad-do-it))        (let ((res ad-do-it))
5511          (setq ad-return-value (or res (list name)))))))          (setq ad-return-value (or res (list name)))))))
5512  ;;  )  )
5513    
5514  ;; Tramp version is useful in a number of situations.  ;; Tramp version is useful in a number of situations.
5515    

Legend:
Removed from v.2.190  
changed lines
  Added in v.2.191

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