diff options
| author | Michael Albinus | 2022-12-18 16:42:51 +0100 |
|---|---|---|
| committer | Michael Albinus | 2022-12-18 16:42:51 +0100 |
| commit | 50d18bb6ea7dae575c2b679b63fc6b4b95bdf922 (patch) | |
| tree | 8b86f498f93545d298dabe9edfa5bac2638cde7a | |
| parent | 3941cc29df35d1a6c4071362b4e97a0569b34241 (diff) | |
| download | emacs-50d18bb6ea7dae575c2b679b63fc6b4b95bdf922.tar.gz emacs-50d18bb6ea7dae575c2b679b63fc6b4b95bdf922.zip | |
Make tramp-archive autoloads robust for older Emacs versions
* lisp/net/tramp-archive.el (tramp-archive-file-name-regexp):
Use `eval-when-compile'. Set it explicitly for older Emacs versions.
| -rw-r--r-- | lisp/net/tramp-archive.el | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el index 9c1e78d6b0b..49b0c0bb6b4 100644 --- a/lisp/net/tramp-archive.el +++ b/lisp/net/tramp-archive.el | |||
| @@ -215,11 +215,18 @@ It must be supported by libarchive(3).") | |||
| 215 | ;; In older Emacs (prior 27.1), `tramp-archive-autoload-file-name-regexp' | 215 | ;; In older Emacs (prior 27.1), `tramp-archive-autoload-file-name-regexp' |
| 216 | ;; is not autoloaded. So we cannot expect it to be known in | 216 | ;; is not autoloaded. So we cannot expect it to be known in |
| 217 | ;; tramp-loaddefs.el. But it exists, when tramp-archive.el is loaded. | 217 | ;; tramp-loaddefs.el. But it exists, when tramp-archive.el is loaded. |
| 218 | ;; We must wrap it into `eval-when-compile'. Otherwise, there could | ||
| 219 | ;; be an "Eager macro-expansion failure" when unloading/reloading Tramp. | ||
| 218 | ;;;###tramp-autoload | 220 | ;;;###tramp-autoload |
| 219 | (defconst tramp-archive-file-name-regexp | 221 | (defconst tramp-archive-file-name-regexp |
| 220 | (ignore-errors (tramp-archive-autoload-file-name-regexp)) | 222 | (eval-when-compile (ignore-errors (tramp-archive-autoload-file-name-regexp))) |
| 221 | "Regular expression matching archive file names.") | 223 | "Regular expression matching archive file names.") |
| 222 | 224 | ||
| 225 | ;; The value above is nil for Emacs 26. Set it now. | ||
| 226 | (if (<= emacs-major-version 26) | ||
| 227 | (setq tramp-archive-file-name-regexp | ||
| 228 | (ignore-errors (tramp-archive-autoload-file-name-regexp)))) | ||
| 229 | |||
| 223 | ;;;###tramp-autoload | 230 | ;;;###tramp-autoload |
| 224 | (defconst tramp-archive-method "archive" | 231 | (defconst tramp-archive-method "archive" |
| 225 | "Method name for archives in GVFS.") | 232 | "Method name for archives in GVFS.") |