summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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).")
;; The definition of `tramp-archive-file-name-regexp' contains calls
;; to `regexp-opt', which cannot be autoloaded while loading
;; loaddefs.el. So we use a macro, which is evaluated only when needed.
-;; When tramp-archive.el is unloaded and reloaded, it gripes about
-;; missing `tramp-archive{-compression]-suffixes'. We protect this.
+;; Emacs 26 and earlier cannot use the autoload form
+;; `tramp-compat-rx'. So we refrain from using `rx'.
;;;###autoload
(progn (defmacro tramp-archive-autoload-file-name-regexp ()
"Regular expression matching archive file names."
- `(tramp-compat-rx
+ (if (<= emacs-major-version 26)
+ '(concat
+ "\\`" "\\(" ".+" "\\."
+ ;; Default suffixes ...
+ (regexp-opt tramp-archive-suffixes)
+ ;; ... with compression.
+ "\\(?:" "\\." (regexp-opt tramp-archive-compression-suffixes) "\\)*"
+ "\\)" ;; \1
+ "\\(" "/" ".*" "\\)" "\\'") ;; \2
+ `(rx
bos
;; This group is used in `tramp-archive-file-name-archive'.
(group
(+ nonl)
;; Default suffixes ...
- "." ,(cons '| (bound-and-true-p tramp-archive-suffixes))
+ "." (| ,@tramp-archive-suffixes)
;; ... with compression.
- (? "." ,(cons '| (bound-and-true-p tramp-archive-compression-suffixes))))
+ (? "." (| ,@tramp-archive-compression-suffixes)))
;; This group is used in `tramp-archive-file-name-localname'.
(group "/" (* nonl))
- eos)))
+ eos))))
(put #'tramp-archive-autoload-file-name-regexp 'tramp-autoload t)
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."
(string-prefix-p "tramp" (symbol-name x))
;; `tramp-completion-mode' is autoloaded in Emacs < 28.1.
(not (eq 'tramp-completion-mode x))
+ ;; `tramp-register-archive-file-name-handler' is autoloaded
+ ;; in Emacs < 29.1.
+ (not (eq 'tramp-register-archive-file-name-handler x))
(not (string-match-p
(rx bol "tramp" (? "-archive") (** 1 2 "-") "test")
(symbol-name x)))