1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-05 11:45:45 +00:00

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'.
This commit is contained in:
Michael Albinus 2022-11-23 12:00:35 +01:00
parent 9f4306cd8d
commit 1524fe427d
2 changed files with 18 additions and 6 deletions

View File

@ -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)

View File

@ -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)))