From: Michael Albinus Date: Sat, 31 Mar 2007 18:38:18 +0000 (+0000) Subject: * net/tramp.el (tramp-register-file-name-handler) X-Git-Tag: emacs-pretest-22.0.97~79 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=69cee87364f9c79b9adc85cc580a055ff71c8b3c;p=emacs.git * net/tramp.el (tramp-register-file-name-handler) (tramp-register-completion-file-name-handler): New defsubst, derived from `tramp-register-file-name-handlers'. The split is necessary because Tramp's file name handlers must be registered at different startup places. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0d47cb25a72..af0af5d3f95 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2007-03-31 Michael Albinus + + * net/tramp.el (tramp-register-file-name-handler) + (tramp-register-completion-file-name-handler): New defsubst, + derived from `tramp-register-file-name-handlers'. The split is + necessary because Tramp's file name handlers must be registered at + different startup places. + 2007-03-31 Chong Yidong * progmodes/hideshow.el (turn-off-hideshow): New function. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 7ff9b2d956b..20ac73d0f75 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -4422,10 +4422,20 @@ Falls back to normal file name handler if no tramp file name handler exists." (tramp-completion-run-real-handler operation args))))) ;;;###autoload -(defsubst tramp-register-file-name-handlers () - "Add tramp file name handlers to `file-name-handler-alist'." +(defsubst tramp-register-file-name-handler () + "Add tramp file name handler to `file-name-handler-alist'." (add-to-list 'file-name-handler-alist (cons tramp-file-name-regexp 'tramp-file-name-handler)) + ;; If jka-compr is already loaded, move it to the front of + ;; `file-name-handler-alist'. + (let ((jka (rassoc 'jka-compr-handler file-name-handler-alist))) + (when jka + (setq file-name-handler-alist + (cons jka (delete jka file-name-handler-alist)))))) + +;;;###autoload +(defsubst tramp-register-completion-file-name-handler () + "Add tramp completion file name handler to `file-name-handler-alist'." ;; `partial-completion-mode' is unknown in XEmacs. So we should ;; load it unconditionally there. In the GNU Emacs case, method/ ;; user/host name completion shall be bound to `partial-completion-mode'. @@ -4443,13 +4453,18 @@ Falls back to normal file name handler if no tramp file name handler exists." (setq file-name-handler-alist (cons jka (delete jka file-name-handler-alist)))))) +;; `tramp-file-name-handler' must be registered before evaluation of +;; site-start and init files, because there might exist remote files +;; already, f.e. files kept via recentf-mode. +;;;###autoload(tramp-register-file-name-handler) ;; During autoload, it shall be checked whether -;; `partial-completion-mode' is active. Therefore registering will be -;; delayed. +;; `partial-completion-mode' is active. Therefore registering of +;; `tramp-completion-file-name-handler' will be delayed. ;;;###autoload(add-hook ;;;###autoload 'after-init-hook -;;;###autoload '(lambda () (tramp-register-file-name-handlers))) -(tramp-register-file-name-handlers) +;;;###autoload '(lambda () (tramp-register-completion-file-name-handler))) +(tramp-register-file-name-handler) +(tramp-register-completion-file-name-handler) ;;;###autoload (defun tramp-unload-file-name-handlers ()