comparison lisp/net/tramp.el @ 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 a1925540484f
children d57fb8c98714
comparison
equal deleted inserted replaced
70190:17e94146a139 70191:3a3093f77da8
4335 (let ((fn (assoc operation tramp-completion-file-name-handler-alist))) 4335 (let ((fn (assoc operation tramp-completion-file-name-handler-alist)))
4336 (if fn 4336 (if fn
4337 (save-match-data (apply (cdr fn) args)) 4337 (save-match-data (apply (cdr fn) args))
4338 (tramp-completion-run-real-handler operation args)))) 4338 (tramp-completion-run-real-handler operation args))))
4339 4339
4340 ;; Register in `file-name-handler-alist'.
4341 ;; `tramp-completion-file-name-handler' must not be active when temacs
4342 ;; dumps. And it makes no sense in batch mode anyway.
4340 ;;;###autoload 4343 ;;;###autoload
4341 (put 'tramp-completion-file-name-handler 'safe-magic t) 4344 (defun tramp-register-file-name-handlers ()
4342 4345 "Add tramp file name handlers to `file-name-handler-alist'."
4343 ;; Register in file name handler alist 4346 (unless noninteractive
4347 (add-to-list 'file-name-handler-alist
4348 (cons tramp-file-name-regexp 'tramp-file-name-handler))
4349 (add-to-list 'file-name-handler-alist
4350 (cons tramp-completion-file-name-regexp
4351 'tramp-completion-file-name-handler))
4352 (put 'tramp-completion-file-name-handler 'safe-magic t)))
4353
4354 ;; LAMBDA function used temporarily, because older/other versions of
4355 ;; Tramp don't know of `tramp-register-file-name-handlers'. Can be
4356 ;; replaced once that DEFUN is established. Relevant for Emacs 22 only.
4357 ;;;###;autoload(add-hook 'emacs-startup-hook 'tramp-register-file-name-handlers)
4358 ;;;###autoload(add-hook
4359 ;;;###autoload 'emacs-startup-hook
4360 ;;;###autoload '(lambda ()
4361 ;;;###autoload (condition-case nil
4362 ;;;###autoload (funcall 'tramp-register-file-name-handlers)
4363 ;;;###autoload (error nil))))
4364 (tramp-register-file-name-handlers)
4365
4344 ;;;###autoload 4366 ;;;###autoload
4345 (add-to-list 'file-name-handler-alist 4367 (defun tramp-unload-file-name-handlers ()
4346 (cons tramp-file-name-regexp 'tramp-file-name-handler))
4347 (add-to-list 'file-name-handler-alist
4348 (cons tramp-completion-file-name-regexp
4349 'tramp-completion-file-name-handler))
4350
4351 ;;;###autoload
4352 (defun tramp-unload-file-name-handler-alist ()
4353 (setq file-name-handler-alist 4368 (setq file-name-handler-alist
4354 (delete (rassoc 'tramp-file-name-handler 4369 (delete (rassoc 'tramp-file-name-handler
4355 file-name-handler-alist) 4370 file-name-handler-alist)
4356 (delete (rassoc 'tramp-completion-file-name-handler 4371 (delete (rassoc 'tramp-completion-file-name-handler
4357 file-name-handler-alist) 4372 file-name-handler-alist)
4358 file-name-handler-alist)))) 4373 file-name-handler-alist))))
4359 4374
4360 (add-hook 'tramp-unload-hook 'tramp-unload-file-name-handler-alist) 4375 (add-hook 'tramp-unload-hook 'tramp-unload-file-name-handlers)
4361 4376
4362 (defun tramp-repair-jka-compr () 4377 (defun tramp-repair-jka-compr ()
4363 "If jka-compr is already loaded, move it to the front of 4378 "If jka-compr is already loaded, move it to the front of
4364 `file-name-handler-alist'. On Emacs 22 or so this will not be 4379 `file-name-handler-alist'. On Emacs 22 or so this will not be
4365 necessary anymore." 4380 necessary anymore."
7627 ;; - Cleanup autoloads 7642 ;; - Cleanup autoloads
7628 ;;;###autoload 7643 ;;;###autoload
7629 (defun tramp-unload-tramp () 7644 (defun tramp-unload-tramp ()
7630 (interactive) 7645 (interactive)
7631 ;; When Tramp is not loaded yet, its autoloads are still active. 7646 ;; When Tramp is not loaded yet, its autoloads are still active.
7632 (tramp-unload-file-name-handler-alist) 7647 (tramp-unload-file-name-handlers)
7633 ;; ange-ftp settings must be enabled. 7648 ;; ange-ftp settings must be enabled.
7634 (when (functionp 'tramp-ftp-enable-ange-ftp) 7649 (when (functionp 'tramp-ftp-enable-ange-ftp)
7635 (funcall (symbol-function 'tramp-ftp-enable-ange-ftp))) 7650 (funcall (symbol-function 'tramp-ftp-enable-ange-ftp)))
7636 ;; `tramp-util' unloads also `tramp'. 7651 ;; `tramp-util' unloads also `tramp'.
7637 (condition-case nil ;; maybe its not loaded yet. 7652 (condition-case nil ;; maybe its not loaded yet.