aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2022-11-23 12:00:35 +0100
committerMichael Albinus2022-11-23 12:00:35 +0100
commit1524fe427d00c1cf255b9d68cc8565de45ea78df (patch)
tree0559c302fe9656af628a933f2402f7ffe00b6824
parent9f4306cd8d086745750769d612df3f71defeea1e (diff)
downloademacs-1524fe427d00c1cf255b9d68cc8565de45ea78df.tar.gz
emacs-1524fe427d00c1cf255b9d68cc8565de45ea78df.zip
Restore tramp-achive's Emacs 26 compatibility
* lisp/net/tramp-archive.el (tramp-archive-autoload-file-name-regexp): Special handling of Emacs 26. Simplify the other part. * test/lisp/net/tramp-tests.el (tramp-test48-unload): Special case of `tramp-register-archive-file-name-handler'.
-rw-r--r--lisp/net/tramp-archive.el21
-rw-r--r--test/lisp/net/tramp-tests.el3
2 files changed, 18 insertions, 6 deletions
diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el
index 5b2af7c6b21..0a8c574d84c 100644
--- a/lisp/net/tramp-archive.el
+++ b/lisp/net/tramp-archive.el
@@ -183,23 +183,32 @@ It must be supported by libarchive(3).")
183;; The definition of `tramp-archive-file-name-regexp' contains calls 183;; The definition of `tramp-archive-file-name-regexp' contains calls
184;; to `regexp-opt', which cannot be autoloaded while loading 184;; to `regexp-opt', which cannot be autoloaded while loading
185;; loaddefs.el. So we use a macro, which is evaluated only when needed. 185;; loaddefs.el. So we use a macro, which is evaluated only when needed.
186;; When tramp-archive.el is unloaded and reloaded, it gripes about 186;; Emacs 26 and earlier cannot use the autoload form
187;; missing `tramp-archive{-compression]-suffixes'. We protect this. 187;; `tramp-compat-rx'. So we refrain from using `rx'.
188;;;###autoload 188;;;###autoload
189(progn (defmacro tramp-archive-autoload-file-name-regexp () 189(progn (defmacro tramp-archive-autoload-file-name-regexp ()
190 "Regular expression matching archive file names." 190 "Regular expression matching archive file names."
191 `(tramp-compat-rx 191 (if (<= emacs-major-version 26)
192 '(concat
193 "\\`" "\\(" ".+" "\\."
194 ;; Default suffixes ...
195 (regexp-opt tramp-archive-suffixes)
196 ;; ... with compression.
197 "\\(?:" "\\." (regexp-opt tramp-archive-compression-suffixes) "\\)*"
198 "\\)" ;; \1
199 "\\(" "/" ".*" "\\)" "\\'") ;; \2
200 `(rx
192 bos 201 bos
193 ;; This group is used in `tramp-archive-file-name-archive'. 202 ;; This group is used in `tramp-archive-file-name-archive'.
194 (group 203 (group
195 (+ nonl) 204 (+ nonl)
196 ;; Default suffixes ... 205 ;; Default suffixes ...
197 "." ,(cons '| (bound-and-true-p tramp-archive-suffixes)) 206 "." (| ,@tramp-archive-suffixes)
198 ;; ... with compression. 207 ;; ... with compression.
199 (? "." ,(cons '| (bound-and-true-p tramp-archive-compression-suffixes)))) 208 (? "." (| ,@tramp-archive-compression-suffixes)))
200 ;; This group is used in `tramp-archive-file-name-localname'. 209 ;; This group is used in `tramp-archive-file-name-localname'.
201 (group "/" (* nonl)) 210 (group "/" (* nonl))
202 eos))) 211 eos))))
203 212
204(put #'tramp-archive-autoload-file-name-regexp 'tramp-autoload t) 213(put #'tramp-archive-autoload-file-name-regexp 'tramp-autoload t)
205 214
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index a5bae46a583..a79c47be723 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -7630,6 +7630,9 @@ Since it unloads Tramp, it shall be the last test to run."
7630 (string-prefix-p "tramp" (symbol-name x)) 7630 (string-prefix-p "tramp" (symbol-name x))
7631 ;; `tramp-completion-mode' is autoloaded in Emacs < 28.1. 7631 ;; `tramp-completion-mode' is autoloaded in Emacs < 28.1.
7632 (not (eq 'tramp-completion-mode x)) 7632 (not (eq 'tramp-completion-mode x))
7633 ;; `tramp-register-archive-file-name-handler' is autoloaded
7634 ;; in Emacs < 29.1.
7635 (not (eq 'tramp-register-archive-file-name-handler x))
7633 (not (string-match-p 7636 (not (string-match-p
7634 (rx bol "tramp" (? "-archive") (** 1 2 "-") "test") 7637 (rx bol "tramp" (? "-archive") (** 1 2 "-") "test")
7635 (symbol-name x))) 7638 (symbol-name x)))