emacs-diffs
[Top][All Lists]
Advanced

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

master 6602ec3abc: Remove Emacs 26 compatibility from Tramp


From: Michael Albinus
Subject: master 6602ec3abc: Remove Emacs 26 compatibility from Tramp
Date: Fri, 6 Jan 2023 07:34:43 -0500 (EST)

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

    Remove Emacs 26 compatibility from Tramp
    
    * doc/misc/tramp.texi (Remote processes): Don't mention Emacs version.
    (Frequently Asked Questions): Adapt supported Emacs versions.
    
    * doc/misc/trampver.texi:
    * lisp/net/trampver.el: Change version to "2.7.0-pre".
    
    * lisp/net/tramp-compat.el (tramp-compat-file-name-quoted-p)
    (tramp-compat-file-name-quote, tramp-compat-file-name-unquote)
    (tramp-compat-tramp-syntax, tramp-compat-exec-path)
    (tramp-compat-time-equal-p, tramp-compat-flatten-tree)
    (tramp-compat-progress-reporter-update)
    (tramp-compat-ignore-error, tramp-compat-rx--transform-item)
    (tramp-compat-rx--transform, tramp-compat-rx): Remove.
    
    * lisp/net/tramp-adb.el:
    * lisp/net/tramp-archive.el:
    * lisp/net/tramp-cache.el:
    * lisp/net/tramp-cmds.el:
    * lisp/net/tramp-crypt.el:
    * lisp/net/tramp-fuse.el:
    * lisp/net/tramp-gvfs.el:
    * lisp/net/tramp-integration.el:
    * lisp/net/tramp-rclone.el:
    * lisp/net/tramp-sh.el:
    * lisp/net/tramp-smb.el:
    * lisp/net/tramp-sshfs.el:
    * lisp/net/tramp-sudoedit.el:
    * lisp/net/tramp.el:
    * lisp/net/trampver.el: Replace the removed `tramp-compat-*' items
    by their real definition.  Don't use `tramp-compat-funcall' when
    not needed.  Remove `with-no-warnings' and `ignore-errors' where
    appropriate.
    
    * lisp/net/tramp.el (tramp-file-name-for-operation): Rearrange list.
    (tramp-handle-file-newer-than-file-p): Simplify.
    (tramp-get-process-attributes): Don't check for existence of
    `connection-local-criteria-for-default-directory'.
    (tramp-handle-shell-command): Don't check for existence of
    `shell-command-save-pos-or-erase', `async-shell-command-width' and
    `shell-command-set-point-after-cmd'.
    (tramp-handle-start-file-process): Call `make-process' directly.
    (tramp-defined-time): New defsubst.
    (tramp-get-local-gid): Don't check for existence of `group-name'.
    
    * lisp/net/tramp-adb.el (tramp-adb-handle-set-file-times):
    Use `tramp-defined-time'.
    (tramp-adb-get-signal-strings): Don't bind `shell-file-name' and
    `shell-command-switch'.
    
    * lisp/net/tramp-archive.el (top, tramp-archive-file-name-handler):
    Don't bind `max-specpdl-size' any longer.
    (tramp-archive-autoload-file-name-regexp): Remove Emacs 26
    specific code.
    (top): Don't call `tramp-register-archive-autoload-file-name-handler'.
    
    * lisp/net/tramp-gvfs.el (top): Don't bind `max-specpdl-size' any longer.
    (tramp-gvfs-handle-set-file-times): Use `tramp-defined-time'.
    
    * lisp/net/tramp-sh.el (tramp-sh-handle-set-file-times):
    Use `tramp-defined-time'.
    
    * test/lisp/net/tramp-archive-tests.el (tramp-archive--test-emacs27-p):
    Remove.
    (all):
    * test/lisp/net/tramp-tests.el (all): Don't skip for Emacs 26.
    Replace the removed `tramp-compat-*' items by their real
    definition.  Don't use `tramp-compat-funcall' when not needed.
    Remove `with-no-warnings' and `ignore-errors' where appropriate.
    (with-connection-local-variables)
    (shell-command-dont-erase-buffer): Don't declare.
    (tramp-test10-write-region): Don't check for `make-empty-file'.
    (tramp-test32-shell-command): Simplify.
    (tramp-test34-explicit-shell-file-name): Don't protect
    `explicit-shell-file-name' any longer.
    (tramp--test-emacs27-p): Remove.
---
 doc/misc/tramp.texi                  |  18 +-
 doc/misc/trampver.texi               |   4 +-
 lisp/net/tramp-adb.el                |  49 ++--
 lisp/net/tramp-archive.el            |  45 +---
 lisp/net/tramp-cache.el              |   7 +-
 lisp/net/tramp-cmds.el               |   6 +-
 lisp/net/tramp-compat.el             | 157 +------------
 lisp/net/tramp-crypt.el              |  54 ++---
 lisp/net/tramp-fuse.el               |  17 +-
 lisp/net/tramp-gvfs.el               |  57 ++---
 lisp/net/tramp-integration.el        |   3 +-
 lisp/net/tramp-rclone.el             |   2 +-
 lisp/net/tramp-sh.el                 | 144 +++++-------
 lisp/net/tramp-smb.el                |  33 ++-
 lisp/net/tramp-sshfs.el              |   5 +-
 lisp/net/tramp-sudoedit.el           |  77 +++---
 lisp/net/tramp.el                    | 327 +++++++++++---------------
 lisp/net/trampver.el                 |  21 +-
 test/lisp/net/tramp-archive-tests.el |  27 +--
 test/lisp/net/tramp-tests.el         | 437 ++++++++++++-----------------------
 20 files changed, 514 insertions(+), 976 deletions(-)

diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 56436d3297..a2c292dd5a 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -1,5 +1,5 @@
 \input texinfo   @c -*- mode: texinfo; coding: utf-8 -*-
-@setfilename ../info/tramp
+@setfilename ../../info/tramp.info
 @c %**start of header
 @include docstyle.texi
 @c In the Tramp GIT, the version number and the bug report address
@@ -3928,12 +3928,12 @@ connection-local variables.
 
 @vindex async-shell-command-width
 @vindex COLUMNS@r{, environment variable}
-If Emacs supports the user option @code{async-shell-command-width}
-(since @w{Emacs 27}), @value{tramp} cares about its value for
-asynchronous shell commands.  It specifies the number of display
-columns for command output.  For synchronous shell commands, a similar
-effect can be achieved by adding the environment variable
-@env{COLUMNS} to @code{tramp-remote-process-environment}.
+@value{tramp} cares about the user option
+@code{async-shell-command-width} for asynchronous shell commands.  It
+specifies the number of display columns for command output.  For
+synchronous shell commands, a similar effect can be achieved by adding
+the environment variable @env{COLUMNS} to
+@code{tramp-remote-process-environment}.
 
 
 @subsection Running @code{eshell} on a remote host
@@ -4824,8 +4824,8 @@ Where is the latest @value{tramp}?
 @item
 Which systems does it work on?
 
-The package works successfully on @w{Emacs 26}, @w{Emacs 27}, @w{Emacs
-28}, and @w{Emacs 29}.
+The package works successfully on @w{Emacs 27}, @w{Emacs 28}, @w{Emacs
+29}, and @w{Emacs 30}.
 
 While Unix and Unix-like systems are the primary remote targets,
 @value{tramp} has equal success connecting to other platforms, such as
diff --git a/doc/misc/trampver.texi b/doc/misc/trampver.texi
index dce02933f2..2f505c6ace 100644
--- a/doc/misc/trampver.texi
+++ b/doc/misc/trampver.texi
@@ -7,10 +7,10 @@
 
 @c In the  Tramp GIT, the version number and the bug report address
 @c are auto-frobbed from configure.ac.
-@set trampver 2.6.0-pre
+@set trampver 2.7.0-pre
 @set trampurl https://www.gnu.org/software/tramp/
 @set tramp-bug-report-address tramp-devel@@gnu.org
-@set emacsver 26.1
+@set emacsver 27.1
 
 @c Other flags from configuration.
 @set instprefix /usr/local
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index bfa84007ac..619d29bb4d 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -71,14 +71,14 @@ It is used for TCP/IP devices."
   "Regexp for date time format in ls output."))
 
 (defconst tramp-adb-ls-date-regexp
-  (tramp-compat-rx
+  (rx
    blank (regexp tramp-adb-ls-date-year-regexp)
    blank (regexp tramp-adb-ls-date-time-regexp)
    blank)
   "Regexp for date format in ls output.")
 
 (defconst tramp-adb-ls-toolbox-regexp
-  (tramp-compat-rx
+  (rx
    bol (* blank) (group (+ (any ".-" alpha)))                  ; \1 permissions
    (? (+ blank) (+ digit))                           ; links (Android 7/toybox)
    (* blank) (group (+ (not blank)))                           ; \2 username
@@ -327,8 +327,7 @@ arguments to pass to the OPERATION."
                     (tramp-shell-quote-argument
                      (tramp-compat-file-name-concat localname ".."))))
          (tramp-compat-replace-regexp-in-region
-          (tramp-compat-rx (literal (tramp-compat-file-name-unquote
-                                     (file-name-as-directory localname))))
+          (rx (literal (file-name-unquote (file-name-as-directory localname))))
           "" (point-min))
          (widen)))
       (tramp-adb-sh-fix-ls-output)
@@ -366,14 +365,12 @@ Emacs dired can't find files."
     (goto-char (point-min))
     (while
        (search-forward-regexp
-        (tramp-compat-rx
-         blank (group blank (regexp tramp-adb-ls-date-year-regexp) blank))
+        (rx blank (group blank (regexp tramp-adb-ls-date-year-regexp) blank))
         nil t)
       (replace-match "0\\1" "\\1" nil)
       ;; Insert missing "/".
       (when (looking-at-p
-            (tramp-compat-rx
-             (regexp tramp-adb-ls-date-time-regexp) (+ blank) eol))
+            (rx (regexp tramp-adb-ls-date-time-regexp) (+ blank) eol))
        (end-of-line)
        (insert "/")))
     ;; Sort entries.
@@ -393,12 +390,10 @@ Emacs dired can't find files."
 (defun tramp-adb-ls-output-time-less-p (a b)
   "Sort \"ls\" output by time, descending."
   (let (time-a time-b)
-    ;; Once we can assume Emacs 27 or later, the two calls
-    ;; (apply #'encode-time X) can be replaced by (encode-time X).
     (string-match tramp-adb-ls-date-regexp a)
-    (setq time-a (apply #'encode-time (parse-time-string (match-string 0 a))))
+    (setq time-a (encode-time (parse-time-string (match-string 0 a))))
     (string-match tramp-adb-ls-date-regexp b)
-    (setq time-b (apply #'encode-time (parse-time-string (match-string 0 b))))
+    (setq time-b (encode-time (parse-time-string (match-string 0 b))))
     (time-less-p time-b time-a)))
 
 (defun tramp-adb-ls-output-name-less-p (a b)
@@ -474,7 +469,7 @@ Emacs dired can't find files."
       ;; "adb pull ..." does not always return an error code.
       (unless
          (and (tramp-adb-execute-adb-command
-               v "pull" (tramp-compat-file-name-unquote localname) tmpfile)
+               v "pull" (file-name-unquote localname) tmpfile)
               (file-exists-p tmpfile))
        (ignore-errors (delete-file tmpfile))
        (tramp-error
@@ -554,8 +549,7 @@ Emacs dired can't find files."
                 "Moving tmp file `%s' to `%s'" tmpfile filename)
          (unwind-protect
              (unless (tramp-adb-execute-adb-command
-                      v "push" tmpfile
-                      (tramp-compat-file-name-unquote localname))
+                      v "push" tmpfile (file-name-unquote localname))
                (tramp-error v 'file-error "Cannot write: `%s'" filename))
            (delete-file tmpfile)))))))
 
@@ -570,11 +564,7 @@ Emacs dired can't find files."
 (defun tramp-adb-handle-set-file-times (filename &optional time flag)
   "Like `set-file-times' for Tramp files."
   (tramp-skeleton-set-file-modes-times-uid-gid filename
-    (let ((time (if (or (null time)
-                       (tramp-compat-time-equal-p time tramp-time-doesnt-exist)
-                       (tramp-compat-time-equal-p time tramp-time-dont-know))
-                   (current-time)
-                 time))
+    (let ((time (tramp-defined-time time))
          (nofollow (if (eq flag 'nofollow) "-h" ""))
          (quoted-name (tramp-shell-quote-argument localname)))
       ;; Older versions of toybox 'touch' mishandle nanoseconds and/or
@@ -660,8 +650,8 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
                  (tramp-flush-file-properties v localname)
                  (unless (tramp-adb-execute-adb-command
                           v "push"
-                          (tramp-compat-file-name-unquote filename)
-                          (tramp-compat-file-name-unquote localname))
+                          (file-name-unquote filename)
+                          (file-name-unquote localname))
                    (tramp-error
                     v 'file-error
                     "Cannot copy `%s' `%s'" filename newname)))))))))
@@ -727,11 +717,6 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
   "Strings to return by `process-file' in case of signals."
   (with-tramp-connection-property vec "signal-strings"
     (let ((default-directory (tramp-make-tramp-file-name vec 'noloc))
-         ;; `shell-file-name' and `shell-command-switch' are needed
-         ;; for Emacs < 27.1, which doesn't support connection-local
-         ;; variables in `shell-command'.
-         (shell-file-name "/system/bin/sh")
-         (shell-command-switch "-c")
          process-file-return-signal-string signals result)
       (dotimes (i 128) (push (format "Signal %d" i) result))
       (setq result (reverse result)
@@ -764,7 +749,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
       ;; Determine input.
       (if (null infile)
          (setq input (tramp-get-remote-null-device v))
-       (setq infile (tramp-compat-file-name-unquote (expand-file-name infile)))
+       (setq infile (file-name-unquote (expand-file-name infile)))
        (if (tramp-equal-remote default-directory infile)
            ;; INFILE is on the same remote host.
            (setq input (tramp-unquote-file-local-name infile))
@@ -940,7 +925,7 @@ implementation will be used."
                 (i 0)
                 p)
 
-           (when (string-match-p (tramp-compat-rx multibyte) command)
+           (when (string-match-p (rx multibyte) command)
              (tramp-error
               v 'file-error "Cannot apply multi-byte command `%s'" command))
 
@@ -1132,7 +1117,7 @@ error and non-nil on success."
 
 (defun tramp-adb-send-command (vec command &optional neveropen nooutput)
   "Send the COMMAND to connection VEC."
-  (if (string-match-p (tramp-compat-rx multibyte) command)
+  (if (string-match-p (rx multibyte) command)
       ;; Multibyte codepoints with four bytes are not supported at
       ;; least by toybox.
 
@@ -1156,7 +1141,7 @@ error and non-nil on success."
          ;; We can't use stty to disable echo of command.  stty is said
          ;; to be added to toybox 0.7.6.  busybox shall have it, but this
          ;; isn't used any longer for Android.
-         (delete-matching-lines (tramp-compat-rx bol (literal command) eol))
+         (delete-matching-lines (rx bol (literal command) eol))
          ;; When the local machine is W32, there are still trailing ^M.
          ;; There must be a better solution by setting the correct coding
          ;; system, but this requires changes in core Tramp.
@@ -1279,7 +1264,7 @@ connection if a previous connection has died for some 
reason."
 
            ;; Change prompt.
            (tramp-set-connection-property
-            p "prompt" (tramp-compat-rx "///" (literal prompt) "#$"))
+            p "prompt" (rx "///" (literal prompt) "#$"))
            (tramp-adb-send-command
             vec (format "PS1=\"///\"\"%s\"\"#$\"" prompt))
 
diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el
index 66447f0cb5..daf44a293a 100644
--- a/lisp/net/tramp-archive.el
+++ b/lisp/net/tramp-archive.el
@@ -110,12 +110,7 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl-lib))
-;; Sometimes, compilation fails with "Variable binding depth exceeds
-;; max-specpdl-size".  Shall be fixed in Emacs 27.
-(with-no-warnings ;; max-specpdl-size
-  (eval-and-compile
-    (let ((max-specpdl-size (* 2 max-specpdl-size)))
-      (require 'tramp-gvfs))))
+(require 'tramp-gvfs)
 
 (autoload 'dired-uncache "dired")
 (autoload 'url-tramp-convert-url-to-tramp "url-tramp")
@@ -183,20 +178,9 @@ 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.
-;; 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."
-  (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'.
@@ -208,25 +192,17 @@ It must be supported by libarchive(3).")
      (? "." (| ,@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)
 
-;; In older Emacs (prior 27.1), `tramp-archive-autoload-file-name-regexp'
-;; is not autoloaded.  So we cannot expect it to be known in
-;; tramp-loaddefs.el.  But it exists, when tramp-archive.el is loaded.
 ;; We must wrap it into `eval-when-compile'.  Otherwise, there could
 ;; be an "Eager macro-expansion failure" when unloading/reloading Tramp.
 ;;;###tramp-autoload
 (defconst tramp-archive-file-name-regexp
-  (eval-when-compile (ignore-errors (tramp-archive-autoload-file-name-regexp)))
+  (eval-when-compile (tramp-archive-autoload-file-name-regexp))
   "Regular expression matching archive file names.")
 
-;; The value above is nil for Emacs 26.  Set it now.
-(if (<= emacs-major-version 26)
-    (setq tramp-archive-file-name-regexp
-         (ignore-errors (tramp-archive-autoload-file-name-regexp))))
-
 ;;;###tramp-autoload
 (defconst tramp-archive-method "archive"
   "Method name for archives in GVFS.")
@@ -360,13 +336,9 @@ arguments to pass to the OPERATION."
           (tramp-register-file-name-handlers)
           (tramp-archive-run-real-handler operation args))
 
-      (with-no-warnings ;; max-specpdl-size
       (let* ((filename (apply #'tramp-archive-file-name-for-operation
                              operation args))
-            (archive (tramp-archive-file-name-archive filename))
-            ;; Sometimes, it fails with "Variable binding depth exceeds
-            ;; max-specpdl-size".  Shall be fixed in Emacs 27.
-            (max-specpdl-size (* 2 max-specpdl-size)))
+            (archive (tramp-archive-file-name-archive filename)))
 
         ;; `filename' could be a quoted file name.  Or the file
         ;; archive could be a directory, see Bug#30293.
@@ -394,7 +366,7 @@ arguments to pass to the OPERATION."
              (setq args (cons operation args)))
            (if fn
                (save-match-data (apply (cdr fn) args))
-             (tramp-archive-run-real-handler operation args))))))))
+             (tramp-archive-run-real-handler operation args)))))))
 
 ;;;###autoload
 (progn (defun tramp-archive-autoload-file-name-handler (operation &rest args)
@@ -432,10 +404,6 @@ arguments to pass to the OPERATION."
      (remove-hook
       'after-init-hook #'tramp-register-archive-autoload-file-name-handler))))
 
-;; In older Emacsen (prior 27.1), the autoload above does not exist.
-;; So we call it again; it doesn't hurt.
-(tramp-register-archive-autoload-file-name-handler)
-
 ;; Mark `operations' the handler is responsible for.
 (put #'tramp-archive-file-name-handler 'operations
      (mapcar #'car tramp-archive-file-name-handler-alist))
@@ -458,7 +426,7 @@ arguments to pass to the OPERATION."
   "Return t if NAME is a string with archive file name syntax."
   (and (stringp name)
        ;; `tramp-archive-file-name-regexp' does not suppress quoted file names.
-       (not (tramp-compat-file-name-quoted-p name t))
+       (not (file-name-quoted-p name t))
        ;; We cannot use `string-match-p', the matches are used.
        (string-match tramp-archive-file-name-regexp name)
        t))
@@ -511,7 +479,6 @@ name is kept in slot `hop'"
 
        ;; http://...
        ((and url-handler-mode
-            tramp-compat-use-url-tramp-p
              (string-match-p url-handler-regexp archive)
             (string-match-p
              "https?" (url-type (url-generic-parse-url archive))))
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index 09e43a9903..c5864e7fa5 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -267,8 +267,7 @@ Return VALUE."
 (defun tramp-flush-directory-properties (key directory)
   "Remove all properties of DIRECTORY in the cache context of KEY.
 Remove also properties of all files in subdirectories."
-  (let* ((directory
-         (directory-file-name (tramp-compat-file-name-unquote directory)))
+  (let* ((directory (directory-file-name (file-name-unquote directory)))
         (truename (tramp-get-file-property key directory "file-truename")))
     (tramp-message key 8 "%s" directory)
     (dolist (key (hash-table-keys tramp-cache-data))
@@ -677,4 +676,8 @@ for all methods.  Resulting data are derived from 
connection history."
 
 (provide 'tramp-cache)
 
+;;; TODO:
+;;
+;; * Use multisession.el, starting with Emacs 29.1.
+
 ;;; tramp-cache.el ends here
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el
index bf7d45d2a5..dc967dccf6 100644
--- a/lisp/net/tramp-cmds.el
+++ b/lisp/net/tramp-cmds.el
@@ -359,7 +359,7 @@ The remote connection identified by SOURCE is flushed by
                      (dir (tramp-rename-read-file-name-dir default))
                      (init (tramp-rename-read-file-name-init default))
                      (tramp-ignored-file-name-regexp
-                      (tramp-compat-rx (literal (file-remote-p source)))))
+                      (rx (literal (file-remote-p source)))))
                 (read-file-name-default
                  "Enter new Tramp connection: "
                  dir default 'confirm init #'file-directory-p)))))
@@ -470,7 +470,7 @@ For details, see `tramp-rename-files'."
                      (dir (tramp-rename-read-file-name-dir default))
                      (init (tramp-rename-read-file-name-init default))
                      (tramp-ignored-file-name-regexp
-                      (tramp-compat-rx (literal (file-remote-p source)))))
+                      (rx (literal (file-remote-p source)))))
                 (read-file-name-default
                  (format "Change Tramp connection `%s': " source)
                  dir default 'confirm init #'file-directory-p)))))
@@ -625,7 +625,7 @@ buffer in your bug report.
     (unless (hash-table-p val)
       ;; Remove string quotation.
       (when (looking-at
-            (tramp-compat-rx
+            (rx
              bol (group (* anychar)) "\""          ;; \1 "
              (group "(base64-decode-string ") "\\" ;; \2 \
              (group "\"" (* anychar)) "\\"         ;; \3 \
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index f176476a73..6a2654ee47 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -23,9 +23,9 @@
 
 ;;; Commentary:
 
-;; Tramp's main Emacs version for development is Emacs 29.  This
-;; package provides compatibility functions for Emacs 26, Emacs 27 and
-;; Emacs 28.
+;; Tramp's main Emacs version for development is Emacs 30.  This
+;; package provides compatibility functions for Emacs 27, Emacs 28 and
+;; Emacs 29.
 
 ;;; Code:
 
@@ -36,7 +36,6 @@
 (require 'shell)
 (require 'subr-x)
 
-(declare-function tramp-compat-rx "tramp")
 (declare-function tramp-error "tramp")
 (declare-function tramp-file-name-handler "tramp")
 (declare-function tramp-tramp-file-p "tramp")
@@ -85,153 +84,6 @@ Add the extension of F, if existing."
     tramp-temp-name-prefix tramp-compat-temporary-file-directory)
    dir-flag (file-name-extension f t)))
 
-;; `file-name-quoted-p', `file-name-quote' and `file-name-unquote' got
-;; a second argument in Emacs 27.1.
-;;;###tramp-autoload
-(defalias 'tramp-compat-file-name-quoted-p
-  (if (equal (func-arity #'file-name-quoted-p) '(1 . 2))
-      #'file-name-quoted-p
-    (lambda (name &optional top)
-      "Whether NAME is quoted with prefix \"/:\".
-If NAME is a remote file name and TOP is nil, check the local part of NAME."
-      (let ((file-name-handler-alist (unless top file-name-handler-alist)))
-       (string-prefix-p "/:" (file-local-name name))))))
-
-(defalias 'tramp-compat-file-name-quote
-  (if (equal (func-arity #'file-name-quote) '(1 . 2))
-      #'file-name-quote
-    (lambda (name &optional top)
-      "Add the quotation prefix \"/:\" to file NAME.
-If NAME is a remote file name and TOP is nil, the local part of NAME is 
quoted."
-      (let ((file-name-handler-alist (unless top file-name-handler-alist)))
-       (if (tramp-compat-file-name-quoted-p name top)
-            name
-         (concat (file-remote-p name) "/:" (file-local-name name)))))))
-
-(defalias 'tramp-compat-file-name-unquote
-  (if (equal (func-arity #'file-name-unquote) '(1 . 2))
-      #'file-name-unquote
-    (lambda (name &optional top)
-      "Remove quotation prefix \"/:\" from file NAME.
-If NAME is a remote file name and TOP is nil, the local part of
-NAME is unquoted."
-      (let* ((file-name-handler-alist (unless top file-name-handler-alist))
-             (localname (file-local-name name)))
-       (when (tramp-compat-file-name-quoted-p localname top)
-         (setq
-          localname (if (= (length localname) 2) "/" (substring localname 2))))
-       (concat (file-remote-p name) localname)))))
-
-;; `tramp-syntax' has changed its meaning in Emacs 26.1.  We still
-;; support old settings.
-(defsubst tramp-compat-tramp-syntax ()
-  "Return proper value of `tramp-syntax'."
-  (defvar tramp-syntax)
-  (cond ((eq tramp-syntax 'ftp) 'default)
-       ((eq tramp-syntax 'sep) 'separate)
-       (t tramp-syntax)))
-
-;; The signature of `tramp-make-tramp-file-name' has been changed.
-;; Therefore, we cannot use `url-tramp-convert-url-to-tramp' prior
-;; Emacs 26.1.  We use `temporary-file-directory' as indicator.
-(defconst tramp-compat-use-url-tramp-p (fboundp 'temporary-file-directory)
-  "Whether to use url-tramp.el.")
-
-;; `exec-path' is new in Emacs 27.1.
-(defalias 'tramp-compat-exec-path
-  (if (fboundp 'exec-path)
-      #'exec-path
-    (lambda ()
-      "List of directories to search programs to run in remote subprocesses."
-      (if (tramp-tramp-file-p default-directory)
-         (tramp-file-name-handler 'exec-path)
-       exec-path))))
-
-;; `time-equal-p' has appeared in Emacs 27.1.
-(defalias 'tramp-compat-time-equal-p
-  (if (fboundp 'time-equal-p)
-      #'time-equal-p
-    (lambda (t1 t2)
-      "Return non-nil if time value T1 is equal to time value T2.
-A nil value for either argument stands for the current time."
-      (equal (or t1 (current-time)) (or t2 (current-time))))))
-
-;; `flatten-tree' has appeared in Emacs 27.1.
-(defalias 'tramp-compat-flatten-tree
-  (if (fboundp 'flatten-tree)
-      #'flatten-tree
-    (lambda (tree)
-      "Take TREE and \"flatten\" it."
-      (let (elems)
-       (setq tree (list tree))
-       (while (let ((elem (pop tree)))
-                (cond ((consp elem)
-                       (setq tree (cons (car elem) (cons (cdr elem) tree))))
-                       (elem
-                       (push elem elems)))
-                tree))
-       (nreverse elems)))))
-
-;; `progress-reporter-update' got argument SUFFIX in Emacs 27.1.
-(defalias 'tramp-compat-progress-reporter-update
-  (if (equal (func-arity #'progress-reporter-update) '(1 . 3))
-      #'progress-reporter-update
-    (lambda (reporter &optional value _suffix)
-      (progress-reporter-update reporter value))))
-
-;; `ignore-error' is new in Emacs 27.1.
-(defmacro tramp-compat-ignore-error (condition &rest body)
-  "Execute BODY; if the error CONDITION occurs, return nil.
-Otherwise, return result of last form in BODY.
-
-CONDITION can also be a list of error conditions."
-  (declare (debug t) (indent 1))
-  `(condition-case nil (progn ,@body) (,condition nil)))
-
-;; `rx' in Emacs 26 doesn't know the `literal', `anychar' and
-;; `multibyte' constructs.  The `not' construct requires an `any'
-;; construct as argument.  The `regexp' construct requires a literal
-;; string.
-(defvar tramp-compat-rx--runtime-params)
-
-(defun tramp-compat-rx--transform-items (items)
-  (mapcar #'tramp-compat-rx--transform-item items))
-
-;; There is an error in Emacs 26.  `(rx "a" (? ""))' => "a?".
-;; We must protect the string in regexp and literal, therefore.
-(defun tramp-compat-rx--transform-item (item)
-  (pcase item
-    ('anychar 'anything)
-    ('multibyte 'nonascii)
-    (`(not ,expr)
-     (if (consp expr) item (list 'not (list 'any expr))))
-    (`(regexp ,expr)
-     (setq tramp-compat-rx--runtime-params t)
-     `(regexp ,(list '\, `(concat "\\(?:" ,expr "\\)"))))
-    (`(literal ,expr)
-     (setq tramp-compat-rx--runtime-params t)
-     `(regexp ,(list '\, `(concat "\\(?:" (regexp-quote ,expr) "\\)"))))
-    (`(eval . ,_) item)
-    (`(,head . ,rest) (cons head (tramp-compat-rx--transform-items rest)))
-    (_ item)))
-
-(defun tramp-compat-rx--transform (items)
-  (let* ((tramp-compat-rx--runtime-params nil)
-         (new-rx (cons ': (tramp-compat-rx--transform-items items))))
-    (if tramp-compat-rx--runtime-params
-        `(rx-to-string ,(list '\` new-rx) t)
-      (rx-to-string new-rx t))))
-
-(if (ignore-errors (rx-to-string '(literal "a"))) ;; Emacs 27+.
-    (defalias 'tramp-compat-rx #'rx)
-  (defmacro tramp-compat-rx (&rest items)
-    (tramp-compat-rx--transform items)))
-
-;; This is needed for compilation in the Emacs source tree.
-;;;###autoload (defalias 'tramp-compat-rx #'rx)
-
-(put #'tramp-compat-rx 'tramp-autoload t)
-
 ;; `file-modes', `set-file-modes' and `set-file-times' got argument
 ;; FLAG in Emacs 28.1.
 (defalias 'tramp-compat-file-modes
@@ -419,8 +271,5 @@ CONDITION can also be a list of error conditions."
 ;;
 ;; * Starting with Emacs 27.1, there's no need to escape open
 ;;   parentheses with a backslash in docstrings anymore.
-;;
-;; * Starting with Emacs 27.1, there's `make-empty-file'.  Could be
-;;   used instead of `(write-region "" ...)'.
 
 ;;; tramp-compat.el ends here
diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el
index 0e033451af..61d1c52961 100644
--- a/lisp/net/tramp-crypt.el
+++ b/lisp/net/tramp-crypt.el
@@ -146,7 +146,7 @@ They are completed by \"M-x TAB\" only when encryption 
support is enabled."
 If NAME doesn't belong to an encrypted remote directory, return nil."
   (catch 'crypt-file-name-p
     (and tramp-crypt-enabled (stringp name)
-        (not (tramp-compat-file-name-quoted-p name))
+        (not (file-name-quoted-p name))
         (not (string-suffix-p tramp-crypt-encfs-config name))
         (dolist (dir tramp-crypt-directories)
           (and (string-prefix-p
@@ -497,7 +497,7 @@ directory.  File names will be also encrypted."
     (tramp-user-error nil "Feature is not enabled."))
   (unless (and (tramp-tramp-file-p name) (file-directory-p name))
     (tramp-user-error nil "%s must be an existing remote directory." name))
-  (when (tramp-compat-file-name-quoted-p name)
+  (when (file-name-quoted-p name)
     (tramp-user-error nil "%s must not be quoted." name))
   (setq name (file-name-as-directory (expand-file-name name)))
   (unless (member name tramp-crypt-directories)
@@ -556,7 +556,7 @@ localname."
 (defun tramp-crypt-handle-access-file (filename string)
   "Like `access-file' for Tramp files."
   (let* ((encrypt-filename (tramp-crypt-encrypt-file-name filename))
-        (encrypt-regexp (tramp-compat-rx (literal encrypt-filename) eos))
+        (encrypt-regexp (rx (literal encrypt-filename) eos))
         tramp-crypt-enabled)
     (condition-case err
        (access-file encrypt-filename string)
@@ -709,8 +709,7 @@ absolute file names."
       (mapcar
        (lambda (x)
         (replace-regexp-in-string
-         (tramp-compat-rx bos (literal directory)) ""
-         (tramp-crypt-decrypt-file-name x)))
+         (rx bos (literal directory)) "" (tramp-crypt-decrypt-file-name x)))
        (directory-files (tramp-crypt-encrypt-file-name directory) 'full)))))
 
 (defun tramp-crypt-handle-file-attributes (filename &optional id-format)
@@ -756,9 +755,7 @@ absolute file names."
 (defun tramp-crypt-handle-file-system-info (filename)
   "Like `file-system-info' for Tramp files."
   (let (tramp-crypt-enabled)
-    ;; `file-system-info' exists since Emacs 27.1.
-    (tramp-compat-funcall
-     'file-system-info (tramp-crypt-encrypt-file-name filename))))
+    (file-system-info (tramp-crypt-encrypt-file-name filename))))
 
 (defun tramp-crypt-handle-file-writable-p (filename)
   "Like `file-writable-p' for Tramp files."
@@ -769,27 +766,26 @@ absolute file names."
   (filename switches &optional wildcard full-directory-p)
   "Like `insert-directory' for Tramp files.
 WILDCARD is not supported."
-  ;; This package has been added to Emacs 27.1.
-  (when (load "text-property-search" 'noerror 'nomessage)
-    (let (tramp-crypt-enabled)
-      (tramp-handle-insert-directory
-       (tramp-crypt-encrypt-file-name filename)
-       switches wildcard full-directory-p)
-      (let* ((filename (file-name-as-directory filename))
-            (enc (tramp-crypt-encrypt-file-name filename))
-            match string)
-       (goto-char (point-min))
-       (while (setq match (text-property-search-forward 'dired-filename t t))
-         (setq string
-               (buffer-substring
-                (prop-match-beginning match) (prop-match-end match))
-               string (if (file-name-absolute-p string)
-                          (tramp-crypt-decrypt-file-name string)
-                        (substring
-                         (tramp-crypt-decrypt-file-name (concat enc string))
-                         (length filename))))
-         (delete-region (prop-match-beginning match) (prop-match-end match))
-         (insert (propertize string 'dired-filename t)))))))
+  (require 'text-property-search)
+  (let (tramp-crypt-enabled)
+    (tramp-handle-insert-directory
+     (tramp-crypt-encrypt-file-name filename)
+     switches wildcard full-directory-p)
+    (let* ((filename (file-name-as-directory filename))
+          (enc (tramp-crypt-encrypt-file-name filename))
+          match string)
+      (goto-char (point-min))
+      (while (setq match (text-property-search-forward 'dired-filename t t))
+       (setq string
+             (buffer-substring
+              (prop-match-beginning match) (prop-match-end match))
+             string (if (file-name-absolute-p string)
+                        (tramp-crypt-decrypt-file-name string)
+                      (substring
+                       (tramp-crypt-decrypt-file-name (concat enc string))
+                       (length filename))))
+       (delete-region (prop-match-beginning match) (prop-match-end match))
+       (insert (propertize string 'dired-filename t))))))
 
 (defun tramp-crypt-handle-lock-file (filename)
   "Like `lock-file' for Tramp files."
diff --git a/lisp/net/tramp-fuse.el b/lisp/net/tramp-fuse.el
index b73ec22f0c..c8754e2b03 100644
--- a/lisp/net/tramp-fuse.el
+++ b/lisp/net/tramp-fuse.el
@@ -69,15 +69,15 @@
               (tramp-fuse-local-file-name directory))))))))
     (if full
        ;; Massage the result.
-       (let ((local (tramp-compat-rx
+       (let ((local (rx
                      bol
                      (literal
                       (tramp-fuse-mount-point
                        (tramp-dissect-file-name directory)))))
              (remote (directory-file-name
                       (funcall
-                       (if (tramp-compat-file-name-quoted-p directory)
-                           #'tramp-compat-file-name-quote #'identity)
+                       (if (file-name-quoted-p directory)
+                           #'file-name-quote #'identity)
                        (file-remote-p directory)))))
          (mapcar
           (lambda (x) (replace-regexp-in-string local remote x))
@@ -174,8 +174,7 @@ It has the same meaning as 
`remote-file-name-inhibit-cache'.")
           (tramp-set-file-property
           vec "/" "mounted"
            (when (string-match
-                 (tramp-compat-rx
-                  bol (group (literal (tramp-fuse-mount-spec vec))) blank)
+                 (rx bol (group (literal (tramp-fuse-mount-spec vec))) blank)
                  mount)
              (match-string 1 mount)))))))
 
@@ -205,7 +204,7 @@ It has the same meaning as 
`remote-file-name-inhibit-cache'.")
 
 (defun tramp-fuse-local-file-name (filename)
   "Return local mount name of FILENAME."
-  (setq filename (tramp-compat-file-name-unquote (expand-file-name filename)))
+  (setq filename (file-name-unquote (expand-file-name filename)))
   (with-parsed-tramp-file-name filename nil
     ;; As long as we call `tramp-*-maybe-open-connection' here,
     ;; we cache the result.
@@ -214,10 +213,10 @@ It has the same meaning as 
`remote-file-name-inhibit-cache'.")
        (intern
        (format "tramp-%s-maybe-open-connection" (tramp-file-name-method v)))
        v)
-      (let ((quoted (tramp-compat-file-name-quoted-p localname))
-           (localname (tramp-compat-file-name-unquote localname)))
+      (let ((quoted (file-name-quoted-p localname))
+           (localname (file-name-unquote localname)))
        (funcall
-        (if quoted #'tramp-compat-file-name-quote #'identity)
+        (if quoted #'file-name-quote #'identity)
         (expand-file-name
          (if (file-name-absolute-p localname)
              (substring localname 1) localname)
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 1a5303b4d5..bb81b3eb66 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -414,7 +414,7 @@ It has been changed in GVFS 1.14.")
 ;; </interface>
 
 (defconst tramp-goa-identity-regexp
-  (tramp-compat-rx
+  (rx
    bol (? (group (regexp tramp-user-regexp)))
    "@" (? (group (regexp tramp-host-regexp)))
    (? ":" (group (regexp tramp-port-regexp))))
@@ -716,13 +716,13 @@ It has been changed in GVFS 1.14.")
     "GVFS file attributes."))
 
 (defconst tramp-gvfs-file-attributes-with-gvfs-ls-regexp
-  (tramp-compat-rx
+  (rx
    blank (group (regexp (regexp-opt tramp-gvfs-file-attributes)))
    "=" (group (+? nonl)))
   "Regexp to parse GVFS file attributes with `gvfs-ls'.")
 
 (defconst tramp-gvfs-file-attributes-with-gvfs-info-regexp
-  (tramp-compat-rx
+  (rx
    bol (* blank) (group (regexp (regexp-opt tramp-gvfs-file-attributes)))
    ":" (+ blank) (group (* nonl)) eol)
   "Regexp to parse GVFS file attributes with `gvfs-info'.")
@@ -734,7 +734,7 @@ It has been changed in GVFS 1.14.")
   "GVFS file system attributes.")
 
 (defconst tramp-gvfs-file-system-attributes-regexp
-  (tramp-compat-rx
+  (rx
    bol (* blank)
    (group (regexp (regexp-opt tramp-gvfs-file-system-attributes)))
    ":" (+ blank) (group (* nonl)) eol)
@@ -744,7 +744,7 @@ It has been changed in GVFS 1.14.")
   "Default prefix for owncloud / nextcloud methods.")
 
 (defconst tramp-gvfs-nextcloud-default-prefix-regexp
-  (tramp-compat-rx (literal tramp-gvfs-nextcloud-default-prefix) eol)
+  (rx (literal tramp-gvfs-nextcloud-default-prefix) eol)
   "Regexp of default prefix for owncloud / nextcloud methods.")
 
 
@@ -1168,8 +1168,7 @@ file names."
     (with-parsed-tramp-file-name name nil
       ;; If there is a default location, expand tilde.
       (when (string-match
-            (tramp-compat-rx bos "~" (group (* (not "/"))) (group (* nonl)) 
eos)
-             localname)
+            (rx bos "~" (group (* (not "/"))) (group (* nonl)) eos) localname)
        (let ((uname (match-string 1 localname))
              (fname (match-string 2 localname))
              hname)
@@ -1186,8 +1185,7 @@ file names."
       ;; We do not pass "/..".
       (if (string-match-p (rx bos (| "afp" (: "dav" (? "s")) "smb") eos) 
method)
          (when (string-match
-                (tramp-compat-rx bos "/" (+ (not "/")) (group "/.." (? "/")))
-                localname)
+                (rx bos "/" (+ (not "/")) (group "/.." (? "/"))) localname)
            (setq localname (replace-match "/" t t localname 1)))
        (when (string-match (rx bol "/.." (? "/")) localname)
          (setq localname (replace-match "/" t t localname))))
@@ -1222,7 +1220,7 @@ file names."
        (with-current-buffer (tramp-get-connection-buffer v)
          (goto-char (point-min))
          (while (looking-at
-                 (tramp-compat-rx
+                 (rx
                   bol (group (+ nonl)) blank
                   (group (+ digit)) blank
                   "(" (group (+? nonl)) ")"
@@ -1232,7 +1230,7 @@ file names."
                              (cons "name" (match-string 1)))))
              (goto-char (1+ (match-end 3)))
              (while (looking-at
-                     (tramp-compat-rx
+                     (rx
                       (regexp tramp-gvfs-file-attributes-with-gvfs-ls-regexp)
                       (group
                        (| (regexp
@@ -1281,11 +1279,10 @@ If FILE-SYSTEM is non-nil, return file system 
attributes."
   "Return GVFS attributes association list of FILENAME."
   (setq filename (directory-file-name (expand-file-name filename)))
   (with-parsed-tramp-file-name filename nil
-    (setq localname (tramp-compat-file-name-unquote localname))
+    (setq localname (file-name-unquote localname))
     (if (or (and (string-match-p
                  (rx bol (| "afp" (: "dav" (? "s")) "smb") eol) method)
-                (string-match-p
-                 (tramp-compat-rx bol (? "/") (+ (not "/")) eol) localname))
+                (string-match-p (rx bol (? "/") (+ (not "/")) eol) localname))
            (string-equal localname "/"))
        (tramp-gvfs-get-root-attributes filename)
       (assoc
@@ -1485,7 +1482,7 @@ If FILE-SYSTEM is non-nil, return file system attributes."
   (let* ((events (process-get proc 'events))
         (rest-string (process-get proc 'rest-string))
         (dd (tramp-get-default-directory (process-buffer proc)))
-        (ddu (tramp-compat-rx (literal (tramp-gvfs-url-file-name dd)))))
+        (ddu (rx (literal (tramp-gvfs-url-file-name dd)))))
     (when rest-string
       (tramp-message proc 10 "Previous string:\n%s" rest-string))
     (tramp-message proc 6 "%S\n%s" proc string)
@@ -1504,7 +1501,7 @@ If FILE-SYSTEM is non-nil, return file system attributes."
       (delete-process proc))
 
     (while (string-match
-           (tramp-compat-rx
+           (rx
             bol (+ nonl) ":"
             blank (group (+ nonl)) ":"
             blank (group (regexp (regexp-opt tramp-gio-events)))
@@ -1607,12 +1604,7 @@ If FILE-SYSTEM is non-nil, return file system 
attributes."
     (tramp-gvfs-set-attribute
      v (if (eq flag 'nofollow) "-nt" "-t") "uint64"
      (tramp-gvfs-url-file-name filename) "time::modified"
-     (format-time-string
-      "%s" (if (or (null time)
-                  (tramp-compat-time-equal-p time tramp-time-doesnt-exist)
-                  (tramp-compat-time-equal-p time tramp-time-dont-know))
-              nil
-            time)))))
+     (format-time-string "%s" (tramp-defined-time time)))))
 
 (defun tramp-gvfs-handle-get-home-directory (vec &optional _user)
   "The remote home directory for connection VEC as local file name.
@@ -1705,7 +1697,7 @@ ID-FORMAT valid values are `string' and `integer'."
 
 (defun tramp-gvfs-url-file-name (filename)
   "Return FILENAME in URL syntax."
-  (setq filename (tramp-compat-file-name-unquote filename))
+  (setq filename (file-name-unquote filename))
   (let* (;; "/" must NOT be hexified.
         (url-unreserved-chars (cons ?/ url-unreserved-chars))
         (result
@@ -1725,8 +1717,7 @@ ID-FORMAT valid values are `string' and `integer'."
   "Retrieve file name from D-Bus OBJECT-PATH."
   (dbus-unescape-from-identifier
    (replace-regexp-in-string
-    (tramp-compat-rx bol (* nonl) "/" (group (+ (not "/"))) eol) "\\1"
-    object-path)))
+    (rx bol (* nonl) "/" (group (+ (not "/"))) eol) "\\1" object-path)))
 
 (defun tramp-gvfs-url-host (url)
   "Return the host name part of URL, a string.
@@ -2002,7 +1993,7 @@ Their full names are \"org.gtk.vfs.MountTracker.mounted\" 
and
                (string-equal host (tramp-file-name-host vec))
                (string-equal port (tramp-file-name-port vec))
                (string-match-p
-                (tramp-compat-rx bol "/" (literal (or share "")))
+                (rx bol "/" (literal (or share "")))
                 (tramp-file-name-unquote-localname vec)))
           ;; Set mountpoint and location.
           (tramp-set-file-property vec "/" "fuse-mountpoint" fuse-mountpoint)
@@ -2047,8 +2038,7 @@ It was \"a(say)\", but has changed to \"a{sv})\"."
                   (tramp-media-device-port media) (tramp-file-name-port vec)))
         (localname (tramp-file-name-unquote-localname vec))
         (share (when (string-match
-                      (tramp-compat-rx bol (? "/") (group (+ (not "/"))))
-                      localname)
+                      (rx bol (? "/") (group (+ (not "/")))) localname)
                  (match-string 1 localname)))
         (ssl (if (string-match-p (rx bol (| "davs" "nextcloud")) method)
                  "true" "false"))
@@ -2091,8 +2081,7 @@ It was \"a(say)\", but has changed to \"a{sv})\"."
                 (list (tramp-gvfs-mount-spec-entry "port" port)))))
         (mount-pref
           (if (and (string-match-p (rx bol "dav") method)
-                   (string-match
-                   (tramp-compat-rx bol (? "/") (+ (not "/"))) localname))
+                   (string-match (rx bol (? "/") (+ (not "/"))) localname))
               (match-string 0 localname)
            (tramp-gvfs-get-remote-prefix vec))))
 
@@ -2492,12 +2481,8 @@ This uses \"avahi-browse\" in case D-Bus is not enabled 
in Avahi."
       result))))
 
 (when tramp-gvfs-enabled
-  (with-no-warnings ;; max-specpdl-size
   ;; Suppress D-Bus error messages and Tramp traces.
-  (let (;; Sometimes, it fails with "Variable binding depth exceeds
-       ;; max-specpdl-size".  Shall be fixed in Emacs 27.
-       (max-specpdl-size (* 2 max-specpdl-size))
-       (tramp-verbose 0)
+  (let ((tramp-verbose 0)
        tramp-gvfs-dbus-event-vector fun)
     ;; Add completion functions for services announced by DNS-SD.
     ;; See <http://www.dns-sd.org/ServiceTypes.html> for valid service types.
@@ -2550,7 +2535,7 @@ This uses \"avahi-browse\" in case D-Bus is not enabled 
in Avahi."
      "mtp"
      (mapcar
       (lambda (method) `(tramp-parse-media-names ,(format "_%s._tcp" method)))
-      tramp-media-methods)))))
+      tramp-media-methods))))
 
 (add-hook 'tramp-unload-hook
          (lambda ()
diff --git a/lisp/net/tramp-integration.el b/lisp/net/tramp-integration.el
index cff0877555..c7877c9824 100644
--- a/lisp/net/tramp-integration.el
+++ b/lisp/net/tramp-integration.el
@@ -133,8 +133,7 @@ been set up by `rfn-eshadow-setup-minibuffer'."
   ;; Use `path-separator' as it does eshell.
   (setq eshell-path-env
         (if (file-remote-p default-directory)
-            (mapconcat
-            #'identity (butlast (tramp-compat-exec-path)) path-separator)
+            (mapconcat #'identity (butlast (exec-path)) path-separator)
           (getenv "PATH"))))
 
 (with-eval-after-load 'esh-util
diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el
index 2360abfb1d..4018fa3aa2 100644
--- a/lisp/net/tramp-rclone.el
+++ b/lisp/net/tramp-rclone.el
@@ -337,7 +337,7 @@ file names."
 
 (defun tramp-rclone-remote-file-name (filename)
   "Return FILENAME as used in the `rclone' command."
-  (setq filename (tramp-compat-file-name-unquote (expand-file-name filename)))
+  (setq filename (file-name-unquote (expand-file-name filename)))
   (if (tramp-rclone-file-name-p filename)
       (with-parsed-tramp-file-name filename nil
        ;; As long as we call `tramp-rclone-maybe-open-connection' here,
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index f215cbc19e..fbdd40dd1d 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -411,7 +411,7 @@ The string is used in `tramp-methods'.")
 
  (add-to-list 'tramp-default-method-alist
              `(,tramp-local-host-regexp
-               ,(tramp-compat-rx bos (literal tramp-root-id-string) eos) "su"))
+               ,(rx bos (literal tramp-root-id-string) eos) "su"))
 
  (add-to-list 'tramp-default-user-alist
              `(,(rx bos (| "su" "sudo" "doas" "ksu") eos)
@@ -1149,8 +1149,7 @@ component is used as the target of the symlink."
     ;; If TARGET is still remote, quote it.
     (if (tramp-tramp-file-p target)
        (make-symbolic-link
-        (tramp-compat-file-name-quote target 'top)
-        linkname ok-if-already-exists)
+        (file-name-quote target 'top) linkname ok-if-already-exists)
 
       (let ((ln (tramp-get-remote-ln v))
            (cwd (tramp-run-real-handler
@@ -1200,10 +1199,9 @@ component is used as the target of the symlink."
    (if (directory-name-p filename) #'file-name-as-directory #'identity)
    ;; Quote properly.
    (funcall
-    (if (tramp-compat-file-name-quoted-p filename)
-       #'tramp-compat-file-name-quote #'identity)
+    (if (file-name-quoted-p filename) #'file-name-quote #'identity)
     (with-parsed-tramp-file-name
-       (tramp-compat-file-name-unquote (expand-file-name filename)) nil
+       (file-name-unquote (expand-file-name filename)) nil
       (tramp-make-tramp-file-name
        v
        (with-tramp-file-property v localname "file-truename"
@@ -1243,7 +1241,7 @@ component is used as the target of the symlink."
           ;; If the resulting localname looks remote, we must quote it
           ;; for security reasons.
           (when (file-remote-p result)
-            (setq result (tramp-compat-file-name-quote result 'top)))
+            (setq result (file-name-quote result 'top)))
           (tramp-message v 4 "True name of `%s' is `%s'" localname result)
           result)))))))
 
@@ -1438,7 +1436,7 @@ component is used as the target of the symlink."
               (modtime (or (file-attribute-modification-time attr)
                            tramp-time-doesnt-exist)))
          (setq coding-system-used last-coding-system-used)
-         (if (not (tramp-compat-time-equal-p modtime tramp-time-dont-know))
+         (if (not (time-equal-p modtime tramp-time-dont-know))
              (tramp-run-real-handler #'set-visited-file-modtime (list modtime))
            (progn
              (tramp-send-command
@@ -1478,9 +1476,7 @@ of."
 
            (cond
             ;; File exists, and has a known modtime.
-            ((and attr
-                  (not
-                   (tramp-compat-time-equal-p modtime tramp-time-dont-know)))
+            ((and attr (not (time-equal-p modtime tramp-time-dont-know)))
              (< (abs (tramp-time-diff modtime mt)) 2))
             ;; Modtime has the don't know value.
             (attr
@@ -1497,7 +1493,7 @@ of."
                v localname "visited-file-modtime-ild" "")))
             ;; If file does not exist, say it is not modified if and
             ;; only if that agrees with the buffer's record.
-            (t (tramp-compat-time-equal-p mt tramp-time-doesnt-exist)))))))))
+            (t (time-equal-p mt tramp-time-doesnt-exist)))))))))
 
 (defun tramp-sh-handle-set-file-modes (filename mode &optional flag)
   "Like `set-file-modes' for Tramp files."
@@ -1519,21 +1515,17 @@ of."
   "Like `set-file-times' for Tramp files."
   (tramp-skeleton-set-file-modes-times-uid-gid filename
     (when (tramp-get-remote-touch v)
-      (let ((time
-            (if (or (null time)
-                    (tramp-compat-time-equal-p time tramp-time-doesnt-exist)
-                    (tramp-compat-time-equal-p time tramp-time-dont-know))
-                nil
-              time)))
-       (tramp-send-command-and-check
-        v (format
-           "env TZ=UTC0 %s %s %s %s"
-           (tramp-get-remote-touch v)
-           (if (tramp-get-connection-property v "touch-t")
-               (format "-t %s" (format-time-string "%Y%m%d%H%M.%S" time t))
-             "")
-           (if (eq flag 'nofollow) "-h" "")
-           (tramp-shell-quote-argument localname)))))))
+      (tramp-send-command-and-check
+       v (format
+         "env TZ=UTC0 %s %s %s %s"
+         (tramp-get-remote-touch v)
+         (if (tramp-get-connection-property v "touch-t")
+             (format
+              "-t %s"
+              (format-time-string "%Y%m%d%H%M.%S" (tramp-defined-time time) t))
+           "")
+         (if (eq flag 'nofollow) "-h" "")
+         (tramp-shell-quote-argument localname))))))
 
 (defun tramp-sh-handle-get-home-directory (vec &optional user)
   "The remote home directory for connection VEC as local file name.
@@ -1631,7 +1623,7 @@ ID-FORMAT valid values are `string' and `integer'."
   (with-parsed-tramp-file-name (expand-file-name filename) nil
     (with-tramp-file-property v localname "file-selinux-context"
       (let ((context '(nil nil nil nil))
-           (regexp (tramp-compat-rx
+           (regexp (rx
                     (group (+ (any "_" alnum))) ":"
                     (group (+ (any "_" alnum))) ":"
                     (group (+ (any "_" alnum))) ":"
@@ -2389,10 +2381,10 @@ The method used must be an out-of-band method."
                      #'identity)
                    (if v1
                        (tramp-make-copy-program-file-name v1)
-                     (tramp-compat-file-name-unquote filename)))
+                     (file-name-unquote filename)))
            target (if v2
                       (tramp-make-copy-program-file-name v2)
-                    (tramp-compat-file-name-unquote newname)))
+                    (file-name-unquote newname)))
 
       ;; Check for listener port.
       (when (tramp-get-method-parameter v 'tramp-remote-copy-args)
@@ -2436,7 +2428,7 @@ The method used must be an out-of-band method."
            ;; `tramp-ssh-controlmaster-options' is a string instead
            ;; of a list.  Unflatten it.
            copy-args
-           (tramp-compat-flatten-tree
+           (flatten-tree
             (mapcar
              (lambda (x) (if (tramp-compat-string-search " " x)
                               (split-string x) x))
@@ -2821,8 +2813,7 @@ the result will be a local, non-Tramp, file name."
   ;; there could be the false positive "/:".
   (if (or (and (eq system-type 'windows-nt)
               (string-match-p
-               (tramp-compat-rx bol (| (: alpha ":") (: (literal null-device) 
eol)))
-               name))
+               (rx bol (| (: alpha ":") (: (literal null-device) eol))) name))
          (and (not (tramp-tramp-file-p name))
               (not (tramp-tramp-file-p dir))))
       (tramp-run-real-handler #'expand-file-name (list name dir))
@@ -2841,9 +2832,7 @@ the result will be a local, non-Tramp, file name."
        ;; supposed to find such a shell on the remote host.  Please
        ;; tell me about it when this doesn't work on your system.
        (when (string-match
-              (tramp-compat-rx
-               bos "~" (group (* (not "/"))) (group (* nonl)) eos)
-              localname)
+              (rx bos "~" (group (* (not "/"))) (group (* nonl)) eos) 
localname)
          (let ((uname (match-string 1 localname))
                (fname (match-string 2 localname))
                hname)
@@ -3235,7 +3224,7 @@ implementation will be used."
       ;; Determine input.
       (if (null infile)
          (setq input (tramp-get-remote-null-device v))
-       (setq infile (tramp-compat-file-name-unquote (expand-file-name infile)))
+       (setq infile (file-name-unquote (expand-file-name infile)))
        (if (tramp-equal-remote default-directory infile)
            ;; INFILE is on the same remote host.
            (setq input (tramp-unquote-file-local-name infile))
@@ -3916,7 +3905,7 @@ Fall back to normal file name handler if no Tramp handler 
exists."
       (setq string (tramp-compat-string-replace "\n\n" "\n" string))
 
       (while (string-match
-             (tramp-compat-rx
+             (rx
               bol (+ (not ":")) ":" blank
               (group (+ (not ":"))) ":" blank
               (group (regexp (regexp-opt tramp-gio-events)))
@@ -4019,66 +4008,55 @@ commands.  \"%n\" is replaced by \"2>/dev/null\", and 
\"%t\" is
 replaced by a temporary file name.  If VEC is nil, the respective
 local commands are used.  If there is a format specifier which
 cannot be expanded, this function returns nil."
-  (if (not (string-match-p
-           (tramp-compat-rx (| bol (not "%")) "%" (any "ahlnoprsty")) script))
+  (if (not (string-match-p (rx (| bol (not "%")) "%" (any "ahlnoprsty")) 
script))
       script
     (catch 'wont-work
-      (let ((awk (when (string-match-p
-                       (tramp-compat-rx (| bol (not "%")) "%a") script)
+      (let ((awk (when (string-match-p (rx (| bol (not "%")) "%a") script)
                   (or
                    (if vec (tramp-get-remote-awk vec) (executable-find "awk"))
                    (throw 'wont-work nil))))
-           (hdmp (when (string-match-p
-                        (tramp-compat-rx (| bol (not "%")) "%h") script)
+           (hdmp (when (string-match-p (rx (| bol (not "%")) "%h") script)
                    (or
                     (if vec (tramp-get-remote-hexdump vec)
                       (executable-find "hexdump"))
                     (throw 'wont-work nil))))
-           (dev (when (string-match-p
-                       (tramp-compat-rx (| bol (not "%")) "%n") script)
+           (dev (when (string-match-p (rx (| bol (not "%")) "%n") script)
                   (or
                    (if vec (concat "2>" (tramp-get-remote-null-device vec))
                      (if (eq system-type 'windows-nt) ""
                        (concat "2>" null-device)))
                    (throw 'wont-work nil))))
-           (ls (when (string-match-p
-                      (tramp-compat-rx (| bol (not "%")) "%l") script)
+           (ls (when (string-match-p (rx (| bol (not "%")) "%l") script)
                  (format "%s %s"
                          (or (tramp-get-ls-command vec)
                              (throw 'wont-work nil))
                          (tramp-sh--quoting-style-options vec))))
-           (od (when (string-match-p
-                      (tramp-compat-rx (| bol (not "%")) "%o") script)
+           (od (when (string-match-p (rx (| bol (not "%")) "%o") script)
                  (or (if vec (tramp-get-remote-od vec) (executable-find "od"))
                      (throw 'wont-work nil))))
-           (perl (when (string-match-p
-                        (tramp-compat-rx (| bol (not "%")) "%p") script)
+           (perl (when (string-match-p (rx (| bol (not "%")) "%p") script)
                    (or
                     (if vec
                         (tramp-get-remote-perl vec) (executable-find "perl"))
                     (throw 'wont-work nil))))
-           (python (when (string-match-p
-                          (tramp-compat-rx (| bol (not "%")) "%y") script)
-                   (or
-                    (if vec
-                        (tramp-get-remote-python vec)
-                      (executable-find "python"))
-                    (throw 'wont-work nil))))
-           (readlink (when (string-match-p
-                            (tramp-compat-rx (| bol (not "%")) "%r") script)
+           (python (when (string-match-p (rx (| bol (not "%")) "%y") script)
+                     (or
+                      (if vec
+                          (tramp-get-remote-python vec)
+                        (executable-find "python"))
+                      (throw 'wont-work nil))))
+           (readlink (when (string-match-p (rx (| bol (not "%")) "%r") script)
                        (or
                         (if vec
-                        (tramp-get-remote-readlink vec)
-                      (executable-find "readlink"))
-                    (throw 'wont-work nil))))
-           (stat (when (string-match-p
-                        (tramp-compat-rx (| bol (not "%")) "%s") script)
+                            (tramp-get-remote-readlink vec)
+                          (executable-find "readlink"))
+                        (throw 'wont-work nil))))
+           (stat (when (string-match-p (rx (| bol (not "%")) "%s") script)
                    (or
                     (if vec
                         (tramp-get-remote-stat vec) (executable-find "stat"))
                     (throw 'wont-work nil))))
-           (tmp (when (string-match-p
-                       (tramp-compat-rx (| bol (not "%")) "%t") script)
+           (tmp (when (string-match-p (rx (| bol (not "%")) "%t") script)
                   (or
                    (if vec
                        (tramp-file-local-name (tramp-make-tramp-temp-name vec))
@@ -4339,8 +4317,7 @@ file exists and nonzero exit status otherwise."
      "Couldn't find remote shell prompt for %s" shell)
     (unless
        (tramp-check-for-regexp
-        (tramp-get-connection-process vec)
-        (tramp-compat-rx (literal tramp-end-of-output)))
+        (tramp-get-connection-process vec) (rx (literal tramp-end-of-output)))
       (tramp-wait-for-output (tramp-get-connection-process vec))
       (tramp-message vec 5 "Setting shell prompt")
       (tramp-send-command
@@ -4381,8 +4358,7 @@ file exists and nonzero exit status otherwise."
                (tramp-send-command
                 vec (format "echo ~%s" tramp-root-id-string) t)
                (if (or (string-match-p
-                        (tramp-compat-rx
-                         bol "~" (literal tramp-root-id-string) eol)
+                        (rx bol "~" (literal tramp-root-id-string) eol)
                         (buffer-string))
                        ;; The default shell (ksh93) of OpenSolaris
                        ;; and Solaris is buggy.  We've got reports
@@ -4421,7 +4397,7 @@ seconds.  If not, it produces an error message with the 
given ERROR-ARGS."
     (condition-case nil
        (tramp-wait-for-regexp
         proc timeout
-        (tramp-compat-rx
+        (rx
          (| (regexp shell-prompt-pattern) (regexp tramp-shell-prompt-pattern))
          eos))
       (error
@@ -4808,7 +4784,7 @@ Goes through the list `tramp-local-coding-commands' and
 
                  (with-current-buffer (tramp-get-connection-buffer vec)
                    (goto-char (point-min))
-                   (unless (looking-at-p (tramp-compat-rx (literal magic)))
+                   (unless (looking-at-p (rx (literal magic)))
                      (throw 'wont-work-remote nil)))
 
                  ;; `rem-enc' and `rem-dec' could be a string meanwhile.
@@ -4894,7 +4870,7 @@ Goes through the list `tramp-inline-compress-commands'."
                      nil t))
               (throw 'next nil))
            (goto-char (point-min))
-           (unless (looking-at-p (tramp-compat-rx (literal magic)))
+           (unless (looking-at-p (rx (literal magic)))
              (throw 'next nil)))
           (tramp-message
           vec 5
@@ -4905,7 +4881,7 @@ Goes through the list `tramp-inline-compress-commands'."
            (throw 'next nil))
          (with-current-buffer (tramp-get-buffer vec)
            (goto-char (point-min))
-           (unless (looking-at-p (tramp-compat-rx (literal magic)))
+           (unless (looking-at-p (rx (literal magic)))
              (throw 'next nil)))
          (setq found t)))
 
@@ -5250,7 +5226,7 @@ connection if a previous connection has died for some 
reason."
                          (tramp-get-method-parameter hop 'tramp-remote-shell))
                         (extra-args (tramp-get-sh-extra-args remote-shell))
                         (async-args
-                         (tramp-compat-flatten-tree
+                         (flatten-tree
                           (tramp-get-method-parameter hop 'tramp-async-args)))
                         (connection-timeout
                          (tramp-get-method-parameter
@@ -5394,7 +5370,7 @@ function waits for output unless NOOUTPUT is set."
           ;; Busyboxes built with the EDITING_ASK_TERMINAL config
           ;; option send also escape sequences, which must be
           ;; ignored.
-          (regexp (tramp-compat-rx
+          (regexp (rx
                    (* (not (any "#$\n")))
                    (literal tramp-end-of-output)
                    (? (regexp tramp-device-escape-sequence-regexp))
@@ -5402,7 +5378,7 @@ function waits for output unless NOOUTPUT is set."
           ;; Sometimes, the commands do not return a newline but a
           ;; null byte before the shell prompt, for example "git
           ;; ls-files -c -z ...".
-          (regexp1 (tramp-compat-rx (| bol "\000") (regexp regexp)))
+          (regexp1 (rx (| bol "\000") (regexp regexp)))
           (found (tramp-wait-for-regexp proc timeout regexp1)))
       (if found
          (let ((inhibit-read-only t))
@@ -5442,8 +5418,7 @@ the exit status."
   (let (cmd data)
     (if (and (stringp command)
             (string-match
-             (tramp-compat-rx
-              (* nonl) "<<'" (literal tramp-end-of-heredoc) "'" (* nonl))
+             (rx (* nonl) "<<'" (literal tramp-end-of-heredoc) "'" (* nonl))
              command))
        (setq cmd (match-string 0 command)
              data (substring command (match-end 0)))
@@ -5613,7 +5588,7 @@ Nonexistent directories are removed from spec."
                    (tramp-get-method-parameter vec 'tramp-remote-shell-args)
                    " ")
                   (tramp-shell-quote-argument tramp-end-of-heredoc))
-                 'noerror (tramp-compat-rx (literal tramp-end-of-heredoc)))
+                 'noerror (rx (literal tramp-end-of-heredoc)))
                 (progn
                   (tramp-message
                    vec 2 "Could not retrieve `tramp-own-remote-path'")
@@ -5663,8 +5638,7 @@ Nonexistent directories are removed from spec."
        (while candidates
          (goto-char (point-min))
          (if (string-match-p
-              (tramp-compat-rx bol (literal (car candidates)) (? "\r") eol)
-              (buffer-string))
+              (rx bol (literal (car candidates)) (? "\r") eol) (buffer-string))
              (setq locale (car candidates)
                    candidates nil)
            (setq candidates (cdr candidates)))))
@@ -5742,7 +5716,7 @@ Nonexistent directories are removed from spec."
        vec (format "( %s / -nt / )" (tramp-get-test-command vec)))
        (with-current-buffer (tramp-get-buffer vec)
         (goto-char (point-min))
-        (when (looking-at-p (tramp-compat-rx (literal tramp-end-of-output)))
+        (when (looking-at-p (rx (literal tramp-end-of-output)))
           (format "%s %%s -nt %%s" (tramp-get-test-command vec)))))
      (progn
        (tramp-send-command
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 0c45756505..f31865d498 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -53,7 +53,7 @@
 ;;;###tramp-autoload
 (tramp--with-startup
  (add-to-list 'tramp-default-user-alist
-             `(,(tramp-compat-rx bos (literal tramp-smb-method) eos) nil nil))
+             `(,(rx bos (literal tramp-smb-method) eos) nil nil))
 
  ;; Add completion function for SMB method.
  (tramp-set-completion-function
@@ -92,9 +92,9 @@ this variable \"client min protocol=NT1\"."
   "Version string of the SMB client.")
 
 (defconst tramp-smb-server-version
-  (tramp-compat-rx "Domain=[" (* (not "]")) "] "
-                  "OS=[" (* (not "]")) "] "
-                  "Server=[" (* (not "]")) "]")
+  (rx "Domain=[" (* (not "]")) "] "
+      "OS=[" (* (not "]")) "] "
+      "Server=[" (* (not "]")) "]")
   "Regexp of SMB server identification.")
 
 (defconst tramp-smb-prompt
@@ -730,8 +730,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
     (with-parsed-tramp-file-name name nil
       ;; Tilde expansion if necessary.
       (when (string-match
-            (tramp-compat-rx bos "~" (group (* (not "/"))) (group (* nonl)) 
eos)
-            localname)
+            (rx bos "~" (group (* (not "/"))) (group (* nonl)) eos) localname)
        (let ((uname (match-string 1 localname))
              (fname (match-string 2 localname))
              hname)
@@ -1083,8 +1082,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
                     ;; Check for matching entries.
                     (mapcar
                      (lambda (x)
-                       (when (string-match-p
-                              (tramp-compat-rx bol (literal base)) (nth 0 x))
+                       (when (string-match-p (rx bol (literal base)) (nth 0 x))
                          x))
                      entries)
                   ;; We just need the only and only entry FILENAME.
@@ -1198,8 +1196,7 @@ component is used as the target of the symlink."
     ;; If TARGET is still remote, quote it.
     (if (tramp-tramp-file-p target)
        (make-symbolic-link
-        (tramp-compat-file-name-quote target 'top)
-        linkname ok-if-already-exists)
+        (file-name-quote target 'top) linkname ok-if-already-exists)
 
       ;; Do the 'confirm if exists' thing.
       (when (file-exists-p linkname)
@@ -1244,7 +1241,7 @@ component is used as the target of the symlink."
 
       ;; Determine input.
       (when infile
-       (setq infile (tramp-compat-file-name-unquote (expand-file-name infile)))
+       (setq infile (file-name-unquote (expand-file-name infile)))
        (if (tramp-equal-remote default-directory infile)
            ;; INFILE is on the same remote host.
            (setq input (tramp-unquote-file-local-name infile))
@@ -1552,7 +1549,7 @@ component is used as the target of the symlink."
 \"//\" substitutes only in the local filename part.  Catches
 errors for shares like \"C$/\", which are common in Microsoft Windows."
   ;; Check, whether the local part is a quoted file name.
-  (if (tramp-compat-file-name-quoted-p filename)
+  (if (file-name-quoted-p filename)
       filename
     (with-parsed-tramp-file-name filename nil
       ;; Ignore in LOCALNAME everything before "//".
@@ -1603,8 +1600,7 @@ VEC or USER, or if there is no home directory, return 
nil."
   "Return the share name of LOCALNAME."
   (save-match-data
     (let ((localname (tramp-file-name-unquote-localname vec)))
-      (when (string-match
-            (tramp-compat-rx bol (? "/") (group (+ (not "/"))) "/") localname)
+      (when (string-match (rx bol (? "/") (group (+ (not "/"))) "/") localname)
        (match-string 1 localname)))))
 
 (defun tramp-smb-get-localname (vec)
@@ -1615,8 +1611,7 @@ If VEC has no cifs capabilities, exchange \"/\" by 
\"\\\\\"."
       (setq
        localname
        (if (string-match
-           (tramp-compat-rx bol (? "/") (+ (not "/")) (group "/" (* nonl)))
-           localname)
+           (rx bol (? "/") (+ (not "/")) (group "/" (* nonl))) localname)
           ;; There is a share, separated by "/".
           (if (not (tramp-smb-get-cifs-capabilities vec))
               (mapconcat
@@ -1624,8 +1619,7 @@ If VEC has no cifs capabilities, exchange \"/\" by 
\"\\\\\"."
                (match-string 1 localname) "")
             (match-string 1 localname))
         ;; There is just a share.
-        (if (string-match
-             (tramp-compat-rx bol (? "/") (group (+ (not "/"))) eol) localname)
+        (if (string-match (rx bol (? "/") (group (+ (not "/"))) eol) localname)
             (match-string 1 localname)
           "")))
 
@@ -1753,8 +1747,7 @@ are listed.  Result is the list (LOCALNAME MODE SIZE 
MTIME)."
     (if (not share)
 
        ;; Read share entries.
-       (when (string-match
-              (tramp-compat-rx bol "Disk|" (group (+ (not "|"))) "|") line)
+       (when (string-match (rx bol "Disk|" (group (+ (not "|"))) "|") line)
          (setq localname (match-string 1 line)
                mode "dr-xr-xr-x"
                size 0))
diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el
index 2d3c436632..27b2854e45 100644
--- a/lisp/net/tramp-sshfs.el
+++ b/lisp/net/tramp-sshfs.el
@@ -228,8 +228,7 @@ arguments to pass to the OPERATION."
 
 (defun tramp-sshfs-handle-file-system-info (filename)
   "Like `file-system-info' for Tramp files."
-  ;;`file-system-info' exists since Emacs 27.1.
-  (tramp-compat-funcall 'file-system-info (tramp-fuse-local-file-name 
filename)))
+  (file-system-info (tramp-fuse-local-file-name filename)))
 
 (defun tramp-sshfs-handle-file-writable-p (filename)
   "Like `file-writable-p' for Tramp files."
@@ -266,7 +265,7 @@ arguments to pass to the OPERATION."
       ;; Determine input.
       (if (null infile)
          (setq input (tramp-get-remote-null-device v))
-       (setq infile (tramp-compat-file-name-unquote (expand-file-name infile)))
+       (setq infile (file-name-unquote (expand-file-name infile)))
        (if (tramp-equal-remote default-directory infile)
            ;; INFILE is on the same remote host.
            (setq input (tramp-unquote-file-local-name infile))
diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el
index 63946c2da3..c4e1d32f52 100644
--- a/lisp/net/tramp-sudoedit.el
+++ b/lisp/net/tramp-sudoedit.el
@@ -49,7 +49,7 @@
                (tramp-password-previous-hop t)))
 
  (add-to-list 'tramp-default-user-alist
-             `(,(tramp-compat-rx bos (literal tramp-sudoedit-method) eos)
+             `(,(rx bos (literal tramp-sudoedit-method) eos)
                nil ,tramp-root-id-string))
 
  (tramp-set-completion-function
@@ -212,8 +212,8 @@ arguments to pass to the OPERATION."
        (unless
            (tramp-sudoedit-send-command
             v1 "ln"
-            (tramp-compat-file-name-unquote v1-localname)
-            (tramp-compat-file-name-unquote v2-localname))
+            (file-name-unquote v1-localname)
+            (file-name-unquote v2-localname))
          (tramp-error
           v1 'file-error
           "error with add-name-to-file, see buffer `%s' for details"
@@ -342,7 +342,7 @@ absolute file names."
   (tramp-skeleton-delete-directory directory recursive trash
     (unless (tramp-sudoedit-send-command
             v (if recursive '("rm" "-rf") "rmdir")
-            (tramp-compat-file-name-unquote localname))
+            (file-name-unquote localname))
       (tramp-error v 'file-error "Couldn't delete %s" directory))))
 
 (defun tramp-sudoedit-handle-delete-file (filename &optional trash)
@@ -352,7 +352,7 @@ absolute file names."
     (if (and delete-by-moving-to-trash trash)
        (move-file-to-trash filename)
       (unless (tramp-sudoedit-send-command
-              v "rm" "-f" (tramp-compat-file-name-unquote localname))
+              v "rm" "-f" (file-name-unquote localname))
        ;; Propagate the error.
        (with-current-buffer (tramp-get-connection-buffer v)
          (goto-char (point-min))
@@ -382,8 +382,7 @@ the result will be a local, non-Tramp, file name."
       (unless (file-name-absolute-p localname)
        (setq localname (format "~%s/%s" user localname)))
       (when (string-match
-            (tramp-compat-rx bos "~" (group (* (not "/"))) (group (* nonl)) 
eos)
-            localname)
+            (rx bos "~" (group (* (not "/"))) (group (* nonl)) eos) localname)
        (let ((uname (match-string 1 localname))
              (fname (match-string 2 localname))
              hname)
@@ -413,7 +412,7 @@ the result will be a local, non-Tramp, file name."
       (let ((result (and (tramp-sudoedit-remote-acl-p v)
                         (tramp-sudoedit-send-command-string
                          v "getfacl" "-acp"
-                         (tramp-compat-file-name-unquote localname)))))
+                         (file-name-unquote localname)))))
        ;; The acl string must have a trailing \n, which is not
        ;; provided by `tramp-sudoedit-send-command-string'.  Add it.
        (and (stringp result) (concat result "\n"))))))
@@ -440,8 +439,7 @@ the result will be a local, non-Tramp, file name."
     (tramp-convert-file-attributes v localname id-format
       (tramp-sudoedit-send-command-and-read
        v "env" "QUOTING_STYLE=locale" "stat" "-c"
-       tramp-sudoedit-file-attributes
-       (tramp-compat-file-name-unquote localname)))))
+       tramp-sudoedit-file-attributes (file-name-unquote localname)))))
 
 (defun tramp-sudoedit-handle-file-executable-p (filename)
   "Like `file-executable-p' for Tramp files."
@@ -453,7 +451,7 @@ the result will be a local, non-Tramp, file name."
          (or (tramp-check-cached-permissions v ?x)
              (tramp-check-cached-permissions v ?s))
        (tramp-sudoedit-send-command
-        v "test" "-x" (tramp-compat-file-name-unquote localname))))))
+        v "test" "-x" (file-name-unquote localname))))))
 
 (defun tramp-sudoedit-handle-file-exists-p (filename)
   "Like `file-exists-p' for Tramp files."
@@ -466,7 +464,7 @@ the result will be a local, non-Tramp, file name."
        (if (tramp-file-property-p v localname "file-attributes")
            (not (null (tramp-get-file-property v localname "file-attributes")))
          (tramp-sudoedit-send-command
-          v "test" "-e" (tramp-compat-file-name-unquote localname)))))))
+          v "test" "-e" (file-name-unquote localname)))))))
 
 (defun tramp-sudoedit-handle-file-name-all-completions (filename directory)
   "Like `file-name-all-completions' for Tramp files."
@@ -477,7 +475,7 @@ the result will be a local, non-Tramp, file name."
        (tramp-sudoedit-send-command
        v "ls" "-a1" "--quoting-style=literal" "--show-control-chars"
        (if (zerop (length localname))
-           "" (tramp-compat-file-name-unquote localname)))
+           "" (file-name-unquote localname)))
        (mapcar
        (lambda (f)
          (if (file-directory-p (expand-file-name f directory))
@@ -500,7 +498,7 @@ the result will be a local, non-Tramp, file name."
       (if (tramp-file-property-p v localname "file-attributes")
          (tramp-handle-file-readable-p filename)
        (tramp-sudoedit-send-command
-        v "test" "-r" (tramp-compat-file-name-unquote localname))))))
+        v "test" "-r" (file-name-unquote localname))))))
 
 (defun tramp-sudoedit-handle-set-file-modes (filename mode &optional flag)
   "Like `set-file-modes' for Tramp files."
@@ -508,8 +506,7 @@ the result will be a local, non-Tramp, file name."
   (unless (and (eq flag 'nofollow) (file-symlink-p filename))
     (tramp-skeleton-set-file-modes-times-uid-gid filename
       (unless (tramp-sudoedit-send-command
-              v "chmod" (format "%o" mode)
-              (tramp-compat-file-name-unquote localname))
+              v "chmod" (format "%o" mode) (file-name-unquote localname))
        (tramp-error
         v 'file-error "Error while changing file's mode %s" filename)))))
 
@@ -523,15 +520,14 @@ the result will be a local, non-Tramp, file name."
   (with-parsed-tramp-file-name (expand-file-name filename) nil
     (with-tramp-file-property v localname "file-selinux-context"
       (let ((context '(nil nil nil nil))
-           (regexp (tramp-compat-rx
+           (regexp (rx
                     (group (+ (any "_" alnum))) ":"
                     (group (+ (any "_" alnum))) ":"
                     (group (+ (any "_" alnum))) ":"
                     (group (+ (any "_" alnum))))))
        (when (and (tramp-sudoedit-remote-selinux-p v)
                   (tramp-sudoedit-send-command
-                   v "ls" "-d" "-Z"
-                   (tramp-compat-file-name-unquote localname)))
+                   v "ls" "-d" "-Z" (file-name-unquote localname)))
          (with-current-buffer (tramp-get-connection-buffer v)
            (goto-char (point-min))
            (when (re-search-forward regexp (line-end-position) t)
@@ -547,7 +543,7 @@ the result will be a local, non-Tramp, file name."
       (tramp-message v 5 "file system info: %s" localname)
       (when (tramp-sudoedit-send-command
             v "df" "--block-size=1" "--output=size,used,avail"
-            (tramp-compat-file-name-unquote localname))
+            (file-name-unquote localname))
        (with-current-buffer (tramp-get-connection-buffer v)
          (goto-char (point-min))
          (forward-line)
@@ -565,17 +561,11 @@ the result will be a local, non-Tramp, file name."
 (defun tramp-sudoedit-handle-set-file-times (filename &optional time flag)
   "Like `set-file-times' for Tramp files."
   (tramp-skeleton-set-file-modes-times-uid-gid filename
-    (let ((time
-          (if (or (null time)
-                  (tramp-compat-time-equal-p time tramp-time-doesnt-exist)
-                  (tramp-compat-time-equal-p time tramp-time-dont-know))
-              nil
-            time)))
-      (tramp-sudoedit-send-command
-       v "env" "TZ=UTC0" "touch" "-t"
-       (format-time-string "%Y%m%d%H%M.%S" time t)
-       (if (eq flag 'nofollow) "-h" "")
-       (tramp-compat-file-name-unquote localname)))))
+    (tramp-sudoedit-send-command
+     v "env" "TZ=UTC0" "touch" "-t"
+     (format-time-string "%Y%m%d%H%M.%S" (tramp-defined-time time) t)
+     (if (eq flag 'nofollow) "-h" "")
+     (file-name-unquote localname))))
 
 (defun tramp-sudoedit-handle-file-truename (filename)
   "Like `file-truename' for Tramp files."
@@ -584,10 +574,9 @@ the result will be a local, non-Tramp, file name."
    (if (directory-name-p filename) #'file-name-as-directory #'identity)
    ;; Quote properly.
    (funcall
-    (if (tramp-compat-file-name-quoted-p filename)
-       #'tramp-compat-file-name-quote #'identity)
+    (if (file-name-quoted-p filename) #'file-name-quote #'identity)
     (with-parsed-tramp-file-name
-       (tramp-compat-file-name-unquote (expand-file-name filename)) nil
+       (file-name-unquote (expand-file-name filename)) nil
       (tramp-make-tramp-file-name
        v
        (with-tramp-file-property v localname "file-truename"
@@ -604,7 +593,7 @@ the result will be a local, non-Tramp, file name."
           ;; If the resulting localname looks remote, we must quote it
           ;; for security reasons.
           (when (file-remote-p result)
-            (setq result (tramp-compat-file-name-quote result 'top)))
+            (setq result (file-name-quote result 'top)))
           (tramp-message v 4 "True name of `%s' is `%s'" localname result)
           result)))))))
 
@@ -618,7 +607,7 @@ the result will be a local, non-Tramp, file name."
              ;; be satisfied without remote operation.
              (tramp-check-cached-permissions v ?w)
            (tramp-sudoedit-send-command
-            v "test" "-w" (tramp-compat-file-name-unquote localname)))
+            v "test" "-w" (file-name-unquote localname)))
        ;; If file doesn't exist, check if directory is writable.
        (and
         (file-directory-p (file-name-directory filename))
@@ -629,7 +618,7 @@ the result will be a local, non-Tramp, file name."
   (tramp-skeleton-make-directory dir parents
     (unless (tramp-sudoedit-send-command
             v "mkdir" "-m" (format "%#o" (default-file-modes))
-            (tramp-compat-file-name-unquote localname))
+            (file-name-unquote localname))
       (tramp-error v 'file-error "Couldn't make directory %s" dir))))
 
 (defun tramp-sudoedit-handle-make-symbolic-link
@@ -649,8 +638,7 @@ component is used as the target of the symlink."
     ;; If TARGET is still remote, quote it.
     (if (tramp-tramp-file-p target)
        (make-symbolic-link
-        (tramp-compat-file-name-quote target 'top)
-        linkname ok-if-already-exists)
+        (file-name-quote target 'top) linkname ok-if-already-exists)
 
       ;; Do the 'confirm if exists' thing.
       (when (file-exists-p linkname)
@@ -668,8 +656,8 @@ component is used as the target of the symlink."
       (tramp-flush-file-properties v localname)
       (tramp-sudoedit-send-command
        v "ln" "-sf"
-       (tramp-compat-file-name-unquote target)
-       (tramp-compat-file-name-unquote localname)))))
+       (file-name-unquote target)
+       (file-name-unquote localname)))))
 
 (defun tramp-sudoedit-handle-rename-file
   (filename newname &optional ok-if-already-exists)
@@ -693,8 +681,7 @@ component is used as the target of the symlink."
       (setq acl-string (string-join (split-string acl-string "\n" 'omit) ","))
       (prog1
          (tramp-sudoedit-send-command
-          v "setfacl" "-m"
-          acl-string (tramp-compat-file-name-unquote localname))
+          v "setfacl" "-m" acl-string (file-name-unquote localname))
        (tramp-flush-file-property v localname "file-acl")))))
 
 (defun tramp-sudoedit-handle-set-file-selinux-context (filename context)
@@ -712,7 +699,7 @@ component is used as the target of the symlink."
               (when role (format "--role=%s" role))
               (when type (format "--type=%s" type))
               (when range (format "--range=%s" range))
-              (tramp-compat-file-name-unquote localname))
+              (file-name-unquote localname))
          (if (and user role type range)
              (tramp-set-file-property
               v localname "file-selinux-context" context)
@@ -820,7 +807,7 @@ in case of error, t otherwise."
                       vec 'tramp-sudo-login
                       ?h (or (tramp-file-name-host vec) "")
                       ?u (or (tramp-file-name-user vec) ""))
-                     (tramp-compat-flatten-tree args))))
+                     (flatten-tree args))))
           ;; We suppress the messages `Waiting for prompts from remote shell'.
           (tramp-verbose (if (= tramp-verbose 3) 2 tramp-verbose))
           ;; The password shall be cached also in case of "emacs -Q".
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 67a269ce50..4bf0fdefc0 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -523,7 +523,7 @@ interpreted as a regular expression which always matches."
 (defcustom tramp-restricted-shell-hosts-alist
   (when (and (eq system-type 'windows-nt)
              (not (string-match-p (rx "sh" eol) tramp-encoding-shell)))
-    (list (tramp-compat-rx
+    (list (rx
           bos (| (literal (downcase tramp-system-name))
                  (literal (upcase tramp-system-name)))
           eos)))
@@ -537,7 +537,7 @@ host runs a restricted shell, it shall be added to this 
list, too."
 
 ;;;###tramp-autoload
 (defcustom tramp-local-host-regexp
-  (tramp-compat-rx
+  (rx
    bos
    (| (literal tramp-system-name)
       (| "localhost" "localhost4" "localhost6" "127.0.0.1" "::1"))
@@ -638,7 +638,7 @@ This regexp must match both `tramp-initial-end-of-output' 
and
   :type 'regexp)
 
 (defcustom tramp-password-prompt-regexp
-  (tramp-compat-rx
+  (rx
    bol (* nonl)
    (group (regexp (regexp-opt password-word-equivalents)))
    (* nonl) ":" (? "\^@") (* blank))
@@ -897,18 +897,17 @@ Used in `tramp-make-tramp-file-name'.")
 
 (defun tramp-build-prefix-regexp ()
   "Return `tramp-prefix-regexp'."
-  (tramp-compat-rx bol (literal (tramp-build-prefix-format))))
+  (rx bol (literal (tramp-build-prefix-format))))
 
 (defvar tramp-prefix-regexp nil ; Initialized when defining `tramp-syntax'!
   "Regexp matching the very beginning of Tramp file names.
 Should always start with \"^\".  Derived from `tramp-prefix-format'.")
 
 (defconst tramp-method-regexp-alist
-  `((default . ,(tramp-compat-rx
-                (| (literal tramp-default-method-marker) (>= 2 alnum))))
+  `((default . ,(rx (| (literal tramp-default-method-marker) (>= 2 alnum))))
     (simplified . "")
-    (separate . ,(tramp-compat-rx
-                 (? (| (literal tramp-default-method-marker) (>= 2 alnum))))))
+    (separate
+     . ,(rx (? (| (literal tramp-default-method-marker) (>= 2 alnum))))))
   "Alist mapping Tramp syntax to regexps matching methods identifiers.")
 
 (defun tramp-build-method-regexp ()
@@ -936,7 +935,7 @@ Used in `tramp-make-tramp-file-name'.")
 
 (defun tramp-build-postfix-method-regexp ()
   "Return `tramp-postfix-method-regexp'."
-  (tramp-compat-rx (literal (tramp-build-postfix-method-format))))
+  (rx (literal (tramp-build-postfix-method-format))))
 
 (defvar tramp-postfix-method-regexp nil ; Init'd when defining `tramp-syntax'!
   "Regexp matching delimiter between method and user or host names.
@@ -948,8 +947,7 @@ Derived from `tramp-postfix-method-format'.")
 (defconst tramp-prefix-domain-format "%"
   "String matching delimiter between user and domain names.")
 
-(defconst tramp-prefix-domain-regexp
-  (tramp-compat-rx (literal tramp-prefix-domain-format))
+(defconst tramp-prefix-domain-regexp (rx (literal tramp-prefix-domain-format))
   "Regexp matching delimiter between user and domain names.
 Derived from `tramp-prefix-domain-format'.")
 
@@ -957,7 +955,7 @@ Derived from `tramp-prefix-domain-format'.")
   "Regexp matching domain names.")
 
 (defconst tramp-user-with-domain-regexp
-  (tramp-compat-rx
+  (rx
    (group (regexp tramp-user-regexp))
    (regexp tramp-prefix-domain-regexp)
    (group (regexp tramp-domain-regexp)))
@@ -967,8 +965,7 @@ Derived from `tramp-prefix-domain-format'.")
   "String matching delimiter between user and host names.
 Used in `tramp-make-tramp-file-name'.")
 
-(defconst tramp-postfix-user-regexp
-  (tramp-compat-rx (literal tramp-postfix-user-format))
+(defconst tramp-postfix-user-regexp (rx (literal tramp-postfix-user-format))
   "Regexp matching delimiter between user and host names.
 Derived from `tramp-postfix-user-format'.")
 
@@ -991,7 +988,7 @@ Used in `tramp-make-tramp-file-name'.")
 
 (defun tramp-build-prefix-ipv6-regexp ()
   "Return `tramp-prefix-ipv6-regexp'."
-  (tramp-compat-rx (literal tramp-prefix-ipv6-format)))
+  (rx (literal tramp-prefix-ipv6-format)))
 
 (defvar tramp-prefix-ipv6-regexp nil ; Initialized when defining 
`tramp-syntax'!
   "Regexp matching left hand side of IPv6 addresses.
@@ -1019,7 +1016,7 @@ Used in `tramp-make-tramp-file-name'.")
 
 (defun tramp-build-postfix-ipv6-regexp ()
   "Return `tramp-postfix-ipv6-regexp'."
-  (tramp-compat-rx (literal tramp-postfix-ipv6-format)))
+  (rx (literal tramp-postfix-ipv6-format)))
 
 (defvar tramp-postfix-ipv6-regexp nil ; Initialized when defining 
`tramp-syntax'!
   "Regexp matching right hand side of IPv6 addresses.
@@ -1028,8 +1025,7 @@ Derived from `tramp-postfix-ipv6-format'.")
 (defconst tramp-prefix-port-format "#"
   "String matching delimiter between host names and port numbers.")
 
-(defconst tramp-prefix-port-regexp
-  (tramp-compat-rx (literal tramp-prefix-port-format))
+(defconst tramp-prefix-port-regexp (rx (literal tramp-prefix-port-format))
   "Regexp matching delimiter between host names and port numbers.
 Derived from `tramp-prefix-port-format'.")
 
@@ -1037,7 +1033,7 @@ Derived from `tramp-prefix-port-format'.")
   "Regexp matching port numbers.")
 
 (defconst tramp-host-with-port-regexp
-  (tramp-compat-rx
+  (rx
    (group (regexp tramp-host-regexp))
    (regexp tramp-prefix-port-regexp)
    (group (regexp tramp-port-regexp)))
@@ -1046,8 +1042,7 @@ Derived from `tramp-prefix-port-format'.")
 (defconst tramp-postfix-hop-format "|"
   "String matching delimiter after ad-hoc hop definitions.")
 
-(defconst tramp-postfix-hop-regexp
-  (tramp-compat-rx (literal tramp-postfix-hop-format))
+(defconst tramp-postfix-hop-regexp (rx (literal tramp-postfix-hop-format))
   "Regexp matching delimiter after ad-hoc hop definitions.
 Derived from `tramp-postfix-hop-format'.")
 
@@ -1067,7 +1062,7 @@ Used in `tramp-make-tramp-file-name'.")
 
 (defun tramp-build-postfix-host-regexp ()
   "Return `tramp-postfix-host-regexp'."
-  (tramp-compat-rx (literal tramp-postfix-host-format)))
+  (rx (literal tramp-postfix-host-format)))
 
 (defvar tramp-postfix-host-regexp nil ; Initialized when defining 
`tramp-syntax'!
   "Regexp matching delimiter between host names and localnames.
@@ -1094,7 +1089,7 @@ Derived from `tramp-postfix-host-format'.")
 (defun tramp-build-remote-file-name-spec-regexp ()
   "Construct a regexp matching a Tramp file name for a Tramp syntax.
 It is expected, that `tramp-syntax' has the proper value."
-  (tramp-compat-rx
+  (rx
    ;; Method.
    (group (regexp tramp-method-regexp)) (regexp tramp-postfix-method-regexp)
    ;; Optional user.  This includes domain.
@@ -1116,7 +1111,7 @@ It is expected, that `tramp-syntax' has the proper value."
 It is expected, that `tramp-syntax' has the proper value.
 See `tramp-file-name-structure'."
   (list
-   (tramp-compat-rx
+   (rx
     (regexp tramp-prefix-regexp)
     (? (group (+ (regexp tramp-remote-file-name-spec-regexp)
                 (regexp tramp-postfix-hop-regexp))))
@@ -1176,11 +1171,9 @@ initial value is overwritten by the car of 
`tramp-file-name-structure'.")
 ;; `tramp-method-regexp' needs at least two characters, in order to
 ;; distinguish from volume letter.  This is in the way when completing.
 (defconst tramp-completion-method-regexp-alist
-  `((default    . ,(tramp-compat-rx
-                   (| (literal tramp-default-method-marker) (+ alnum))))
+  `((default . ,(rx (| (literal tramp-default-method-marker) (+ alnum))))
     (simplified . "")
-    (separate   . ,(tramp-compat-rx
-                   (| (literal tramp-default-method-marker) (* alnum)))))
+    (separate . ,(rx (| (literal tramp-default-method-marker) (* alnum)))))
   "Alist mapping Tramp syntax to regexps matching completion methods.")
 
 (defun tramp-build-completion-method-regexp ()
@@ -1196,8 +1189,8 @@ The `ftp' syntax does not support methods.")
   "Return `tramp-completion-file-name-regexp' according to `tramp-syntax'."
   (if (eq tramp-syntax 'separate)
       ;; FIXME: This shouldn't be necessary.
-      (tramp-compat-rx bos "/" (? "[" (* (not "]"))) eos)
-    (tramp-compat-rx
+      (rx bos "/" (? "[" (* (not "]"))) eos)
+    (rx
      bos
      ;; `file-name-completion' uses absolute paths for matching.
      ;; This means that on W32 systems, something like
@@ -1509,8 +1502,7 @@ same connection.  Make a copy in order to avoid side 
effects."
       (setq vec (copy-tramp-file-name vec))
       (setf (tramp-file-name-localname vec)
            (and (stringp localname)
-                (tramp-compat-file-name-unquote
-                 (directory-file-name localname)))
+                (file-name-unquote (directory-file-name localname)))
            (tramp-file-name-hop vec) nil))
     vec))
 
@@ -1543,7 +1535,7 @@ entry does not exist, return nil."
 ;; The localname can be quoted with "/:".  Extract this.
 (defun tramp-file-name-unquote-localname (vec)
   "Return unquoted localname component of VEC."
-  (tramp-compat-file-name-unquote (tramp-file-name-localname vec)))
+  (file-name-unquote (tramp-file-name-localname vec)))
 
 ;;;###tramp-autoload
 (defun tramp-tramp-file-p (name)
@@ -1581,7 +1573,7 @@ of `process-file', `start-file-process', or 
`shell-command'."
 ;; The localname can be quoted with "/:".  Extract this.
 (defun tramp-unquote-file-local-name (name)
   "Return unquoted localname of NAME."
-  (tramp-compat-file-name-unquote (tramp-file-local-name name)))
+  (file-name-unquote (tramp-file-local-name name)))
 
 (defun tramp-find-method (method user host)
   "Return the right method string to use depending on USER and HOST.
@@ -1743,7 +1735,7 @@ See `tramp-dissect-file-name' for details."
   (let ((v (tramp-dissect-file-name
            (concat tramp-prefix-format
                    (replace-regexp-in-string
-                    (tramp-compat-rx (regexp tramp-postfix-hop-regexp) eos)
+                    (rx (regexp tramp-postfix-hop-regexp) eos)
                     tramp-postfix-host-format name))
            nodefault)))
     ;; Only some methods from tramp-sh.el do support multi-hops.
@@ -1839,8 +1831,7 @@ the form (METHOD USER DOMAIN HOST PORT LOCALNAME 
&optional HOP)."
    (replace-regexp-in-string
     tramp-prefix-regexp ""
     (replace-regexp-in-string
-     (tramp-compat-rx
-      (regexp tramp-postfix-host-regexp) eos)
+     (rx (regexp tramp-postfix-host-regexp) eos)
      tramp-postfix-hop-format
      (tramp-make-tramp-file-name vec 'noloc)))))
 
@@ -1970,7 +1961,7 @@ of `current-buffer'."
   ;; Also, in `font-lock-defaults' you can specify a function name for
   ;; the "KEYWORDS" part, so font-lock calls it to get the actual keywords!
   '(list
-    (tramp-compat-rx bol (regexp tramp-debug-outline-regexp) (+ nonl))
+    (rx bol (regexp tramp-debug-outline-regexp) (+ nonl))
     '(1 font-lock-warning-face t t)
     '(0 (outline-font-lock-face) keep t))
   "Used for highlighting Tramp debug buffers in `outline-mode'.")
@@ -2384,7 +2375,7 @@ If VAR is nil, then we bind `v' to the structure and 
`method', `user',
   (let* ((parameters (cdr reporter))
         (message (aref parameters 3)))
     (when (tramp-compat-string-search message (or (current-message) ""))
-      (tramp-compat-progress-reporter-update reporter value suffix))))
+      (progress-reporter-update reporter value suffix))))
 
 (defmacro with-tramp-progress-reporter (vec level message &rest body)
   "Execute BODY, spinning a progress reporter with MESSAGE in interactive mode.
@@ -2422,13 +2413,12 @@ locally on a remote file name.  When the local system 
is a W32 system
 but the remote system is Unix, this introduces a superfluous drive
 letter into the file name.  This function removes it."
   (save-match-data
-    (let ((quoted (tramp-compat-file-name-quoted-p name 'top))
-         (result (tramp-compat-file-name-unquote name 'top)))
+    (let ((quoted (file-name-quoted-p name 'top))
+         (result (file-name-unquote name 'top)))
       (setq result
            (replace-regexp-in-string
-            (tramp-compat-rx (regexp tramp-volume-letter-regexp) "/")
-            "/" result))
-      (if quoted (tramp-compat-file-name-quote result 'top) result))))
+            (rx (regexp tramp-volume-letter-regexp) "/") "/" result))
+      (if quoted (file-name-quote result 'top) result))))
 
 ;;; Config Manipulation Functions:
 
@@ -2536,7 +2526,7 @@ coding system might not be determined.  This function 
repairs it."
        ;; We found a matching entry in `file-coding-system-alist'.
        ;; So we add a similar entry, but with the temporary file name
        ;; as regexp.
-       (push (cons (tramp-compat-rx (literal tmpname)) (cdr elt)) result)))))
+       (push (cons (rx (literal tmpname)) (cdr elt)) result)))))
 
 (defun tramp-run-real-handler (operation args)
   "Invoke normal file name handler for OPERATION.
@@ -2586,15 +2576,13 @@ Must be handled by the callers."
              file-name-nondirectory file-name-sans-versions
              file-notify-add-watch file-ownership-preserved-p
              file-readable-p file-regular-p file-remote-p
-             file-selinux-context file-symlink-p file-truename
-             file-writable-p find-backup-file-name get-file-buffer
-             insert-directory insert-file-contents load
-             make-directory set-file-acl set-file-modes
+             file-selinux-context file-symlink-p file-system-info
+             file-truename file-writable-p find-backup-file-name
+             get-file-buffer insert-directory insert-file-contents
+             load make-directory set-file-acl set-file-modes
              set-file-selinux-context set-file-times
              substitute-in-file-name unhandled-file-name-directory
              vc-registered
-             ;; Emacs 27+ only.
-             file-system-info
              ;; Emacs 28- only.
              make-directory-internal
              ;; Emacs 28+ only.
@@ -2637,10 +2625,8 @@ Must be handled by the callers."
      (if (bufferp (nth 0 args)) (nth 0 args) (current-buffer))))
    ;; COMMAND.
    ((member operation
-           '(make-nearby-temp-file process-file shell-command
-             start-file-process temporary-file-directory
-             ;; Emacs 27+ only.
-             exec-path make-process
+           '(exec-path make-nearby-temp-file make-process process-file
+             shell-command start-file-process temporary-file-directory
              ;; Emacs 29+ only.
               list-system-processes memory-info process-attributes))
     default-directory)
@@ -2821,7 +2807,7 @@ remote file names."
                  #'file-name-sans-extension
                  (directory-files
                   dir nil (rx bos "tramp" (+ nonl) ".el" (? "c") eos)))))
-        (files-regexp (tramp-compat-rx bol (regexp (regexp-opt files)) eol)))
+        (files-regexp (rx bol (regexp (regexp-opt files)) eol)))
     (mapatoms
      (lambda (atom)
        (when (and (functionp atom)
@@ -2858,7 +2844,7 @@ remote file names."
   (put #'tramp-completion-file-name-handler 'operations
        (mapcar #'car tramp-completion-file-name-handler-alist))
 
-  ;; Integrated in Emacs 27.
+  ;; After unloading, `tramp-archive-enabled' might not be defined.
   (when (bound-and-true-p tramp-archive-enabled)
     (add-to-list 'file-name-handler-alist
                 (cons tramp-archive-file-name-regexp
@@ -2967,7 +2953,7 @@ not in completion mode."
 
     ;; Suppress hop from completion.
     (when (string-match
-          (tramp-compat-rx
+          (rx
            (regexp tramp-prefix-regexp)
            (group (+ (regexp tramp-remote-file-name-spec-regexp)
                      (regexp tramp-postfix-hop-regexp))))
@@ -3060,14 +3046,14 @@ They are collected by 
`tramp-completion-dissect-file-name1'."
   (let (;; "/method" "/[method"
        (tramp-completion-file-name-structure1
         (list
-         (tramp-compat-rx
+         (rx
           (regexp tramp-prefix-regexp)
           (group (? (regexp tramp-completion-method-regexp))) eol)
          1 nil nil nil))
        ;; "/method:user" "/[method/user"
        (tramp-completion-file-name-structure2
         (list
-         (tramp-compat-rx
+         (rx
           (regexp tramp-prefix-regexp)
           (group (regexp tramp-method-regexp))
           (regexp tramp-postfix-method-regexp)
@@ -3076,7 +3062,7 @@ They are collected by 
`tramp-completion-dissect-file-name1'."
        ;; "/method:host" "/[method/host"
        (tramp-completion-file-name-structure3
         (list
-         (tramp-compat-rx
+         (rx
           (regexp tramp-prefix-regexp)
           (group (regexp tramp-method-regexp))
           (regexp tramp-postfix-method-regexp)
@@ -3085,7 +3071,7 @@ They are collected by 
`tramp-completion-dissect-file-name1'."
        ;; "/method:[ipv6" "/[method/ipv6"
        (tramp-completion-file-name-structure4
         (list
-         (tramp-compat-rx
+         (rx
           (regexp tramp-prefix-regexp)
           (group (regexp tramp-method-regexp))
           (regexp tramp-postfix-method-regexp)
@@ -3095,7 +3081,7 @@ They are collected by 
`tramp-completion-dissect-file-name1'."
        ;; "/method:user@host" "/[method/user@host"
        (tramp-completion-file-name-structure5
         (list
-         (tramp-compat-rx
+         (rx
           (regexp tramp-prefix-regexp)
           (group (regexp tramp-method-regexp))
           (regexp tramp-postfix-method-regexp)
@@ -3106,7 +3092,7 @@ They are collected by 
`tramp-completion-dissect-file-name1'."
        ;; "/method:user@[ipv6" "/[method/user@ipv6"
        (tramp-completion-file-name-structure6
         (list
-         (tramp-compat-rx
+         (rx
           (regexp tramp-prefix-regexp)
           (group (regexp tramp-method-regexp))
           (regexp tramp-postfix-method-regexp)
@@ -3239,7 +3225,7 @@ Either user or host may be nil."
 Either user or host may be nil."
    (let (result
         (regexp
-         (tramp-compat-rx
+         (rx
           bol (group (regexp tramp-host-regexp))
           (? (+ blank) (group (regexp tramp-user-regexp))))))
      (when (re-search-forward regexp (line-end-position) t)
@@ -3255,8 +3241,7 @@ User is always nil."
 (defun tramp-parse-shosts-group ()
    "Return a (user host) tuple allowed to access.
 User is always nil."
-   (tramp-parse-group
-    (tramp-compat-rx bol (group (regexp tramp-host-regexp))) 1 ","))
+   (tramp-parse-group (rx bol (group (regexp tramp-host-regexp))) 1 ","))
 
 (defun tramp-parse-sconfig (filename)
   "Return a list of (user host) tuples allowed to access.
@@ -3267,7 +3252,7 @@ User is always nil."
    "Return a (user host) tuple allowed to access.
 User is always nil."
    (tramp-parse-group
-    (tramp-compat-rx
+    (rx
      (| (: bol (* blank) "Host")
        (: bol (+ nonl)) ;; ???
        (group (regexp tramp-host-regexp))))
@@ -3292,15 +3277,14 @@ User is always nil."
 User is always nil."
   (tramp-parse-shostkeys-sknownhosts
    dirname
-   (tramp-compat-rx
-    bol "key_" (+ digit) "_" (group (regexp tramp-host-regexp)) ".pub" eol)))
+   (rx bol "key_" (+ digit) "_" (group (regexp tramp-host-regexp)) ".pub" 
eol)))
 
 (defun tramp-parse-sknownhosts (dirname)
   "Return a list of (user host) tuples allowed to access.
 User is always nil."
   (tramp-parse-shostkeys-sknownhosts
    dirname
-   (tramp-compat-rx
+   (rx
     bol (group (regexp tramp-host-regexp)) ".ssh-" (| "dss" "rsa") ".pub" 
eol)))
 
 (defun tramp-parse-hosts (filename)
@@ -3312,8 +3296,7 @@ User is always nil."
    "Return a (user host) tuple allowed to access.
 User is always nil."
    (tramp-parse-group
-    (tramp-compat-rx
-     bol (group (| (regexp tramp-ipv6-regexp) (regexp tramp-host-regexp))))
+    (rx bol (group (| (regexp tramp-ipv6-regexp) (regexp tramp-host-regexp))))
     1 (rx blank)))
 
 (defun tramp-parse-passwd (filename)
@@ -3332,7 +3315,7 @@ Host is always \"localhost\"."
    "Return a (user host) tuple allowed to access.
 Host is always \"localhost\"."
    (let (result
-        (regexp (tramp-compat-rx bol (group (regexp tramp-user-regexp)) ":")))
+        (regexp (rx bol (group (regexp tramp-user-regexp)) ":")))
      (when (re-search-forward regexp (line-end-position) t)
        (setq result (list (match-string 1) "localhost")))
      (forward-line 1)
@@ -3383,14 +3366,13 @@ User is always nil."
                     (tramp-parse-putty-group registry-or-dirname)))))
     ;; UNIX case.
     (tramp-parse-shostkeys-sknownhosts
-     registry-or-dirname
-     (tramp-compat-rx bol (group (regexp tramp-host-regexp)) eol))))
+     registry-or-dirname (rx bol (group (regexp tramp-host-regexp)) eol))))
 
 (defun tramp-parse-putty-group (registry)
   "Return a (user host) tuple allowed to access.
 User is always nil."
   (let (result
-       (regexp (tramp-compat-rx (literal registry) "\\" (group (+ nonl)))))
+       (regexp (rx (literal registry) "\\" (group (+ nonl)))))
     (when (re-search-forward regexp (line-end-position) t)
       (setq result (list nil (match-string 1))))
     (forward-line 1)
@@ -3812,8 +3794,7 @@ Let-bind it when necessary.")
       ;; not support tilde expansion.  But users could declare a
       ;; respective connection property.  (Bug#53847)
       (when (string-match
-            (tramp-compat-rx bos "~" (group (* (not "/"))) (group (* nonl)) 
eos)
-            localname)
+            (rx bos "~" (group (* (not "/"))) (group (* nonl)) eos) localname)
        (let ((uname (match-string 1 localname))
              (fname (match-string 2 localname))
              hname)
@@ -3974,9 +3955,7 @@ Let-bind it when necessary.")
           (and
            completion-ignored-extensions
            (string-match-p
-            (tramp-compat-rx
-             (regexp (regexp-opt completion-ignored-extensions)) eos)
-            x)
+            (rx (regexp (regexp-opt completion-ignored-extensions)) eos) x)
            ;; We remember the hit.
            (push x hits-ignored-extensions))))))
      ;; No match.  So we try again for ignored files.
@@ -4007,18 +3986,11 @@ Let-bind it when necessary.")
    ((not (file-exists-p file2)) t)
    ;; Tramp reads and writes timestamps on second level.  So we round
    ;; the timestamps to seconds without fractions.
-   ;; `time-convert' has been introduced with Emacs 27.1.
-   ((fboundp 'time-convert)
-    (time-less-p
-     (tramp-compat-funcall
-      'time-convert
-      (file-attribute-modification-time (file-attributes file2)) 'integer)
-     (tramp-compat-funcall
-      'time-convert
-      (file-attribute-modification-time (file-attributes file1)) 'integer)))
    (t (time-less-p
-       (file-attribute-modification-time (file-attributes file2))
-       (file-attribute-modification-time (file-attributes file1))))))
+       (time-convert
+       (file-attribute-modification-time (file-attributes file2)) 'integer)
+       (time-convert
+       (file-attribute-modification-time (file-attributes file1)) 'integer)))))
 
 (defun tramp-handle-file-readable-p (filename)
   "Like `file-readable-p' for Tramp files."
@@ -4081,9 +4053,8 @@ Let-bind it when necessary.")
    (if (directory-name-p filename) #'file-name-as-directory #'identity)
    ;; Quote properly.
    (funcall
-    (if (tramp-compat-file-name-quoted-p filename)
-       #'tramp-compat-file-name-quote #'identity)
-    (let ((result (tramp-compat-file-name-unquote (expand-file-name filename)))
+    (if (file-name-quoted-p filename) #'file-name-quote #'identity)
+    (let ((result (file-name-unquote (expand-file-name filename)))
          (numchase 0)
          ;; Don't make the following value larger than necessary.
          ;; People expect an error message in a timely fashion when
@@ -4107,7 +4078,7 @@ Let-bind it when necessary.")
                      v2
                      (if (stringp symlink-target)
                          (if (file-remote-p symlink-target)
-                             (tramp-compat-file-name-quote symlink-target 'top)
+                             (file-name-quote symlink-target 'top)
                            (tramp-drop-volume-letter
                             (expand-file-name
                              symlink-target
@@ -4417,53 +4388,49 @@ Parsing the remote \"ps\" output is controlled by
 It is not guaranteed, that all process attributes as described in
 `process-attributes' are returned.  The additional attribute
 `pid' shall be returned always."
-  ;; Since Emacs 27.1.
-  (when (fboundp 'connection-local-criteria-for-default-directory)
-    (with-tramp-file-property vec "/" "process-attributes"
-      (ignore-errors
-        (with-temp-buffer
-          (hack-connection-local-variables-apply
-           (connection-local-criteria-for-default-directory))
-          ;; (pop-to-buffer (current-buffer))
-          (when (zerop
-                 (apply
-                  #'process-file
-                  "ps" nil t nil tramp-process-attributes-ps-args))
-            (let (result res)
-              (goto-char (point-min))
-              (while (not (eobp))
-                ;; (tramp-test-message
-                ;;  "%s" (buffer-substring (point) (line-end-position)))
-                (when (save-excursion
-                        (search-forward-regexp
-                        (rx digit) (line-end-position) 'noerror))
-                  (setq res nil)
-                  (dolist (elt tramp-process-attributes-ps-format)
-                    (push
-                     (cons
-                      (car elt)
-                      (cond
-                       ((eq (cdr elt) 'number) (read (current-buffer)))
-                       ((eq (cdr elt) 'string)
-                        (search-forward-regexp (rx (+ (not blank))))
-                        (match-string 0))
-                       ((numberp (cdr elt))
-                        (search-forward-regexp (rx (+ blank)))
-                        (search-forward-regexp
-                        (rx (+ nonl)) (+ (point) (cdr elt)))
-                        (string-trim (match-string 0)))
-                       ((fboundp (cdr elt))
-                        (funcall (cdr elt)))
-                       ((null (cdr elt))
-                        (search-forward-regexp (rx (+ blank)))
-                        (buffer-substring (point) (line-end-position)))))
-                     res))
-                  ;; `nice' could be `-'.
-                  (setq res (rassq-delete-all '- res))
-                  (push (append res) result))
-                (forward-line))
-              ;; Return result.
-              result)))))))
+  (with-tramp-file-property vec "/" "process-attributes"
+    (ignore-errors
+      (with-temp-buffer
+        (hack-connection-local-variables-apply
+         (connection-local-criteria-for-default-directory))
+        ;; (pop-to-buffer (current-buffer))
+        (when (zerop
+               (apply
+                #'process-file "ps" nil t nil 
tramp-process-attributes-ps-args))
+          (let (result res)
+            (goto-char (point-min))
+            (while (not (eobp))
+              ;; (tramp-test-message
+              ;;  "%s" (buffer-substring (point) (line-end-position)))
+              (when (save-excursion
+                      (search-forward-regexp
+                      (rx digit) (line-end-position) 'noerror))
+                (setq res nil)
+                (dolist (elt tramp-process-attributes-ps-format)
+                  (push
+                   (cons
+                    (car elt)
+                    (cond
+                     ((eq (cdr elt) 'number) (read (current-buffer)))
+                     ((eq (cdr elt) 'string)
+                      (search-forward-regexp (rx (+ (not blank))))
+                      (match-string 0))
+                     ((numberp (cdr elt))
+                      (search-forward-regexp (rx (+ blank)))
+                      (search-forward-regexp (rx (+ nonl)) (+ (point) (cdr 
elt)))
+                      (string-trim (match-string 0)))
+                     ((fboundp (cdr elt))
+                      (funcall (cdr elt)))
+                     ((null (cdr elt))
+                      (search-forward-regexp (rx (+ blank)))
+                      (buffer-substring (point) (line-end-position)))))
+                   res))
+                ;; `nice' could be `-'.
+                (setq res (rassq-delete-all '- res))
+                (push (append res) result))
+              (forward-line))
+            ;; Return result.
+            result))))))
 
 (defun tramp-handle-list-system-processes ()
   "Like `list-system-processes' for Tramp files."
@@ -4624,9 +4591,9 @@ Do not set it manually, it is used buffer-local in 
`tramp-get-lock-pid'.")
                     tramp-prefix-format proxy tramp-postfix-host-format))
             (entry
              (list (and (stringp host-port)
-                        (tramp-compat-rx bol (literal host-port) eol))
+                        (rx bol (literal host-port) eol))
                    (and (stringp user-domain)
-                        (tramp-compat-rx bol (literal user-domain) eol))
+                        (rx bol (literal user-domain) eol))
                    (propertize proxy 'tramp-ad-hoc t))))
        (tramp-message vec 5 "Add %S to `tramp-default-proxies-alist'" entry)
        ;; Add the hop.
@@ -4699,14 +4666,14 @@ Do not set it manually, it is used buffer-local in 
`tramp-get-lock-pid'.")
              (or
               ;; The host name is used for the remote shell command.
               (member
-               "%h" (tramp-compat-flatten-tree
+               "%h" (flatten-tree
                      (tramp-get-method-parameter item 'tramp-login-args)))
               ;; The host name must match previous hop.
               (string-match-p previous-host host))
            (setq tramp-default-proxies-alist saved-tdpa)
            (tramp-user-error
             vec "Host name `%s' does not match `%s'" host previous-host))
-         (setq previous-host (tramp-compat-rx bol (literal host) eol)))))
+         (setq previous-host (rx bol (literal host) eol)))))
 
     ;; Result.
     target-alist))
@@ -4720,7 +4687,7 @@ substitution.  SPEC-LIST is a list of char/value pairs 
used for
   (let ((args (tramp-get-method-parameter vec parameter))
        (spec (apply 'format-spec-make spec-list)))
     ;; Expand format spec.
-    (tramp-compat-flatten-tree
+    (flatten-tree
      (mapcar
       (lambda (x)
        (setq x (mapcar (lambda (y) (format-spec y spec)) x))
@@ -4857,9 +4824,8 @@ substitution.  SPEC-LIST is a list of char/value pairs 
used for
            (setq
             login-args
             (append
-             (tramp-compat-flatten-tree
-              (tramp-get-method-parameter v 'tramp-async-args))
-             (tramp-compat-flatten-tree
+             (flatten-tree (tramp-get-method-parameter v 'tramp-async-args))
+             (flatten-tree
               (mapcar
                (lambda (x) (split-string x " "))
                (tramp-expand-args
@@ -5061,19 +5027,11 @@ support symbolic links."
       (when current-buffer-p
        (barf-if-buffer-read-only)
        (push-mark nil t))
-      ;; `shell-command-save-pos-or-erase' has been introduced with
-      ;; Emacs 27.1.
-      (if (fboundp 'shell-command-save-pos-or-erase)
-         (tramp-compat-funcall
-          'shell-command-save-pos-or-erase current-buffer-p)
-       (setq buffer-read-only nil)
-       (erase-buffer)))
+      (shell-command-save-pos-or-erase current-buffer-p))
 
     (if (integerp asynchronous)
        (let ((tramp-remote-process-environment
-              ;; `async-shell-command-width' has been introduced with
-              ;; Emacs 27.1.
-              (if (natnump (bound-and-true-p async-shell-command-width))
+              (if (natnump async-shell-command-width)
                   (cons (format "COLUMNS=%d"
                                 (bound-and-true-p async-shell-command-width))
                         tramp-remote-process-environment)
@@ -5124,11 +5082,7 @@ support symbolic links."
              (goto-char (prog1 (mark t)
                           (set-marker (mark-marker) (point)
                                       (current-buffer))))
-              ;; `shell-command-set-point-after-cmd' has been
-             ;; introduced with Emacs 27.1.
-             (if (fboundp 'shell-command-set-point-after-cmd)
-                 (tramp-compat-funcall
-                  'shell-command-set-point-after-cmd)))
+             (shell-command-set-point-after-cmd))
          ;; There's some output, display it.
          (when (with-current-buffer output-buffer (> (point-max) (point-min)))
            (display-message-or-buffer output-buffer)))))))
@@ -5136,10 +5090,7 @@ support symbolic links."
 (defun tramp-handle-start-file-process (name buffer program &rest args)
   "Like `start-file-process' for Tramp files.
 BUFFER might be a list, in this case STDERR is separated."
-  ;; `make-process' knows the `:file-handler' argument since Emacs
-  ;; 27.1 only.  Therefore, we invoke it via `tramp-file-name-handler'.
-  (tramp-file-name-handler
-   'make-process
+  (make-process
    :name name
    :buffer (if (consp buffer) (car buffer) buffer)
    :command (and program (cons program args))
@@ -5152,7 +5103,7 @@ BUFFER might be a list, in this case STDERR is separated."
   "Like `substitute-in-file-name' for Tramp files.
 \"//\" and \"/~\" substitute only in the local filename part."
   ;; Check, whether the local part is a quoted file name.
-  (if (tramp-compat-file-name-quoted-p filename)
+  (if (file-name-quoted-p filename)
       filename
     ;; First, we must replace environment variables.
     (setq filename (tramp-replace-environment-variables filename))
@@ -5183,6 +5134,12 @@ BUFFER might be a list, in this case STDERR is 
separated."
 (defconst tramp-time-doesnt-exist '(-1 65535)
   "An invalid time value, used as \"Doesn't exist\" value.")
 
+(defsubst tramp-defined-time (time)
+  "Return TIME or nil (when TIME is not a time spec)."
+  (unless (or (time-equal-p time tramp-time-doesnt-exist)
+             (time-equal-p time tramp-time-dont-know))
+    time))
+
 (defun tramp-handle-set-visited-file-modtime (&optional time-list)
   "Like `set-visited-file-modtime' for Tramp files."
   (unless (buffer-file-name)
@@ -5194,7 +5151,7 @@ BUFFER might be a list, in this case STDERR is separated."
            (or (file-attribute-modification-time
                 (file-attributes (buffer-file-name)))
                tramp-time-doesnt-exist))))
-  (unless (tramp-compat-time-equal-p time-list tramp-time-dont-know)
+  (unless (time-equal-p time-list tramp-time-dont-know)
     (tramp-run-real-handler #'set-visited-file-modtime (list time-list))))
 
 (defun tramp-handle-verify-visited-file-modtime (&optional buf)
@@ -5220,14 +5177,13 @@ of."
 
          (cond
           ;; File exists, and has a known modtime.
-          ((and attr
-                (not (tramp-compat-time-equal-p modtime tramp-time-dont-know)))
+          ((and attr (not (time-equal-p modtime tramp-time-dont-know)))
            (< (abs (tramp-time-diff modtime mt)) 2))
           ;; Modtime has the don't know value.
           (attr t)
           ;; If file does not exist, say it is not modified if and
           ;; only if that agrees with the buffer's record.
-          (t (tramp-compat-time-equal-p mt tramp-time-doesnt-exist))))))))
+          (t (time-equal-p mt tramp-time-doesnt-exist))))))))
 
 (defun tramp-handle-write-region
   (start end filename &optional append visit lockname mustbenew)
@@ -5424,7 +5380,7 @@ Wait, until the connection buffer changes."
        ;; Hide message in buffer.
        (narrow-to-region (point-max) (point-max))
        ;; Wait for new output.
-       (while (not (tramp-compat-ignore-error file-error
+       (while (not (ignore-error file-error
                      (tramp-wait-for-regexp
                       proc 0.1 tramp-security-key-confirmed-regexp)))
          (when (tramp-check-for-regexp proc tramp-security-key-timeout-regexp)
@@ -5756,8 +5712,7 @@ the remote host use line-endings as defined in the 
variable
         (tramp-flush-directory-properties vec "/"))
       (when (buffer-live-p buf)
        (with-current-buffer buf
-          (when (and prompt
-                    (tramp-search-regexp (tramp-compat-rx (literal prompt))))
+          (when (and prompt (tramp-search-regexp (rx (literal prompt))))
            (delete-region (point) (point-max))))))))
 
 (defun tramp-get-inode (vec)
@@ -5942,9 +5897,7 @@ ID-FORMAT valid values are `string' and `integer'."
   (with-tramp-connection-property nil (format "gid-%s" id-format)
     (cond
      ((equal id-format 'integer) (group-gid))
-     ;; `group-name' has been introduced with Emacs 27.1.
-     ((and (fboundp 'group-name) (equal id-format 'string))
-      (tramp-compat-funcall 'group-name (group-gid)))
+     ((equal id-format 'string) (group-name (group-gid)))
      ((file-attribute-group-id (file-attributes "~/" id-format))))))
 
 (defun tramp-get-local-locale (&optional vec)
@@ -5961,7 +5914,7 @@ VEC is used for tracing."
          (while candidates
            (goto-char (point-min))
            (if (string-match-p
-                (tramp-compat-rx bol (literal (car candidates)) (? "\r") eol)
+                (rx bol (literal (car candidates)) (? "\r") eol)
                 (buffer-string))
                (setq locale (car candidates)
                      candidates nil)
@@ -6292,7 +6245,7 @@ this file, if that variable is non-nil."
                 ("|" . "__")
                 ("[" . "_l")
                 ("]" . "_r"))
-              (tramp-compat-file-name-unquote (buffer-file-name)))
+              (file-name-unquote (buffer-file-name)))
              tramp-auto-save-directory)))
          result)
       (prog1 ;; Run plain `make-auto-save-file-name'.
@@ -6321,7 +6274,7 @@ ALIST is of the form ((FROM . TO) ...)."
       (let* ((pr (car alist))
              (from (car pr))
              (to (cdr pr)))
-        (while (string-match (tramp-compat-rx (literal from)) string)
+        (while (string-match (rx (literal from)) string)
           (setq string (replace-match to t t string)))
         (setq alist (cdr alist))))
     string))
@@ -6556,7 +6509,7 @@ T1 and T2 are time values (as returned by `current-time' 
for example)."
 Suppress `shell-file-name'.  This is needed on w32 systems, which
 would use a wrong quoting for local file names.  See `w32-shell-name'."
   (let (shell-file-name)
-    (shell-quote-argument (tramp-compat-file-name-unquote s))))
+    (shell-quote-argument (file-name-unquote s))))
 
 ;; Currently (as of Emacs 20.5), the function `shell-quote-argument'
 ;; does not deal well with newline characters.  Newline is replaced by
@@ -6589,7 +6542,7 @@ Only works for Bourne-like shells."
                   (string= (substring result 0 2) "\\~"))
          (setq result (substring result 1)))
        (replace-regexp-in-string
-        (tramp-compat-rx "\\" (literal tramp-rsh-end-of-line))
+        (rx "\\" (literal tramp-rsh-end-of-line))
         (format "'%s'" tramp-rsh-end-of-line) result)))))
 
 ;;; Signal handling.  This works for remote processes, which have set
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index 7532c64f85..9b271a7cfb 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -7,8 +7,8 @@
 ;; Maintainer: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
 ;; Package: tramp
-;; Version: 2.6.0-pre
-;; Package-Requires: ((emacs "26.1"))
+;; Version: 2.7.0-pre
+;; Package-Requires: ((emacs "27.1"))
 ;; Package-Type: multi
 ;; URL: https://www.gnu.org/software/tramp/
 
@@ -40,7 +40,7 @@
 ;; ./configure" to change them.
 
 ;;;###tramp-autoload
-(defconst tramp-version "2.6.0-pre"
+(defconst tramp-version "2.7.0-pre"
   "This version of Tramp.")
 
 ;;;###tramp-autoload
@@ -55,11 +55,9 @@
          (dir (or (locate-dominating-file (locate-library "tramp") ".git")
                   source-directory))
          debug-on-error)
-      ;; `emacs-repository-get-branch' has been introduced with Emacs 27.1.
-      (with-no-warnings
-       (and (stringp dir) (file-directory-p dir)
-            (executable-find "git")
-            (emacs-repository-get-branch dir)))))
+      (and (stringp dir) (file-directory-p dir)
+          (executable-find "git")
+          (emacs-repository-get-branch dir))))
   "The repository branch of the Tramp sources.")
 
 (defconst tramp-repository-version
@@ -76,9 +74,9 @@
   "The repository revision of the Tramp sources.")
 
 ;; Check for Emacs version.
-(let ((x   (if (not (string-version-lessp emacs-version "26.1"))
+(let ((x   (if (not (string-version-lessp emacs-version "27.1"))
       "ok"
-    (format "Tramp 2.6.0-pre is not fit for %s"
+    (format "Tramp 2.7.0-pre is not fit for %s"
             (replace-regexp-in-string "\n" "" (emacs-version))))))
   (unless (string-equal "ok" x) (error "%s" x)))
 
@@ -104,7 +102,8 @@
          ("2.3.3" . "26.1") ("2.3.3.26.1" . "26.1") ("2.3.5.26.2" . "26.2")
          ("2.3.5.26.3" . "26.3")
          ("2.4.3.27.1" . "27.1") ("2.4.5.27.2" . "27.2")
-         ("2.5.2.28.1" . "28.1") ("2.5.3.28.2" . "28.2")))
+         ("2.5.2.28.1" . "28.1") ("2.5.3.28.2" . "28.2")
+         ("2.6.0.29.1" . "29.1")))
 
 (add-hook 'tramp-unload-hook
          (lambda ()
diff --git a/test/lisp/net/tramp-archive-tests.el 
b/test/lisp/net/tramp-archive-tests.el
index 96c1e78e37..85766f95cd 100644
--- a/test/lisp/net/tramp-archive-tests.el
+++ b/test/lisp/net/tramp-archive-tests.el
@@ -121,12 +121,6 @@ the origin of the temporary TMPFILE, have no write 
permissions."
      (directory-files tmpfile 'full directory-files-no-dot-files-regexp))
     (delete-directory tmpfile)))
 
-(defun tramp-archive--test-emacs27-p ()
-  "Check for Emacs version >= 27.1.
-Some semantics has been changed for there, without new functions or
-variables, so we check the Emacs version directly."
-  (>= emacs-major-version 27))
-
 (ert-deftest tramp-archive-test00-availability ()
   "Test availability of archive file name functions."
   :expected-result (if tramp-archive-enabled :passed :failed)
@@ -615,16 +609,13 @@ This checks also `file-name-as-directory', 
`file-name-directory',
          (with-temp-buffer
            (insert-directory tramp-archive-test-archive nil)
            (goto-char (point-min))
-           (should
-            (looking-at-p
-             (tramp-compat-rx (literal tramp-archive-test-archive)))))
+           (should (looking-at-p (rx (literal tramp-archive-test-archive)))))
          (with-temp-buffer
            (insert-directory tramp-archive-test-archive "-al")
            (goto-char (point-min))
            (should
             (looking-at-p
-             (tramp-compat-rx
-              bol (+ nonl) blank (literal tramp-archive-test-archive) eol))))
+             (rx bol (+ nonl) blank (literal tramp-archive-test-archive) 
eol))))
          (with-temp-buffer
            (insert-directory
             (file-name-as-directory tramp-archive-test-archive)
@@ -877,12 +868,8 @@ This tests also `file-executable-p', `file-writable-p' and 
`set-file-modes'."
 (ert-deftest tramp-archive-test43-file-system-info ()
   "Check that `file-system-info' returns proper values."
   (skip-unless tramp-archive-enabled)
-  ;; Since Emacs 27.1.
-  (skip-unless (fboundp 'file-system-info))
 
-  ;; `file-system-info' exists since Emacs 27.  We don't want to see
-  ;; compiler warnings for older Emacsen.
-  (let ((fsi (with-no-warnings (file-system-info tramp-archive-test-archive))))
+  (let ((fsi (file-system-info tramp-archive-test-archive)))
     (skip-unless fsi)
     (should (and (consp fsi)
                 (= (length fsi) 3)
@@ -895,8 +882,6 @@ This tests also `file-executable-p', `file-writable-p' and 
`set-file-modes'."
   "Check that `tramp-archive' autoloads properly."
   :tags '(:expensive-test)
   (skip-unless tramp-archive-enabled)
-  ;; Autoloading tramp-archive works since Emacs 27.1.
-  (skip-unless (tramp-archive--test-emacs27-p))
 
   ;; tramp-archive is neither loaded at Emacs startup, nor when
   ;; loading a file like "/mock::foo" (which loads Tramp).
@@ -919,7 +904,7 @@ This tests also `file-executable-p', `file-writable-p' and 
`set-file-modes'."
        (dolist (file `("/mock::foo" ,(concat tramp-archive-test-archive 
"foo")))
           (should
            (string-match
-           (tramp-compat-rx
+           (rx
             "tramp-archive loaded: "
             (literal (symbol-name
                       (tramp-archive-file-name-p default-directory)))
@@ -942,8 +927,6 @@ This tests also `file-executable-p', `file-writable-p' and 
`set-file-modes'."
   "Check that `tramp-archive' is loaded lazily, only when needed."
   :tags '(:expensive-test)
   (skip-unless tramp-archive-enabled)
-  ;; Autoloading tramp-archive works since Emacs 27.1.
-  (skip-unless (tramp-archive--test-emacs27-p))
 
   ;; tramp-archive is neither loaded at Emacs startup, nor when
   ;; loading a file like "/foo.tar".  It is loaded only when
@@ -964,7 +947,7 @@ This tests also `file-executable-p', `file-writable-p' and 
`set-file-modes'."
     (dolist (tae '(t nil))
       (should
        (string-match
-       (tramp-compat-rx
+       (rx
         "tramp-archive loaded: nil" (+ ascii)
         "tramp-archive loaded: nil" (+ ascii)
         "tramp-archive loaded: " (literal (symbol-name tae)))
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 6fb9fa1fae..90f6fcd6b1 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -74,14 +74,10 @@
 (defvar tramp-remote-path)
 (defvar tramp-remote-process-environment)
 
-;; Needed for Emacs 26.
-(declare-function with-connection-local-variables "files-x")
 ;; Needed for Emacs 27.
 (defvar lock-file-name-transforms)
 (defvar process-file-return-signal-string)
 (defvar remote-file-name-inhibit-locks)
-(defvar shell-command-dont-erase-buffer)
-;; Needed for Emacs 28.
 (defvar dired-copy-dereference)
 
 ;; `ert-resource-file' was introduced in Emacs 28.1.
@@ -224,7 +220,7 @@ If LOCAL is non-nil, a local file name is returned.
 If QUOTED is non-nil, the local part of the file name is quoted.
 The temporary file is not created."
   (funcall
-   (if quoted #'tramp-compat-file-name-quote #'identity)
+   (if quoted #'file-name-quote #'identity)
    (expand-file-name
     (make-temp-name "tramp-test")
     (if local temporary-file-directory ert-remote-temporary-file-directory))))
@@ -2296,10 +2292,9 @@ This checks also `file-name-as-directory', 
`file-name-directory',
 
     ;; Check `directory-abbrev-alist' abbreviation.
     (let ((directory-abbrev-alist
-           `((,(tramp-compat-rx bos (literal home-dir) "/foo")
-              . ,(concat home-dir "/f"))
-             (,(tramp-compat-rx bos (literal remote-host) "/nowhere")
-              . ,(concat remote-host "/nw")))))
+           `((,(rx bos (literal home-dir) "/foo") . ,(concat home-dir "/f"))
+             (,(rx bos (literal remote-host) "/nowhere")
+             . ,(concat remote-host "/nw")))))
       (should (equal (abbreviate-file-name (concat home-dir "/foo/bar"))
                      (concat remote-host-nohop "~/f/bar")))
       (should (equal (abbreviate-file-name
@@ -2479,17 +2474,14 @@ This checks also `file-name-as-directory', 
`file-name-directory',
              (should (string-equal (buffer-string) "foo")))
 
            ;; Write empty string.  Used for creation of temporary files.
-           ;; Since Emacs 27.1.
-           (when (fboundp 'make-empty-file)
-             (with-no-warnings
-               (should-error
-                (make-empty-file tmp-name)
-                :type 'file-already-exists)
-               (delete-file tmp-name)
-               (make-empty-file tmp-name)
-               (with-temp-buffer
-                 (insert-file-contents tmp-name)
-                 (should (string-equal (buffer-string) "")))))
+           (should-error
+            (make-empty-file tmp-name)
+            :type 'file-already-exists)
+           (delete-file tmp-name)
+           (make-empty-file tmp-name)
+           (with-temp-buffer
+             (insert-file-contents tmp-name)
+             (should (string-equal (buffer-string) "")))
 
            ;; Write partly.
            (with-temp-buffer
@@ -2511,8 +2503,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
                     (string-match-p
                      (if (and (null noninteractive)
                               (or (eq visit t) (null visit) (stringp visit)))
-                         (tramp-compat-rx
-                          bol "Wrote " (literal tmp-name) "\n" eos)
+                         (rx bol "Wrote " (literal tmp-name) "\n" eos)
                        (rx bos))
                      tramp--test-messages))))))
 
@@ -2542,8 +2533,6 @@ This checks also `file-name-as-directory', 
`file-name-directory',
   "Check that `file-precious-flag' is respected with Tramp in use."
   (skip-unless (tramp--test-enabled))
   (skip-unless (tramp--test-sh-p))
-  ;; The bug is fixed in Emacs 27.1.
-  (skip-unless (tramp--test-emacs27-p))
 
   (let* ((tmp-name (tramp--test-make-temp-name))
          (inhibit-message t)
@@ -2626,10 +2615,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
   "Check `copy-file'."
   (skip-unless (tramp--test-enabled))
 
-  ;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
-  (dolist (quoted
-          (if (and (tramp--test-expensive-test-p) (tramp--test-emacs27-p))
-              '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
          (tmp-name2 (tramp--test-make-temp-name nil quoted))
          (tmp-name3 (tramp--test-make-temp-name 'local quoted)))
@@ -2738,10 +2724,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
   "Check `rename-file'."
   (skip-unless (tramp--test-enabled))
 
-  ;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
-  (dolist (quoted
-          (if (and (tramp--test-expensive-test-p) (tramp--test-emacs27-p))
-              '(nil t) '(nil)))
+  (dolist (quoted  (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
          (tmp-name2 (tramp--test-make-temp-name nil quoted))
          (tmp-name3 (tramp--test-make-temp-name 'local quoted)))
@@ -2925,13 +2908,11 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
       (delete-directory tmp-name1 'recursive)
       (should-not (file-directory-p tmp-name1))
 
-      ;; Trashing directories works only since Emacs 27.1.  It doesn't
-      ;; work when `system-move-file-to-trash' is defined (on MS
-      ;; Windows and macOS), for encrypted remote directories and for
-      ;; ange-ftp.
+      ;; Trashing directories doesn't work when
+      ;; `system-move-file-to-trash' is defined (on MS Windows and
+      ;; macOS), for encrypted remote directories and for ange-ftp.
       (when (and (not (fboundp 'system-move-file-to-trash))
-                (not (tramp--test-crypt-p)) (not (tramp--test-ftp-p))
-                (tramp--test-emacs27-p))
+                (not (tramp--test-crypt-p)) (not (tramp--test-ftp-p)))
        (let ((trash-directory (tramp--test-make-temp-name 'local quoted))
              (delete-by-moving-to-trash t))
          (make-directory trash-directory)
@@ -3200,9 +3181,6 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
   ;; (this is performed by `dired').  If FULL is nil, it shows just
   ;; one file.  So we refrain from testing.
   (skip-unless (not (tramp--test-ange-ftp-p)))
-  ;; `insert-directory' of encrypted remote directories works only
-  ;; since Emacs 27.1.
-  (skip-unless (or (not (tramp--test-crypt-p)) (tramp--test-emacs27-p)))
 
   (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let* ((tmp-name1
@@ -3220,26 +3198,23 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
            (with-temp-buffer
              (insert-directory tmp-name1 nil)
              (goto-char (point-min))
-             (should (looking-at-p (tramp-compat-rx (literal tmp-name1)))))
+             (should (looking-at-p (rx (literal tmp-name1)))))
            (with-temp-buffer
              (insert-directory (file-name-as-directory tmp-name1) nil)
              (goto-char (point-min))
              (should
-               (looking-at-p
-                (tramp-compat-rx (literal (file-name-as-directory 
tmp-name1))))))
+               (looking-at-p (rx (literal (file-name-as-directory 
tmp-name1))))))
            (with-temp-buffer
              (insert-directory tmp-name1 "-al")
              (goto-char (point-min))
              (should
-              (looking-at-p
-               (tramp-compat-rx bol (+ nonl) blank (literal tmp-name1) eol))))
+              (looking-at-p (rx bol (+ nonl) blank (literal tmp-name1) eol))))
            (with-temp-buffer
              (insert-directory (file-name-as-directory tmp-name1) "-al")
              (goto-char (point-min))
              (should
               (looking-at-p
-               (tramp-compat-rx
-                bol (+ nonl) blank (literal tmp-name1) "/" eol))))
+               (rx bol (+ nonl) blank (literal tmp-name1) "/" eol))))
            (with-temp-buffer
              (insert-directory
               (file-name-as-directory tmp-name1) "-al" nil 'full-directory-p)
@@ -3300,7 +3275,7 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
           (tmp-name4 (expand-file-name "bar" tmp-name2))
           (ert-remote-temporary-file-directory
            (funcall
-            (if quoted #'tramp-compat-file-name-quote #'identity)
+            (if quoted #'file-name-quote #'identity)
             ert-remote-temporary-file-directory))
           buffer)
       (unwind-protect
@@ -3323,14 +3298,14 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
              (goto-char (point-min))
              (should
               (re-search-forward
-               (tramp-compat-rx
+               (rx
                 (literal
                  (file-relative-name
                   tmp-name1 ert-remote-temporary-file-directory)))))
              (goto-char (point-min))
              (should
               (re-search-forward
-               (tramp-compat-rx
+               (rx
                 (literal
                  (file-relative-name
                   tmp-name2 ert-remote-temporary-file-directory))))))
@@ -3345,14 +3320,14 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
              (goto-char (point-min))
              (should
               (re-search-forward
-               (tramp-compat-rx
+               (rx
                 (literal
                  (file-relative-name
                   tmp-name3 ert-remote-temporary-file-directory)))))
              (goto-char (point-min))
              (should
               (re-search-forward
-               (tramp-compat-rx
+               (rx
                 (literal
                  (file-relative-name
                   tmp-name4
@@ -3375,14 +3350,14 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
              (goto-char (point-min))
              (should
               (re-search-forward
-               (tramp-compat-rx
+               (rx
                 (literal
                  (file-relative-name
                   tmp-name3 ert-remote-temporary-file-directory)))))
              (goto-char (point-min))
              (should
               (re-search-forward
-               (tramp-compat-rx
+               (rx
                 (literal
                  (file-relative-name
                   tmp-name4
@@ -3552,7 +3527,7 @@ This tests also `access-file', `file-readable-p',
              (should
               (string-equal
                (funcall
-                (if quoted #'tramp-compat-file-name-quote #'identity)
+                (if quoted #'file-name-quote #'identity)
                 (file-attribute-type attr))
                (file-remote-p (file-truename tmp-name1) 'localname)))
              (delete-file tmp-name2))
@@ -3616,9 +3591,6 @@ This tests also `access-file', `file-readable-p',
               (cons '(nil "perl" nil)
                     tramp-connection-properties)))
         (progn
-          ;; `ert-test-result-duration' exists since Emacs 27.  It
-          ;; doesn't hurt to call it unconditionally, because
-          ;; `skip-unless' hides the error.
           (skip-unless (< (ert-test-result-duration result) 300))
           (funcall (ert-test-body ert-test)))
        (ert-skip (format "Test `%s' must run before" ',test)))))
@@ -3647,9 +3619,6 @@ This tests also `access-file', `file-readable-p',
                  (nil "id" nil))
                tramp-connection-properties)))
         (progn
-          ;; `ert-test-result-duration' exists since Emacs 27.  It
-          ;; doesn't hurt to call it unconditionally, because
-          ;; `skip-unless' hides the error.
           (skip-unless (< (ert-test-result-duration result) 300))
           (funcall (ert-test-body ert-test)))
        (ert-skip (format "Test `%s' must run before" ',test)))))
@@ -3676,9 +3645,6 @@ This tests also `access-file', `file-readable-p',
                  (nil "readlink" nil))
                tramp-connection-properties)))
         (progn
-          ;; `ert-test-result-duration' exists since Emacs 27.  It
-          ;; doesn't hurt to call it unconditionally, because
-          ;; `skip-unless' hides the error.
           (skip-unless (< (ert-test-result-duration result) 300))
           (funcall (ert-test-body ert-test)))
        (ert-skip (format "Test `%s' must run before" ',test)))))
@@ -3714,9 +3680,9 @@ They might differ only in time attributes or directory 
size."
     ;; few seconds).  We use a test start time minus 10 seconds, in
     ;; order to compensate a possible timestamp resolution higher than
     ;; a second on the remote machine.
-    (when (or (tramp-compat-time-equal-p
+    (when (or (time-equal-p
               (file-attribute-modification-time attr1) tramp-time-dont-know)
-             (tramp-compat-time-equal-p
+             (time-equal-p
               (file-attribute-modification-time attr2) tramp-time-dont-know))
       (setcar (nthcdr 5 attr1) tramp-time-dont-know)
       (setcar (nthcdr 5 attr2) tramp-time-dont-know))
@@ -3727,9 +3693,9 @@ They might differ only in time attributes or directory 
size."
             (float-time (file-attribute-modification-time attr2)))
       (setcar (nthcdr 5 attr2) tramp-time-dont-know))
     ;; Status change time.  Ditto.
-    (when (or (tramp-compat-time-equal-p
+    (when (or (time-equal-p
               (file-attribute-status-change-time attr1) tramp-time-dont-know)
-             (tramp-compat-time-equal-p
+             (time-equal-p
               (file-attribute-status-change-time attr2) tramp-time-dont-know))
       (setcar (nthcdr 6 attr1) tramp-time-dont-know)
       (setcar (nthcdr 6 attr2) tramp-time-dont-know))
@@ -3868,7 +3834,7 @@ This tests also `file-executable-p', `file-writable-p' 
and `set-file-modes'."
              (should
               (string-equal
                (funcall
-                (if quoted #'tramp-compat-file-name-unquote #'identity)
+                (if quoted #'file-name-unquote #'identity)
                 (file-remote-p tmp-name1 'localname))
                (file-symlink-p tmp-name2)))
              ;; Both report the modes of `tmp-name1'.
@@ -3938,7 +3904,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            (should
             (string-equal
              (funcall
-              (if quoted #'tramp-compat-file-name-unquote #'identity)
+              (if quoted #'file-name-unquote #'identity)
               (file-remote-p tmp-name1 'localname))
              (file-symlink-p tmp-name2)))
            (when (tramp--test-expensive-test-p)
@@ -3956,14 +3922,14 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
              (should
               (string-equal
                (funcall
-                (if quoted #'tramp-compat-file-name-unquote #'identity)
+                (if quoted #'file-name-unquote #'identity)
                 (file-remote-p tmp-name1 'localname))
                (file-symlink-p tmp-name2))))
            (make-symbolic-link tmp-name1 tmp-name2 'ok-if-already-exists)
            (should
             (string-equal
              (funcall
-              (if quoted #'tramp-compat-file-name-unquote #'identity)
+              (if quoted #'file-name-unquote #'identity)
               (file-remote-p tmp-name1 'localname))
              (file-symlink-p tmp-name2)))
            ;; If we use the local part of `tmp-name1', it shall still work.
@@ -3973,7 +3939,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            (should
             (string-equal
              (funcall
-              (if quoted #'tramp-compat-file-name-unquote #'identity)
+              (if quoted #'file-name-unquote #'identity)
               (file-remote-p tmp-name1 'localname))
              (file-symlink-p tmp-name2)))
            ;; `tmp-name3' is a local file name.  Therefore, the link
@@ -3993,7 +3959,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            (should
             (string-equal
              (funcall
-              (if quoted #'tramp-compat-file-name-unquote #'identity)
+              (if quoted #'file-name-unquote #'identity)
               (file-remote-p tmp-name1 'localname))
              (file-symlink-p tmp-name5)))
            ;; Check, that files in symlinked directories still work.
@@ -4082,15 +4048,13 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
                       "/[penguin/motd]" "/penguin:motd:")))
              (delete-file tmp-name2)
              (make-symbolic-link
-              (funcall
-               (if quoted #'tramp-compat-file-name-unquote #'identity) penguin)
+              (funcall (if quoted #'file-name-unquote #'identity) penguin)
               tmp-name2)
              (should (file-symlink-p tmp-name2))
              (should
               (string-equal
                (file-truename tmp-name2)
-               (tramp-compat-file-name-quote
-                (concat (file-remote-p tmp-name2) penguin)))))
+               (file-name-quote (concat (file-remote-p tmp-name2) penguin)))))
            ;; `tmp-name3' is a local file name.
            ;; `make-symbolic-link' might not be permitted on w32 systems.
            (unless (tramp--test-windows-nt-p)
@@ -4102,7 +4066,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
              (should
               (string-equal
                (file-truename tmp-name1)
-               (tramp-compat-file-name-unquote (file-truename tmp-name3))))))
+               (file-name-unquote (file-truename tmp-name3))))))
 
        ;; Cleanup.
        (ignore-errors
@@ -4175,7 +4139,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
       (let* ((dir1
              (directory-file-name
               (funcall
-               (if quoted #'tramp-compat-file-name-quote #'identity)
+               (if quoted #'file-name-quote #'identity)
                ert-remote-temporary-file-directory)))
             (dir2 (file-name-as-directory dir1)))
        (should (string-equal (file-truename dir1) (expand-file-name dir1)))
@@ -4204,12 +4168,12 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
            (skip-unless (set-file-times tmp-name1 (seconds-to-time 60)))
            ;; Dumb remote shells without perl(1) or stat(1) are not
            ;; able to return the date correctly.  They say "don't know".
-           (unless (tramp-compat-time-equal-p
+           (unless (time-equal-p
                     (file-attribute-modification-time
                      (file-attributes tmp-name1))
                     tramp-time-dont-know)
              (should
-              (tramp-compat-time-equal-p
+              (time-equal-p
                 (file-attribute-modification-time (file-attributes tmp-name1))
                (seconds-to-time 60)))
              ;; Setting the time for not existing files shall fail.
@@ -4228,7 +4192,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
                (with-no-warnings
                  (set-file-times tmp-name1 (seconds-to-time 60) 'nofollow)
                  (should
-                  (tramp-compat-time-equal-p
+                  (time-equal-p
                     (file-attribute-modification-time
                     (file-attributes tmp-name1))
                    (seconds-to-time 60)))))))
@@ -4274,10 +4238,7 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
   (skip-unless (file-acl ert-remote-temporary-file-directory))
   (skip-unless (not (tramp--test-crypt-p)))
 
-  ;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
-  (dolist (quoted
-          (if (and (tramp--test-expensive-test-p) (tramp--test-emacs27-p))
-              '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
          (tmp-name2 (tramp--test-make-temp-name nil quoted))
          (tmp-name3 (tramp--test-make-temp-name 'local quoted)))
@@ -4354,10 +4315,7 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
               '(nil nil nil nil))))
   (skip-unless (not (tramp--test-crypt-p)))
 
-  ;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
-  (dolist (quoted
-          (if (and (tramp--test-expensive-test-p) (tramp--test-emacs27-p))
-              '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
          (tmp-name2 (tramp--test-make-temp-name nil quoted))
          (tmp-name3 (tramp--test-make-temp-name 'local quoted)))
@@ -4862,9 +4820,10 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
       (unless (tramp--test-sshfs-p)
        (unwind-protect
            (with-temp-buffer
-           (setq command '("cat")
-                 proc
-                 (apply #'start-file-process "test4" (current-buffer) command))
+             (setq command '("cat")
+                   proc
+                   (apply
+                    #'start-file-process "test4" (current-buffer) command))
              (should (processp proc))
              (should (equal (process-status proc) 'run))
              (should (equal (process-get proc 'remote-command) command))
@@ -4884,12 +4843,7 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
       ;; Process connection type.
       (when (and (tramp--test-sh-p)
                 (not (tramp-direct-async-process-p))
-                ;; `executable-find' has changed the number of
-                ;; parameters in Emacs 27.1, so we use `apply' for
-                ;; older Emacsen.
-                (ignore-errors
-                  (with-no-warnings
-                    (apply #'executable-find '("hexdump" remote)))))
+                (executable-find "hexdump" 'remote))
        (dolist (process-connection-type '(nil pipe t pty))
          (unwind-protect
              (with-temp-buffer
@@ -4946,33 +4900,29 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
   "Define ert test `TEST-direct-async' for direct async processes.
 If UNSTABLE is non-nil, the test is tagged as `:unstable'."
   (declare (indent 1))
-  ;; `make-process' supports file name handlers since Emacs 27.  We
-  ;; cannot use `tramp--test-always' during compilation of the macro.
-  (when (let ((file-name-handler-alist '(("" . (lambda (&rest _) t)))))
-         (ignore-errors (make-process :file-handler t)))
-    `(ert-deftest ,(intern (concat (symbol-name test) "-direct-async")) ()
-       ;; This is the docstring.  However, it must be expanded to a
-       ;; string inside the macro.  No idea.
-       ;; (concat (ert-test-documentation (get ',test 'ert--test))
-       ;;         "\nUse direct async process.")
-       :tags (append '(:expensive-test :tramp-asynchronous-processes)
-                    (and ,unstable '(:unstable)))
-       (skip-unless (tramp--test-enabled))
-       (let ((default-directory ert-remote-temporary-file-directory)
-            (ert-test (ert-get-test ',test))
-            (tramp-connection-properties
-             (cons '(nil "direct-async-process" t)
-                   tramp-connection-properties)))
-        (skip-unless (tramp-direct-async-process-p))
-        ;; We do expect an established connection already,
-        ;; `file-truename' does it by side-effect.  Suppress
-        ;; `tramp--test-enabled', in order to keep the connection.
-        ;; Suppress "Process ... finished" messages.
-        (cl-letf (((symbol-function #'tramp--test-enabled) 
#'tramp--test-always)
-                  ((symbol-function #'internal-default-process-sentinel)
-                   #'ignore))
-          (file-truename ert-remote-temporary-file-directory)
-          (funcall (ert-test-body ert-test)))))))
+  `(ert-deftest ,(intern (concat (symbol-name test) "-direct-async")) ()
+     ;; This is the docstring.  However, it must be expanded to a
+     ;; string inside the macro.  No idea.
+     ;; (concat (ert-test-documentation (get ',test 'ert--test))
+     ;;         "\nUse direct async process.")
+     :tags (append '(:expensive-test :tramp-asynchronous-processes)
+                  (and ,unstable '(:unstable)))
+     (skip-unless (tramp--test-enabled))
+     (let ((default-directory ert-remote-temporary-file-directory)
+          (ert-test (ert-get-test ',test))
+          (tramp-connection-properties
+           (cons '(nil "direct-async-process" t)
+                 tramp-connection-properties)))
+       (skip-unless (tramp-direct-async-process-p))
+       ;; We do expect an established connection already,
+       ;; `file-truename' does it by side-effect.  Suppress
+       ;; `tramp--test-enabled', in order to keep the connection.
+       ;; Suppress "Process ... finished" messages.
+       (cl-letf (((symbol-function #'tramp--test-enabled) #'tramp--test-always)
+                ((symbol-function #'internal-default-process-sentinel)
+                 #'ignore))
+        (file-truename ert-remote-temporary-file-directory)
+        (funcall (ert-test-body ert-test))))))
 
 (tramp--test-deftest-direct-async-process tramp-test29-start-file-process)
 
@@ -4983,24 +4933,21 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
                      '(:unstable)))
   (skip-unless (tramp--test-enabled))
   (skip-unless (tramp--test-supports-processes-p))
-  ;; `make-process' supports file name handlers since Emacs 27.
-  (skip-unless (tramp--test-emacs27-p))
 
   (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let ((default-directory ert-remote-temporary-file-directory)
          (tmp-name (tramp--test-make-temp-name nil quoted))
          kill-buffer-query-functions command proc)
-      (with-no-warnings (should-not (make-process)))
+      (should-not (make-process))
 
       ;; Simple process.
       (unwind-protect
          (with-temp-buffer
            (setq command '("cat")
                  proc
-                 (with-no-warnings
-                   (make-process
-                    :name "test1" :buffer (current-buffer) :command command
-                    :file-handler t)))
+                 (make-process
+                  :name "test1" :buffer (current-buffer) :command command
+                  :file-handler t))
            (should (processp proc))
            (should (equal (process-status proc) 'run))
            (should (equal (process-get proc 'remote-command) command))
@@ -5022,10 +4969,9 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
            (should (file-exists-p tmp-name))
            (setq command `("cat" ,(file-name-nondirectory tmp-name))
                  proc
-                 (with-no-warnings
-                   (make-process
-                    :name "test2" :buffer (current-buffer) :command command
-                    :file-handler t)))
+                 (make-process
+                  :name "test2" :buffer (current-buffer) :command command
+                  :file-handler t))
            (should (processp proc))
            (should (equal (process-get proc 'remote-command) command))
            ;; Read output.
@@ -5044,13 +4990,12 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
          (with-temp-buffer
            (setq command '("cat")
                  proc
-                 (with-no-warnings
-                   (make-process
-                    :name "test3" :buffer (current-buffer) :command command
-                    :filter
-                    (lambda (p s)
-                      (with-current-buffer (process-buffer p) (insert s)))
-                    :file-handler t)))
+                 (make-process
+                  :name "test3" :buffer (current-buffer) :command command
+                  :filter
+                  (lambda (p s)
+                    (with-current-buffer (process-buffer p) (insert s)))
+                  :file-handler t))
            (should (processp proc))
            (should (equal (process-status proc) 'run))
            (should (equal (process-get proc 'remote-command) command))
@@ -5071,11 +5016,9 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
            (with-temp-buffer
              (setq command '("cat")
                    proc
-                   (with-no-warnings
-                     (make-process
-                      :name "test4" :buffer (current-buffer) :command command
-                      :filter t
-                      :file-handler t)))
+                   (make-process
+                    :name "test4" :buffer (current-buffer) :command command
+                    :filter t :file-handler t))
              (should (processp proc))
              (should (equal (process-status proc) 'run))
              (should (equal (process-get proc 'remote-command) command))
@@ -5096,13 +5039,12 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
          (with-temp-buffer
            (setq command '("cat")
                  proc
-                 (with-no-warnings
-                   (make-process
-                    :name "test5" :buffer (current-buffer) :command command
-                    :sentinel
-                    (lambda (p s)
-                      (with-current-buffer (process-buffer p) (insert s)))
-                    :file-handler t)))
+                 (make-process
+                  :name "test5" :buffer (current-buffer) :command command
+                  :sentinel
+                  (lambda (p s)
+                    (with-current-buffer (process-buffer p) (insert s)))
+                  :file-handler t))
            (should (processp proc))
            (should (equal (process-status proc) 'run))
            (should (equal (process-get proc 'remote-command) command))
@@ -5128,11 +5070,9 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
              (with-temp-buffer
                (setq command '("cat" "/does-not-exist")
                      proc
-                     (with-no-warnings
-                       (make-process
-                        :name "test6" :buffer (current-buffer) :command  
command
-                        :stderr stderr
-                        :file-handler t)))
+                     (make-process
+                      :name "test6" :buffer (current-buffer) :command  command
+                      :stderr stderr :file-handler t))
                (should (processp proc))
                (should (equal (process-get proc 'remote-command) command))
                ;; Read output.
@@ -5161,11 +5101,9 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
            (with-temp-buffer
              (setq command '("cat" "/does-not-exist")
                    proc
-                   (with-no-warnings
-                     (make-process
-                      :name "test7" :buffer (current-buffer) :command command
-                      :stderr tmp-name
-                      :file-handler t)))
+                   (make-process
+                    :name "test7" :buffer (current-buffer) :command command
+                    :stderr tmp-name :file-handler t))
              (should (processp proc))
              (should (equal (process-get proc 'remote-command) command))
              ;; Read stderr.
@@ -5186,12 +5124,7 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
       ;; Process connection type.
       (when (and (tramp--test-sh-p)
                 (not (tramp-direct-async-process-p))
-                ;; `executable-find' has changed the number of
-                ;; parameters in Emacs 27.1, so we use `apply' for
-                ;; older Emacsen.
-                (ignore-errors
-                  (with-no-warnings
-                    (apply #'executable-find '("hexdump" remote)))))
+                (executable-find "hexdump" 'remote))
        (dolist (connection-type '(nil pipe t pty))
          ;; `process-connection-type' is taken when
          ;; `:connection-type' is nil.
@@ -5201,15 +5134,14 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
                (with-temp-buffer
                  (setq command '("hexdump" "-v" "-e" "/1 \"%02X\n\"")
                        proc
-                       (with-no-warnings
-                         (make-process
-                          :name
-                          (format "test8-%s-%s"
-                                  connection-type process-connection-type)
-                          :buffer (current-buffer)
-                          :connection-type connection-type
-                          :command command
-                          :file-handler t)))
+                       (make-process
+                        :name
+                        (format "test8-%s-%s"
+                                connection-type process-connection-type)
+                        :buffer (current-buffer)
+                        :connection-type connection-type
+                        :command command
+                        :file-handler t))
                  (should (processp proc))
                  (should (equal (process-status proc) 'run))
                  (should (equal (process-get proc 'remote-command) command))
@@ -5245,8 +5177,6 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
   (skip-unless (tramp--test-sh-p))
   (skip-unless (not (tramp--test-windows-nt-p)))
   (skip-unless (not (tramp--test-crypt-p)))
-  ;; Since Emacs 27.1.
-  (skip-unless (macrop 'with-connection-local-variables))
 
   ;; We must use `file-truename' for the temporary directory, in
   ;; order to establish the connection prior running an asynchronous
@@ -5288,8 +5218,6 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
   (skip-unless (tramp--test-sh-p))
   (skip-unless (not (tramp--test-windows-nt-p)))
   (skip-unless (not (tramp--test-crypt-p)))
-  ;; Since Emacs 27.1.
-  (skip-unless (macrop 'with-connection-local-variables))
   ;; Since Emacs 29.1.
   (skip-unless (boundp 'signal-process-functions))
 
@@ -5416,11 +5344,9 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
 INPUT, if non-nil, is a string sent to the process."
   (let ((proc (async-shell-command command output-buffer error-buffer))
        (delete-exited-processes t))
-    ;; Since Emacs 27.1.
-    (when (macrop 'with-connection-local-variables)
-      (should (equal (process-get proc 'remote-command)
-                    (with-connection-local-variables
-                     `(,shell-file-name ,shell-command-switch ,command)))))
+    (should (equal (process-get proc 'remote-command)
+                  (with-connection-local-variables
+                   `(,shell-file-name ,shell-command-switch ,command))))
     (cl-letf (((symbol-function #'shell-command-sentinel) #'ignore))
       (when (stringp input)
        (process-send-string proc input))
@@ -5441,10 +5367,6 @@ INPUT, if non-nil, is a string sent to the process."
   :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
   (skip-unless (tramp--test-supports-processes-p))
-  ;; Prior Emacs 27, `shell-file-name' was hard coded as "/bin/sh" for
-  ;; remote processes in Emacs.  That doesn't work for tramp-adb.el.
-  (when (tramp--test-adb-p)
-    (skip-unless (tramp--test-emacs27-p)))
 
   (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let ((tmp-name (tramp--test-make-temp-name nil quoted))
@@ -5512,7 +5434,7 @@ INPUT, if non-nil, is a string sent to the process."
              (should
               (string-match-p
                ;; Some shells echo, for example the "adb" or "docker" methods.
-               (tramp-compat-rx
+               (rx
                 bos (** 1 2 (literal (file-name-nondirectory tmp-name)) "\n")
                 eos)
                (buffer-string))))
@@ -5520,10 +5442,8 @@ INPUT, if non-nil, is a string sent to the process."
          ;; Cleanup.
          (ignore-errors (delete-file tmp-name))))))
 
-  ;; Test `async-shell-command-width'.  It exists since Emacs 26.1,
-  ;; but seems to work since Emacs 27.1 only.
-  (when (and (tramp--test-asynchronous-processes-p)
-            (tramp--test-sh-p) (tramp--test-emacs27-p))
+  ;; Test `async-shell-command-width'.
+  (when (and (tramp--test-asynchronous-processes-p) (tramp--test-sh-p))
     (let* ((async-shell-command-width 1024)
           (default-directory ert-remote-temporary-file-directory)
           (cols (ignore-errors
@@ -5543,8 +5463,6 @@ INPUT, if non-nil, is a string sent to the process."
   (skip-unless (tramp--test-enabled))
   (skip-unless nil)
   (skip-unless (tramp--test-supports-processes-p))
-  ;; Prior Emacs 27, `shell-command-dont-erase-buffer' wasn't working properly.
-  (skip-unless (tramp--test-emacs27-p))
 
   ;; (message "   s-c-d-e-b current-buffer buffer-string point")
   ;; (message "===============================================")
@@ -5719,8 +5637,7 @@ INPUT, if non-nil, is a string sent to the process."
        ;; Variable is set.
        (should
         (string-match-p
-         (tramp-compat-rx (literal envvar))
-         (funcall this-shell-command-to-string "set"))))
+         (rx (literal envvar)) (funcall this-shell-command-to-string "set"))))
 
       (unless (tramp-direct-async-process-p)
        ;; We force a reconnect, in order to have a clean environment.
@@ -5746,7 +5663,7 @@ INPUT, if non-nil, is a string sent to the process."
            ;; Variable is unset.
            (should-not
             (string-match-p
-             (tramp-compat-rx (literal envvar))
+             (rx (literal envvar))
              ;; We must remove PS1, the output is truncated otherwise.
              ;; We must suppress "_=VAR...".
              (funcall
@@ -5791,13 +5708,10 @@ INPUT, if non-nil, is a string sent to the process."
     (dolist (dir '("/mock:localhost#11111:" "/mock:localhost#22222:"))
       (tramp-cleanup-connection (tramp-dissect-file-name dir)))))
 
-;; Connection-local variables are enabled per default since Emacs 27.1.
 (ert-deftest tramp-test34-connection-local-variables ()
   "Check that connection-local variables are enabled."
   :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
-  ;; Since Emacs 27.1.
-  (skip-unless (macrop 'with-connection-local-variables))
 
   (let* ((default-directory ert-remote-temporary-file-directory)
         (tmp-name1 (tramp--test-make-temp-name))
@@ -5861,19 +5775,12 @@ INPUT, if non-nil, is a string sent to the process."
   :tags '(:expensive-test :tramp-asynchronous-processes)
   (skip-unless (tramp--test-enabled))
   (skip-unless (tramp--test-supports-processes-p))
-  ;; Prior Emacs 27, `shell-file-name' was hard coded as "/bin/sh" for
-  ;; remote processes in Emacs.  That doesn't work for tramp-adb.el.
-  (when (tramp--test-adb-p)
-    (skip-unless (tramp--test-emacs27-p)))
 
   (let ((default-directory ert-remote-temporary-file-directory)
        explicit-shell-file-name kill-buffer-query-functions
        connection-local-profile-alist connection-local-criteria-alist)
     (unwind-protect
        (progn
-         ;; `shell-mode' would ruin our test, because it deletes all
-         ;; buffer local variables.  Not needed in Emacs 27.1.
-         (put 'explicit-shell-file-name 'permanent-local t)
          (connection-local-set-profile-variables
           'remote-sh
           `((explicit-shell-file-name . ,(tramp--test-shell-file-name))
@@ -5904,29 +5811,24 @@ INPUT, if non-nil, is a string sent to the process."
       (put 'explicit-shell-file-name 'permanent-local nil)
       (kill-buffer "*shell*"))))
 
-;; `exec-path' was introduced in Emacs 27.1.  `executable-find' has
-;; changed the number of parameters, so we use `apply' for older
-;; Emacsen.
 (ert-deftest tramp-test35-exec-path ()
   "Check `exec-path' and `executable-find'."
   (skip-unless (tramp--test-enabled))
   (skip-unless (tramp--test-supports-processes-p))
   (skip-unless (tramp--test-supports-set-file-modes-p))
-  ;; Since Emacs 27.1.
-  (skip-unless (fboundp 'exec-path))
 
   (let ((tmp-name (tramp--test-make-temp-name))
        (default-directory ert-remote-temporary-file-directory))
     (unwind-protect
        (progn
-         (should (consp (with-no-warnings (exec-path))))
+         (should (consp (exec-path)))
          ;; Last element is the `exec-directory'.
          (should
           (string-equal
-           (car (last (with-no-warnings (exec-path))))
+           (car (last (exec-path)))
            (file-remote-p default-directory 'localname)))
          ;; The shell "sh" shall always exist.
-         (should (apply #'executable-find '("sh" remote)))
+         (should (executable-find "sh" 'remote))
          ;; Since the last element in `exec-path' is the current
          ;; directory, an executable file in that directory will be
          ;; found.
@@ -5937,32 +5839,25 @@ INPUT, if non-nil, is a string sent to the process."
          (should (file-executable-p tmp-name))
          (should
           (string-equal
-           (apply
-            #'executable-find `(,(file-name-nondirectory tmp-name) remote))
+           (executable-find (file-name-nondirectory tmp-name) 'remote)
            (file-remote-p tmp-name 'localname)))
          (should-not
-          (apply
-           #'executable-find
-           `(,(concat (file-name-nondirectory tmp-name) "foo") remote))))
+          (executable-find
+           (concat (file-name-nondirectory tmp-name) "foo") 'remote)))
 
       ;; Cleanup.
       (ignore-errors (delete-file tmp-name)))))
 
 ;; This test is inspired by Bug#33781.
-;; `exec-path' was introduced in Emacs 27.1.  `executable-find' has
-;; changed the number of parameters, so we use `apply' for older
-;; Emacsen.
 (ert-deftest tramp-test35-remote-path ()
   "Check loooong `tramp-remote-path'."
   (skip-unless (tramp--test-enabled))
   (skip-unless (tramp--test-sh-p))
   (skip-unless (not (tramp--test-crypt-p)))
-  ;; Since Emacs 27.1.
-  (skip-unless (fboundp 'exec-path))
 
   (let* ((tmp-name (tramp--test-make-temp-name))
         (default-directory ert-remote-temporary-file-directory)
-         (orig-exec-path (with-no-warnings (exec-path)))
+         (orig-exec-path (exec-path))
          (tramp-remote-path tramp-remote-path)
         (orig-tramp-remote-path tramp-remote-path)
         path)
@@ -5972,14 +5867,13 @@ INPUT, if non-nil, is a string sent to the process."
           (setq tramp-remote-path
                 (cons (file-remote-p tmp-name 'localname) tramp-remote-path))
           (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password)
-          (should (equal (with-no-warnings (exec-path)) orig-exec-path))
+          (should (equal (exec-path) orig-exec-path))
           (setq tramp-remote-path orig-tramp-remote-path)
 
           ;; Double entries are removed.
           (setq tramp-remote-path (append '("/" "/") tramp-remote-path))
           (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password)
-          (should
-          (equal (with-no-warnings (exec-path)) (cons "/" orig-exec-path)))
+          (should (equal (exec-path) (cons "/" orig-exec-path)))
           (setq tramp-remote-path orig-tramp-remote-path)
 
           ;; We make a super long `tramp-remote-path'.
@@ -5997,7 +5891,7 @@ INPUT, if non-nil, is a string sent to the process."
                     `(,(file-remote-p dir 'localname))
                     (last orig-exec-path)))))
           (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password)
-          (should (equal (with-no-warnings (exec-path)) orig-exec-path))
+          (should (equal (exec-path) orig-exec-path))
           ;; Ignore trailing newline.
          (setq path (substring (shell-command-to-string "echo $PATH") nil -1))
          ;; The shell doesn't handle such long strings.
@@ -6009,7 +5903,7 @@ INPUT, if non-nil, is a string sent to the process."
             (string-equal
              path (mapconcat #'identity (butlast orig-exec-path) ":"))))
          ;; The shell "sh" shall always exist.
-         (should (apply #'executable-find '("sh" remote))))
+         (should (executable-find "sh" 'remote)))
 
       ;; Cleanup.
       (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password)
@@ -6129,7 +6023,7 @@ INPUT, if non-nil, is a string sent to the process."
                 (string-equal
                  (make-auto-save-file-name)
                  (funcall
-                  (if quoted #'tramp-compat-file-name-quote #'identity)
+                  (if quoted #'file-name-quote #'identity)
                   (expand-file-name
                    (format "#%s#" (file-name-nondirectory tmp-name1))
                    ert-remote-temporary-file-directory))))))
@@ -6154,7 +6048,7 @@ INPUT, if non-nil, is a string sent to the process."
                         ("|" . "__")
                         ("[" . "_l")
                         ("]" . "_r"))
-                      (tramp-compat-file-name-unquote tmp-name1)))
+                      (file-name-unquote tmp-name1)))
                     tmp-name2)))
                  (should (file-directory-p tmp-name2)))))
 
@@ -6178,7 +6072,7 @@ INPUT, if non-nil, is a string sent to the process."
                         ("|" . "__")
                         ("[" . "_l")
                         ("]" . "_r"))
-                      (tramp-compat-file-name-unquote tmp-name1)))
+                      (file-name-unquote tmp-name1)))
                     tmp-name2)))
                  (should (file-directory-p tmp-name2)))))
 
@@ -6234,7 +6128,7 @@ INPUT, if non-nil, is a string sent to the process."
              (find-backup-file-name tmp-name1)
              (list
               (funcall
-               (if quoted #'tramp-compat-file-name-quote #'identity)
+               (if quoted #'file-name-quote #'identity)
                (expand-file-name
                 (format "%s~" (file-name-nondirectory tmp-name1))
                 ert-remote-temporary-file-directory)))))))
@@ -6248,7 +6142,7 @@ INPUT, if non-nil, is a string sent to the process."
              (find-backup-file-name tmp-name1)
              (list
               (funcall
-               (if quoted #'tramp-compat-file-name-quote #'identity)
+               (if quoted #'file-name-quote #'identity)
                (expand-file-name
                 (format
                  "%s~"
@@ -6277,7 +6171,7 @@ INPUT, if non-nil, is a string sent to the process."
                (find-backup-file-name tmp-name1)
                (list
                 (funcall
-                 (if quoted #'tramp-compat-file-name-quote #'identity)
+                 (if quoted #'file-name-quote #'identity)
                  (expand-file-name
                   (format
                    "%s~"
@@ -6308,7 +6202,7 @@ INPUT, if non-nil, is a string sent to the process."
                (find-backup-file-name tmp-name1)
                (list
                 (funcall
-                 (if quoted #'tramp-compat-file-name-quote #'identity)
+                 (if quoted #'file-name-quote #'identity)
                  (expand-file-name
                   (format
                    "%s~"
@@ -6566,7 +6460,6 @@ INPUT, if non-nil, is a string sent to the process."
            (tramp-cleanup-connection
             tramp-test-vec 'keep-debug 'keep-password)))))))
 
-;; The functions were introduced in Emacs 26.1.
 (ert-deftest tramp-test40-make-nearby-temp-file ()
   "Check `make-nearby-temp-file' and `temporary-file-directory'."
   (skip-unless (tramp--test-enabled))
@@ -6598,12 +6491,6 @@ INPUT, if non-nil, is a string sent to the process."
     (delete-directory tmp-file)
     (should-not (file-exists-p tmp-file))))
 
-(defun tramp--test-emacs27-p ()
-  "Check for Emacs version >= 27.1.
-Some semantics has been changed for there, without new functions
-or variables, so we check the Emacs version directly."
-  (>= emacs-major-version 27))
-
 (defun tramp--test-emacs28-p ()
   "Check for Emacs version >= 28.1.
 Some semantics has been changed for there, without new functions
@@ -6638,7 +6525,7 @@ This is used in tests which we don't want to tag
                          :body nil :tags '(:tramp-asynchronous-processes))))
    ;; tramp-adb.el cannot apply multi-byte commands.
    (not (and (tramp--test-adb-p)
-            (string-match-p (tramp-compat-rx multibyte) default-directory)))))
+            (string-match-p (rx multibyte) default-directory)))))
 
 (defun tramp--test-crypt-p ()
   "Check, whether the remote directory is encrypted."
@@ -6802,10 +6689,7 @@ This requires restrictions of file name syntax."
 
 (defun tramp--test-check-files (&rest files)
   "Run a simple but comprehensive test over every file in FILES."
-  ;; `filename-non-special' has been fixed in Emacs 27.1, see Bug#29579.
-  (dolist (quoted
-          (if (and (tramp--test-expensive-test-p) (tramp--test-emacs27-p))
-              '(nil t) '(nil)))
+  (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     ;; We must use `file-truename' for the temporary directory,
     ;; because it could be located on a symlinked directory.  This
     ;; would let the test fail.
@@ -6855,7 +6739,7 @@ This requires restrictions of file name syntax."
                  (should
                   (string-equal
                    (funcall
-                    (if quoted #'tramp-compat-file-name-quote #'identity)
+                    (if quoted #'file-name-quote #'identity)
                     (file-attribute-type (file-attributes file3)))
                    (file-remote-p (file-truename file1) 'localname)))
                  ;; Check file contents.
@@ -6946,14 +6830,14 @@ This requires restrictions of file name syntax."
                    (should
                     (string-equal
                      (caar (directory-files-and-attributes
-                            file1 nil (tramp-compat-rx (literal elt1))))
+                            file1 nil (rx (literal elt1))))
                      elt1))
                    (should
                     (string-equal
                      (funcall
-                      (if quoted #'tramp-compat-file-name-quote #'identity)
+                      (if quoted #'file-name-quote #'identity)
                       (cadr (car (directory-files-and-attributes
-                                  file1 nil (tramp-compat-rx (literal 
elt1))))))
+                                  file1 nil (rx (literal elt1))))))
                      (file-remote-p (file-truename file2) 'localname)))
                    (delete-file file3)
                    (should-not (file-exists-p file3))))
@@ -6962,15 +6846,7 @@ This requires restrictions of file name syntax."
                ;; `default-directory' with special characters.  See
                ;; Bug#53846.
                (when (and (tramp--test-expensive-test-p)
-                          (tramp--test-supports-processes-p)
-                          ;; Prior Emacs 27, `shell-file-name' was
-                          ;; hard coded as "/bin/sh" for remote
-                          ;; processes in Emacs.  That doesn't work
-                          ;; for tramp-adb.el.  tramp-sshfs.el times
-                          ;; out for older Emacsen, reason unknown.
-                          (or (and (not (tramp--test-adb-p))
-                                   (not (tramp--test-sshfs-p)))
-                              (tramp--test-emacs27-p)))
+                          (tramp--test-supports-processes-p))
                  (let ((default-directory file1))
                    (dolist (this-shell-command
                             (append
@@ -7008,7 +6884,7 @@ This requires restrictions of file name syntax."
                    (goto-char (point-min))
                    (should
                     (re-search-forward
-                     (tramp-compat-rx
+                     (rx
                       bol (literal envvar)
                       "=" (literal (getenv envvar)) eol))))))))
 
@@ -7154,13 +7030,8 @@ This requires restrictions of file name syntax."
 (ert-deftest tramp-test43-file-system-info ()
   "Check that `file-system-info' returns proper values."
   (skip-unless (tramp--test-enabled))
-  ;; Since Emacs 27.1.
-  (skip-unless (fboundp 'file-system-info))
 
-  ;; `file-system-info' exists since Emacs 27.1.  We don't want to see
-  ;; compiler warnings for older Emacsen.
-  (when-let ((fsi (with-no-warnings
-                   (file-system-info ert-remote-temporary-file-directory))))
+  (when-let ((fsi (file-system-info ert-remote-temporary-file-directory)))
     (should (consp fsi))
     (should (= (length fsi) 3))
     (dotimes (i (length fsi))
@@ -7216,10 +7087,6 @@ process sentinels.  They shall not disturb each other."
                      '(:unstable)))
   (skip-unless (tramp--test-enabled))
   (skip-unless (tramp--test-supports-processes-p))
-  ;; Prior Emacs 27, `shell-file-name' was hard coded as "/bin/sh" for
-  ;; remote processes in Emacs.  That doesn't work for tramp-adb.el.
-  (when (tramp--test-adb-p)
-    (skip-unless (tramp--test-emacs27-p)))
   (skip-unless (not (tramp--test-docker-p)))
   (skip-unless (not (tramp--test-telnet-p)))
   (skip-unless (not (tramp--test-sshfs-p)))
@@ -7552,7 +7419,7 @@ process sentinels.  They shall not disturb each other."
     (dolist (tm '(t nil))
       (should
        (string-match-p
-       (tramp-compat-rx
+       (rx
         "Tramp loaded: nil" (+ (any "\n\r"))
         "Tramp loaded: nil" (+ (any "\n\r"))
         "Tramp loaded: " (literal (symbol-name tm)) (+ (any "\n\r")))
@@ -7600,7 +7467,7 @@ process sentinels.  They shall not disturb each other."
            (tramp-cleanup-all-connections))"))
     (should
      (string-match-p
-      (tramp-compat-rx
+      (rx
        "Loading "
        (literal
         (expand-file-name



reply via email to

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