diff options
| author | Michael Albinus | 2006-01-22 21:59:55 +0000 |
|---|---|---|
| committer | Michael Albinus | 2006-01-22 21:59:55 +0000 |
| commit | a69c01a0b7951796518e21baf719bd58584c04a3 (patch) | |
| tree | 99c166bc9adc4e5d8aff1b5a1c74a929c670429b /lisp | |
| parent | 6e36b4ff39959c6eabe3c8774a0c6cf9f2bc6f7c (diff) | |
| download | emacs-a69c01a0b7951796518e21baf719bd58584c04a3.tar.gz emacs-a69c01a0b7951796518e21baf719bd58584c04a3.zip | |
Sync with Tramp 2.0.52.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 42 | ||||
| -rw-r--r-- | lisp/net/tramp-ftp.el | 38 | ||||
| -rw-r--r-- | lisp/net/tramp-util.el | 16 | ||||
| -rw-r--r-- | lisp/net/tramp-vc.el | 69 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 190 | ||||
| -rw-r--r-- | lisp/net/trampver.el | 2 |
6 files changed, 286 insertions, 71 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8a831ee01d8..893c8ba68ef 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,45 @@ | |||
| 1 | 2006-01-22 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | Sync with Tramp 2.0.52. | ||
| 4 | |||
| 5 | * net/tramp.el, net/tramp-ftp.el, net/tramp-util.el, | ||
| 6 | net/tramp-vc.el: Add code for unloading Tramp. See comment before | ||
| 7 | `tramp-unload-tramp' for checklist. | ||
| 8 | |||
| 9 | * net/tramp.el: Require `timer-funcs' instead of `timer' if in | ||
| 10 | XEmacs. Contributed by Steve Youngs <steve@sxemacs.org>. | ||
| 11 | (tramp-unload-file-name-handler-alist) | ||
| 12 | (tramp-unload-tramp): New defuns. | ||
| 13 | (tramp-advice-PC-expand-many-files): New defadvice. | ||
| 14 | (tramp-save-PC-expand-many-files, tramp-setup-complete) Defuns | ||
| 15 | removed. | ||
| 16 | (tramp-handle-expand-file-name): Remove double slash. | ||
| 17 | (tramp-handle-file-attributes-with-ls): Return t as 9th attribute. | ||
| 18 | It doesn't matter, because it will be converted later on. | ||
| 19 | (tramp-handle-file-ownership-preserved-p): Rewritten. The old | ||
| 20 | implementation was just heuristic. | ||
| 21 | (tramp-post-connection): Set uid and gid properties. | ||
| 22 | (tramp-convert-file-attributes): Set file's gid change bit. | ||
| 23 | (tramp-get-remote-uid, tramp-get-remote-gid): New defuns. | ||
| 24 | (tramp-handle-expand-file-name): Use "~root" for tilde expansion | ||
| 25 | in case of su(do)? methods. The home directory of the local user | ||
| 26 | will be taken else. | ||
| 27 | (tramp-open-connection-telnet) | ||
| 28 | (tramp-open-connection-rsh, tramp-open-connection-su) | ||
| 29 | (tramp-open-connection-multi): Set PS1 to "$ ". Otherwise, a | ||
| 30 | local shell prompt could hurt. Reported by Romain Francoise | ||
| 31 | <romain@orebokech.com>. | ||
| 32 | (tramp-let-maybe): Add `edebug-form-spec' property. | ||
| 33 | (tramp-handle-expand-file-name): Bind `default-directory' locally | ||
| 34 | to "/" in order to avoid problems with UNC shares or Cygwin | ||
| 35 | mounts. | ||
| 36 | (tramp-md5-function): Fix typo in error message. | ||
| 37 | |||
| 38 | * net/tramp-ftp.el (tramp-ftp-enable-ange-ftp): New defun. | ||
| 39 | |||
| 40 | * net/tramp-util.el (top): Apply `ignore' instead of `identity' | ||
| 41 | for byte-compiler pacification. | ||
| 42 | |||
| 1 | 2006-01-22 Andre Spiegel <spiegel@gnu.org> | 43 | 2006-01-22 Andre Spiegel <spiegel@gnu.org> |
| 2 | 44 | ||
| 3 | * vc-rcs.el (vc-rcs-state-heuristic): Use file-attributes with | 45 | * vc-rcs.el (vc-rcs-state-heuristic): Use file-attributes with |
diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el index 53cc392ad7a..dc3742c231a 100644 --- a/lisp/net/tramp-ftp.el +++ b/lisp/net/tramp-ftp.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; tramp-ftp.el --- Tramp convenience functions for Ange-FTP -*- coding: iso-8859-1; -*- | 1 | ;;; tramp-ftp.el --- Tramp convenience functions for Ange-FTP -*- coding: iso-8859-1; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Michael Albinus <michael.albinus@gmx.de> | 5 | ;; Author: Michael Albinus <michael.albinus@gmx.de> |
| 6 | ;; Keywords: comm, processes | 6 | ;; Keywords: comm, processes |
| @@ -63,8 +63,40 @@ present for backward compatibility." | |||
| 63 | (a2 (rassq 'ange-ftp-completion-hook-function file-name-handler-alist))) | 63 | (a2 (rassq 'ange-ftp-completion-hook-function file-name-handler-alist))) |
| 64 | (setq file-name-handler-alist | 64 | (setq file-name-handler-alist |
| 65 | (delete a1 (delete a2 file-name-handler-alist))))) | 65 | (delete a1 (delete a2 file-name-handler-alist))))) |
| 66 | (tramp-disable-ange-ftp) | 66 | |
| 67 | (eval-after-load "ange-ftp" '(tramp-disable-ange-ftp)) | 67 | (eval-after-load "ange-ftp" |
| 68 | '(when (functionp 'tramp-disable-ange-ftp) | ||
| 69 | (tramp-disable-ange-ftp))) | ||
| 70 | |||
| 71 | ;;;###autoload | ||
| 72 | (defun tramp-ftp-enable-ange-ftp () | ||
| 73 | ;; The following code is commented out in Ange-FTP. | ||
| 74 | |||
| 75 | ;;; This regexp takes care of real ange-ftp file names (with a slash | ||
| 76 | ;;; and colon). | ||
| 77 | ;;; Don't allow the host name to end in a period--some systems use /.: | ||
| 78 | (or (assoc "^/[^/:]*[^/:.]:" file-name-handler-alist) | ||
| 79 | (setq file-name-handler-alist | ||
| 80 | (cons '("^/[^/:]*[^/:.]:" . ange-ftp-hook-function) | ||
| 81 | file-name-handler-alist))) | ||
| 82 | |||
| 83 | ;;; This regexp recognizes absolute filenames with only one component, | ||
| 84 | ;;; for the sake of hostname completion. | ||
| 85 | (or (assoc "^/[^/:]*\\'" file-name-handler-alist) | ||
| 86 | (setq file-name-handler-alist | ||
| 87 | (cons '("^/[^/:]*\\'" . ange-ftp-completion-hook-function) | ||
| 88 | file-name-handler-alist))) | ||
| 89 | |||
| 90 | ;;; This regexp recognizes absolute filenames with only one component | ||
| 91 | ;;; on Windows, for the sake of hostname completion. | ||
| 92 | (and (memq system-type '(ms-dos windows-nt)) | ||
| 93 | (or (assoc "^[a-zA-Z]:/[^/:]*\\'" file-name-handler-alist) | ||
| 94 | (setq file-name-handler-alist | ||
| 95 | (cons '("^[a-zA-Z]:/[^/:]*\\'" . | ||
| 96 | ange-ftp-completion-hook-function) | ||
| 97 | file-name-handler-alist))))) | ||
| 98 | |||
| 99 | (add-hook 'tramp-ftp-unload-hook 'tramp-ftp-enable-ange-ftp) | ||
| 68 | 100 | ||
| 69 | ;; Define FTP method ... | 101 | ;; Define FTP method ... |
| 70 | (defcustom tramp-ftp-method "ftp" | 102 | (defcustom tramp-ftp-method "ftp" |
diff --git a/lisp/net/tramp-util.el b/lisp/net/tramp-util.el index acb10727d46..666471d6429 100644 --- a/lisp/net/tramp-util.el +++ b/lisp/net/tramp-util.el | |||
| @@ -1,7 +1,8 @@ | |||
| 1 | ;;; -*- coding: iso-2022-7bit; -*- | 1 | ;;; -*- coding: iso-2022-7bit; -*- |
| 2 | ;;; tramp-util.el --- Misc utility functions to use with Tramp | 2 | ;;; tramp-util.el --- Misc utility functions to use with Tramp |
| 3 | 3 | ||
| 4 | ;; Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. | 4 | ;; Copyright (C) 2001, 2002, 2003, 2004, 2005, |
| 5 | ;; 2006 Free Software Foundation, Inc. | ||
| 5 | 6 | ||
| 6 | ;; Author: kai.grossjohann@gmx.net | 7 | ;; Author: kai.grossjohann@gmx.net |
| 7 | ;; Keywords: comm, extensions, processes | 8 | ;; Keywords: comm, extensions, processes |
| @@ -31,6 +32,10 @@ | |||
| 31 | (eval-when-compile (require 'cl)) | 32 | (eval-when-compile (require 'cl)) |
| 32 | (require 'compile) | 33 | (require 'compile) |
| 33 | (require 'tramp) | 34 | (require 'tramp) |
| 35 | (add-hook 'tramp-util-unload-hook | ||
| 36 | '(lambda () | ||
| 37 | (when (featurep 'tramp) | ||
| 38 | (unload-feature 'tramp 'force)))) | ||
| 34 | 39 | ||
| 35 | ;; Define a Tramp minor mode. It's intention is to redefine some keys for Tramp | 40 | ;; Define a Tramp minor mode. It's intention is to redefine some keys for Tramp |
| 36 | ;; specific functions, like compilation. | 41 | ;; specific functions, like compilation. |
| @@ -42,7 +47,7 @@ | |||
| 42 | (defalias 'define-minor-mode 'identity) | 47 | (defalias 'define-minor-mode 'identity) |
| 43 | (defvar tramp-minor-mode)) | 48 | (defvar tramp-minor-mode)) |
| 44 | (unless (featurep 'xemacs) | 49 | (unless (featurep 'xemacs) |
| 45 | (defalias 'add-menu-button 'identity))) | 50 | (defalias 'add-menu-button 'ignore))) |
| 46 | 51 | ||
| 47 | (defvar tramp-minor-mode-map (make-sparse-keymap) | 52 | (defvar tramp-minor-mode-map (make-sparse-keymap) |
| 48 | "Keymap for Tramp minor mode.") | 53 | "Keymap for Tramp minor mode.") |
| @@ -57,7 +62,14 @@ | |||
| 57 | (and tramp-minor-mode (tramp-tramp-file-p default-directory)))) | 62 | (and tramp-minor-mode (tramp-tramp-file-p default-directory)))) |
| 58 | 63 | ||
| 59 | (add-hook 'find-file-hooks 'tramp-minor-mode t) | 64 | (add-hook 'find-file-hooks 'tramp-minor-mode t) |
| 65 | (add-hook 'tramp-util-unload-hook | ||
| 66 | '(lambda () | ||
| 67 | (remove-hook 'find-file-hooks 'tramp-minor-mode))) | ||
| 68 | |||
| 60 | (add-hook 'dired-mode-hook 'tramp-minor-mode t) | 69 | (add-hook 'dired-mode-hook 'tramp-minor-mode t) |
| 70 | (add-hook 'tramp-util-unload-hook | ||
| 71 | '(lambda () | ||
| 72 | (remove-hook 'dired-mode-hook 'tramp-minor-mode))) | ||
| 61 | 73 | ||
| 62 | (defun tramp-remap-command (old-command new-command) | 74 | (defun tramp-remap-command (old-command new-command) |
| 63 | "Replaces bindings of OLD-COMMAND by NEW-COMMAND. | 75 | "Replaces bindings of OLD-COMMAND by NEW-COMMAND. |
diff --git a/lisp/net/tramp-vc.el b/lisp/net/tramp-vc.el index c1806a4be24..368d85c8e57 100644 --- a/lisp/net/tramp-vc.el +++ b/lisp/net/tramp-vc.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; tramp-vc.el --- Version control integration for TRAMP.el | 1 | ;;; tramp-vc.el --- Version control integration for TRAMP.el |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, | 3 | ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, |
| 4 | ;; 2005 Free Software Foundation, Inc. | 4 | ;; 2005, 2006 Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Author: Daniel Pittman <daniel@danann.net> | 6 | ;; Author: Daniel Pittman <daniel@danann.net> |
| 7 | ;; Keywords: comm, processes | 7 | ;; Keywords: comm, processes |
| @@ -220,34 +220,37 @@ Since TRAMP doesn't do async commands yet, this function doesn't, either." | |||
| 220 | ;; Daniel Pittman <daniel@danann.net> | 220 | ;; Daniel Pittman <daniel@danann.net> |
| 221 | ;;-(if (fboundp 'vc-call-backend) | 221 | ;;-(if (fboundp 'vc-call-backend) |
| 222 | ;;- () ;; This is the new VC for which we don't have an appropriate advice yet | 222 | ;;- () ;; This is the new VC for which we don't have an appropriate advice yet |
| 223 | ;;-) | ||
| 223 | (unless (fboundp 'process-file) | 224 | (unless (fboundp 'process-file) |
| 224 | (if (fboundp 'vc-call-backend) | 225 | (if (fboundp 'vc-call-backend) |
| 226 | (defadvice vc-do-command | ||
| 227 | (around tramp-advice-vc-do-command | ||
| 228 | (buffer okstatus command file &rest flags) | ||
| 229 | activate) | ||
| 230 | "Invoke tramp-vc-do-command for tramp files." | ||
| 231 | (let ((file (symbol-value 'file))) ;pacify byte-compiler | ||
| 232 | (if (or (and (stringp file) (tramp-tramp-file-p file)) | ||
| 233 | (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))) | ||
| 234 | (setq ad-return-value | ||
| 235 | (apply 'tramp-vc-do-command-new buffer okstatus command | ||
| 236 | file ;(or file (buffer-file-name)) | ||
| 237 | flags)) | ||
| 238 | ad-do-it))) | ||
| 225 | (defadvice vc-do-command | 239 | (defadvice vc-do-command |
| 226 | (around tramp-advice-vc-do-command | 240 | (around tramp-advice-vc-do-command |
| 227 | (buffer okstatus command file &rest flags) | 241 | (buffer okstatus command file last &rest flags) |
| 228 | activate) | 242 | activate) |
| 229 | "Invoke tramp-vc-do-command for tramp files." | 243 | "Invoke tramp-vc-do-command for tramp files." |
| 230 | (let ((file (symbol-value 'file))) ;pacify byte-compiler | 244 | (let ((file (symbol-value 'file))) ;pacify byte-compiler |
| 231 | (if (or (and (stringp file) (tramp-tramp-file-p file)) | 245 | (if (or (and (stringp file) (tramp-tramp-file-p file)) |
| 232 | (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))) | 246 | (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))) |
| 233 | (setq ad-return-value | 247 | (setq ad-return-value |
| 234 | (apply 'tramp-vc-do-command-new buffer okstatus command | 248 | (apply 'tramp-vc-do-command buffer okstatus command |
| 235 | file ;(or file (buffer-file-name)) | 249 | (or file (buffer-file-name)) last flags)) |
| 236 | flags)) | 250 | ad-do-it)))) |
| 237 | ad-do-it))) | 251 | |
| 238 | (defadvice vc-do-command | 252 | (add-hook 'tramp-unload-hook |
| 239 | (around tramp-advice-vc-do-command | 253 | '(lambda () (ad-unadvise 'vc-do-command)))) |
| 240 | (buffer okstatus command file last &rest flags) | ||
| 241 | activate) | ||
| 242 | "Invoke tramp-vc-do-command for tramp files." | ||
| 243 | (let ((file (symbol-value 'file))) ;pacify byte-compiler | ||
| 244 | (if (or (and (stringp file) (tramp-tramp-file-p file)) | ||
| 245 | (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name)))) | ||
| 246 | (setq ad-return-value | ||
| 247 | (apply 'tramp-vc-do-command buffer okstatus command | ||
| 248 | (or file (buffer-file-name)) last flags)) | ||
| 249 | ad-do-it))))) | ||
| 250 | ;;-) | ||
| 251 | 254 | ||
| 252 | 255 | ||
| 253 | ;; XEmacs uses this to do some of its work. Like vc-do-command, we | 256 | ;; 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." | |||
| 324 | (or file (buffer-file-name)) args)) | 327 | (or file (buffer-file-name)) args)) |
| 325 | ad-do-it))) | 328 | ad-do-it))) |
| 326 | 329 | ||
| 330 | (add-hook 'tramp-unload-hook | ||
| 331 | '(lambda () (ad-unadvise 'vc-simple-command))) | ||
| 332 | |||
| 327 | 333 | ||
| 328 | ;; `vc-workfile-unchanged-p' | 334 | ;; `vc-workfile-unchanged-p' |
| 329 | ;; This function does not deal well with remote files, so we do the | 335 | ;; 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." | |||
| 364 | (tramp-vc-workfile-unchanged-p filename want-differences-if-changed)) | 370 | (tramp-vc-workfile-unchanged-p filename want-differences-if-changed)) |
| 365 | ad-do-it)) | 371 | ad-do-it)) |
| 366 | 372 | ||
| 373 | (add-hook 'tramp-unload-hook | ||
| 374 | '(lambda () (ad-unadvise 'vc-workfile-unchanged-p))) | ||
| 375 | |||
| 367 | 376 | ||
| 368 | ;; Redefine a function from vc.el -- allow tramp files. | 377 | ;; Redefine a function from vc.el -- allow tramp files. |
| 369 | ;; `save-match-data' seems not to be required -- it isn't in | 378 | ;; `save-match-data' seems not to be required -- it isn't in |
| @@ -445,6 +454,9 @@ filename we are thinking about..." | |||
| 445 | (tramp-handle-vc-user-login-name uid)))) ; get the owner name | 454 | (tramp-handle-vc-user-login-name uid)))) ; get the owner name |
| 446 | ad-do-it))) ; else call the original | 455 | ad-do-it))) ; else call the original |
| 447 | 456 | ||
| 457 | (add-hook 'tramp-unload-hook | ||
| 458 | '(lambda () (ad-unadvise 'vc-user-login-name))) | ||
| 459 | |||
| 448 | 460 | ||
| 449 | ;; Determine the name of the user owning a file. | 461 | ;; Determine the name of the user owning a file. |
| 450 | (defun tramp-file-owner (filename) | 462 | (defun tramp-file-owner (filename) |
| @@ -486,6 +498,9 @@ filename we are thinking about..." | |||
| 486 | (tramp-file-owner filename)))) ; get the owner name | 498 | (tramp-file-owner filename)))) ; get the owner name |
| 487 | ad-do-it))) ; else call the original | 499 | ad-do-it))) ; else call the original |
| 488 | 500 | ||
| 501 | (add-hook 'tramp-unload-hook | ||
| 502 | '(lambda () (ad-unadvise 'vc-file-owner))) | ||
| 503 | |||
| 489 | 504 | ||
| 490 | ;; We need to make the version control software backend version | 505 | ;; We need to make the version control software backend version |
| 491 | ;; information local to the current buffer. This is because each TRAMP | 506 | ;; 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." | |||
| 506 | (tramp-tramp-file-p (buffer-file-name))) | 521 | (tramp-tramp-file-p (buffer-file-name))) |
| 507 | (make-local-variable 'vc-rcs-release) | 522 | (make-local-variable 'vc-rcs-release) |
| 508 | (setq vc-rcs-release nil))) | 523 | (setq vc-rcs-release nil))) |
| 524 | |||
| 509 | (add-hook 'find-file-hooks 'tramp-vc-setup-for-remote t) | 525 | (add-hook 'find-file-hooks 'tramp-vc-setup-for-remote t) |
| 526 | (add-hook 'tramp-unload-hook | ||
| 527 | '(lambda () | ||
| 528 | (remove-hook 'find-file-hooks 'tramp-vc-setup-for-remote))) | ||
| 510 | 529 | ||
| 511 | ;; No need to load this again if anyone asks. | 530 | ;; No need to load this again if anyone asks. |
| 512 | (provide 'tramp-vc) | 531 | (provide 'tramp-vc) |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 8555c9a83c5..10a5dd9eedf 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | ;;; tramp.el --- Transparent Remote Access, Multiple Protocol | 2 | ;;; tramp.el --- Transparent Remote Access, Multiple Protocol |
| 3 | 3 | ||
| 4 | ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, | 4 | ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
| 5 | ;; 2005 Free Software Foundation, Inc. | 5 | ;; 2005, 2006 Free Software Foundation, Inc. |
| 6 | 6 | ||
| 7 | ;; Author: Kai Gro,A_(Bjohann <kai.grossjohann@gmx.net> | 7 | ;; Author: Kai Gro,A_(Bjohann <kai.grossjohann@gmx.net> |
| 8 | ;; Michael Albinus <michael.albinus@gmx.de> | 8 | ;; Michael Albinus <michael.albinus@gmx.de> |
| @@ -67,8 +67,15 @@ | |||
| 67 | 67 | ||
| 68 | ;; The Tramp version number and bug report address, as prepared by configure. | 68 | ;; The Tramp version number and bug report address, as prepared by configure. |
| 69 | (require 'trampver) | 69 | (require 'trampver) |
| 70 | (add-hook 'tramp-unload-hook | ||
| 71 | '(lambda () | ||
| 72 | (when (featurep 'trampver) | ||
| 73 | (unload-feature 'trampver 'force)))) | ||
| 74 | |||
| 75 | (if (featurep 'xemacs) | ||
| 76 | (require 'timer-funcs) | ||
| 77 | (require 'timer)) | ||
| 70 | 78 | ||
| 71 | (require 'timer) | ||
| 72 | (require 'format-spec) ;from Gnus 5.8, also in tar ball | 79 | (require 'format-spec) ;from Gnus 5.8, also in tar ball |
| 73 | ;; As long as password.el is not part of (X)Emacs, it shouldn't | 80 | ;; As long as password.el is not part of (X)Emacs, it shouldn't |
| 74 | ;; be mandatory | 81 | ;; be mandatory |
| @@ -87,6 +94,10 @@ | |||
| 87 | 94 | ||
| 88 | (autoload 'tramp-uuencode-region "tramp-uu" | 95 | (autoload 'tramp-uuencode-region "tramp-uu" |
| 89 | "Implementation of `uuencode' in Lisp.") | 96 | "Implementation of `uuencode' in Lisp.") |
| 97 | (add-hook 'tramp-unload-hook | ||
| 98 | '(lambda () | ||
| 99 | (when (featurep 'tramp-uu) | ||
| 100 | (unload-feature 'tramp-uu 'force)))) | ||
| 90 | 101 | ||
| 91 | (unless (fboundp 'uudecode-decode-region) | 102 | (unless (fboundp 'uudecode-decode-region) |
| 92 | (autoload 'uudecode-decode-region "uudecode")) | 103 | (autoload 'uudecode-decode-region "uudecode")) |
| @@ -110,10 +121,20 @@ Nil means to use a separate filename syntax for Tramp.") | |||
| 110 | ;; tramp-ftp supports Ange-FTP only. Not suited for XEmacs therefore. | 121 | ;; tramp-ftp supports Ange-FTP only. Not suited for XEmacs therefore. |
| 111 | (unless (featurep 'xemacs) | 122 | (unless (featurep 'xemacs) |
| 112 | (eval-after-load "tramp" | 123 | (eval-after-load "tramp" |
| 113 | '(require 'tramp-ftp))) | 124 | '(progn |
| 125 | (require 'tramp-ftp) | ||
| 126 | (add-hook 'tramp-unload-hook | ||
| 127 | '(lambda () | ||
| 128 | (when (featurep 'tramp-ftp) | ||
| 129 | (unload-feature 'tramp-ftp 'force))))))) | ||
| 114 | (when (and tramp-unified-filenames (featurep 'xemacs)) | 130 | (when (and tramp-unified-filenames (featurep 'xemacs)) |
| 115 | (eval-after-load "tramp" | 131 | (eval-after-load "tramp" |
| 116 | '(require 'tramp-efs))) | 132 | '(progn |
| 133 | (require 'tramp-efs) | ||
| 134 | (add-hook 'tramp-unload-hook | ||
| 135 | '(lambda () | ||
| 136 | (when (featurep 'tramp-efs) | ||
| 137 | (unload-feature 'tramp-efs 'force))))))) | ||
| 117 | 138 | ||
| 118 | ;; tramp-smb uses "smbclient" from Samba. | 139 | ;; tramp-smb uses "smbclient" from Samba. |
| 119 | ;; Not available under Cygwin and Windows, because they don't offer | 140 | ;; 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.") | |||
| 121 | ;; UNC file names like "//host/share/localname". | 142 | ;; UNC file names like "//host/share/localname". |
| 122 | (unless (memq system-type '(cygwin windows-nt)) | 143 | (unless (memq system-type '(cygwin windows-nt)) |
| 123 | (eval-after-load "tramp" | 144 | (eval-after-load "tramp" |
| 124 | '(require 'tramp-smb))) | 145 | '(progn |
| 146 | (require 'tramp-smb) | ||
| 147 | (add-hook 'tramp-unload-hook | ||
| 148 | '(lambda () | ||
| 149 | (when (featurep 'tramp-smb) | ||
| 150 | (unload-feature 'tramp-smb 'force))))))) | ||
| 125 | 151 | ||
| 126 | (eval-when-compile | 152 | (eval-when-compile |
| 127 | (require 'cl) | 153 | (require 'cl) |
| @@ -1445,7 +1471,7 @@ the visited file modtime.") | |||
| 1445 | ((fboundp 'md5-encode) | 1471 | ((fboundp 'md5-encode) |
| 1446 | (lambda (x) (base64-encode-string | 1472 | (lambda (x) (base64-encode-string |
| 1447 | (funcall (symbol-function 'md5-encode) x)))) | 1473 | (funcall (symbol-function 'md5-encode) x)))) |
| 1448 | (t (error "Coulnd't find an `md5' function"))) | 1474 | (t (error "Couldn't find an `md5' function"))) |
| 1449 | "Function to call for running the MD5 algorithm.") | 1475 | "Function to call for running the MD5 algorithm.") |
| 1450 | 1476 | ||
| 1451 | (defvar tramp-end-of-output | 1477 | (defvar tramp-end-of-output |
| @@ -2012,6 +2038,7 @@ The intent is to protect against `obsolete variable' warnings." | |||
| 2012 | (let ((,variable ,value)) | 2038 | (let ((,variable ,value)) |
| 2013 | ,@body))) | 2039 | ,@body))) |
| 2014 | (put 'tramp-let-maybe 'lisp-indent-function 2) | 2040 | (put 'tramp-let-maybe 'lisp-indent-function 2) |
| 2041 | (put 'tramp-let-maybe 'edebug-form-spec t) | ||
| 2015 | 2042 | ||
| 2016 | ;;; Config Manipulation Functions: | 2043 | ;;; Config Manipulation Functions: |
| 2017 | 2044 | ||
| @@ -2370,8 +2397,8 @@ target of the symlink differ." | |||
| 2370 | ;; 8. File modes, as a string of ten letters or dashes as in ls -l. | 2397 | ;; 8. File modes, as a string of ten letters or dashes as in ls -l. |
| 2371 | res-filemodes | 2398 | res-filemodes |
| 2372 | ;; 9. t iff file's gid would change if file were deleted and | 2399 | ;; 9. t iff file's gid would change if file were deleted and |
| 2373 | ;; recreated. | 2400 | ;; recreated. Will be set in `tramp-convert-file-attributes' |
| 2374 | nil ;hm? | 2401 | t |
| 2375 | ;; 10. inode number. | 2402 | ;; 10. inode number. |
| 2376 | res-inode | 2403 | res-inode |
| 2377 | ;; 11. Device number. Will be replaced by a virtual device number. | 2404 | ;; 11. Device number. Will be replaced by a virtual device number. |
| @@ -2627,9 +2654,12 @@ of." | |||
| 2627 | (defun tramp-handle-file-ownership-preserved-p (filename) | 2654 | (defun tramp-handle-file-ownership-preserved-p (filename) |
| 2628 | "Like `file-ownership-preserved-p' for tramp files." | 2655 | "Like `file-ownership-preserved-p' for tramp files." |
| 2629 | (with-parsed-tramp-file-name filename nil | 2656 | (with-parsed-tramp-file-name filename nil |
| 2630 | (or (not (file-exists-p filename)) | 2657 | (let ((attributes (file-attributes filename))) |
| 2631 | ;; Existing files must be writable. | 2658 | ;; Return t if the file doesn't exist, since it's true that no |
| 2632 | (zerop (tramp-run-test "-O" filename))))) | 2659 | ;; information would be lost by an (attempted) delete and create. |
| 2660 | (or (null attributes) | ||
| 2661 | (= (nth 2 attributes) | ||
| 2662 | (tramp-get-remote-uid multi-method method user host)))))) | ||
| 2633 | 2663 | ||
| 2634 | ;; Other file name ops. | 2664 | ;; Other file name ops. |
| 2635 | 2665 | ||
| @@ -3487,6 +3517,17 @@ the result will be a local, non-Tramp, filename." | |||
| 3487 | (when (string-match "\\`\\(~[^/]*\\)\\(.*\\)\\'" localname) | 3517 | (when (string-match "\\`\\(~[^/]*\\)\\(.*\\)\\'" localname) |
| 3488 | (let ((uname (match-string 1 localname)) | 3518 | (let ((uname (match-string 1 localname)) |
| 3489 | (fname (match-string 2 localname))) | 3519 | (fname (match-string 2 localname))) |
| 3520 | ;; We cannot simply apply "~/", because under sudo "~/" is | ||
| 3521 | ;; expanded to the local user home directory but to the | ||
| 3522 | ;; root home directory. On the other hand, using always | ||
| 3523 | ;; the default user name for tilde expansion is not | ||
| 3524 | ;; appropriate either, because ssh and companions might | ||
| 3525 | ;; use a user name from the config file. | ||
| 3526 | (when (and (string-equal uname "~") | ||
| 3527 | (string-match | ||
| 3528 | "\\`su\\(do\\)?\\'" | ||
| 3529 | (tramp-find-method multi-method method user host))) | ||
| 3530 | (setq uname (concat uname (or user "root")))) | ||
| 3490 | ;; CCC fanatic error checking? | 3531 | ;; CCC fanatic error checking? |
| 3491 | (set-buffer (tramp-get-buffer multi-method method user host)) | 3532 | (set-buffer (tramp-get-buffer multi-method method user host)) |
| 3492 | (erase-buffer) | 3533 | (erase-buffer) |
| @@ -3499,17 +3540,24 @@ the result will be a local, non-Tramp, filename." | |||
| 3499 | (setq uname (buffer-substring (point) (tramp-line-end-position))) | 3540 | (setq uname (buffer-substring (point) (tramp-line-end-position))) |
| 3500 | (setq localname (concat uname fname)) | 3541 | (setq localname (concat uname fname)) |
| 3501 | (erase-buffer))) | 3542 | (erase-buffer))) |
| 3543 | ;; There might be a double slash, for example when "~/" | ||
| 3544 | ;; expands to "/". Remove this. | ||
| 3545 | (while (string-match "//" localname) | ||
| 3546 | (setq localname (replace-match "/" t t localname))) | ||
| 3502 | ;; No tilde characters in file name, do normal | 3547 | ;; No tilde characters in file name, do normal |
| 3503 | ;; expand-file-name (this does "/./" and "/../"). We bind | 3548 | ;; expand-file-name (this does "/./" and "/../"). We bind |
| 3504 | ;; directory-sep-char here for XEmacs on Windows, which | 3549 | ;; directory-sep-char here for XEmacs on Windows, which would |
| 3505 | ;; would otherwise use backslash. | 3550 | ;; otherwise use backslash. `default-directory' is bound to |
| 3551 | ;; "/", because on Windows there would be problems with UNC | ||
| 3552 | ;; shares or Cygwin mounts. | ||
| 3506 | (tramp-let-maybe directory-sep-char ?/ | 3553 | (tramp-let-maybe directory-sep-char ?/ |
| 3507 | (tramp-make-tramp-file-name | 3554 | (let ((default-directory "/")) |
| 3508 | multi-method (or method (tramp-find-default-method user host)) | 3555 | (tramp-make-tramp-file-name |
| 3509 | user host | 3556 | multi-method (or method (tramp-find-default-method user host)) |
| 3510 | (tramp-drop-volume-letter | 3557 | user host |
| 3511 | (tramp-run-real-handler 'expand-file-name | 3558 | (tramp-drop-volume-letter |
| 3512 | (list localname))))))))) | 3559 | (tramp-run-real-handler 'expand-file-name |
| 3560 | (list localname)))))))))) | ||
| 3513 | 3561 | ||
| 3514 | ;; old version follows. it uses ".." to cross file handler | 3562 | ;; old version follows. it uses ".." to cross file handler |
| 3515 | ;; boundaries. | 3563 | ;; boundaries. |
| @@ -4294,6 +4342,17 @@ Falls back to normal file name handler if no tramp file name handler exists." | |||
| 4294 | (cons tramp-completion-file-name-regexp | 4342 | (cons tramp-completion-file-name-regexp |
| 4295 | 'tramp-completion-file-name-handler)) | 4343 | 'tramp-completion-file-name-handler)) |
| 4296 | 4344 | ||
| 4345 | ;;;###autoload | ||
| 4346 | (defun tramp-unload-file-name-handler-alist () | ||
| 4347 | (setq file-name-handler-alist | ||
| 4348 | (delete (rassoc 'tramp-file-name-handler | ||
| 4349 | file-name-handler-alist) | ||
| 4350 | (delete (rassoc 'tramp-completion-file-name-handler | ||
| 4351 | file-name-handler-alist) | ||
| 4352 | file-name-handler-alist)))) | ||
| 4353 | |||
| 4354 | (add-hook 'tramp-unload-hook 'tramp-unload-file-name-handler-alist) | ||
| 4355 | |||
| 4297 | (defun tramp-repair-jka-compr () | 4356 | (defun tramp-repair-jka-compr () |
| 4298 | "If jka-compr is already loaded, move it to the front of | 4357 | "If jka-compr is already loaded, move it to the front of |
| 4299 | `file-name-handler-alist'. On Emacs 22 or so this will not be | 4358 | `file-name-handler-alist'. On Emacs 22 or so this will not be |
| @@ -4353,22 +4412,16 @@ necessary anymore." | |||
| 4353 | (read (current-buffer)))))) | 4412 | (read (current-buffer)))))) |
| 4354 | (list (expand-file-name name)))))) | 4413 | (list (expand-file-name name)))))) |
| 4355 | 4414 | ||
| 4356 | ;; Check for complete.el and override PC-expand-many-files if appropriate. | 4415 | (eval-after-load "complete" |
| 4357 | (eval-and-compile | 4416 | '(progn |
| 4358 | (defun tramp-save-PC-expand-many-files (name))); avoid compiler warning | 4417 | (defadvice PC-expand-many-files |
| 4359 | 4418 | (around tramp-advice-PC-expand-many-files (name) activate) | |
| 4360 | (defun tramp-setup-complete () | 4419 | "Invoke `tramp-handle-expand-many-files' for tramp files." |
| 4361 | (fset 'tramp-save-PC-expand-many-files | 4420 | (if (tramp-tramp-file-p name) |
| 4362 | (symbol-function 'PC-expand-many-files)) | 4421 | (setq ad-return-value (tramp-handle-expand-many-files name)) |
| 4363 | (defun PC-expand-many-files (name) | 4422 | ad-do-it)) |
| 4364 | (if (tramp-tramp-file-p name) | 4423 | (add-hook 'tramp-unload-hook |
| 4365 | (funcall (symbol-function 'expand-many-files) name) | 4424 | '(lambda () (ad-unadvise 'PC-expand-many-files))))) |
| 4366 | (tramp-save-PC-expand-many-files name)))) | ||
| 4367 | |||
| 4368 | ;; Why isn't eval-after-load sufficient? | ||
| 4369 | (if (fboundp 'PC-expand-many-files) | ||
| 4370 | (tramp-setup-complete) | ||
| 4371 | (eval-after-load "complete" '(tramp-setup-complete))) | ||
| 4372 | 4425 | ||
| 4373 | ;;; File name handler functions for completion mode | 4426 | ;;; File name handler functions for completion mode |
| 4374 | 4427 | ||
| @@ -4940,6 +4993,9 @@ Function may have 0-3 parameters." | |||
| 4940 | auto-save-default) | 4993 | auto-save-default) |
| 4941 | (auto-save-mode 1))) | 4994 | (auto-save-mode 1))) |
| 4942 | (add-hook 'find-file-hooks 'tramp-set-auto-save t) | 4995 | (add-hook 'find-file-hooks 'tramp-set-auto-save t) |
| 4996 | (add-hook 'tramp-unload-hook | ||
| 4997 | '(lambda () | ||
| 4998 | (remove-hook 'find-file-hooks 'tramp-set-auto-save))) | ||
| 4943 | 4999 | ||
| 4944 | (defun tramp-run-test (switch filename) | 5000 | (defun tramp-run-test (switch filename) |
| 4945 | "Run `test' on the remote system, given a SWITCH and a FILENAME. | 5001 | "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. | |||
| 5532 | (or user (user-login-name)) host method) | 5588 | (or user (user-login-name)) host method) |
| 5533 | (let ((process-environment (copy-sequence process-environment))) | 5589 | (let ((process-environment (copy-sequence process-environment))) |
| 5534 | (setenv "TERM" tramp-terminal-type) | 5590 | (setenv "TERM" tramp-terminal-type) |
| 5591 | (setenv "PS1" "$ ") | ||
| 5535 | (let* ((default-directory (tramp-temporary-file-directory)) | 5592 | (let* ((default-directory (tramp-temporary-file-directory)) |
| 5536 | ;; If we omit the conditional here, then we would use | 5593 | ;; If we omit the conditional here, then we would use |
| 5537 | ;; `undecided-dos' in some cases. With the conditional, | 5594 | ;; `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. | |||
| 5608 | (setq login-args (cons "-p" (cons (match-string 2 host) login-args))) | 5665 | (setq login-args (cons "-p" (cons (match-string 2 host) login-args))) |
| 5609 | (setq real-host (match-string 1 host))) | 5666 | (setq real-host (match-string 1 host))) |
| 5610 | (setenv "TERM" tramp-terminal-type) | 5667 | (setenv "TERM" tramp-terminal-type) |
| 5668 | (setenv "PS1" "$ ") | ||
| 5611 | (let* ((default-directory (tramp-temporary-file-directory)) | 5669 | (let* ((default-directory (tramp-temporary-file-directory)) |
| 5612 | ;; If we omit the conditional, we would use | 5670 | ;; If we omit the conditional, we would use |
| 5613 | ;; `undecided-dos' in some cases. With the conditional, | 5671 | ;; `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 | |||
| 5659 | (or user "<root>") method) | 5717 | (or user "<root>") method) |
| 5660 | (let ((process-environment (copy-sequence process-environment))) | 5718 | (let ((process-environment (copy-sequence process-environment))) |
| 5661 | (setenv "TERM" tramp-terminal-type) | 5719 | (setenv "TERM" tramp-terminal-type) |
| 5720 | (setenv "PS1" "$ ") | ||
| 5662 | (let* ((default-directory (tramp-temporary-file-directory)) | 5721 | (let* ((default-directory (tramp-temporary-file-directory)) |
| 5663 | ;; If we omit the conditional, we use `undecided-dos' in | 5722 | ;; If we omit the conditional, we use `undecided-dos' in |
| 5664 | ;; some cases. With the conditional, we use nil in these | 5723 | ;; some cases. With the conditional, we use nil in these |
| @@ -5723,6 +5782,7 @@ log in as u2 to h2." | |||
| 5723 | (tramp-message 7 "Opening `%s' connection..." multi-method) | 5782 | (tramp-message 7 "Opening `%s' connection..." multi-method) |
| 5724 | (let ((process-environment (copy-sequence process-environment))) | 5783 | (let ((process-environment (copy-sequence process-environment))) |
| 5725 | (setenv "TERM" tramp-terminal-type) | 5784 | (setenv "TERM" tramp-terminal-type) |
| 5785 | (setenv "PS1" "$ ") | ||
| 5726 | (let* ((default-directory (tramp-temporary-file-directory)) | 5786 | (let* ((default-directory (tramp-temporary-file-directory)) |
| 5727 | ;; If we omit the conditional, we use `undecided-dos' in | 5787 | ;; If we omit the conditional, we use `undecided-dos' in |
| 5728 | ;; some cases. With the conditional, we use nil in these | 5788 | ;; 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." | |||
| 6203 | "ln" tramp-remote-path nil))) | 6263 | "ln" tramp-remote-path nil))) |
| 6204 | (when ln | 6264 | (when ln |
| 6205 | (tramp-set-connection-property "ln" ln multi-method method user host))) | 6265 | (tramp-set-connection-property "ln" ln multi-method method user host))) |
| 6266 | ;; Set uid and gid. | ||
| 6206 | (erase-buffer) | 6267 | (erase-buffer) |
| 6268 | (tramp-send-command multi-method method user host "id -u; id -g") | ||
| 6269 | (tramp-wait-for-output) | ||
| 6270 | (goto-char (point-min)) | ||
| 6271 | (tramp-set-connection-property | ||
| 6272 | "uid" (read (current-buffer)) multi-method method user host) | ||
| 6273 | (tramp-set-connection-property | ||
| 6274 | "gid" (read (current-buffer)) multi-method method user host) | ||
| 6207 | ;; Find the right encoding/decoding commands to use. | 6275 | ;; Find the right encoding/decoding commands to use. |
| 6276 | (erase-buffer) | ||
| 6208 | (unless (tramp-method-out-of-band-p multi-method method user host) | 6277 | (unless (tramp-method-out-of-band-p multi-method method user host) |
| 6209 | (tramp-find-inline-encoding multi-method method user host)) | 6278 | (tramp-find-inline-encoding multi-method method user host)) |
| 6210 | ;; If encoding/decoding command are given, test to see if they work. | 6279 | ;; If encoding/decoding command are given, test to see if they work. |
| @@ -6700,6 +6769,10 @@ Return ATTR." | |||
| 6700 | (unless (stringp (nth 8 attr)) | 6769 | (unless (stringp (nth 8 attr)) |
| 6701 | ;; Convert file mode bits to string. | 6770 | ;; Convert file mode bits to string. |
| 6702 | (setcar (nthcdr 8 attr) (tramp-file-mode-from-int (nth 8 attr)))) | 6771 | (setcar (nthcdr 8 attr) (tramp-file-mode-from-int (nth 8 attr)))) |
| 6772 | ;; Set file's gid change bit. | ||
| 6773 | (setcar (nthcdr 9 attr) | ||
| 6774 | (not (= (nth 3 attr) | ||
| 6775 | (tramp-get-remote-gid multi-method method user host)))) | ||
| 6703 | ;; Set virtual device number. | 6776 | ;; Set virtual device number. |
| 6704 | (setcar (nthcdr 11 attr) | 6777 | (setcar (nthcdr 11 attr) |
| 6705 | (tramp-get-device multi-method method user host)) | 6778 | (tramp-get-device multi-method method user host)) |
| @@ -6957,6 +7030,12 @@ If both MULTI-METHOD and METHOD are nil, do a lookup in | |||
| 6957 | (defun tramp-get-remote-ln (multi-method method user host) | 7030 | (defun tramp-get-remote-ln (multi-method method user host) |
| 6958 | (tramp-get-connection-property "ln" nil multi-method method user host)) | 7031 | (tramp-get-connection-property "ln" nil multi-method method user host)) |
| 6959 | 7032 | ||
| 7033 | (defun tramp-get-remote-uid (multi-method method user host) | ||
| 7034 | (tramp-get-connection-property "uid" nil multi-method method user host)) | ||
| 7035 | |||
| 7036 | (defun tramp-get-remote-gid (multi-method method user host) | ||
| 7037 | (tramp-get-connection-property "gid" nil multi-method method user host)) | ||
| 7038 | |||
| 6960 | ;; Get a property of a TRAMP connection. | 7039 | ;; Get a property of a TRAMP connection. |
| 6961 | (defun tramp-get-connection-property | 7040 | (defun tramp-get-connection-property |
| 6962 | (property default multi-method method user host) | 7041 | (property default multi-method method user host) |
| @@ -6967,7 +7046,7 @@ If the value is not set for the connection, return `default'" | |||
| 6967 | (let (error) | 7046 | (let (error) |
| 6968 | (condition-case nil | 7047 | (condition-case nil |
| 6969 | (symbol-value (intern (concat "tramp-connection-property-" property))) | 7048 | (symbol-value (intern (concat "tramp-connection-property-" property))) |
| 6970 | (error default))))) | 7049 | (error default))))) |
| 6971 | 7050 | ||
| 6972 | ;; Set a property of a TRAMP connection. | 7051 | ;; Set a property of a TRAMP connection. |
| 6973 | (defun tramp-set-connection-property | 7052 | (defun tramp-set-connection-property |
| @@ -7045,7 +7124,9 @@ as default." | |||
| 7045 | "Invoke `tramp-handle-make-auto-save-file-name' for tramp files." | 7124 | "Invoke `tramp-handle-make-auto-save-file-name' for tramp files." |
| 7046 | (if (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name))) | 7125 | (if (and (buffer-file-name) (tramp-tramp-file-p (buffer-file-name))) |
| 7047 | (setq ad-return-value (tramp-handle-make-auto-save-file-name)) | 7126 | (setq ad-return-value (tramp-handle-make-auto-save-file-name)) |
| 7048 | ad-do-it))) | 7127 | ad-do-it)) |
| 7128 | (add-hook 'tramp-unload-hook | ||
| 7129 | '(lambda () (ad-unadvise 'make-auto-save-file-name)))) | ||
| 7049 | 7130 | ||
| 7050 | ;; In Emacs < 22 and XEmacs < 21.5 autosaved remote files have | 7131 | ;; In Emacs < 22 and XEmacs < 21.5 autosaved remote files have |
| 7051 | ;; permission 0666 minus umask. This is a security threat. | 7132 | ;; permission 0666 minus umask. This is a security threat. |
| @@ -7069,7 +7150,10 @@ as default." | |||
| 7069 | (and (featurep 'xemacs) | 7150 | (and (featurep 'xemacs) |
| 7070 | (= emacs-major-version 21) | 7151 | (= emacs-major-version 21) |
| 7071 | (> emacs-minor-version 4))) | 7152 | (> emacs-minor-version 4))) |
| 7072 | (add-hook 'auto-save-hook 'tramp-set-auto-save-file-modes)) | 7153 | (add-hook 'auto-save-hook 'tramp-set-auto-save-file-modes) |
| 7154 | (add-hook 'tramp-unload-hook | ||
| 7155 | '(lambda () | ||
| 7156 | (remove-hook 'auto-save-hook 'tramp-set-auto-save-file-modes)))) | ||
| 7073 | 7157 | ||
| 7074 | (defun tramp-subst-strs-in-string (alist string) | 7158 | (defun tramp-subst-strs-in-string (alist string) |
| 7075 | "Replace all occurrences of the string FROM with TO in STRING. | 7159 | "Replace all occurrences of the string FROM with TO in STRING. |
| @@ -7296,7 +7380,9 @@ Only works for Bourne-like shells." | |||
| 7296 | (setq ad-return-value (list name)))) | 7380 | (setq ad-return-value (list name)))) |
| 7297 | ;; If it is not a Tramp file, just run the original function. | 7381 | ;; If it is not a Tramp file, just run the original function. |
| 7298 | (let ((res ad-do-it)) | 7382 | (let ((res ad-do-it)) |
| 7299 | (setq ad-return-value (or res (list name)))))))) | 7383 | (setq ad-return-value (or res (list name))))))) |
| 7384 | (add-hook 'tramp-unload-hook | ||
| 7385 | '(lambda () (ad-unadvise 'file-expand-wildcards)))) | ||
| 7300 | 7386 | ||
| 7301 | ;; Tramp version is useful in a number of situations. | 7387 | ;; Tramp version is useful in a number of situations. |
| 7302 | 7388 | ||
| @@ -7521,6 +7607,25 @@ Therefore, the contents of files might be included in the debug buffer(s).") | |||
| 7521 | 7607 | ||
| 7522 | (defalias 'tramp-submit-bug 'tramp-bug) | 7608 | (defalias 'tramp-submit-bug 'tramp-bug) |
| 7523 | 7609 | ||
| 7610 | ;; Checklist for `tramp-unload-hook' | ||
| 7611 | ;; - Unload all `tramp-*' packages | ||
| 7612 | ;; - Reset `file-name-handler-alist' | ||
| 7613 | ;; - Cleanup hooks where Tramp functions are in | ||
| 7614 | ;; - Cleanup advised functions | ||
| 7615 | ;; - Cleanup autoloads | ||
| 7616 | ;;;###autoload | ||
| 7617 | (defun tramp-unload-tramp () | ||
| 7618 | (interactive) | ||
| 7619 | ;; When Tramp is not loaded yet, its autoloads are still active. | ||
| 7620 | (tramp-unload-file-name-handler-alist) | ||
| 7621 | ;; ange-ftp settings must be enabled. | ||
| 7622 | (when (functionp 'tramp-ftp-enable-ange-ftp) | ||
| 7623 | (funcall (symbol-function 'tramp-ftp-enable-ange-ftp))) | ||
| 7624 | ;; `tramp-util' unloads also `tramp'. | ||
| 7625 | (condition-case nil ;; maybe its not loaded yet. | ||
| 7626 | (unload-feature (if (featurep 'tramp-util) 'tramp-util 'tramp) 'force) | ||
| 7627 | (error nil))) | ||
| 7628 | |||
| 7524 | (provide 'tramp) | 7629 | (provide 'tramp) |
| 7525 | 7630 | ||
| 7526 | ;; Make sure that we get integration with the VC package. | 7631 | ;; 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).") | |||
| 7528 | ;; This must come after (provide 'tramp) because tramp-vc.el | 7633 | ;; This must come after (provide 'tramp) because tramp-vc.el |
| 7529 | ;; requires tramp. | 7634 | ;; requires tramp. |
| 7530 | (eval-after-load "vc" | 7635 | (eval-after-load "vc" |
| 7531 | '(require 'tramp-vc)) | 7636 | '(progn |
| 7637 | (require 'tramp-vc) | ||
| 7638 | (add-hook 'tramp-unload-hook | ||
| 7639 | '(lambda () | ||
| 7640 | (when (featurep 'tramp-vc) | ||
| 7641 | (unload-feature 'tramp-vc 'force)))))) | ||
| 7532 | 7642 | ||
| 7533 | ;;; TODO: | 7643 | ;;; TODO: |
| 7534 | 7644 | ||
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el index 650f1a727a7..632d958249d 100644 --- a/lisp/net/trampver.el +++ b/lisp/net/trampver.el | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | ;; are auto-frobbed from configure.ac, so you should edit that file and run | 30 | ;; are auto-frobbed from configure.ac, so you should edit that file and run |
| 31 | ;; "autoconf && ./configure" to change them. | 31 | ;; "autoconf && ./configure" to change them. |
| 32 | 32 | ||
| 33 | (defconst tramp-version "2.0.51" | 33 | (defconst tramp-version "2.0.52" |
| 34 | "This version of Tramp.") | 34 | "This version of Tramp.") |
| 35 | 35 | ||
| 36 | (defconst tramp-bug-report-address "tramp-devel@gnu.org" | 36 | (defconst tramp-bug-report-address "tramp-devel@gnu.org" |