diff options
| author | Michael Albinus | 2006-04-28 04:06:16 +0000 |
|---|---|---|
| committer | Michael Albinus | 2006-04-28 04:06:16 +0000 |
| commit | 1ecc6145d808a276cb1ce4bfc9052dc1e9515388 (patch) | |
| tree | 137f95b263ac9ee10ec73ab0a75a4ea72ffd4aff | |
| parent | a48b489eb94a238c1eca6a0c4bdf7d5b80503240 (diff) | |
| download | emacs-1ecc6145d808a276cb1ce4bfc9052dc1e9515388.tar.gz emacs-1ecc6145d808a276cb1ce4bfc9052dc1e9515388.zip | |
* net/tramp.el (tramp-completion-file-name-handler): Disable
Tramp's functionality while loading Tramp itself.
(tramp-register-file-name-handlers): That's a defsubst now. Code
from `tramp-repair-jka-compr' moved here. Apply it via
`after-init-hook'.
(tramp-repair-jka-compr): Removed.
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 58 |
2 files changed, 39 insertions, 28 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0b384c6d8c3..ac0bbfb9700 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2006-04-28 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * net/tramp.el (tramp-completion-file-name-handler): Disable | ||
| 4 | Tramp's functionality while loading Tramp itself. | ||
| 5 | (tramp-register-file-name-handlers): That's a defsubst now. Code | ||
| 6 | from `tramp-repair-jka-compr' moved here. Apply it via | ||
| 7 | `after-init-hook'. | ||
| 8 | (tramp-repair-jka-compr): Removed. | ||
| 9 | |||
| 1 | 2006-04-27 Jay Belanger <belanger@truman.edu> | 10 | 2006-04-27 Jay Belanger <belanger@truman.edu> |
| 2 | 11 | ||
| 3 | * calc-embed.el (calc-embedded-make-info): Use `math-read-expr' to | 12 | * calc-embed.el (calc-embedded-make-info): Use `math-read-expr' to |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 5f3ab41e5cb..ad4eaaa4862 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -4324,24 +4324,34 @@ Fall back to normal file name handler if no Tramp handler exists." | |||
| 4324 | (tramp-run-real-handler operation args)))))) | 4324 | (tramp-run-real-handler operation args)))))) |
| 4325 | (setq tramp-locked tl)))) | 4325 | (setq tramp-locked tl)))) |
| 4326 | 4326 | ||
| 4327 | ;; Preload this DEFUN with the progn trick. This avoids cyclic | ||
| 4328 | ;; loading, because the `load-in-progress' check can be performed. | ||
| 4327 | ;;;###autoload | 4329 | ;;;###autoload |
| 4328 | (defun tramp-completion-file-name-handler (operation &rest args) | 4330 | (progn (defun tramp-completion-file-name-handler (operation &rest args) |
| 4329 | "Invoke tramp file name completion handler. | 4331 | "Invoke tramp file name completion handler. |
| 4330 | Falls back to normal file name handler if no tramp file name handler exists." | 4332 | Falls back to normal file name handler if no tramp file name handler exists." |
| 4331 | ;; (setq tramp-debug-buffer t) | 4333 | ;; (setq tramp-debug-buffer t) |
| 4332 | ;; (tramp-message 1 "%s %s" operation args) | 4334 | ;; (tramp-message 1 "%s %s" operation args) |
| 4333 | ;; (tramp-message 1 "%s %s\n%s" | 4335 | ;; (tramp-message 1 "%s %s\n%s" |
| 4334 | ;; operation args (with-output-to-string (backtrace))) | 4336 | ;; operation args (with-output-to-string (backtrace))) |
| 4335 | (let ((fn (assoc operation tramp-completion-file-name-handler-alist))) | 4337 | (if load-in-progress |
| 4336 | (if fn | 4338 | ;; We are while loading Tramp. |
| 4337 | (save-match-data (apply (cdr fn) args)) | 4339 | (let (file-name-handler-alist) |
| 4338 | (tramp-completion-run-real-handler operation args)))) | 4340 | (apply operation args)) |
| 4341 | ;; If Tramp is not loaded yet, do it now. | ||
| 4342 | (require 'tramp) | ||
| 4343 | (let ((fn (assoc operation tramp-completion-file-name-handler-alist))) | ||
| 4344 | (if fn | ||
| 4345 | (save-match-data (apply (cdr fn) args)) | ||
| 4346 | (tramp-completion-run-real-handler operation args)))))) | ||
| 4339 | 4347 | ||
| 4340 | ;; Register in `file-name-handler-alist'. | 4348 | ;; Register in `file-name-handler-alist'. |
| 4341 | ;; `tramp-completion-file-name-handler' must not be active when temacs | 4349 | ;; `tramp-completion-file-name-handler' must not be active when temacs |
| 4342 | ;; dumps. And it makes no sense in batch mode anyway. | 4350 | ;; dumps. And it makes no sense in batch mode anyway. This must be |
| 4351 | ;; an autoloaded DEFSUBST, because Tramp would be loaded otherwise | ||
| 4352 | ;; applying the `after-init-hook'. | ||
| 4343 | ;;;###autoload | 4353 | ;;;###autoload |
| 4344 | (defun tramp-register-file-name-handlers () | 4354 | (defsubst tramp-register-file-name-handlers () |
| 4345 | "Add tramp file name handlers to `file-name-handler-alist'." | 4355 | "Add tramp file name handlers to `file-name-handler-alist'." |
| 4346 | (unless noninteractive | 4356 | (unless noninteractive |
| 4347 | (add-to-list 'file-name-handler-alist | 4357 | (add-to-list 'file-name-handler-alist |
| @@ -4349,18 +4359,20 @@ Falls back to normal file name handler if no tramp file name handler exists." | |||
| 4349 | (add-to-list 'file-name-handler-alist | 4359 | (add-to-list 'file-name-handler-alist |
| 4350 | (cons tramp-completion-file-name-regexp | 4360 | (cons tramp-completion-file-name-regexp |
| 4351 | 'tramp-completion-file-name-handler)) | 4361 | 'tramp-completion-file-name-handler)) |
| 4352 | (put 'tramp-completion-file-name-handler 'safe-magic t))) | 4362 | (put 'tramp-completion-file-name-handler 'safe-magic t) |
| 4353 | 4363 | ;; If jka-compr is already loaded, move it to the front of | |
| 4354 | ;; LAMBDA function used temporarily, because older/other versions of | 4364 | ;; `file-name-handler-alist'. |
| 4355 | ;; Tramp don't know of `tramp-register-file-name-handlers'. Can be | 4365 | (let ((jka (rassoc 'jka-compr-handler file-name-handler-alist))) |
| 4356 | ;; replaced once that DEFUN is established. Relevant for Emacs 22 only. | 4366 | (when jka |
| 4357 | ;;;###;autoload(add-hook 'emacs-startup-hook 'tramp-register-file-name-handlers) | 4367 | (setq file-name-handler-alist |
| 4368 | (cons jka (delete jka file-name-handler-alist))))))) | ||
| 4369 | |||
| 4370 | ;; `tramp-register-file-name-handlers' cannot be autoloaded as-it-is, | ||
| 4371 | ;; because the `noninteractive' check would prevent functionality to | ||
| 4372 | ;; be dumped in temacs. | ||
| 4358 | ;;;###autoload(add-hook | 4373 | ;;;###autoload(add-hook |
| 4359 | ;;;###autoload 'emacs-startup-hook | 4374 | ;;;###autoload 'after-init-hook |
| 4360 | ;;;###autoload '(lambda () | 4375 | ;;;###autoload '(lambda () (tramp-register-file-name-handlers))) |
| 4361 | ;;;###autoload (condition-case nil | ||
| 4362 | ;;;###autoload (funcall 'tramp-register-file-name-handlers) | ||
| 4363 | ;;;###autoload (error nil)))) | ||
| 4364 | (tramp-register-file-name-handlers) | 4376 | (tramp-register-file-name-handlers) |
| 4365 | 4377 | ||
| 4366 | ;;;###autoload | 4378 | ;;;###autoload |
| @@ -4374,16 +4386,6 @@ Falls back to normal file name handler if no tramp file name handler exists." | |||
| 4374 | 4386 | ||
| 4375 | (add-hook 'tramp-unload-hook 'tramp-unload-file-name-handlers) | 4387 | (add-hook 'tramp-unload-hook 'tramp-unload-file-name-handlers) |
| 4376 | 4388 | ||
| 4377 | (defun tramp-repair-jka-compr () | ||
| 4378 | "If jka-compr is already loaded, move it to the front of | ||
| 4379 | `file-name-handler-alist'. On Emacs 22 or so this will not be | ||
| 4380 | necessary anymore." | ||
| 4381 | (let ((jka (rassoc 'jka-compr-handler file-name-handler-alist))) | ||
| 4382 | (when jka | ||
| 4383 | (setq file-name-handler-alist | ||
| 4384 | (cons jka (delete jka file-name-handler-alist)))))) | ||
| 4385 | (tramp-repair-jka-compr) | ||
| 4386 | |||
| 4387 | 4389 | ||
| 4388 | ;;; Interactions with other packages: | 4390 | ;;; Interactions with other packages: |
| 4389 | 4391 | ||