From: Michael Albinus Date: Sun, 23 Apr 2006 21:45:28 +0000 (+0000) Subject: * net/tramp.el (tramp-register-file-name-handlers): New defun. X-Git-Tag: emacs-pretest-22.0.90~2981 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8c04e197f2afb2032ab58707148f7ffad44b9465;p=emacs.git * 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'. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4f07ffef7a8..e6181f976fa 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2006-04-23 Michael Albinus + + * 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 * comint.el (comint-match-partial-filename): Doc fix. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 617e21ebfeb..5f3ab41e5cb 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -4337,19 +4337,34 @@ Falls back to normal file name handler if no tramp file name handler exists." (save-match-data (apply (cdr fn) args)) (tramp-completion-run-real-handler operation args)))) +;; 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 -(put 'tramp-completion-file-name-handler 'safe-magic t) +(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) -;; Register in file name handler alist ;;;###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)) - -;;;###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 @@ Falls back to normal file name handler if no tramp file name handler exists." 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 @@ Therefore, the contents of files might be included in the debug buffer(s).") (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)))