diff options
| author | Stefan Monnier | 2025-09-11 12:26:47 +0200 |
|---|---|---|
| committer | Michael Albinus | 2025-09-11 12:26:47 +0200 |
| commit | 569fa594e24e288f3d3ba4d9042bb85f8c4f348f (patch) | |
| tree | 8c602e4d906be123f3f7567c9c51623fdc2184c8 | |
| parent | 2954234f8ff227fe276b88d759b1e247ca811c8c (diff) | |
| download | emacs-569fa594e24e288f3d3ba4d9042bb85f8c4f348f.tar.gz emacs-569fa594e24e288f3d3ba4d9042bb85f8c4f348f.zip | |
Rearrange tramp.el in order to avoid bootstrap problems
* lisp/net/tramp.el (tramp-compat, tramp-message)
(tramp-integration, trampver): Require them later.
(top): Use `eval-and-compile' modifying `macro-declarations-alist'.
(tramp-register-file-name-handlers): Don't fail during bootstrap
before `tramp-loaddefs.el' is built.
| -rw-r--r-- | lisp/net/tramp.el | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 9bf1b4ae6c3..ad768f9e038 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -63,11 +63,6 @@ | |||
| 63 | 63 | ||
| 64 | ;;; Code: | 64 | ;;; Code: |
| 65 | 65 | ||
| 66 | (require 'tramp-compat) | ||
| 67 | (require 'tramp-message) | ||
| 68 | (require 'tramp-integration) | ||
| 69 | (require 'trampver) | ||
| 70 | |||
| 71 | ;; Pacify byte-compiler. | 66 | ;; Pacify byte-compiler. |
| 72 | (require 'cl-lib) | 67 | (require 'cl-lib) |
| 73 | (declare-function file-notify-rm-watch "filenotify") | 68 | (declare-function file-notify-rm-watch "filenotify") |
| @@ -106,8 +101,9 @@ | |||
| 106 | ;; TODO: Once (autoload-macro expand) is available in all supported | 101 | ;; TODO: Once (autoload-macro expand) is available in all supported |
| 107 | ;; Emacs versions (Emacs 31.1+), this can be eliminated: | 102 | ;; Emacs versions (Emacs 31.1+), this can be eliminated: |
| 108 | ;; Backward compatibility for autoload-macro declare form. | 103 | ;; Backward compatibility for autoload-macro declare form. |
| 109 | (unless (assq 'autoload-macro macro-declarations-alist) | 104 | (eval-and-compile |
| 110 | (push '(autoload-macro ignore) macro-declarations-alist)) | 105 | (unless (assq 'autoload-macro macro-declarations-alist) |
| 106 | (push '(autoload-macro ignore) macro-declarations-alist))) | ||
| 111 | 107 | ||
| 112 | (defmacro tramp--with-startup (&rest body) | 108 | (defmacro tramp--with-startup (&rest body) |
| 113 | "Schedule BODY to be executed at the end of tramp.el." | 109 | "Schedule BODY to be executed at the end of tramp.el." |
| @@ -124,6 +120,11 @@ | |||
| 124 | 'defun-declarations-alist | 120 | 'defun-declarations-alist |
| 125 | (list 'tramp-suppress-trace #'tramp-byte-run--set-suppress-trace)))) | 121 | (list 'tramp-suppress-trace #'tramp-byte-run--set-suppress-trace)))) |
| 126 | 122 | ||
| 123 | (require 'tramp-compat) | ||
| 124 | (require 'tramp-message) | ||
| 125 | (require 'tramp-integration) | ||
| 126 | (require 'trampver) | ||
| 127 | |||
| 127 | ;;; User Customizable Internal Variables: | 128 | ;;; User Customizable Internal Variables: |
| 128 | 129 | ||
| 129 | (defgroup tramp nil | 130 | (defgroup tramp nil |
| @@ -2760,7 +2761,9 @@ remote file names." | |||
| 2760 | (cons tramp-file-name-regexp #'tramp-file-name-handler)) | 2761 | (cons tramp-file-name-regexp #'tramp-file-name-handler)) |
| 2761 | (put #'tramp-file-name-handler 'safe-magic t) | 2762 | (put #'tramp-file-name-handler 'safe-magic t) |
| 2762 | 2763 | ||
| 2763 | (tramp-register-crypt-file-name-handler) | 2764 | ;; Don't fail during bootstrap before `tramp-loaddefs.el' is built. |
| 2765 | (when (fboundp 'tramp-register-crypt-file-name-handler) | ||
| 2766 | (tramp-register-crypt-file-name-handler)) | ||
| 2764 | 2767 | ||
| 2765 | (add-to-list 'file-name-handler-alist | 2768 | (add-to-list 'file-name-handler-alist |
| 2766 | (cons tramp-completion-file-name-regexp | 2769 | (cons tramp-completion-file-name-regexp |
| @@ -2771,7 +2774,9 @@ remote file names." | |||
| 2771 | (mapcar #'car tramp-completion-file-name-handler-alist)) | 2774 | (mapcar #'car tramp-completion-file-name-handler-alist)) |
| 2772 | 2775 | ||
| 2773 | ;; After unloading, `tramp-archive-enabled' might not be defined. | 2776 | ;; After unloading, `tramp-archive-enabled' might not be defined. |
| 2774 | (when (bound-and-true-p tramp-archive-enabled) | 2777 | (when (and (bound-and-true-p tramp-archive-enabled) |
| 2778 | ;; Don't burp during boostrap when `tramp-loaddefs.el' isn't built. | ||
| 2779 | (boundp 'tramp-archive-file-name-regexp)) | ||
| 2775 | (add-to-list 'file-name-handler-alist | 2780 | (add-to-list 'file-name-handler-alist |
| 2776 | (cons tramp-archive-file-name-regexp | 2781 | (cons tramp-archive-file-name-regexp |
| 2777 | #'tramp-archive-file-name-handler)) | 2782 | #'tramp-archive-file-name-handler)) |