changeset 70191:3a3093f77da8

* net/tramp.el (tramp-register-file-name-handlers): New defun. Added with autoload cookie. (tramp-unload-file-name-handlers): Renamed from `tramp-unload-file-name-handler-alist'.
author Michael Albinus <michael.albinus@gmx.de>
date Sun, 23 Apr 2006 21:45:28 +0000
parents 17e94146a139
children 174ade98e30b
files lisp/ChangeLog lisp/net/tramp.el
diffstat 2 files changed, 34 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Apr 23 08:29:09 2006 +0000
+++ b/lisp/ChangeLog	Sun Apr 23 21:45:28 2006 +0000
@@ -1,3 +1,10 @@
+2006-04-23  Michael Albinus  <michael.albinus@gmx.de>
+
+	* net/tramp.el (tramp-register-file-name-handlers): New defun.
+	Added with autoload cookie.
+	(tramp-unload-file-name-handlers): Renamed from
+	`tramp-unload-file-name-handler-alist'.
+
 2006-04-23  Romain Francoise  <romain@orebokech.com>
 
 	* comint.el (comint-match-partial-filename): Doc fix.
--- a/lisp/net/tramp.el	Sun Apr 23 08:29:09 2006 +0000
+++ b/lisp/net/tramp.el	Sun Apr 23 21:45:28 2006 +0000
@@ -4337,19 +4337,34 @@
 	(save-match-data (apply (cdr fn) args))
       (tramp-completion-run-real-handler operation args))))
 
-;;;###autoload
-(put 'tramp-completion-file-name-handler 'safe-magic t)
-
-;; Register in file name handler alist
+;; Register in `file-name-handler-alist'.
+;; `tramp-completion-file-name-handler' must not be active when temacs
+;; dumps.  And it makes no sense in batch mode anyway.
 ;;;###autoload
-(add-to-list 'file-name-handler-alist
-	     (cons tramp-file-name-regexp 'tramp-file-name-handler))
-(add-to-list 'file-name-handler-alist
-	     (cons tramp-completion-file-name-regexp
-		   'tramp-completion-file-name-handler))
+(defun tramp-register-file-name-handlers ()
+  "Add tramp file name handlers to `file-name-handler-alist'."
+  (unless noninteractive
+    (add-to-list 'file-name-handler-alist
+		 (cons tramp-file-name-regexp 'tramp-file-name-handler))
+    (add-to-list 'file-name-handler-alist
+		 (cons tramp-completion-file-name-regexp
+		       'tramp-completion-file-name-handler))
+    (put 'tramp-completion-file-name-handler 'safe-magic t)))
+
+;; LAMBDA function used temporarily, because older/other versions of
+;; Tramp don't know of `tramp-register-file-name-handlers'.  Can be
+;; replaced once that DEFUN is established.  Relevant for Emacs 22 only.
+;;;###;autoload(add-hook 'emacs-startup-hook 'tramp-register-file-name-handlers)
+;;;###autoload(add-hook
+;;;###autoload 'emacs-startup-hook
+;;;###autoload '(lambda ()
+;;;###autoload    (condition-case nil
+;;;###autoload        (funcall 'tramp-register-file-name-handlers)
+;;;###autoload      (error nil))))
+(tramp-register-file-name-handlers)
 
 ;;;###autoload
-(defun tramp-unload-file-name-handler-alist ()
+(defun tramp-unload-file-name-handlers ()
   (setq file-name-handler-alist
 	(delete (rassoc 'tramp-file-name-handler
 			file-name-handler-alist)
@@ -4357,7 +4372,7 @@
 				file-name-handler-alist)
 			file-name-handler-alist))))
 
-(add-hook 'tramp-unload-hook 'tramp-unload-file-name-handler-alist)
+(add-hook 'tramp-unload-hook 'tramp-unload-file-name-handlers)
 
 (defun tramp-repair-jka-compr ()
   "If jka-compr is already loaded, move it to the front of
@@ -7629,7 +7644,7 @@
 (defun tramp-unload-tramp ()
   (interactive)
   ;; When Tramp is not loaded yet, its autoloads are still active.
-  (tramp-unload-file-name-handler-alist)
+  (tramp-unload-file-name-handlers)
   ;; ange-ftp settings must be enabled.
   (when (functionp 'tramp-ftp-enable-ange-ftp)
     (funcall (symbol-function 'tramp-ftp-enable-ange-ftp)))