emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 1524fe427d: Restore tramp-achive's Emacs 26 compatibility


From: Michael Albinus
Subject: master 1524fe427d: Restore tramp-achive's Emacs 26 compatibility
Date: Wed, 23 Nov 2022 06:00:45 -0500 (EST)

branch: master
commit 1524fe427d00c1cf255b9d68cc8565de45ea78df
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    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'.
---
 lisp/net/tramp-archive.el    | 21 +++++++++++++++------
 test/lisp/net/tramp-tests.el |  3 +++
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el
index 5b2af7c6b2..0a8c574d84 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 a5bae46a58..a79c47be72 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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]