Show
Ignore:
Timestamp:
09/09/06 16:30:10 (2 years ago)
Author:
miyoshi
Message:

Sync up with Emacs CVS HEAD.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lisp/net/tramp.el

    r4111 r4161  
    38893889  "Like `make-auto-save-file-name' for tramp files. 
    38903890Returns a file name in `tramp-auto-save-directory' for autosaving this file." 
    3891   (when tramp-auto-save-directory 
    3892     (unless (file-exists-p tramp-auto-save-directory) 
    3893       (make-directory tramp-auto-save-directory t))) 
    3894   ;; jka-compr doesn't like auto-saving, so by appending "~" to the 
    3895   ;; file name we make sure that jka-compr isn't used for the 
    3896   ;; auto-save file. 
    3897   (let ((buffer-file-name 
    3898          (if tramp-auto-save-directory 
    3899              (expand-file-name 
    3900               (tramp-subst-strs-in-string 
    3901                '(("_" . "|") 
    3902                  ("/" . "_a") 
    3903                  (":" . "_b") 
    3904                  ("|" . "__") 
    3905                  ("[" . "_l") 
    3906                  ("]" . "_r")) 
    3907                (buffer-file-name)) 
    3908               tramp-auto-save-directory) 
    3909            (buffer-file-name)))) 
    3910     ;; Run plain `make-auto-save-file-name'.  There might be an advice when 
    3911     ;; it is not a magic file name operation (since Emacs 22). 
    3912     ;; We must deactivate it temporarily. 
    3913     (if (not (ad-is-active 'make-auto-save-file-name)) 
    3914         (tramp-run-real-handler 
    3915          'make-auto-save-file-name nil) 
    3916       ;; else 
    3917       (ad-deactivate 'make-auto-save-file-name) 
    3918       (prog1 
    3919        (tramp-run-real-handler 
    3920         'make-auto-save-file-name nil) 
    3921        (ad-activate 'make-auto-save-file-name))))) 
     3891  (let ((tramp-auto-save-directory tramp-auto-save-directory)) 
     3892    ;; File name must be unique.  This is ensured with Emacs 22 (see 
     3893    ;; UNIQUIFY element of `auto-save-file-name-transforms'); but for 
     3894    ;; all other cases we must do it ourselves. 
     3895    (when (boundp 'auto-save-file-name-transforms) 
     3896      (mapcar 
     3897       '(lambda (x) 
     3898          (when (and (string-match (car x) buffer-file-name) 
     3899                     (not (car (cddr x)))) 
     3900            (setq tramp-auto-save-directory 
     3901                  (or tramp-auto-save-directory temporary-file-directory)))) 
     3902       (symbol-value 'auto-save-file-name-transforms))) 
     3903    ;; Create directory. 
     3904    (when tramp-auto-save-directory 
     3905      (unless (file-exists-p tramp-auto-save-directory) 
     3906        (make-directory tramp-auto-save-directory t))) 
     3907    ;; jka-compr doesn't like auto-saving, so by appending "~" to the 
     3908    ;; file name we make sure that jka-compr isn't used for the 
     3909    ;; auto-save file. 
     3910    (let ((buffer-file-name 
     3911           (if tramp-auto-save-directory 
     3912               (expand-file-name 
     3913                (tramp-subst-strs-in-string 
     3914                 '(("_" . "|") 
     3915                   ("/" . "_a") 
     3916                   (":" . "_b") 
     3917                   ("|" . "__") 
     3918                   ("[" . "_l") 
     3919                   ("]" . "_r")) 
     3920                 (buffer-file-name)) 
     3921                tramp-auto-save-directory) 
     3922             (buffer-file-name)))) 
     3923      ;; Run plain `make-auto-save-file-name'.  There might be an advice when 
     3924      ;; it is not a magic file name operation (since Emacs 22). 
     3925      ;; We must deactivate it temporarily. 
     3926      (if (not (ad-is-active 'make-auto-save-file-name)) 
     3927          (tramp-run-real-handler 
     3928           'make-auto-save-file-name nil) 
     3929        ;; else 
     3930        (ad-deactivate 'make-auto-save-file-name) 
     3931        (prog1 
     3932            (tramp-run-real-handler 
     3933             'make-auto-save-file-name nil) 
     3934          (ad-activate 'make-auto-save-file-name)))))) 
    39223935 
    39233936 
     
    43344347  (add-to-list 'file-name-handler-alist 
    43354348               (cons tramp-file-name-regexp 'tramp-file-name-handler)) 
    4336   (when (or partial-completion-mode (featurep 'ido)) 
     4349  ;; `partial-completion-mode' is unknown in XEmacs.  So we should 
     4350  ;; load it unconditionally there.  In the GNU Emacs case, method/ 
     4351  ;; user/host name completion shall be bound to `partial-completion-mode'. 
     4352  (when (or (not (boundp 'partial-completion-mode)) 
     4353            (symbol-value 'partial-completion-mode) 
     4354            (featurep 'ido)) 
    43374355    (add-to-list 'file-name-handler-alist 
    43384356                 (cons tramp-completion-file-name-regexp 
     
    67506768  (when (numberp (nth 3 attr)) 
    67516769    (setcar (nthcdr 9 attr) 
    6752             (not (= (nth 3 attr) 
    6753                     (tramp-get-remote-gid multi-method method user host))))) 
     6770            (not (eql (nth 3 attr) 
     6771                      (tramp-get-remote-gid multi-method method user host))))) 
    67546772  ;; Set virtual device number. 
    67556773  (setcar (nthcdr 11 attr) 
     
    72017219(defun tramp-time-diff (t1 t2) 
    72027220  "Return the difference between the two times, in seconds. 
    7203 T1 and T2 are time values (as returned by `current-time' for example). 
    7204  
    7205 NOTE: This function will fail if the time difference is too large to 
    7206 fit in an integer." 
     7221T1 and T2 are time values (as returned by `current-time' for example)." 
    72077222  ;; Pacify byte-compiler with `symbol-function'. 
    72087223  (cond ((and (fboundp 'subtract-time) 
     
    72157230                  (funcall (symbol-function 'subtract-time) t1 t2))) 
    72167231        ((fboundp 'itimer-time-difference) 
    7217          (floor (funcall 
    7218                  (symbol-function 'itimer-time-difference) 
    7219                  (if (< (length t1) 3) (append t1 '(0)) t1) 
    7220                  (if (< (length t2) 3) (append t2 '(0)) t2)))) 
     7232         (funcall (symbol-function 'itimer-time-difference) 
     7233                  (if (< (length t1) 3) (append t1 '(0)) t1) 
     7234                  (if (< (length t2) 3) (append t2 '(0)) t2))) 
    72217235        (t 
    72227236         ;; snarfed from Emacs 21 time-date.el; combining