Commit a69c01a0 authored by Michael Albinus's avatar Michael Albinus
Browse files

Sync with Tramp 2.0.52.

parent 6e36b4ff
2006-01-22 Michael Albinus <michael.albinus@gmx.de>
Sync with Tramp 2.0.52.
* net/tramp.el, net/tramp-ftp.el, net/tramp-util.el,
net/tramp-vc.el: Add code for unloading Tramp. See comment before
`tramp-unload-tramp' for checklist.
* net/tramp.el: Require `timer-funcs' instead of `timer' if in
XEmacs. Contributed by Steve Youngs <steve@sxemacs.org>.
(tramp-unload-file-name-handler-alist)
(tramp-unload-tramp): New defuns.
(tramp-advice-PC-expand-many-files): New defadvice.
(tramp-save-PC-expand-many-files, tramp-setup-complete) Defuns
removed.
(tramp-handle-expand-file-name): Remove double slash.
(tramp-handle-file-attributes-with-ls): Return t as 9th attribute.
It doesn't matter, because it will be converted later on.
(tramp-handle-file-ownership-preserved-p): Rewritten. The old
implementation was just heuristic.
(tramp-post-connection): Set uid and gid properties.
(tramp-convert-file-attributes): Set file's gid change bit.
(tramp-get-remote-uid, tramp-get-remote-gid): New defuns.
(tramp-handle-expand-file-name): Use "~root" for tilde expansion
in case of su(do)? methods. The home directory of the local user
will be taken else.
(tramp-open-connection-telnet)
(tramp-open-connection-rsh, tramp-open-connection-su)
(tramp-open-connection-multi): Set PS1 to "$ ". Otherwise, a
local shell prompt could hurt. Reported by Romain Francoise
<romain@orebokech.com>.
(tramp-let-maybe): Add `edebug-form-spec' property.
(tramp-handle-expand-file-name): Bind `default-directory' locally
to "/" in order to avoid problems with UNC shares or Cygwin
mounts.
(tramp-md5-function): Fix typo in error message.
* net/tramp-ftp.el (tramp-ftp-enable-ange-ftp): New defun.
* net/tramp-util.el (top): Apply `ignore' instead of `identity'
for byte-compiler pacification.
2006-01-22 Andre Spiegel <spiegel@gnu.org>
 
* vc-rcs.el (vc-rcs-state-heuristic): Use file-attributes with
......
;;; tramp-ftp.el --- Tramp convenience functions for Ange-FTP -*- coding: iso-8859-1; -*-
;; Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
;; Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
;; Author: Michael Albinus <michael.albinus@gmx.de>
;; Keywords: comm, processes
......@@ -63,8 +63,40 @@ present for backward compatibility."
(a2 (rassq 'ange-ftp-completion-hook-function file-name-handler-alist)))
(setq file-name-handler-alist
(delete a1 (delete a2 file-name-handler-alist)))))
(tramp-disable-ange-ftp)
(eval-after-load "ange-ftp" '(tramp-disable-ange-ftp))
(eval-after-load "ange-ftp"
'(when (functionp 'tramp-disable-ange-ftp)
(tramp-disable-ange-ftp)))
;;;###autoload
(defun tramp-ftp-enable-ange-ftp ()
;; The following code is commented out in Ange-FTP.
;;; This regexp takes care of real ange-ftp file names (with a slash
;;; and colon).
;;; Don't allow the host name to end in a period--some systems use /.:
(or (assoc "^/[^/:]*[^/:.]:" file-name-handler-alist)
(setq file-name-handler-alist
(cons '("^/[^/:]*[^/:.]:" . ange-ftp-hook-function)
file-name-handler-alist)))
;;; This regexp recognizes absolute filenames with only one component,
;;; for the sake of hostname completion.
(or (assoc "^/[^/:]*\\'" file-name-handler-alist)
(setq file-name-handler-alist
(cons '("^/[^/:]*\\'" . ange-ftp-completion-hook-function)
file-name-handler-alist)))
;;; This regexp recognizes absolute filenames with only one component
;;; on Windows, for the sake of hostname completion.
(and (memq system-type '(ms-dos windows-nt))
(or (assoc "^[a-zA-Z]:/[^/:]*\\'" file-name-handler-alist)
(setq file-name-handler-alist
(cons '("^[a-zA-Z]:/[^/:]*\\'" .
ange-ftp-completion-hook-function)
file-name-handler-alist)))))
(add-hook 'tramp-ftp-unload-hook 'tramp-ftp-enable-ange-ftp)
;; Define FTP method ...
(defcustom tramp-ftp-method "ftp"
......
;;; -*- coding: iso-2022-7bit; -*-
;;; tramp-util.el --- Misc utility functions to use with Tramp
;; Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
;; Copyright (C) 2001, 2002, 2003, 2004, 2005,
;; 2006 Free Software Foundation, Inc.
;; Author: kai.grossjohann@gmx.net
;; Keywords: comm, extensions, processes
......@@ -31,6 +32,10 @@
(eval-when-compile (require 'cl))
(require 'compile)
(require 'tramp)
(add-hook 'tramp-util-unload-hook
'(lambda ()
(when (featurep 'tramp)
(unload-feature 'tramp 'force))))
;; Define a Tramp minor mode. It's intention is to redefine some keys for Tramp
;; specific functions, like compilation.
......@@ -42,7 +47,7 @@
(defalias 'define-minor-mode 'identity)
(defvar tramp-minor-mode))
(unless (featurep 'xemacs)
(defalias 'add-menu-button 'identity)))
(defalias 'add-menu-button 'ignore)))
(defvar tramp-minor-mode-map (make-sparse-keymap)
"Keymap for Tramp minor mode.")
......@@ -57,7 +62,14 @@
(and tramp-minor-mode (tramp-tramp-file-p default-directory))))
(add-hook 'find-file-hooks 'tramp-minor-mode t)
(add-hook 'tramp-util-unload-hook
'(lambda ()
(remove-hook 'find-file-hooks 'tramp-minor-mode)))
(add-hook 'dired-mode-hook 'tramp-minor-mode t)
(add-hook 'tramp-util-unload-hook
'(lambda ()
(remove-hook 'dired-mode-hook 'tramp-minor-mode)))
(defun tramp-remap-command (old-command new-command)
"Replaces bindings of OLD-COMMAND by NEW-COMMAND.
......
;;; tramp-vc.el --- Version control integration for TRAMP.el
;; Copyright (C) 2000, 2001, 2002, 2003, 2004,
;; 2005 Free Software Foundation, Inc.
;; 2005, 2006 Free Software Foundation, Inc.
;; Author: Daniel Pittman <daniel@danann.net>
;; Keywords: comm, processes
......@@ -220,34 +220,37 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either."
;; Daniel Pittman <daniel@danann.net>
;;-(if (fboundp 'vc-call-backend)
;;- () ;; This is the new VC for which we don't have an appropriate advice yet
;;-)
(unless (fboundp 'process-file)
(if (fboundp 'vc-call-backend)
(if (fboundp 'vc-call-backend)
(defadvice vc-do-command
(around tramp-advice-vc-do-command
(buffer okstatus command file &rest flags)
activate)
"Invoke tramp-vc-do-command for tramp files."
(let ((file (symbol-value 'file))) ;pacify byte-compiler
(if (or (and (stringp file) (tramp-tramp-file-p file))
(and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name))))
(setq ad-return-value
(apply 'tramp-vc-do-command-new buffer okstatus command
file ;(or file (buffer-file-name))
flags))
ad-do-it)))
(defadvice vc-do-command
(around tramp-advice-vc-do-command
(buffer okstatus command file &rest flags)
activate)
(buffer okstatus command file last &rest flags)
activate)
"Invoke tramp-vc-do-command for tramp files."
(let ((file (symbol-value 'file))) ;pacify byte-compiler
(if (or (and (stringp file) (tramp-tramp-file-p file))
(and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name))))
(setq ad-return-value
(apply 'tramp-vc-do-command-new buffer okstatus command
file ;(or file (buffer-file-name))
flags))
ad-do-it)))
(defadvice vc-do-command
(around tramp-advice-vc-do-command
(buffer okstatus command file last &rest flags)
activate)
"Invoke tramp-vc-do-command for tramp files."
(let ((file (symbol-value 'file))) ;pacify byte-compiler
(if (or (and (stringp file) (tramp-tramp-file-p file))
(and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name))))
(setq ad-return-value
(apply 'tramp-vc-do-command buffer okstatus command
(or file (buffer-file-name)) last flags))
ad-do-it)))))
;;-)
(let ((file (symbol-value 'file))) ;pacify byte-compiler
(if (or (and (stringp file) (tramp-tramp-file-p file))
(and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name))))
(setq ad-return-value
(apply 'tramp-vc-do-command buffer okstatus command
(or file (buffer-file-name)) last flags))
ad-do-it))))
(add-hook 'tramp-unload-hook
'(lambda () (ad-unadvise 'vc-do-command))))
;; XEmacs uses this to do some of its work. Like vc-do-command, we
......@@ -324,6 +327,9 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either."
(or file (buffer-file-name)) args))
ad-do-it)))
(add-hook 'tramp-unload-hook
'(lambda () (ad-unadvise 'vc-simple-command)))
;; `vc-workfile-unchanged-p'
;; This function does not deal well with remote files, so we do the
......@@ -364,6 +370,9 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either."
(tramp-vc-workfile-unchanged-p filename want-differences-if-changed))
ad-do-it))
(add-hook 'tramp-unload-hook
'(lambda () (ad-unadvise 'vc-workfile-unchanged-p)))
;; Redefine a function from vc.el -- allow tramp files.
;; `save-match-data' seems not to be required -- it isn't in
......@@ -445,6 +454,9 @@ filename we are thinking about..."
(tramp-handle-vc-user-login-name uid)))) ; get the owner name
ad-do-it))) ; else call the original
(add-hook 'tramp-unload-hook
'(lambda () (ad-unadvise 'vc-user-login-name)))
;; Determine the name of the user owning a file.
(defun tramp-file-owner (filename)
......@@ -486,6 +498,9 @@ filename we are thinking about..."
(tramp-file-owner filename)))) ; get the owner name
ad-do-it))) ; else call the original
(add-hook 'tramp-unload-hook
'(lambda () (ad-unadvise 'vc-file-owner)))
;; We need to make the version control software backend version
;; information local to the current buffer. This is because each TRAMP
......@@ -506,7 +521,11 @@ This makes remote VC work correctly at the cost of some processing time."
(tramp-tramp-file-p (buffer-file-name)))
(make-local-variable 'vc-rcs-release)
(setq vc-rcs-release nil)))
(add-hook 'find-file-hooks 'tramp-vc-setup-for-remote t)
(add-hook 'tramp-unload-hook
'(lambda ()
(remove-hook 'find-file-hooks 'tramp-vc-setup-for-remote)))
;; No need to load this again if anyone asks.
(provide 'tramp-vc)
......
......@@ -2,7 +2,7 @@
;;; tramp.el --- Transparent Remote Access, Multiple Protocol
;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
;; 2005 Free Software Foundation, Inc.
;; 2005, 2006 Free Software Foundation, Inc.
;; Author: Kai Gro,A_(Bjohann <kai.grossjohann@gmx.net>
;; Michael Albinus <michael.albinus@gmx.de>
......@@ -67,8 +67,15 @@
;; The Tramp version number and bug report address, as prepared by configure.
(require 'trampver)
(add-hook 'tramp-unload-hook
'(lambda ()
(when (featurep 'trampver)
(unload-feature 'trampver 'force))))
(if (featurep 'xemacs)
(require 'timer-funcs)
(require 'timer))
(require 'timer)
(require 'format-spec) ;from Gnus 5.8, also in tar ball
;; As long as password.el is not part of (X)Emacs, it shouldn't
;; be mandatory
......@@ -87,6 +94,10 @@
(autoload 'tramp-uuencode-region "tramp-uu"
"Implementation of `uuencode' in Lisp.")
(add-hook 'tramp-unload-hook
'(lambda ()
(when (featurep 'tramp-uu)
(unload-feature 'tramp-uu 'force))))
(unless (fboundp 'uudecode-decode-region)
(autoload 'uudecode-decode-region "uudecode"))
......@@ -110,10 +121,20 @@ Nil means to use a separate filename syntax for Tramp.")
;; tramp-ftp supports Ange-FTP only. Not suited for XEmacs therefore.
(unless (featurep 'xemacs)
(eval-after-load "tramp"
'(require 'tramp-ftp)))
'(progn
(require 'tramp-ftp)
(add-hook 'tramp-unload-hook
'(lambda ()
(when (featurep 'tramp-ftp)
(unload-feature 'tramp-ftp 'force)))))))
(when (and tramp-unified-filenames (featurep 'xemacs))
(eval-after-load "tramp"
'(require 'tramp-efs)))
'(progn
(require 'tramp-efs)
(add-hook 'tramp-unload-hook
'(lambda ()
(when (featurep 'tramp-efs)
(unload-feature 'tramp-efs 'force)))))))
;; tramp-smb uses "smbclient" from Samba.
;; Not available under Cygwin and Windows, because they don't offer
......@@ -121,7 +142,12 @@ Nil means to use a separate filename syntax for Tramp.")
;; UNC file names like "//host/share/localname".
(unless (memq system-type '(cygwin windows-nt))
(eval-after-load "tramp"
'(require 'tramp-smb)))
'(progn
(require 'tramp-smb)
(add-hook 'tramp-unload-hook
'(lambda ()
(when (featurep 'tramp-smb)
(unload-feature 'tramp-smb 'force)))))))
(eval-when-compile
(require 'cl)
......@@ -1445,7 +1471,7 @@ the visited file modtime.")
((fboundp 'md5-encode)
(lambda (x) (base64-encode-string
(funcall (symbol-function 'md5-encode) x))))
(t (error "Coulnd't find an `md5' function")))
(t (error "Couldn't find an `md5' function")))
"Function to call for running the MD5 algorithm.")
(defvar tramp-end-of-output
......@@ -2012,6 +2038,7 @@ The intent is to protect against `obsolete variable' warnings."
(let ((,variable ,value))
,@body)))
(put 'tramp-let-maybe 'lisp-indent-function 2)
(put 'tramp-let-maybe 'edebug-form-spec t)
;;; Config Manipulation Functions:
......@@ -2370,8 +2397,8 @@ target of the symlink differ."
;; 8. File modes, as a string of ten letters or dashes as in ls -l.
res-filemodes
;; 9. t iff file's gid would change if file were deleted and
;; recreated.
nil ;hm?
;; recreated. Will be set in `tramp-convert-file-attributes'
t
;; 10. inode number.
res-inode
;; 11. Device number. Will be replaced by a virtual device number.
......@@ -2627,9 +2654,12 @@ of."
(defun tramp-handle-file-ownership-preserved-p (filename)
"Like `file-ownership-preserved-p' for tramp files."
(with-parsed-tramp-file-name filename nil
(or (not (file-exists-p filename))
;; Existing files must be writable.
(zerop (tramp-run-test "-O" filename)))))
(let ((attributes (file-attributes filename)))
;; Return t if the file doesn't exist, since it's true that no
;; information would be lost by an (attempted) delete and create.
(or (null attributes)
(= (nth 2 attributes)
(tramp-get-remote-uid multi-method method user host))))))
;; Other file name ops.
......@@ -3487,6 +3517,17 @@ the result will be a local, non-Tramp, filename."
(when (string-match "\\`\\(~[^/]*\\)\\(.*\\)\\'" localname)
(let ((uname (match-string 1 localname))
(fname (match-string 2 localname)))
;; We cannot simply apply "~/", because under sudo "~/" is
;; expanded to the local user home directory but to the
;; root home directory. On the other hand, using always
;; the default user name for tilde expansion is not
;; appropriate either, because ssh and companions might
;; use a user name from the config file.
(when (and (string-equal uname "~")
(string-match
"\\`su\\(do\\)?\\'"
(tramp-find-method multi-method method user host)))
(setq uname (concat uname (or user "root"))))
;; CCC fanatic error checking?
(set-buffer (tramp-get-buffer multi-method method user host))
(erase-buffer)
......@@ -3499,17 +3540,24 @@ the result will be a local, non-Tramp, filename."
(setq uname (buffer-substring (point) (tramp-line-end-position)))
(setq localname (concat uname fname))
(erase-buffer)))
;; There might be a double slash, for example when "~/"
;; expands to "/". Remove this.
(while (string-match "//" localname)
(setq localname (replace-match "/" t t localname)))
;; No tilde characters in file name, do normal
;; expand-file-name (this does "/./" and "/../"). We bind
;; directory-sep-char here for XEmacs on Windows, which
;; would otherwise use backslash.
;; directory-sep-char here for XEmacs on Windows, which would
;; otherwise use backslash. `default-directory' is bound to
;; "/", because on Windows there would be problems with UNC
;; shares or Cygwin mounts.
(tramp-let-maybe directory-sep-char ?/
(tramp-make-tramp-file-name
multi-method (or method (tramp-find-default-method user host))
user host
(tramp-drop-volume-letter
(tramp-run-real-handler 'expand-file-name
(list localname)))))))))
(let ((default-directory "/"))
(tramp-make-tramp-file-name
multi-method (or method (tramp-find-default-method user host))
user host
(tramp-drop-volume-letter
(tramp-run-real-handler 'expand-file-name
(list localname))))))))))
;; old version follows. it uses ".." to cross file handler
;; boundaries.
......@@ -4294,6 +4342,17 @@ Falls back to normal file name handler if no tramp file name handler exists."
(cons tramp-completion-file-name-regexp
'tramp-completion-file-name-handler))
;;;###autoload
(defun tramp-unload-file-name-handler-alist ()
(setq file-name-handler-alist
(delete (rassoc 'tramp-file-name-handler
file-name-handler-alist)
(delete (rassoc 'tramp-completion-file-name-handler
file-name-handler-alist)
file-name-handler-alist))))
(add-hook 'tramp-unload-hook 'tramp-unload-file-name-handler-alist)
(defun tramp-repair-jka-compr ()
"If jka-compr is already loaded, move it to the front of
`file-name-handler-alist'. On Emacs 22 or so this will not be
......@@ -4353,22 +4412,16 @@ necessary anymore."
(read (current-buffer))))))
(list (expand-file-name name))))))
;; Check for complete.el and override PC-expand-many-files if appropriate.
(eval-and-compile
(defun tramp-save-PC-expand-many-files (name))); avoid compiler warning
(defun tramp-setup-complete ()
(fset 'tramp-save-PC-expand-many-files
(symbol-function 'PC-expand-many-files))
(defun PC-expand-many-files (name)
(if (tramp-tramp-file-p name)
(funcall (symbol-function 'expand-many-files) name)
(tramp-save-PC-expand-many-files name))))
;; Why isn't eval-after-load sufficient?
(if (fboundp 'PC-expand-many-files)
(tramp-setup-complete)
(eval-after-load "complete" '(tramp-setup-complete)))
(eval-after-load "complete"
'(progn
(defadvice PC-expand-many-files
(around tramp-advice-PC-expand-many-files (name) activate)
"Invoke `tramp-handle-expand-many-files' for tramp files."
(if (tramp-tramp-file-p name)
(setq ad-return-value (tramp-handle-expand-many-files name))
ad-do-it))
(add-hook 'tramp-unload-hook
'(lambda () (ad-unadvise 'PC-expand-many-files)))))
;;; File name handler functions for completion mode
......@@ -4940,6 +4993,9 @@ Function may have 0-3 parameters."
auto-save-default)
(auto-save-mode 1)))
(add-hook 'find-file-hooks 'tramp-set-auto-save t)
(add-hook 'tramp-unload-hook
'(lambda ()
(remove-hook 'find-file-hooks 'tramp-set-auto-save)))
(defun tramp-run-test (switch filename)
"Run `test' on the remote system, given a SWITCH and a FILENAME.
......@@ -5532,6 +5588,7 @@ Maybe the different regular expressions need to be tuned.
(or user (user-login-name)) host method)
(let ((process-environment (copy-sequence process-environment)))
(setenv "TERM" tramp-terminal-type)
(setenv "PS1" "$ ")
(let* ((default-directory (tramp-temporary-file-directory))
;; If we omit the conditional here, then we would use
;; `undecided-dos' in some cases. With the conditional,
......@@ -5608,6 +5665,7 @@ arguments, and xx will be used as the host name to connect to.
(setq login-args (cons "-p" (cons (match-string 2 host) login-args)))
(setq real-host (match-string 1 host)))
(setenv "TERM" tramp-terminal-type)
(setenv "PS1" "$ ")
(let* ((default-directory (tramp-temporary-file-directory))
;; If we omit the conditional, we would use
;; `undecided-dos' in some cases. With the conditional,
......@@ -5659,6 +5717,7 @@ prompt than you do, so it is not at all unlikely that the variable
(or user "<root>") method)
(let ((process-environment (copy-sequence process-environment)))
(setenv "TERM" tramp-terminal-type)
(setenv "PS1" "$ ")
(let* ((default-directory (tramp-temporary-file-directory))
;; If we omit the conditional, we use `undecided-dos' in
;; some cases. With the conditional, we use nil in these
......@@ -5723,6 +5782,7 @@ log in as u2 to h2."
(tramp-message 7 "Opening `%s' connection..." multi-method)
(let ((process-environment (copy-sequence process-environment)))
(setenv "TERM" tramp-terminal-type)
(setenv "PS1" "$ ")
(let* ((default-directory (tramp-temporary-file-directory))
;; If we omit the conditional, we use `undecided-dos' in
;; some cases. With the conditional, we use nil in these
......@@ -6203,8 +6263,17 @@ locale to C and sets up the remote shell search path."
"ln" tramp-remote-path nil)))
(when ln
(tramp-set-connection-property "ln" ln multi-method method user host)))
;; Set uid and gid.
(erase-buffer)
(tramp-send-command multi-method method user host "id -u; id -g")
(tramp-wait-for-output)
(goto-char (point-min))
(tramp-set-connection-property
"uid" (read (current-buffer)) multi-method method user host)
(tramp-set-connection-property
"gid" (read (current-buffer)) multi-method method user host)
;; Find the right encoding/decoding commands to use.
(erase-buffer)
(unless (tramp-method-out-of-band-p multi-method method user host)
(tramp-find-inline-encoding multi-method method user host))
;; If encoding/decoding command are given, test to see if they work.
......@@ -6700,6 +6769,10 @@ Return ATTR."
(unless (stringp (nth 8 attr))
;; Convert file mode bits to string.
(setcar (nthcdr 8 attr) (tramp-file-mode-from-int (nth 8 attr))))
;; Set file's gid change bit.
(setcar (nthcdr 9 attr)
(not (= (nth 3 attr)
(tramp-get-remote-gid multi-method method user host))))
;; Set virtual device number.
(setcar (nthcdr 11 attr)
(tramp-get-device multi-method method user host))
......@@ -6957,6 +7030,12 @@ If both MULTI-METHOD and METHOD are nil, do a lookup in
(defun tramp-get-remote-ln (multi-method method user host)
(tramp-get-connection-property "ln" nil multi-method method user host))
(defun tramp-get-remote-uid (multi-method method user host)
(tramp-get-connection-property "uid" nil multi-method method user host))
(defun tramp-get-remote-gid (multi-method method user host)
(tramp-get-connection-property "gid" nil multi-method method user host))
;; Get a property of a TRAMP connection.
(defun tramp-get-connection-property
(property default multi-method method user host)
......@@ -6967,7 +7046,7 @@ If the value is not set for the connection, return `default'"
(let (error)
(condition-case nil
(symbol-value (intern (concat "tramp-connection-property-" property)))
(error default)))))
(error default)))))
;; Set a property of a TRAMP connection.
(defun tramp-set-connection-property
......@@ -7045,7 +7124,9 @@ as default."
"Invoke `tramp-handle-make-auto-save-file-name' for tramp files."
(if (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))
(setq ad-return-value (tramp-handle-make-auto-save-file-name))
ad-do-it)))
ad-do-it))
(add-hook 'tramp-unload-hook
'(lambda () (ad-unadvise 'make-auto-save-file-name))))
;; In Emacs < 22 and XEmacs < 21.5 autosaved remote files have
;; permission 0666 minus umask. This is a security threat.
......@@ -7069,7 +7150,10 @@ as default."
(and (featurep 'xemacs)
(= emacs-major-version 21)
(> emacs-minor-version 4)))
(add-hook 'auto-save-hook 'tramp-set-auto-save-file-modes))
(add-hook 'auto-save-hook 'tramp-set-auto-save-file-modes)
(add-hook 'tramp-unload-hook
'(lambda ()
(remove-hook 'auto-save-hook 'tramp-set-auto-save-file-modes))))
(defun tramp-subst-strs-in-string (alist string)
"Replace all occurrences of the string FROM with TO in STRING.
......@@ -7296,7 +7380,9 @@ Only works for Bourne-like shells."
(setq ad-return-value (list name))))
;; If it is not a Tramp file, just run the original function.
(let ((res ad-do-it))
(setq ad-return-value (or res (list name))))))))
(setq ad-return-value (or res (list name)))))))
(add-hook 'tramp-unload-hook
'(lambda () (ad-unadvise 'file-expand-wildcards))))
;; Tramp version is useful in a number of situations.
......@@ -7521,6 +7607,25 @@ Therefore, the contents of files might be included in the debug buffer(s).")
(defalias 'tramp-submit-bug 'tramp-bug)
;; Checklist for `tramp-unload-hook'
;; - Unload all `tramp-*' packages
;; - Reset `file-name-handler-alist'
;; - Cleanup hooks where Tramp functions are in
;; - Cleanup advised functions
;; - Cleanup autoloads
;;;###autoload
(defun tramp-unload-tramp ()
(interactive)
;; When Tramp is not loaded yet, its autoloads are still active.
(tramp-unload-file-name-handler-alist)
;; ange-ftp settings must be enabled.
(when (functionp 'tramp-ftp-enable-ange-ftp)
(funcall (symbol-function 'tramp-ftp-enable-ange-ftp)))
;; `tramp-util' unloads also `tramp'.
(condition-case nil ;; maybe its not loaded yet.
(unload-feature (if (featurep 'tramp-util) 'tramp-util 'tramp) 'force)
(error nil)))
(provide 'tramp)
;; Make sure that we get integration with the VC package.
......@@ -7528,7 +7633,12 @@ Therefore, the contents of files might be included in the debug buffer(s).")
;; This must come after (provide 'tramp) because tramp-vc.el
;; requires tramp.
(eval-after-load "vc"
'(require 'tramp-vc))
'(progn
(require 'tramp-vc)
(add-hook 'tramp-unload-hook
'(lambda ()
(when (featurep 'tramp-vc)
(unload-feature 'tramp-vc 'force))))))
;;; TODO:
......
......@@ -30,7 +30,7 @@
;; are auto-frobbed from configure.ac, so you should edit that file and run
;; "autoconf && ./configure" to change them.
(defconst tramp-version "2.0.51"
(defconst tramp-version "2.0.52"
"This version of Tramp.")
(defconst tramp-bug-report-address "tramp-devel@gnu.org"
......
2006-01-22 Michael Albinus <michael.albinus@gmx.de>
Sync with Tramp 2.0.52.
* tramp.texi (Frequently Asked Questions): Remove Ange-FTP item.
Add Tramp disabling item. New item for common connection
problems.
(various): Apply "ftp" as method for the download URL.
(Bug Reports): Refer to FAQ for common problems.
2006-01-21 Eli Zaretskii <eliz@gnu.org>