emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/tramp 491c6bb: Tramp ELPA version 2.4.2.5 released


From: Michael Albinus
Subject: [elpa] externals/tramp 491c6bb: Tramp ELPA version 2.4.2.5 released
Date: Fri, 29 Nov 2019 07:18:07 -0500 (EST)

branch: externals/tramp
commit 491c6bb34cf0a33a3ab88641eb0c400e185776e0
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Tramp ELPA version 2.4.2.5 released
---
 test/tramp-tests.el  | 417 ++++++++++++++++++++++++++++++---------------------
 texi/tramp.texi      | 140 ++++++++++++++++-
 texi/trampver.texi   |   2 +-
 tramp-adb.el         |  34 +++--
 tramp-archive.el     |  16 +-
 tramp-cache.el       |   2 +-
 tramp-cmds.el        | 269 ++++++++++++++++++++++++++++++++-
 tramp-compat.el      |   5 +-
 tramp-ftp.el         |   4 +-
 tramp-gvfs.el        |  22 ++-
 tramp-integration.el |  17 +++
 tramp-loaddefs.el    | 115 +++++++++++---
 tramp-rclone.el      |  17 ++-
 tramp-sh.el          |  42 ++++--
 tramp-smb.el         |  81 ++++++----
 tramp-sudoedit.el    |  17 ++-
 tramp.el             | 153 ++++++++++++-------
 tramp.info           | 262 +++++++++++++++++++++++---------
 trampver.el          |   9 +-
 19 files changed, 1212 insertions(+), 412 deletions(-)

diff --git a/test/tramp-tests.el b/test/tramp-tests.el
index 4537017..4b887e7 100644
--- a/test/tramp-tests.el
+++ b/test/tramp-tests.el
@@ -57,6 +57,7 @@
 (declare-function tramp-method-out-of-band-p "tramp-sh")
 (declare-function tramp-smb-get-localname "tramp-smb")
 (declare-function tramp-time-diff "tramp")
+(defvar ange-ftp-make-backup-files)
 (defvar auto-save-file-name-transforms)
 (defvar tramp-connection-properties)
 (defvar tramp-copy-size-limit)
@@ -264,7 +265,7 @@ properly.  BODY shall not contain a timeout."
   ;; No newline or linefeed.
   (should-not (tramp-tramp-file-p "/method::file\nname"))
   (should-not (tramp-tramp-file-p "/method::file\rname"))
-  ;; Ange-ftp syntax.
+  ;; Ange-FTP syntax.
   (should-not (tramp-tramp-file-p "/host:"))
   (should-not (tramp-tramp-file-p "/user@host:"))
   (should-not (tramp-tramp-file-p "/1.2.3.4:"))
@@ -398,7 +399,7 @@ properly.  BODY shall not contain a timeout."
          ;; No strings.
          (should-not (tramp-tramp-file-p nil))
          (should-not (tramp-tramp-file-p 'symbol))
-         ;; Ange-ftp syntax.
+         ;; Ange-FTP syntax.
          (should-not (tramp-tramp-file-p "/host:"))
          (should-not (tramp-tramp-file-p "/user@host:"))
          (should-not (tramp-tramp-file-p "/1.2.3.4:"))
@@ -1956,36 +1957,40 @@ properly.  BODY shall not contain a timeout."
       (substitute-in-file-name "/method:host:/:/path//foo")
       "/method:host:/:/path//foo"))
 
-    (should
-     (string-equal (substitute-in-file-name "/method:host://~foo") "/~foo"))
-    (should
-     (string-equal
-      (substitute-in-file-name "/method:host:/~foo") "/method:host:/~foo"))
-    (should
-     (string-equal
-      (substitute-in-file-name "/method:host:/path//~foo") "/~foo"))
-    ;; (substitute-in-file-name "/path/~foo") expands only for a local
-    ;; user "foo" to "/~foo"".  Otherwise, it doesn't expand.
-    (should
-     (string-equal
-      (substitute-in-file-name
-       "/method:host:/path/~foo") "/method:host:/path/~foo"))
-    ;; Quoting local part.
-    (should
-     (string-equal
-      (substitute-in-file-name "/method:host:/://~foo")
-      "/method:host:/://~foo"))
-    (should
-     (string-equal
-      (substitute-in-file-name "/method:host:/:/~foo") "/method:host:/:/~foo"))
-    (should
-     (string-equal
-      (substitute-in-file-name
-       "/method:host:/:/path//~foo") "/method:host:/:/path//~foo"))
-    (should
-     (string-equal
-      (substitute-in-file-name
-       "/method:host:/:/path/~foo") "/method:host:/:/path/~foo"))
+    ;; Forwhatever reasons, the following tests let Emacs crash for
+    ;; Emacs 24 and Emacs 25, occasionally. No idea what's up.
+    (when (tramp--test-emacs26-p)
+      (should
+       (string-equal (substitute-in-file-name "/method:host://~foo") "/~foo"))
+      (should
+       (string-equal
+       (substitute-in-file-name "/method:host:/~foo") "/method:host:/~foo"))
+      (should
+       (string-equal
+       (substitute-in-file-name "/method:host:/path//~foo") "/~foo"))
+      ;; (substitute-in-file-name "/path/~foo") expands only for a local
+      ;; user "foo" to "/~foo"".  Otherwise, it doesn't expand.
+      (should
+       (string-equal
+       (substitute-in-file-name
+        "/method:host:/path/~foo") "/method:host:/path/~foo"))
+      ;; Quoting local part.
+      (should
+       (string-equal
+       (substitute-in-file-name "/method:host:/://~foo")
+       "/method:host:/://~foo"))
+      (should
+       (string-equal
+       (substitute-in-file-name
+        "/method:host:/:/~foo") "/method:host:/:/~foo"))
+      (should
+       (string-equal
+       (substitute-in-file-name
+        "/method:host:/:/path//~foo") "/method:host:/:/path//~foo"))
+      (should
+       (string-equal
+       (substitute-in-file-name
+        "/method:host:/:/path/~foo") "/method:host:/:/path/~foo")))
 
     (let (process-environment)
       (should
@@ -2061,7 +2066,8 @@ properly.  BODY shall not contain a timeout."
   (skip-unless (tramp--test-enabled))
 
   ;; These are the methods the test doesn't fail.
-  (when (or (tramp--test-adb-p) (tramp--test-gvfs-p) (tramp--test-rclone-p)
+  (when (or (tramp--test-adb-p) (tramp--test-ange-ftp-p) (tramp--test-gvfs-p)
+           (tramp--test-rclone-p)
            (tramp-smb-file-name-p tramp-test-temporary-file-directory))
     (setf (ert-test-expected-result-type
           (ert-get-test 'tramp-test05-expand-file-name-relative))
@@ -2146,7 +2152,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
           (string-equal
            (file-name-as-directory file)
            (if (tramp-completion-mode-p)
-               file (concat file "./"))))
+               file (concat file (if (tramp--test-ange-ftp-p) "/" "./")))))
          (should (string-equal (file-name-directory file) file))
          (should (string-equal (file-name-nondirectory file) "")))))))
 
@@ -2251,18 +2257,19 @@ This checks also `file-name-as-directory', 
`file-name-directory',
              (should (string-equal (buffer-string) "foo")))
 
            ;; Append.
-           (with-temp-buffer
-             (insert "bla")
-             (write-region nil nil tmp-name 'append))
-           (with-temp-buffer
-             (insert-file-contents tmp-name)
-             (should (string-equal (buffer-string) "foobla")))
-           (with-temp-buffer
-             (insert "baz")
-             (write-region nil nil tmp-name 3))
-           (with-temp-buffer
-             (insert-file-contents tmp-name)
-             (should (string-equal (buffer-string) "foobaz")))
+           (unless (tramp--test-ange-ftp-p)
+             (with-temp-buffer
+               (insert "bla")
+               (write-region nil nil tmp-name 'append))
+             (with-temp-buffer
+               (insert-file-contents tmp-name)
+               (should (string-equal (buffer-string) "foobla")))
+             (with-temp-buffer
+               (insert "baz")
+               (write-region nil nil tmp-name 3))
+             (with-temp-buffer
+               (insert-file-contents tmp-name)
+               (should (string-equal (buffer-string) "foobaz"))))
 
            ;; Write string.
            (write-region "foo" nil tmp-name)
@@ -2282,7 +2289,8 @@ This checks also `file-name-as-directory', 
`file-name-directory',
            ;; Macro `ert-with-message-capture' was introduced in Emacs 26.1.
            (with-no-warnings (when (symbol-plist 'ert-with-message-capture)
              (let ((tramp-message-show-message t))
-               (dolist (noninteractive '(nil t))
+               (dolist
+                   (noninteractive (unless (tramp--test-ange-ftp-p) '(nil t)))
                  (dolist (visit '(nil t "string" no-message))
                    (ert-with-message-capture tramp--test-messages
                      (write-region "foo" nil tmp-name nil visit)
@@ -2296,12 +2304,16 @@ This checks also `file-name-as-directory', 
`file-name-directory',
                        tramp--test-messages))))))))
 
            ;; Do not overwrite if excluded.
-           (cl-letf (((symbol-function 'y-or-n-p) (lambda (_prompt) t)))
+           (cl-letf (((symbol-function 'y-or-n-p) (lambda (_prompt) t))
+                     ;; Ange-FTP.
+                     ((symbol-function 'yes-or-no-p) (lambda (_prompt) t)))
              (write-region "foo" nil tmp-name nil nil nil 'mustbenew))
            ;; `mustbenew' is passed to Tramp since Emacs 26.1.
            (when (tramp--test-emacs26-p)
              (should-error
-              (cl-letf (((symbol-function 'y-or-n-p) 'ignore))
+              (cl-letf (((symbol-function 'y-or-n-p) 'ignore)
+                        ;; Ange-FTP.
+                        ((symbol-function 'yes-or-no-p) 'ignore))
                 (write-region "foo" nil tmp-name nil nil nil 'mustbenew))
                :type 'file-already-exists)
              (should-error
@@ -2366,6 +2378,9 @@ This checks also `file-name-as-directory', 
`file-name-directory',
          ;; Copy simple file.
          (unwind-protect
              (progn
+               (should-error
+                (copy-file source target)
+                :type tramp-file-missing)
                (write-region "foo" nil source)
                (should (file-exists-p source))
                (copy-file source target)
@@ -2387,7 +2402,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
          (unwind-protect
              ;; FIXME: This fails on my QNAP server, see
              ;; /share/Web/owncloud/data/owncloud.log
-             (unless (tramp--test-nextcloud-p)
+             (unless (or (tramp--test-ange-ftp-p) (tramp--test-nextcloud-p))
                (write-region "foo" nil source)
                (should (file-exists-p source))
                (make-directory target)
@@ -2413,7 +2428,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
          (unwind-protect
              ;; FIXME: This fails on my QNAP server, see
              ;; /share/Web/owncloud/data/owncloud.log
-             (unless (tramp--test-nextcloud-p)
+             (unless (or (tramp--test-ange-ftp-p) (tramp--test-nextcloud-p))
                (make-directory source)
                (should (file-directory-p source))
                (write-region "foo" nil (expand-file-name "foo" source))
@@ -2436,7 +2451,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
          (unwind-protect
              ;; FIXME: This fails on my QNAP server, see
              ;; /share/Web/owncloud/data/owncloud.log
-             (unless (tramp--test-nextcloud-p)
+             (unless (or (tramp--test-ange-ftp-p) (tramp--test-nextcloud-p))
                (make-directory source)
                (should (file-directory-p source))
                (write-region "foo" nil (expand-file-name "foo" source))
@@ -2478,6 +2493,9 @@ This checks also `file-name-as-directory', 
`file-name-directory',
          ;; Rename simple file.
          (unwind-protect
              (progn
+               (should-error
+                (rename-file source target)
+                :type tramp-file-missing)
                (write-region "foo" nil source)
                (should (file-exists-p source))
                (rename-file source target)
@@ -2528,7 +2546,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
          (unwind-protect
              ;; FIXME: This fails on my QNAP server, see
              ;; /share/Web/owncloud/data/owncloud.log
-             (unless (tramp--test-nextcloud-p)
+             (unless (or (tramp--test-ange-ftp-p) (tramp--test-nextcloud-p))
                (make-directory source)
                (should (file-directory-p source))
                (write-region "foo" nil (expand-file-name "foo" source))
@@ -2552,7 +2570,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
          (unwind-protect
              ;; FIXME: This fails on my QNAP server, see
              ;; /share/Web/owncloud/data/owncloud.log
-             (unless (tramp--test-nextcloud-p)
+             (unless (or (tramp--test-ange-ftp-p) (tramp--test-nextcloud-p))
                (make-directory source)
                (should (file-directory-p source))
                (write-region "foo" nil (expand-file-name "foo" source))
@@ -2583,9 +2601,14 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
       (unwind-protect
          (progn
            (make-directory tmp-name1)
+           (should-error
+            (make-directory tmp-name1)
+            :type 'file-already-exists)
            (should (file-directory-p tmp-name1))
            (should (file-accessible-directory-p tmp-name1))
-           (should-error (make-directory tmp-name2) :type 'file-error)
+           (should-error
+            (make-directory tmp-name2)
+            :type 'file-error)
            (make-directory tmp-name2 'parents)
            (should (file-directory-p tmp-name2))
            (should (file-accessible-directory-p tmp-name2))
@@ -2601,20 +2624,27 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
   (skip-unless (tramp--test-enabled))
 
   (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
-    (let ((tmp-name (tramp--test-make-temp-name nil quoted)))
+    (let* ((tmp-name1 (tramp--test-make-temp-name nil quoted))
+          (tmp-name2 (expand-file-name "foo" tmp-name1)))
       ;; Delete empty directory.
-      (make-directory tmp-name)
-      (should (file-directory-p tmp-name))
-      (delete-directory tmp-name)
-      (should-not (file-directory-p tmp-name))
+      (make-directory tmp-name1)
+      (should (file-directory-p tmp-name1))
+      (delete-directory tmp-name1)
+      (should-not (file-directory-p tmp-name1))
       ;; Delete non-empty directory.
-      (make-directory tmp-name)
-      (should (file-directory-p tmp-name))
-      (write-region "foo" nil (expand-file-name "bla" tmp-name))
-      (should (file-exists-p (expand-file-name "bla" tmp-name)))
-      (should-error (delete-directory tmp-name) :type 'file-error)
-      (delete-directory tmp-name 'recursive)
-      (should-not (file-directory-p tmp-name)))))
+      (make-directory tmp-name1)
+      (should (file-directory-p tmp-name1))
+      (write-region "foo" nil (expand-file-name "bla" tmp-name1))
+      (should (file-exists-p (expand-file-name "bla" tmp-name1)))
+      (make-directory tmp-name2)
+      (should (file-directory-p tmp-name2))
+      (write-region "foo" nil (expand-file-name "bla" tmp-name2))
+      (should (file-exists-p (expand-file-name "bla" tmp-name2)))
+      (should-error
+       (delete-directory tmp-name1)
+       :type 'file-error)
+      (delete-directory tmp-name1 'recursive)
+      (should-not (file-directory-p tmp-name1)))))
 
 (ert-deftest tramp-test15-copy-directory ()
   "Check `copy-directory'."
@@ -2632,6 +2662,9 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
       ;; Copy complete directory.
       (unwind-protect
          (progn
+           (should-error
+            (copy-directory tmp-name1 tmp-name2)
+            :type tramp-file-missing)
            ;; Copy empty directory.
            (make-directory tmp-name1)
            (write-region "foo" nil tmp-name4)
@@ -2645,7 +2678,7 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
            (when (tramp--test-emacs26-p)
              (should-error
               (copy-directory tmp-name1 tmp-name2)
-              :type 'file-error))
+              :type 'file-already-exists))
            (copy-directory tmp-name1 (file-name-as-directory tmp-name2))
            (should (file-directory-p tmp-name3))
            (should (file-exists-p tmp-name6)))
@@ -2692,6 +2725,9 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
           (tmp-name3 (expand-file-name "foo" tmp-name1)))
       (unwind-protect
          (progn
+           (should-error
+            (directory-files tmp-name1)
+            :type tramp-file-missing)
            (make-directory tmp-name1)
            (write-region "foo" nil tmp-name2)
            (write-region "bla" nil tmp-name3)
@@ -2782,6 +2818,10 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
 (ert-deftest tramp-test17-insert-directory ()
   "Check `insert-directory'."
   (skip-unless (tramp--test-enabled))
+  ;; Ange-FTP is very special.  It does not include the header line
+  ;; (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)))
 
   (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
     (let* ((tmp-name1
@@ -3170,6 +3210,9 @@ They might differ only in time attributes or directory 
size."
           attr)
       (unwind-protect
          (progn
+           (should-error
+            (directory-files-and-attributes tmp-name1)
+            :type tramp-file-missing)
            (make-directory tmp-name1)
            (should (file-directory-p tmp-name1))
            (setq tramp--test-start-time
@@ -3499,7 +3542,9 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
                  :type 'file-error)
               (make-symbolic-link tmp-name1 tmp-name2)
               (should (file-symlink-p tmp-name2))
-              (should-error (file-truename tmp-name1) :type 'file-error))))
+              (should-error
+               (file-truename tmp-name1)
+               :type 'file-error))))
 
        ;; Cleanup.
        (ignore-errors
@@ -3895,9 +3940,12 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
              (should (equal (file-name-completion "foo" tmp-name) t))
              (should (equal (file-name-completion "b" tmp-name) "bo"))
              (should-not (file-name-completion "a" tmp-name))
-             (should
-              (equal
-               (file-name-completion "b" tmp-name #'file-directory-p) "boz/"))
+             ;; Ange-FTP does not support predicates.
+             (unless (tramp--test-ange-ftp-p)
+               (should
+                (equal
+                 (file-name-completion "b" tmp-name #'file-directory-p)
+                 "boz/")))
              (should
               (equal (file-name-all-completions "fo" tmp-name) '("foo")))
              (should
@@ -3907,14 +3955,17 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
              (should-not (file-name-all-completions "a" tmp-name))
              ;; `completion-regexp-list' restricts the completion to
              ;; files which match all expressions in this list.
-             (let ((completion-regexp-list
-                    `(,directory-files-no-dot-files-regexp "b")))
-               (should
-                (equal (file-name-completion "" tmp-name) "bo"))
-               (should
-                (equal
-                 (sort (file-name-all-completions "" tmp-name) #'string-lessp)
-                 '("bold" "boz/"))))
+             ;; Ange-FTP does not complete "".
+             (unless (tramp--test-ange-ftp-p)
+               (let ((completion-regexp-list
+                      `(,directory-files-no-dot-files-regexp "b")))
+                 (should
+                  (equal (file-name-completion "" tmp-name) "bo"))
+                 (should
+                  (equal
+                   (sort
+                    (file-name-all-completions "" tmp-name) #'string-lessp)
+                   '("bold" "boz/")))))
              ;; `file-name-completion' ignores file names that end in
              ;; any string in `completion-ignored-extensions'.
              (let ((completion-ignored-extensions '(".ext")))
@@ -4252,7 +4303,9 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            (while (accept-process-output proc nil nil 0)))
          (should-not (process-live-p proc))
          ;; An interrupted process cannot be interrupted, again.
-         (should-error (interrupt-process proc) :type 'error))
+         (should-error
+          (interrupt-process proc)
+          :type 'error))
 
       ;; Cleanup.
       (ignore-errors (delete-process proc)))))
@@ -4846,49 +4899,52 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
                    tramp-test-temporary-file-directory))))))
 
            ;; Use default `tramp-auto-save-directory' mechanism.
-           (let ((tramp-auto-save-directory tmp-name2))
-             (with-temp-buffer
-               (setq buffer-file-name tmp-name1)
-               (should
-                (string-equal
-                 (make-auto-save-file-name)
-                 ;; This is taken from Tramp.
-                 (expand-file-name
-                  (format
-                   "#%s#"
-                   (tramp-subst-strs-in-string
-                    '(("_" . "|")
-                      ("/" . "_a")
-                      (":" . "_b")
-                      ("|" . "__")
-                      ("[" . "_l")
-                      ("]" . "_r"))
-                    (tramp-compat-file-name-unquote tmp-name1)))
-                  tmp-name2)))
-               (should (file-directory-p tmp-name2))))
-
-           ;; Relative file names shall work, too.
-           (let ((tramp-auto-save-directory "."))
-             (with-temp-buffer
-               (setq buffer-file-name tmp-name1
-                     default-directory tmp-name2)
-               (should
-                (string-equal
-                 (make-auto-save-file-name)
-                 ;; This is taken from Tramp.
-                 (expand-file-name
-                  (format
-                   "#%s#"
-                   (tramp-subst-strs-in-string
-                    '(("_" . "|")
-                      ("/" . "_a")
-                      (":" . "_b")
-                      ("|" . "__")
-                      ("[" . "_l")
-                      ("]" . "_r"))
-                    (tramp-compat-file-name-unquote tmp-name1)))
-                  tmp-name2)))
-               (should (file-directory-p tmp-name2)))))
+           ;; Ange-FTP doesn't care.
+           (unless (tramp--test-ange-ftp-p)
+             (let ((tramp-auto-save-directory tmp-name2))
+               (with-temp-buffer
+                 (setq buffer-file-name tmp-name1)
+                 (should
+                  (string-equal
+                   (make-auto-save-file-name)
+                   ;; This is taken from Tramp.
+                   (expand-file-name
+                    (format
+                     "#%s#"
+                     (tramp-subst-strs-in-string
+                      '(("_" . "|")
+                        ("/" . "_a")
+                        (":" . "_b")
+                        ("|" . "__")
+                        ("[" . "_l")
+                        ("]" . "_r"))
+                      (tramp-compat-file-name-unquote tmp-name1)))
+                    tmp-name2)))
+                 (should (file-directory-p tmp-name2)))))
+
+           ;; Relative file names shall work, too.  Ange-FTP doesn't care.
+           (unless (tramp--test-ange-ftp-p)
+             (let ((tramp-auto-save-directory "."))
+               (with-temp-buffer
+                 (setq buffer-file-name tmp-name1
+                       default-directory tmp-name2)
+                 (should
+                  (string-equal
+                   (make-auto-save-file-name)
+                   ;; This is taken from Tramp.
+                   (expand-file-name
+                    (format
+                     "#%s#"
+                     (tramp-subst-strs-in-string
+                      '(("_" . "|")
+                        ("/" . "_a")
+                        (":" . "_b")
+                        ("|" . "__")
+                        ("[" . "_l")
+                        ("]" . "_r"))
+                      (tramp-compat-file-name-unquote tmp-name1)))
+                    tmp-name2)))
+                 (should (file-directory-p tmp-name2))))))
 
        ;; Cleanup.
        (ignore-errors (delete-file tmp-name1))
@@ -4901,6 +4957,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
   (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
     (let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
          (tmp-name2 (tramp--test-make-temp-name nil quoted))
+         (ange-ftp-make-backup-files t)
          ;; These settings are not used by Tramp, so we ignore them.
          version-control delete-old-versions
          (kept-old-versions (default-toplevel-value 'kept-old-versions))
@@ -4948,58 +5005,61 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
        (ignore-errors (delete-directory tmp-name2 'recursive)))
 
       (unwind-protect
-         ;; Map `tramp-backup-directory-alist'.
-         (let ((tramp-backup-directory-alist `(("." . ,tmp-name2)))
-               backup-directory-alist)
-           (should
-            (equal
-             (find-backup-file-name tmp-name1)
-             (list
-              (funcall
-               (if quoted #'tramp-compat-file-name-quote #'identity)
-               (expand-file-name
-                (format
-                 "%s~"
-                 ;; This is taken from `make-backup-file-name-1'.  We
-                 ;; call `convert-standard-filename', because on MS
-                 ;; Windows the (local) colons must be replaced by
-                 ;; exclamation marks.
-                 (subst-char-in-string
-                  ?/ ?!
-                  (replace-regexp-in-string
-                   "!" "!!" (convert-standard-filename tmp-name1))))
-                tmp-name2)))))
-           ;; The backup directory is created.
-           (should (file-directory-p tmp-name2)))
+         ;; Map `tramp-backup-directory-alist'.  Ange-FTP doesn't care.
+         (unless (tramp--test-ange-ftp-p)
+           (let ((tramp-backup-directory-alist `(("." . ,tmp-name2)))
+                 backup-directory-alist)
+             (should
+              (equal
+               (find-backup-file-name tmp-name1)
+               (list
+                (funcall
+                 (if quoted #'tramp-compat-file-name-quote #'identity)
+                 (expand-file-name
+                  (format
+                   "%s~"
+                   ;; This is taken from `make-backup-file-name-1'.
+                   ;; We call `convert-standard-filename', because on
+                   ;; MS Windows the (local) colons must be replaced
+                   ;; by exclamation marks.
+                   (subst-char-in-string
+                    ?/ ?!
+                    (replace-regexp-in-string
+                     "!" "!!" (convert-standard-filename tmp-name1))))
+                  tmp-name2)))))
+             ;; The backup directory is created.
+             (should (file-directory-p tmp-name2))))
 
        ;; Cleanup.
        (ignore-errors (delete-directory tmp-name2 'recursive)))
 
       (unwind-protect
          ;; Map `tramp-backup-directory-alist' with local file name.
-         (let ((tramp-backup-directory-alist
-                `(("." . ,(file-remote-p tmp-name2 'localname))))
-               backup-directory-alist)
-           (should
-            (equal
-             (find-backup-file-name tmp-name1)
-             (list
-              (funcall
-               (if quoted #'tramp-compat-file-name-quote #'identity)
-               (expand-file-name
-                (format
-                 "%s~"
-                 ;; This is taken from `make-backup-file-name-1'.  We
-                 ;; call `convert-standard-filename', because on MS
-                 ;; Windows the (local) colons must be replaced by
-                 ;; exclamation marks.
-                 (subst-char-in-string
-                  ?/ ?!
-                  (replace-regexp-in-string
-                   "!" "!!" (convert-standard-filename tmp-name1))))
-                tmp-name2)))))
-           ;; The backup directory is created.
-           (should (file-directory-p tmp-name2)))
+         ;; Ange-FTP doesn't care.
+         (unless (tramp--test-ange-ftp-p)
+           (let ((tramp-backup-directory-alist
+                  `(("." . ,(file-remote-p tmp-name2 'localname))))
+                 backup-directory-alist)
+             (should
+              (equal
+               (find-backup-file-name tmp-name1)
+               (list
+                (funcall
+                 (if quoted #'tramp-compat-file-name-quote #'identity)
+                 (expand-file-name
+                  (format
+                   "%s~"
+                   ;; This is taken from `make-backup-file-name-1'.
+                   ;; We call `convert-standard-filename', because on
+                   ;; MS Windows the (local) colons must be replaced
+                   ;; by exclamation marks.
+                   (subst-char-in-string
+                    ?/ ?!
+                    (replace-regexp-in-string
+                     "!" "!!" (convert-standard-filename tmp-name1))))
+                  tmp-name2)))))
+             ;; The backup directory is created.
+             (should (file-directory-p tmp-name2))))
 
        ;; Cleanup.
        (ignore-errors (delete-directory tmp-name2 'recursive))))))
@@ -5008,6 +5068,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
 (ert-deftest tramp-test39-make-nearby-temp-file ()
   "Check `make-nearby-temp-file' and `temporary-file-directory'."
   (skip-unless (tramp--test-enabled))
+  (skip-unless (not (tramp--test-ange-ftp-p)))
   ;; Since Emacs 26.1.
   (skip-unless
    (and (fboundp 'make-nearby-temp-file) (fboundp 'temporary-file-directory)))
@@ -5064,6 +5125,12 @@ variables, so we check the Emacs version directly."
 This requires restrictions of file name syntax."
   (tramp-adb-file-name-p tramp-test-temporary-file-directory))
 
+(defun tramp--test-ange-ftp-p ()
+  "Check, whether Ange-FTP is used."
+  (eq
+   (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
+   'tramp-ftp-file-name-handler))
+
 (defun tramp--test-docker-p ()
   "Check, whether the docker method is used.
 This does not support some special file names."
@@ -5079,7 +5146,8 @@ This does not support globbing characters in file names 
(yet)."
 
 (defun tramp--test-gvfs-p (&optional method)
   "Check, whether the remote host runs a GVFS based method.
-This requires restrictions of file name syntax."
+This requires restrictions of file name syntax.
+If optional METHOD is given, it is checked first."
   (or (member method tramp-gvfs-methods)
       (tramp-gvfs-file-name-p tramp-test-temporary-file-directory)))
 
@@ -5338,7 +5406,8 @@ This requires restrictions of file name syntax."
   ;; expanded to <TAB>.
   (let ((files
         (list
-         (if (or (tramp--test-gvfs-p)
+         (if (or (tramp--test-ange-ftp-p)
+                 (tramp--test-gvfs-p)
                  (tramp--test-rclone-p)
                  (tramp--test-sudoedit-p)
                  (tramp--test-windows-nt-or-smb-p))
@@ -5593,6 +5662,7 @@ Use the `ls' command."
 
 (defmacro tramp--test-with-proper-process-name-and-buffer (proc &rest body)
   "Set \"process-name\" and \"process-buffer\" connection properties.
+The values are derived from PROC.  Run BODY.
 This is needed in timer functions as well as process filters and sentinels."
   (declare (indent 1) (debug (processp body)))
   `(let* ((v (tramp-get-connection-property ,proc "vector" nil))
@@ -6095,7 +6165,8 @@ Since it unloads Tramp, it shall be the last test to run."
          (ert-fail (format "Hook `%s' still contains Tramp function" x))))))
 
 (defun tramp-test-all (&optional interactive)
-  "Run all tests for \\[tramp]."
+  "Run all tests for \\[tramp].
+If INTERACTIVE is non-nil, the tests are run interactively."
   (interactive "p")
   (funcall
    (if interactive
diff --git a/texi/tramp.texi b/texi/tramp.texi
index c84cbb5..302599b 100644
--- a/texi/tramp.texi
+++ b/texi/tramp.texi
@@ -153,6 +153,7 @@ Using @value{tramp}
 * Ad-hoc multi-hops::           Declaring multiple hops in the file name.
 * Remote processes::            Integration with other Emacs packages.
 * Cleanup remote connections::  Cleanup remote connections.
+* Renaming remote files::       Renaming remote files.
 * Archive file names::          Access to files in file archives.
 
 How file names, directories and localnames are mangled and managed
@@ -1409,7 +1410,7 @@ use the @samp{john} as the default user for the domain
 A Caution: @value{tramp} will override any default user specified in
 the configuration files outside Emacs, such as @file{~/.ssh/config}.
 To stop @value{tramp} from applying the default value, set the
-corresponding alist entry to nil:
+corresponding alist entry to @code{nil}:
 
 @lisp
 @group
@@ -2710,6 +2711,7 @@ is a feature of Emacs that may cause missed prompts when 
using
 * Ad-hoc multi-hops::           Declaring multiple hops in the file name.
 * Remote processes::            Integration with other Emacs packages.
 * Cleanup remote connections::  Cleanup remote connections.
+* Renaming remote files::       Renaming remote files.
 * Archive file names::          Access to files in file archives.
 @end menu
 
@@ -3371,9 +3373,9 @@ To open @command{powershell} as a remote shell, use this:
 
 @value{tramp} provides several ways to flush remote connections.
 
-@deffn Command tramp-cleanup-connection vec
-This command flushes all connection related objects.  @option{vec} is
-the internal representation of a remote connection.  When called
+@deffn Command tramp-cleanup-connection vec &optional keep-debug keep-password
+This command flushes all connection related objects.  @var{vec} is the
+internal representation of a remote connection.  When called
 interactively, this command lists active remote connections in the
 minibuffer.  Each connection is of the format
 @file{@trampfn{method,user@@host,}}.
@@ -3383,11 +3385,14 @@ Flushing remote connections also cleans the password 
cache
 (@pxref{Connection caching}), and recentf cache (@pxref{File
 Conveniences, , , emacs}).  It also deletes session timers
 (@pxref{Predefined connection information}) and connection buffers.
+
+If @var{keep-debug} is non-@code{nil}, the debug buffer is kept.  A
+non-@code{nil} @var{keep-password} preserves the password cache.
 @end deffn
 
 @deffn Command tramp-cleanup-this-connection
-Flushes only the current buffer's remote connection objects, the same
-as in @code{tramp-cleanup-connection}.
+Flushes the current buffer's remote connection objects, the same as in
+@code{tramp-cleanup-connection}.
 @end deffn
 
 @deffn Command tramp-cleanup-all-connections
@@ -3404,6 +3409,112 @@ killing all buffers related to remote connections.
 @end deffn
 
 
+@node Renaming remote files
+@section Renaming remote files
+@cindex save remote files
+
+Sometimes, it is desirable to safe file contents of buffers visiting a
+given remote host.  This could happen for example, if the local host
+changes its network integration, and the remote host is not reachable
+anymore.
+
+@deffn Command tramp-rename-files source target
+Replace in all buffers the visiting file name from @var{source} to
+@var{target}.  @var{source} is a remote directory name, which could
+contain also a localname part.  @var{target} is the directory name
+@var{source} is replaced with.  Often, @var{target} is a remote
+directory name on another host, but it can also be a local directory
+name.  If @var{target} has no local part, the local part from
+@var{source} is used.
+
+If @var{target} is @code{nil}, it is selected according to the first
+match in @code{tramp-default-rename-alist}.  If called interactively,
+this match is offered as initial value for selection.
+
+On all buffers, which have a @code{buffer-file-name} matching
+@var{source}, this name is modified by replacing @var{source} with
+@var{target}.  This is applied by calling
+@code{set-visited-file-name}.  The new @code{buffer-file-name} is
+prompted for modification in the minibuffer.  The buffers are marked
+modified, and must be saved explicitly.
+
+If user option @code{tramp-confirm-rename-file-names} is nil, changing
+the file name happens without confirmation.  This requires a
+matching entry in @code{tramp-default-rename-alist}.
+
+Remote buffers related to the remote connection identified by
+@var{source}, which are not visiting files, or which are visiting
+files not matching @var{source}, are not modified.
+
+Interactively, @var{target} is selected from
+@code{tramp-default-rename-alist} without confirmation if the prefix
+argument is non-@code{nil}.
+
+The remote connection identified by @var{source} is flushed by
+@code{tramp-cleanup-connection}.
+@end deffn
+
+@deffn Command tramp-rename-these-files target
+Replace visiting file names to @var{target}.  The current buffer must
+be related to a remote connection.  In all buffers, which are visiting
+a file with the same directory name, the buffer file name is changed.
+
+Interactively, @var{target} is selected from
+@code{tramp-default-rename-alist} without confirmation if the prefix
+argument is non-@code{nil}.
+@end deffn
+
+@defopt tramp-default-rename-alist
+The default target for renaming remote buffer file names.  This is an
+alist of cons cells @code{(source . target)}.  The first matching item
+specifies the target to be applied for renaming buffer file names from
+source via @code{tramp-rename-files}.  @code{source} is a regular
+expressions, which matches a remote file name.  @code{target} must be
+a directory name, which could be remote (including remote directories
+Tramp infers by default, such as @samp{@trampfn{method,user@@host,}}).
+
+@code{target} can contain the patterns @code{%m}, @code{%u} or
+@code{%h}, which are replaced by the method name, user name or host
+name of @code{source} when calling @code{tramp-rename-files}.
+
+@code{source} could also be a Lisp form, which will be evaluated.  The
+result must be a string or nil, which is interpreted as a regular
+expression which always matches.
+
+Example entries:
+
+@lisp
+@group
+("@trampfn{ssh,badhost,/path/to/dir/}"
+ . "@trampfn{ssh,goodhost,/path/to/another/dir/}")
+@end group
+@end lisp
+
+would trigger renaming of buffer file names on @samp{badhost} to
+@samp{goodhost}, including changing the directory name.
+
+@lisp
+("@trampfn{ssh,.+\\\\.company\\\\.org,}" . 
"@value{prefix}ssh@value{postfixhop}multi.hop|ssh@value{postfixhop}%h@value{postfix}")
+@end lisp
+
+routes all connections to a host in @samp{company.org} via
+@samp{@trampfn{ssh,multi.hop,}}, which might be useful when using
+Emacs outside the company network.
+
+@lisp
+(nil . "~/saved-files/%m:%u@@%h/")
+@end lisp
+
+saves all remote files locally, with a directory name including method
+name, user name and host name of the remote connection.
+@end defopt
+
+@defopt tramp-confirm-rename-file-names
+Whether renaming a buffer file name by @code{tramp-rename-files} or
+@code{tramp-rename-these-files} must be confirmed.
+@end defopt
+
+
 @node Archive file names
 @section Archive file names
 @cindex file archives
@@ -3412,7 +3523,7 @@ killing all buffers related to remote connections.
 @cindex archive method
 
 @value{tramp} offers also transparent access to files inside file
-archives.  This is possible only on machines which have installed
+archives.  This is possible only on hosts which have installed
 @acronym{GVFS, the GNOME Virtual File System}, @ref{GVFS-based
 methods}.  Internally, file archives are mounted via the
 @acronym{GVFS} @option{archive} method.
@@ -4440,6 +4551,21 @@ the buffer is remote.  See the optional arguments of
 
 
 @item
+How to save files when a remote host isn't reachable anymore?
+
+If the local machine Emacs is running on changes its network
+integration, remote hosts could become unreachable.  This happens for
+example, if the local machine is moved between your office and your
+home without restarting Emacs.
+
+In such cases, the command @code{tramp-rename-files} can be used to
+alter remote buffers’ method, host, and/or directory names.  This
+permits saving their contents in the same location via another network
+path, or somewhere else entirely (including locally).  @pxref{Renaming
+remote files}.
+
+
+@item
 How to disable other packages from calling @value{tramp}?
 
 There are packages that call @value{tramp} without the user ever
diff --git a/texi/trampver.texi b/texi/trampver.texi
index 61c69af..c2ccf9b 100644
--- a/texi/trampver.texi
+++ b/texi/trampver.texi
@@ -8,7 +8,7 @@
 @c In the Tramp GIT, the version numbers are auto-frobbed from
 @c tramp.el, and the bug report address is auto-frobbed from
 @c configure.ac.
-@set trampver 2.4.2.4
+@set trampver 2.4.2.5
 @set tramp-bug-report-address tramp-devel@@gnu.org
 @set emacsver 24.4
 
diff --git a/tramp-adb.el b/tramp-adb.el
index 982522b..b56ffdd 100644
--- a/tramp-adb.el
+++ b/tramp-adb.el
@@ -94,7 +94,7 @@ It is used for TCP/IP devices."
   '((access-file . tramp-handle-access-file)
     (add-name-to-file . tramp-handle-add-name-to-file)
     ;; `byte-compiler-base-file-name' performed by default handler.
-    ;; `copy-directory' performed by default handler.
+    (copy-directory . tramp-handle-copy-directory)
     (copy-file . tramp-adb-handle-copy-file)
     (delete-directory . tramp-adb-handle-delete-directory)
     (delete-file . tramp-adb-handle-delete-file)
@@ -171,20 +171,20 @@ It is used for TCP/IP devices."
 ;; tramp-loaddefs.el.  Otherwise, there would be recursive autoloading.
 ;;;###tramp-autoload
 (defsubst tramp-adb-file-name-p (filename)
-  "Check if it's a filename for ADB."
+  "Check if it's a FILENAME for ADB."
   (and (tramp-tramp-file-p filename)
        (string= (tramp-file-name-method (tramp-dissect-file-name filename))
                tramp-adb-method)))
 
 ;;;###tramp-autoload
-(defun tramp-adb-file-name-handler (operation &rest args)
+(defun tramp-adb-file-name-handler (operation &rest arguments)
   "Invoke the ADB handler for OPERATION.
-First arg specifies the OPERATION, second arg is a list of arguments to
-pass to the OPERATION."
+First arg specifies the OPERATION, second arg is a list of
+ARGUMENTS to pass to the OPERATION."
   (let ((fn (assoc operation tramp-adb-file-name-handler-alist)))
     (if fn
-       (save-match-data (apply (cdr fn) args))
-      (tramp-run-real-handler operation args))))
+       (save-match-data (apply (cdr fn) arguments))
+      (tramp-run-real-handler operation arguments))))
 
 ;;;###tramp-autoload
 (tramp--with-startup
@@ -383,6 +383,10 @@ pass to the OPERATION."
 (defun tramp-adb-handle-directory-files-and-attributes
   (directory &optional full match nosort id-format)
   "Like `directory-files-and-attributes' for Tramp files."
+  (unless (file-exists-p directory)
+    (tramp-error
+     (tramp-dissect-file-name directory) tramp-file-missing
+     "No such file or directory" directory))
   (when (file-directory-p directory)
     (with-parsed-tramp-file-name (expand-file-name directory) nil
       (copy-tree
@@ -462,7 +466,7 @@ Convert (\"-al\") to (\"-a\" \"-l\").  Remove arguments 
like \"--dired\"."
 
 (defun tramp-adb-sh-fix-ls-output (&optional sort-by-time)
   "Insert dummy 0 in empty size columns.
-Androids \"ls\" command doesn't insert size column for directories:
+Android's \"ls\" command doesn't insert size column for directories:
 Emacs dired can't find files."
   (save-excursion
     ;; Insert missing size.
@@ -510,6 +514,8 @@ Emacs dired can't find files."
   "Like `make-directory' for Tramp files."
   (setq dir (expand-file-name dir))
   (with-parsed-tramp-file-name dir nil
+    (when (and (null parents) (file-exists-p dir))
+      (tramp-error v 'file-already-exists "Directory already exists %s" dir))
     (when parents
       (let ((par (expand-file-name ".." dir)))
        (unless (file-directory-p par)
@@ -706,6 +712,10 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
     (let ((t1 (tramp-tramp-file-p filename))
          (t2 (tramp-tramp-file-p newname)))
       (with-parsed-tramp-file-name (if t1 filename newname) nil
+       (unless (file-exists-p filename)
+         (tramp-error
+          v tramp-file-missing
+          "Copying file" "No such file or directory" filename))
        (when (and (not ok-if-already-exists) (file-exists-p newname))
          (tramp-error v 'file-already-exists newname))
        (when (and (file-directory-p newname)
@@ -784,6 +794,10 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
     (let ((t1 (tramp-tramp-file-p filename))
          (t2 (tramp-tramp-file-p newname)))
       (with-parsed-tramp-file-name (if t1 filename newname) nil
+       (unless (file-exists-p filename)
+         (tramp-error
+          v tramp-file-missing
+          "Renaming file" "No such file or directory" filename))
        (when (and (not ok-if-already-exists) (file-exists-p newname))
          (tramp-error v 'file-already-exists newname))
        (when (and (file-directory-p newname)
@@ -1089,7 +1103,7 @@ E.g. a host name \"192.168.1.1#5555\" returns 
\"192.168.1.1:5555\"
                 vec 'file-error "Could not find device %s" host)))))))
 
 (defun tramp-adb-execute-adb-command (vec &rest args)
-  "Returns nil on success error-output on failure."
+  "Return nil on success error-output on failure."
   (when (and (> (length (tramp-file-name-host vec)) 0)
             ;; The -s switch is only available for ADB device commands.
             (not (member (car args) '("connect" "disconnect"))))
@@ -1103,7 +1117,7 @@ E.g. a host name \"192.168.1.1#5555\" returns 
\"192.168.1.1:5555\"
       (tramp-message vec 6 "%s" (buffer-string)))))
 
 (defun tramp-adb-find-test-command (vec)
-  "Checks, whether the ash has a builtin \"test\" command.
+  "Check whether the ash has a builtin \"test\" command.
 This happens for Android >= 4.0."
   (with-tramp-connection-property vec "test"
     (tramp-adb-send-command-and-check vec "type test")))
diff --git a/tramp-archive.el b/tramp-archive.el
index 84dba32..1158b03 100644
--- a/tramp-archive.el
+++ b/tramp-archive.el
@@ -295,8 +295,8 @@ Operations not mentioned here will be handled by the 
default Emacs primitives.")
 
 (defun tramp-archive-run-real-handler (operation args)
   "Invoke normal file name handler for OPERATION.
-First arg specifies the OPERATION, second arg is a list of arguments to
-pass to the OPERATION."
+First arg specifies the OPERATION, second arg ARGS is a list of
+arguments to pass to the OPERATION."
   (let* ((inhibit-file-name-handlers
          `(tramp-archive-file-name-handler
            .
@@ -308,8 +308,8 @@ pass to the OPERATION."
 ;;;###tramp-autoload
 (defun tramp-archive-file-name-handler (operation &rest args)
   "Invoke the file archive related OPERATION.
-First arg specifies the OPERATION, second arg is a list of arguments to
-pass to the OPERATION."
+First arg specifies the OPERATION, second arg ARGS is a list of
+arguments to pass to the OPERATION."
     (if (not tramp-archive-enabled)
         ;; Unregister `tramp-archive-file-name-handler'.
         (progn
@@ -413,7 +413,7 @@ name of a local copy, if any.")
   (url-hexify-string (tramp-gvfs-url-file-name archive)))
 
 (defun tramp-archive-dissect-file-name (name)
-  "Return a `tramp-file-name' structure.
+  "Return a `tramp-file-name' structure for NAME.
 The structure consists of the `tramp-archive-method' method, the
 hexified archive name as host, and the localname.  The archive
 name is kept in slot `hop'"
@@ -507,7 +507,7 @@ archive name is extracted from the hop part of the VEC 
structure."
        (tramp-file-name-hop vec)))
 
 (defmacro with-parsed-tramp-archive-file-name (filename var &rest body)
-  "Parse an archive filename and make components available in the body.
+  "Parse an archive filename and make components available in the BODY.
 This works exactly as `with-parsed-tramp-file-name' for the Tramp
 file name structure returned by `tramp-archive-dissect-file-name'.
 A variable `foo-archive' (or `archive') will be bound to the
@@ -533,7 +533,7 @@ offered."
        ,@body)))
 
 (defun tramp-archive-gvfs-file-name (name)
-  "Return FILENAME in GVFS syntax."
+  "Return NAME in GVFS syntax."
   (tramp-make-tramp-file-name
    (tramp-archive-dissect-file-name name) nil 'nohop))
 
@@ -541,7 +541,7 @@ offered."
 ;; File name primitives.
 
 (defun tramp-archive-handle-access-file (filename string)
-  "Like `access-file' for Tramp files."
+  "Like `access-file' for file archives."
   (access-file (tramp-archive-gvfs-file-name filename) string))
 
 (defun tramp-archive-handle-copy-file
diff --git a/tramp-cache.el b/tramp-cache.el
index 014d87d..24d0e14 100644
--- a/tramp-cache.el
+++ b/tramp-cache.el
@@ -28,7 +28,7 @@
 ;; An implementation of information caching for remote files.
 
 ;; Each connection, identified by a `tramp-file-name' structure or by
-;; a process, has a unique cache. We distinguish 4 kind of caches,
+;; a process, has a unique cache.  We distinguish 4 kind of caches,
 ;; depending on the key:
 ;;
 ;; - localname is NIL.  This are reusable properties.  Examples:
diff --git a/tramp-cmds.el b/tramp-cmds.el
index 35bb85b..96b11c7 100644
--- a/tramp-cmds.el
+++ b/tramp-cmds.el
@@ -60,7 +60,7 @@ SYNTAX can be one of the symbols `default' (default),
     "*debug tramp" (mapcar #'list (mapcar #'buffer-name (buffer-list))))))
 
 (defun tramp-list-remote-buffers ()
-  "Return a list of all buffers with remote default-directory."
+  "Return a list of all buffers with remote `default-directory'."
   (delq
    nil
    (mapcar
@@ -195,6 +195,268 @@ This includes password cache, file cache, connection 
cache, buffers."
   (dolist (name (tramp-list-remote-buffers))
     (when (bufferp (get-buffer name)) (kill-buffer name))))
 
+;;;###tramp-autoload
+(defcustom tramp-default-rename-alist nil
+  "Default target for renaming remote buffer file names.
+This is an alist of cons cells (SOURCE . TARGET).  The first
+matching item specifies the target to be applied for renaming
+buffer file names from source via `tramp-rename-files'.  SOURCE
+is a regular expressions, which matches a remote file name.
+TARGET must be a directory name, which could be remote (including
+remote directories Tramp infers by default, such as
+\"/method:user@host:\").
+
+TARGET can contain the patterns %m, %u or %h, which are replaced
+by the method name, user name or host name of SOURCE when calling
+`tramp-rename-files'.
+
+SOURCE could also be a Lisp form, which will be evaluated.  The
+result must be a string or nil, which is interpreted as a regular
+expression which always matches."
+  :group 'tramp
+  :version "27.1"
+  :type '(repeat (cons (choice :tag "Source regexp" regexp sexp)
+                      (choice :tag "Target   name" string (const nil)))))
+
+;;;###tramp-autoload
+(defcustom tramp-confirm-rename-file-names t
+  "Whether renaming a buffer file name must be confirmed."
+  :group 'tramp
+  :version "27.1"
+  :type 'boolean)
+
+(defun tramp-default-rename-file (string)
+  "Determine default file name for renaming according to STRING.
+The user option `tramp-default-rename-alist' is consulted,
+finding the default mapping.  If there is no matching entry, the
+function returns nil"
+  (when (tramp-tramp-file-p string)
+    (let ((tdra tramp-default-rename-alist)
+         (method (or (file-remote-p string 'method) ""))
+         (user (or (file-remote-p string 'user) ""))
+         (host (or (file-remote-p string 'host) ""))
+         item result)
+      (while (setq item (pop tdra))
+       (when (string-match-p (or (eval (car item)) "") string)
+         (setq tdra nil
+               result
+               (format-spec
+                (cdr item) (format-spec-make ?m method ?u user ?h host)))))
+      result)))
+
+(defsubst tramp-rename-read-file-name-dir (string)
+  "Return the DIR entry to be applied in `read-file-name', based on STRING."
+  (when (tramp-tramp-file-p string)
+    (substring (file-remote-p string) 0 -1)))
+
+(defsubst tramp-rename-read-file-name-init (string)
+  "Return the INIT entry to be applied in `read-file-name', based on STRING."
+  (when (tramp-tramp-file-p string)
+    (string-remove-prefix (tramp-rename-read-file-name-dir string) string)))
+
+;;;###tramp-autoload
+(defun tramp-rename-files (source target)
+  "Replace in all buffers the visiting file name from SOURCE to TARGET.
+SOURCE is a remote directory name, which could contain also a
+localname part.  TARGET is the directory name SOURCE is replaced
+with.  Often, TARGET is a remote directory name on another host,
+but it can also be a local directory name.  If TARGET has no
+local part, the local part from SOURCE is used.
+
+If TARGET is nil, it is selected according to the first match in
+`tramp-default-rename-alist'.  If called interactively, this
+match is offered as initial value for selection.
+
+On all buffers, which have a `buffer-file-name' matching SOURCE,
+this name is modified by replacing SOURCE with TARGET.  This is
+applied by calling `set-visited-file-name'.  The new
+`buffer-file-name' is prompted for modification in the
+minibuffer.  The buffers are marked modified, and must be saved
+explicitly.
+
+If user option `tramp-confirm-rename-file-names' is nil, changing
+the file name happens without confirmation.  This requires a
+matching entry in `tramp-default-rename-alist'.
+
+Remote buffers related to the remote connection identified by
+SOURCE, which are not visiting files, or which are visiting files
+not matching SOURCE, are not modified.
+
+Interactively, TARGET is selected from `tramp-default-rename-alist'
+without confirmation if the prefix argument is non-nil.
+
+The remote connection identified by SOURCE is flushed by
+`tramp-cleanup-connection'."
+  (interactive
+   (let ((connections
+         (mapcar #'tramp-make-tramp-file-name (tramp-list-connections)))
+        ;; Completion packages do their voodoo in `completing-read'
+        ;; and `read-file-name', which is often incompatible with
+        ;; Tramp.  Ignore them.
+        (completing-read-function #'completing-read-default)
+        (read-file-name-function #'read-file-name-default)
+         source target)
+     (if (null connections)
+        (tramp-user-error nil "There are no remote connections.")
+       (setq source
+            ;; Likely, the source remote connection is broken. So we
+            ;; shall avoid any action on it.
+            (let (non-essential)
+              (completing-read-default
+               "Enter old Tramp connection: "
+               ;; Completion function.
+               (completion-table-dynamic
+                (lambda (string)
+                  (cond
+                   ;; Initially, show existing remote connections.
+                   ((not (tramp-tramp-file-p string))
+                    (all-completions string connections))
+                   ;; There is a selected remote connection.  Show
+                   ;; its longest common directory path of respective
+                   ;; buffers.
+                   (t (mapcar
+                       (lambda (buffer)
+                         (let ((bfn (buffer-file-name buffer)))
+                           (and (buffer-live-p buffer)
+                                (tramp-equal-remote string bfn)
+                                (stringp bfn) (file-name-directory bfn))))
+                       (tramp-list-remote-buffers))))))
+               #'tramp-tramp-file-p t
+               ;; If the current buffer is a remote one, it is likely
+               ;; that this connection is meant.  So we offer it as
+               ;; initial value.  Otherwise, use the longest remote
+               ;; connection path as initial value.
+               (or (file-remote-p default-directory)
+                   (try-completion "" connections))))
+
+            target
+            (when (null current-prefix-arg)
+              ;; The source remote connection shall not trigger any action.
+              ;; FIXME: Better error prompt when trying to access source host.
+              (let* ((default (or (tramp-default-rename-file source) source))
+                     (dir (tramp-rename-read-file-name-dir default))
+                     (init (tramp-rename-read-file-name-init default))
+                     (tramp-ignored-file-name-regexp
+                      (regexp-quote (file-remote-p source))))
+                (read-file-name-default
+                 "Enter new Tramp connection: "
+                 dir default 'confirm init #'file-directory-p)))))
+
+     (list source target)))
+
+  (unless (tramp-tramp-file-p source)
+    (tramp-user-error nil "Source %s must be remote." source))
+  (when (null target)
+    (or (setq target (tramp-default-rename-file source))
+       (tramp-user-error
+        nil
+        (eval-when-compile
+          (concat "There is no target specified.  "
+                  "Check `tramp-default-rename-alist' for a proper entry.")))))
+  (when (tramp-equal-remote source target)
+    (tramp-user-error nil "Source and target must have different remote."))
+
+  ;; Append local file name if none is specified.
+  (when (string-equal (file-remote-p target) target)
+    (setq target (concat target (file-remote-p source 'localname))))
+  ;; Make them directoy names.
+  (setq source (directory-file-name source)
+       target (directory-file-name target))
+
+  ;; Rename visited file names of source buffers.
+  (save-window-excursion
+    (save-current-buffer
+      (let ((help-form "\
+Type SPC or `y' to set visited file name,
+DEL or `n' to skip to next,
+`e' to edit the visited file name,
+ESC or `q' to quit without changing further buffers,
+`!' to change all remaining buffers with no more questions.")
+           (query-choices '(?y ?\s ?n ?\177 ?! ?e ?q ?\e))
+           (query (unless tramp-confirm-rename-file-names ?!))
+           changed-buffers)
+       (dolist (buffer (tramp-list-remote-buffers))
+          (switch-to-buffer buffer)
+         (let* ((bfn (buffer-file-name))
+                (new-bfn (and (stringp bfn)
+                              (replace-regexp-in-string
+                               (regexp-quote source) target bfn)))
+                (prompt (format-message
+                         "Set visited file name to `%s' [Type yn!eq or %s] "
+                         new-bfn (key-description (vector help-char)))))
+           (when (and (buffer-live-p buffer) (stringp bfn)
+                      (string-prefix-p source bfn)
+                      ;; Skip, and don't ask again.
+                      (not (memq query '(?q ?\e))))
+             ;; Read prompt.
+             (unless (eq query ?!)
+               (setq query (read-char-choice prompt query-choices)))
+             ;; Edit the new buffer file name.
+             (when (eq query ?e)
+               (setq new-bfn
+                     (read-file-name
+                      "New visited file name: "
+                      (file-name-directory new-bfn) new-bfn)))
+             ;; Set buffer file name.  Remember the change.
+             (when (memq query '(?y ?\s ?! ?e))
+               (setq changed-buffers
+                     (cons (list buffer bfn (buffer-modified-p))
+                           changed-buffers))
+                (set-visited-file-name new-bfn))
+             ;; Quit.  Revert changes if prompted by user.
+             (when (and (memq query '(?q ?\e)) changed-buffers
+                        (y-or-n-p "Do you want to revert applied changes?"))
+               (dolist (item changed-buffers)
+                 (with-current-buffer (car item)
+                   (set-visited-file-name (nth 1 item))
+                   (set-buffer-modified-p (nth 2 item)))))
+             ;; Cleanup echo area.
+             (message nil)))))))
+
+  ;; Cleanup.
+  (tramp-cleanup-connection (tramp-dissect-file-name source)))
+
+;;;###tramp-autoload
+(defun tramp-rename-these-files (target)
+  "Replace visiting file names to TARGET.
+The current buffer must be related to a remote connection.  In
+all buffers, which are visiting a file with the same directory
+name, the buffer file name is changed.
+
+Interactively, TARGET is selected from `tramp-default-rename-alist'
+without confirmation if the prefix argument is non-nil.
+
+For details, see `tramp-rename-files'."
+  (interactive
+   (let ((source default-directory)
+        target
+        ;; Completion packages do their voodoo in `completing-read'
+        ;; and `read-file-name', which is often incompatible with
+        ;; Tramp.  Ignore them.
+        (completing-read-function #'completing-read-default)
+        (read-file-name-function #'read-file-name-default))
+     (if (not (tramp-tramp-file-p source))
+        (tramp-user-error
+         nil
+         (substitute-command-keys
+          (concat "Current buffer is not remote.  "
+                  "Consider `\\[tramp-rename-files]' instead.")))
+       (setq target
+            (when (null current-prefix-arg)
+              ;; The source remote connection shall not trigger any action.
+              ;; FIXME: Better error prompt when trying to access source host.
+              (let* ((default (or (tramp-default-rename-file source) source))
+                     (dir (tramp-rename-read-file-name-dir default))
+                     (init (tramp-rename-read-file-name-init default))
+                     (tramp-ignored-file-name-regexp
+                      (regexp-quote (file-remote-p source))))
+                (read-file-name-default
+                 (format "Change Tramp connection `%s': " source)
+                 dir default 'confirm init #'file-directory-p)))))
+     (list target)))
+
+  (tramp-rename-files default-directory target))
+
 ;; Tramp version is useful in a number of situations.
 
 ;;;###tramp-autoload
@@ -424,11 +686,6 @@ please ensure that the buffers are attached to your 
email.\n\n"))
 
 ;; * Clean up unused *tramp/foo* buffers after a while.  (Pete Forman)
 ;;
-;; * WIBNI there was an interactive command prompting for Tramp
-;;   method, hostname, username and filename and translates the user
-;;   input into the correct filename syntax (depending on the Emacs
-;;   flavor)  (Reiner Steib)
-;;
 ;; * Let the user edit the connection properties interactively.
 ;;   Something like `gnus-server-edit-server' in Gnus' *Server* buffer.
 
diff --git a/tramp-compat.el b/tramp-compat.el
index 2d44654..169aced 100644
--- a/tramp-compat.el
+++ b/tramp-compat.el
@@ -32,7 +32,7 @@
 ;; In Emacs 24 and 25, `tramp-unload-file-name-handlers' is not
 ;; autoloaded.  So we declare it here in order to avoid recursive
 ;; load.  This will be overwritten in tramp.el.
-(defun tramp-unload-file-name-handlers ())
+(defun tramp-unload-file-name-handlers () ".")
 
 (require 'auth-source)
 (require 'format-spec)
@@ -47,7 +47,7 @@
 ;; changed argument list, there are compiler warnings.  We want to
 ;; avoid them in cases we know what we do.
 (defmacro tramp-compat-funcall (function &rest arguments)
-  "Call FUNCTION if it exists.  Do not raise compiler warnings."
+  "Call FUNCTION with ARGUMENTS if it exists.  Do not raise compiler warnings."
   `(when (functionp ,function)
      (with-no-warnings (funcall ,function ,@arguments))))
 
@@ -267,6 +267,7 @@ NAME is unquoted."
 
 ;; `cl-struct-slot-info' has been introduced with Emacs 25.
 (defmacro tramp-compat-tramp-file-name-slots ()
+  "Return a list of slot names."
   (if (fboundp 'cl-struct-slot-info)
       '(cdr (mapcar #'car (cl-struct-slot-info 'tramp-file-name)))
     '(cdr (mapcar #'car (get 'tramp-file-name 'cl-struct-slots)))))
diff --git a/tramp-ftp.el b/tramp-ftp.el
index fa76a95..7e3dc76 100644
--- a/tramp-ftp.el
+++ b/tramp-ftp.el
@@ -111,7 +111,7 @@ present for backward compatibility."
 
 ;;;###tramp-autoload
 (defun tramp-ftp-file-name-handler (operation &rest args)
-  "Invoke the Ange-FTP handler for OPERATION.
+  "Invoke the Ange-FTP handler for OPERATION and ARGS.
 First arg specifies the OPERATION, second arg is a list of arguments to
 pass to the OPERATION."
   (save-match-data
@@ -186,7 +186,7 @@ pass to the OPERATION."
 ;; tramp-loaddefs.el.  Otherwise, there would be recursive autoloading.
 ;;;###tramp-autoload
 (defsubst tramp-ftp-file-name-p (filename)
-  "Check if it's a filename that should be forwarded to Ange-FTP."
+  "Check if it's a FILENAME that should be forwarded to Ange-FTP."
   (and (tramp-tramp-file-p filename)
        (string= (tramp-file-name-method (tramp-dissect-file-name filename))
                tramp-ftp-method)))
diff --git a/tramp-gvfs.el b/tramp-gvfs.el
index 4843c63..1b87e34 100644
--- a/tramp-gvfs.el
+++ b/tramp-gvfs.el
@@ -535,7 +535,7 @@ It has been changed in GVFS 1.14.")
   '((access-file . tramp-handle-access-file)
     (add-name-to-file . tramp-handle-add-name-to-file)
     ;; `byte-compiler-base-file-name' performed by default handler.
-    ;; `copy-directory' performed by default handler.
+    (copy-directory . tramp-handle-copy-directory)
     (copy-file . tramp-gvfs-handle-copy-file)
     (delete-directory . tramp-gvfs-handle-delete-directory)
     (delete-file . tramp-gvfs-handle-delete-file)
@@ -612,7 +612,7 @@ Operations not mentioned here will be handled by the 
default Emacs primitives.")
 ;; tramp-loaddefs.el.  Otherwise, there would be recursive autoloading.
 ;;;###tramp-autoload
 (defsubst tramp-gvfs-file-name-p (filename)
-  "Check if it's a filename handled by the GVFS daemon."
+  "Check if it's a FILENAME handled by the GVFS daemon."
   (and (tramp-tramp-file-p filename)
        (let ((method
              (tramp-file-name-method (tramp-dissect-file-name filename))))
@@ -620,7 +620,7 @@ Operations not mentioned here will be handled by the 
default Emacs primitives.")
 
 ;;;###tramp-autoload
 (defun tramp-gvfs-file-name-handler (operation &rest args)
-  "Invoke the GVFS related OPERATION.
+  "Invoke the GVFS related OPERATION and ARGS.
 First arg specifies the OPERATION, second arg is a list of arguments to
 pass to the OPERATION."
   (unless tramp-gvfs-enabled
@@ -658,7 +658,7 @@ Return nil for null BYTE-ARRAY."
              (butlast byte-array) byte-array)))))
 
 (defun tramp-gvfs-stringify-dbus-message (message)
-  "Convert a D-Bus message into readable UTF8 strings, used for traces."
+  "Convert a D-Bus MESSAGE into readable UTF8 strings, used for traces."
   (cond
    ((and (consp message) (characterp (car message)))
     (format "%S" (tramp-gvfs-dbus-byte-array-to-string message)))
@@ -765,6 +765,10 @@ file names."
          (msg-operation (if (eq op 'copy) "Copying" "Renaming")))
 
       (with-parsed-tramp-file-name (if t1 filename newname) nil
+       (unless (file-exists-p filename)
+         (tramp-error
+          v tramp-file-missing
+          "%s file" msg-operation "No such file or directory" filename))
        (when (and (not ok-if-already-exists) (file-exists-p newname))
          (tramp-error v 'file-already-exists newname))
        (when (and (file-directory-p newname)
@@ -1204,7 +1208,7 @@ If FILE-SYSTEM is non-nil, return file system attributes."
 
 (defun tramp-gvfs-monitor-process-filter (proc string)
   "Read output from \"gvfs-monitor-file\" and add corresponding \
-file-notify events."
+`file-notify' events."
   (let* ((events (process-get proc 'events))
         (rest-string (process-get proc 'rest-string))
         (dd (with-current-buffer (process-buffer proc) default-directory))
@@ -1306,6 +1310,8 @@ file-notify events."
   "Like `make-directory' for Tramp files."
   (setq dir (directory-file-name (expand-file-name dir)))
   (with-parsed-tramp-file-name dir nil
+    (when (and (null parents) (file-exists-p dir))
+      (tramp-error v 'file-already-exists "Directory already exists %s" dir))
     (tramp-flush-directory-properties v localname)
     (save-match-data
       (let ((ldir (file-name-directory dir)))
@@ -1518,7 +1524,7 @@ file-notify events."
        result))))
 
 (defun tramp-gvfs-handler-mounted-unmounted (mount-info)
-  "Signal handler for the \"org.gtk.vfs.MountTracker.mounted\" and
+  "Signal handler for the \"org.gtk.vfs.MountTracker.mounted\" and \
 \"org.gtk.vfs.MountTracker.unmounted\" signals."
   (ignore-errors
     (let ((signal-name (dbus-event-member-name last-input-event))
@@ -1911,7 +1917,9 @@ connection if a previous connection has died for some 
reason."
          (tramp-error vec 'file-error "FUSE mount denied"))
 
        ;; Save the password.
-       (ignore-errors (funcall tramp-password-save-function))
+       (ignore-errors
+         (and (functionp tramp-password-save-function)
+              (funcall tramp-password-save-function)))
 
        ;; Set connection-local variables.
        (tramp-set-connection-local-variables vec)
diff --git a/tramp-integration.el b/tramp-integration.el
index 0c706da..0c31076 100644
--- a/tramp-integration.el
+++ b/tramp-integration.el
@@ -36,6 +36,8 @@
 (declare-function tramp-file-name-equal-p "tramp")
 (declare-function tramp-tramp-file-p "tramp")
 (defvar eshell-path-env)
+(defvar ido-read-file-name-non-ido)
+(defvar ivy-completing-read-handlers-alist)
 (defvar recentf-exclude)
 (defvar tramp-current-connection)
 (defvar tramp-postfix-host-format)
@@ -69,6 +71,7 @@ special handling of `substitute-in-file-name'."
                         #'tramp-rfn-eshadow-setup-minibuffer)))
 
 (defun tramp-rfn-eshadow-update-overlay-regexp ()
+  "An overlay covering the shadowed part of the filename."
   (format "[^%s/~]*\\(/\\|~\\)" tramp-postfix-host-format))
 
 ;; Package rfn-eshadow is preloaded in Emacs, but for some reason,
@@ -169,6 +172,20 @@ NAME must be equal to `tramp-current-connection'."
              (remove-hook 'tramp-cleanup-all-connections-hook
                           #'tramp-recentf-cleanup-all))))
 
+;;; Integration of ido.el:
+
+(with-eval-after-load 'ido
+  (add-to-list 'ido-read-file-name-non-ido 'tramp-rename-files)
+  (add-to-list 'ido-read-file-name-non-ido 'tramp-these-rename-files))
+
+;;; Integration of ivy.el:
+
+(with-eval-after-load 'ivy
+  (add-to-list 'ivy-completing-read-handlers-alist
+              '(tramp-rename-files . completing-read-default))
+  (add-to-list 'ivy-completing-read-handlers-alist
+              '(tramp-these-rename-files . completing-read-default)))
+
 ;;; Default connection-local variables for Tramp:
 
 (defconst tramp-connection-local-default-profile
diff --git a/tramp-loaddefs.el b/tramp-loaddefs.el
index 18b2427..50fbb47 100644
--- a/tramp-loaddefs.el
+++ b/tramp-loaddefs.el
@@ -27,18 +27,18 @@ Regexp used as prompt in almquist shell.")
 
 (tramp--with-startup (add-to-list 'tramp-methods `(,tramp-adb-method 
(tramp-tmpdir "/data/local/tmp") (tramp-default-port 5555))) (add-to-list 
'tramp-default-host-alist `(,tramp-adb-method nil "")) 
(tramp-set-completion-function tramp-adb-method '((tramp-adb-parse-device-names 
""))))
 
-(defconst tramp-adb-file-name-handler-alist '((access-file . 
tramp-handle-access-file) (add-name-to-file . tramp-handle-add-name-to-file) 
(copy-file . tramp-adb-handle-copy-file) (delete-directory . 
tramp-adb-handle-delete-directory) (delete-file . tramp-adb-handle-delete-file) 
(directory-file-name . tramp-handle-directory-file-name) (directory-files . 
tramp-handle-directory-files) (directory-files-and-attributes . 
tramp-adb-handle-directory-files-and-attributes) (dired-compress-file . i [...]
+(defconst tramp-adb-file-name-handler-alist '((access-file . 
tramp-handle-access-file) (add-name-to-file . tramp-handle-add-name-to-file) 
(copy-directory . tramp-handle-copy-directory) (copy-file . 
tramp-adb-handle-copy-file) (delete-directory . 
tramp-adb-handle-delete-directory) (delete-file . tramp-adb-handle-delete-file) 
(directory-file-name . tramp-handle-directory-file-name) (directory-files . 
tramp-handle-directory-files) (directory-files-and-attributes . 
tramp-adb-handle-directory [...]
 Alist of handler functions for Tramp ADB method.")
 
 (defsubst tramp-adb-file-name-p (filename) "\
-Check if it's a filename for ADB." (and (tramp-tramp-file-p filename) (string= 
(tramp-file-name-method (tramp-dissect-file-name filename)) tramp-adb-method)))
+Check if it's a FILENAME for ADB." (and (tramp-tramp-file-p filename) (string= 
(tramp-file-name-method (tramp-dissect-file-name filename)) tramp-adb-method)))
 
 (autoload 'tramp-adb-file-name-handler "tramp-adb" "\
 Invoke the ADB handler for OPERATION.
-First arg specifies the OPERATION, second arg is a list of arguments to
-pass to the OPERATION.
+First arg specifies the OPERATION, second arg is a list of
+ARGUMENTS to pass to the OPERATION.
 
-\(fn OPERATION &rest ARGS)" nil nil)
+\(fn OPERATION &rest ARGUMENTS)" nil nil)
 
 (tramp--with-startup (tramp-register-foreign-file-name-handler 
#'tramp-adb-file-name-p #'tramp-adb-file-name-handler))
 
@@ -64,8 +64,8 @@ Operations not mentioned here will be handled by the default 
Emacs primitives.")
 
 (autoload 'tramp-archive-file-name-handler "tramp-archive" "\
 Invoke the file archive related OPERATION.
-First arg specifies the OPERATION, second arg is a list of arguments to
-pass to the OPERATION.
+First arg specifies the OPERATION, second arg ARGS is a list of
+arguments to pass to the OPERATION.
 
 \(fn OPERATION &rest ARGS)" nil nil)
 
@@ -219,6 +219,79 @@ This includes password cache, file cache, connection 
cache, buffers." t nil)
 (autoload 'tramp-cleanup-all-buffers "tramp-cmds" "\
 Kill all remote buffers." t nil)
 
+(defvar tramp-default-rename-alist nil "\
+Default target for renaming remote buffer file names.
+This is an alist of cons cells (SOURCE . TARGET).  The first
+matching item specifies the target to be applied for renaming
+buffer file names from source via `tramp-rename-files'.  SOURCE
+is a regular expressions, which matches a remote file name.
+TARGET must be a directory name, which could be remote (including
+remote directories Tramp infers by default, such as
+\"/method:user@host:\").
+
+TARGET can contain the patterns %m, %u or %h, which are replaced
+by the method name, user name or host name of SOURCE when calling
+`tramp-rename-files'.
+
+SOURCE could also be a Lisp form, which will be evaluated.  The
+result must be a string or nil, which is interpreted as a regular
+expression which always matches.")
+
+(custom-autoload 'tramp-default-rename-alist "tramp-cmds" t)
+
+(defvar tramp-confirm-rename-file-names t "\
+Whether renaming a buffer file name must be confirmed.")
+
+(custom-autoload 'tramp-confirm-rename-file-names "tramp-cmds" t)
+
+(autoload 'tramp-rename-files "tramp-cmds" "\
+Replace in all buffers the visiting file name from SOURCE to TARGET.
+SOURCE is a remote directory name, which could contain also a
+localname part.  TARGET is the directory name SOURCE is replaced
+with.  Often, TARGET is a remote directory name on another host,
+but it can also be a local directory name.  If TARGET has no
+local part, the local part from SOURCE is used.
+
+If TARGET is nil, it is selected according to the first match in
+`tramp-default-rename-alist'.  If called interactively, this
+match is offered as initial value for selection.
+
+On all buffers, which have a `buffer-file-name' matching SOURCE,
+this name is modified by replacing SOURCE with TARGET.  This is
+applied by calling `set-visited-file-name'.  The new
+`buffer-file-name' is prompted for modification in the
+minibuffer.  The buffers are marked modified, and must be saved
+explicitly.
+
+If user option `tramp-confirm-rename-file-names' is nil, changing
+the file name happens without confirmation.  This requires a
+matching entry in `tramp-default-rename-alist'.
+
+Remote buffers related to the remote connection identified by
+SOURCE, which are not visiting files, or which are visiting files
+not matching SOURCE, are not modified.
+
+Interactively, TARGET is selected from `tramp-default-rename-alist'
+without confirmation if the prefix argument is non-nil.
+
+The remote connection identified by SOURCE is flushed by
+`tramp-cleanup-connection'.
+
+\(fn SOURCE TARGET)" t nil)
+
+(autoload 'tramp-rename-these-files "tramp-cmds" "\
+Replace visiting file names to TARGET.
+The current buffer must be related to a remote connection.  In
+all buffers, which are visiting a file with the same directory
+name, the buffer file name is changed.
+
+Interactively, TARGET is selected from `tramp-default-rename-alist'
+without confirmation if the prefix argument is non-nil.
+
+For details, see `tramp-rename-files'.
+
+\(fn TARGET)" t nil)
+
 (autoload 'tramp-version "tramp-cmds" "\
 Print version number of tramp.el in minibuffer or current buffer.
 
@@ -241,14 +314,14 @@ When this method name is used, forward all calls to 
Ange-FTP.")
 (tramp--with-startup (add-to-list 'tramp-methods (cons tramp-ftp-method nil)) 
(add-to-list 'tramp-default-method-alist (list "\\`ftp\\." nil 
tramp-ftp-method)) (add-to-list 'tramp-default-method-alist (list nil 
"\\`\\(anonymous\\|ftp\\)\\'" tramp-ftp-method)) (tramp-set-completion-function 
tramp-ftp-method '((tramp-parse-netrc "~/.netrc"))))
 
 (autoload 'tramp-ftp-file-name-handler "tramp-ftp" "\
-Invoke the Ange-FTP handler for OPERATION.
+Invoke the Ange-FTP handler for OPERATION and ARGS.
 First arg specifies the OPERATION, second arg is a list of arguments to
 pass to the OPERATION.
 
 \(fn OPERATION &rest ARGS)" nil nil)
 
 (defsubst tramp-ftp-file-name-p (filename) "\
-Check if it's a filename that should be forwarded to Ange-FTP." (and 
(tramp-tramp-file-p filename) (string= (tramp-file-name-method 
(tramp-dissect-file-name filename)) tramp-ftp-method)))
+Check if it's a FILENAME that should be forwarded to Ange-FTP." (and 
(tramp-tramp-file-p filename) (string= (tramp-file-name-method 
(tramp-dissect-file-name filename)) tramp-ftp-method)))
 
 (tramp--with-startup (add-to-list 'tramp-foreign-file-name-handler-alist (cons 
#'tramp-ftp-file-name-p #'tramp-ftp-file-name-handler)))
 
@@ -274,15 +347,15 @@ Zeroconf domain to be used for discovering services, like 
host names.")
 (defconst tramp-goa-service "org.gnome.OnlineAccounts" "\
 The well known name of the GNOME Online Accounts service.")
 
-(defconst tramp-gvfs-file-name-handler-alist '((access-file . 
tramp-handle-access-file) (add-name-to-file . tramp-handle-add-name-to-file) 
(copy-file . tramp-gvfs-handle-copy-file) (delete-directory . 
tramp-gvfs-handle-delete-directory) (delete-file . 
tramp-gvfs-handle-delete-file) (directory-file-name . 
tramp-handle-directory-file-name) (directory-files . 
tramp-handle-directory-files) (directory-files-and-attributes . 
tramp-handle-directory-files-and-attributes) (dired-compress-file . i [...]
+(defconst tramp-gvfs-file-name-handler-alist '((access-file . 
tramp-handle-access-file) (add-name-to-file . tramp-handle-add-name-to-file) 
(copy-directory . tramp-handle-copy-directory) (copy-file . 
tramp-gvfs-handle-copy-file) (delete-directory . 
tramp-gvfs-handle-delete-directory) (delete-file . 
tramp-gvfs-handle-delete-file) (directory-file-name . 
tramp-handle-directory-file-name) (directory-files . 
tramp-handle-directory-files) (directory-files-and-attributes . 
tramp-handle-directory [...]
 Alist of handler functions for Tramp GVFS method.
 Operations not mentioned here will be handled by the default Emacs 
primitives.")
 
 (defsubst tramp-gvfs-file-name-p (filename) "\
-Check if it's a filename handled by the GVFS daemon." (and (tramp-tramp-file-p 
filename) (let ((method (tramp-file-name-method (tramp-dissect-file-name 
filename)))) (and (stringp method) (member method tramp-gvfs-methods)))))
+Check if it's a FILENAME handled by the GVFS daemon." (and (tramp-tramp-file-p 
filename) (let ((method (tramp-file-name-method (tramp-dissect-file-name 
filename)))) (and (stringp method) (member method tramp-gvfs-methods)))))
 
 (autoload 'tramp-gvfs-file-name-handler "tramp-gvfs" "\
-Invoke the GVFS related OPERATION.
+Invoke the GVFS related OPERATION and ARGS.
 First arg specifies the OPERATION, second arg is a list of arguments to
 pass to the OPERATION.
 
@@ -305,15 +378,15 @@ Name of the rclone program.")
 
 (tramp--with-startup (add-to-list 'tramp-methods `(,tramp-rclone-method 
(tramp-mount-args nil) (tramp-copyto-args nil) (tramp-moveto-args nil) 
(tramp-about-args ("--full")))) (add-to-list 'tramp-default-host-alist 
`(,tramp-rclone-method nil "")) (tramp-set-completion-function 
tramp-rclone-method '((tramp-rclone-parse-device-names ""))))
 
-(defconst tramp-rclone-file-name-handler-alist '((access-file . 
tramp-handle-access-file) (add-name-to-file . tramp-handle-add-name-to-file) 
(copy-file . tramp-rclone-handle-copy-file) (delete-directory . 
tramp-rclone-handle-delete-directory) (delete-file . 
tramp-rclone-handle-delete-file) (directory-file-name . 
tramp-handle-directory-file-name) (directory-files . 
tramp-rclone-handle-directory-files) (directory-files-and-attributes . 
tramp-handle-directory-files-and-attributes) (dired-co [...]
+(defconst tramp-rclone-file-name-handler-alist '((access-file . 
tramp-handle-access-file) (add-name-to-file . tramp-handle-add-name-to-file) 
(copy-directory . tramp-handle-copy-directory) (copy-file . 
tramp-rclone-handle-copy-file) (delete-directory . 
tramp-rclone-handle-delete-directory) (delete-file . 
tramp-rclone-handle-delete-file) (directory-file-name . 
tramp-handle-directory-file-name) (directory-files . 
tramp-rclone-handle-directory-files) (directory-files-and-attributes . tramp-h 
[...]
 Alist of handler functions for Tramp RCLONE method.
 Operations not mentioned here will be handled by the default Emacs 
primitives.")
 
 (defsubst tramp-rclone-file-name-p (filename) "\
-Check if it's a filename for rclone." (and (tramp-tramp-file-p filename) 
(string= (tramp-file-name-method (tramp-dissect-file-name filename)) 
tramp-rclone-method)))
+Check if it's a FILENAME for rclone." (and (tramp-tramp-file-p filename) 
(string= (tramp-file-name-method (tramp-dissect-file-name filename)) 
tramp-rclone-method)))
 
 (autoload 'tramp-rclone-file-name-handler "tramp-rclone" "\
-Invoke the rclone handler for OPERATION.
+Invoke the rclone handler for OPERATION and ARGS.
 First arg specifies the OPERATION, second arg is a list of arguments to
 pass to the OPERATION.
 
@@ -528,10 +601,10 @@ This can be used to disable echo etc.")
 (custom-autoload 'tramp-smb-winexe-shell-command-switch "tramp-smb" t)
 
 (defsubst tramp-smb-file-name-p (filename) "\
-Check if it's a filename for SMB servers." (and (tramp-tramp-file-p filename) 
(string= (tramp-file-name-method (tramp-dissect-file-name filename)) 
tramp-smb-method)))
+Check if it's a FILENAME for SMB servers." (and (tramp-tramp-file-p filename) 
(string= (tramp-file-name-method (tramp-dissect-file-name filename)) 
tramp-smb-method)))
 
 (autoload 'tramp-smb-file-name-handler "tramp-smb" "\
-Invoke the SMB related OPERATION.
+Invoke the SMB related OPERATION and ARGS.
 First arg specifies the OPERATION, second arg is a list of arguments to
 pass to the OPERATION.
 
@@ -550,14 +623,14 @@ When this method name is used, call sudoedit for editing 
a file.")
 
 (tramp--with-startup (add-to-list 'tramp-methods `(,tramp-sudoedit-method 
(tramp-sudo-login (("sudo") ("-u" "%u") ("-S") ("-H") ("-p" "Password:") 
("--"))))) (add-to-list 'tramp-default-user-alist '("\\`sudoedit\\'" nil 
"root")) (tramp-set-completion-function tramp-sudoedit-method 
tramp-completion-function-alist-su))
 
-(defconst tramp-sudoedit-file-name-handler-alist '((access-file . 
tramp-handle-access-file) (add-name-to-file . 
tramp-sudoedit-handle-add-name-to-file) (byte-compiler-base-file-name . ignore) 
(copy-file . tramp-sudoedit-handle-copy-file) (delete-directory . 
tramp-sudoedit-handle-delete-directory) (delete-file . 
tramp-sudoedit-handle-delete-file) (diff-latest-backup-file . ignore) 
(directory-files . tramp-handle-directory-files) 
(directory-files-and-attributes . tramp-handle-directory-fil [...]
+(defconst tramp-sudoedit-file-name-handler-alist '((access-file . 
tramp-handle-access-file) (add-name-to-file . 
tramp-sudoedit-handle-add-name-to-file) (byte-compiler-base-file-name . ignore) 
(copy-directory . tramp-handle-copy-directory) (copy-file . 
tramp-sudoedit-handle-copy-file) (delete-directory . 
tramp-sudoedit-handle-delete-directory) (delete-file . 
tramp-sudoedit-handle-delete-file) (diff-latest-backup-file . ignore) 
(directory-files . tramp-handle-directory-files) (directory-fi [...]
 Alist of handler functions for Tramp SUDOEDIT method.")
 
 (defsubst tramp-sudoedit-file-name-p (filename) "\
-Check if it's a filename for SUDOEDIT." (and (tramp-tramp-file-p filename) 
(string= (tramp-file-name-method (tramp-dissect-file-name filename)) 
tramp-sudoedit-method)))
+Check if it's a FILENAME for SUDOEDIT." (and (tramp-tramp-file-p filename) 
(string= (tramp-file-name-method (tramp-dissect-file-name filename)) 
tramp-sudoedit-method)))
 
 (autoload 'tramp-sudoedit-file-name-handler "tramp-sudoedit" "\
-Invoke the SUDOEDIT handler for OPERATION.
+Invoke the SUDOEDIT handler for OPERATION and ARGS.
 First arg specifies the OPERATION, second arg is a list of arguments to
 pass to the OPERATION.
 
@@ -580,7 +653,7 @@ UU-encode the region between BEG and END.
 ;;;### (autoloads nil "trampver" "trampver.el" (0 0 0 0))
 ;;; Generated autoloads from trampver.el
 
-(defconst tramp-version "2.4.2.4" "\
+(defconst tramp-version "2.4.2.5" "\
 This version of Tramp.")
 
 (defconst tramp-bug-report-address "address@hidden" "\
diff --git a/tramp-rclone.el b/tramp-rclone.el
index 1f0c7ea..109d8c5 100644
--- a/tramp-rclone.el
+++ b/tramp-rclone.el
@@ -70,7 +70,7 @@
   '((access-file . tramp-handle-access-file)
     (add-name-to-file . tramp-handle-add-name-to-file)
     ;; `byte-compiler-base-file-name' performed by default handler.
-    ;; `copy-directory' performed by default handler.
+    (copy-directory . tramp-handle-copy-directory)
     (copy-file . tramp-rclone-handle-copy-file)
     (delete-directory . tramp-rclone-handle-delete-directory)
     (delete-file . tramp-rclone-handle-delete-file)
@@ -147,14 +147,14 @@ Operations not mentioned here will be handled by the 
default Emacs primitives.")
 ;; tramp-loaddefs.el.  Otherwise, there would be recursive autoloading.
 ;;;###tramp-autoload
 (defsubst tramp-rclone-file-name-p (filename)
-  "Check if it's a filename for rclone."
+  "Check if it's a FILENAME for rclone."
   (and (tramp-tramp-file-p filename)
        (string= (tramp-file-name-method (tramp-dissect-file-name filename))
                tramp-rclone-method)))
 
 ;;;###tramp-autoload
 (defun tramp-rclone-file-name-handler (operation &rest args)
-  "Invoke the rclone handler for OPERATION.
+  "Invoke the rclone handler for OPERATION and ARGS.
 First arg specifies the OPERATION, second arg is a list of arguments to
 pass to the OPERATION."
   (let ((fn (assoc operation tramp-rclone-file-name-handler-alist)))
@@ -213,6 +213,10 @@ file names."
          (msg-operation (if (eq op 'copy) "Copying" "Renaming")))
 
       (with-parsed-tramp-file-name (if t1 filename newname) nil
+       (unless (file-exists-p filename)
+         (tramp-error
+          v tramp-file-missing
+          "%s file" msg-operation "No such file or directory" filename))
        (when (and (not ok-if-already-exists) (file-exists-p newname))
          (tramp-error v 'file-already-exists newname))
        (when (and (file-directory-p newname)
@@ -298,6 +302,10 @@ file names."
 (defun tramp-rclone-handle-directory-files
     (directory &optional full match nosort)
   "Like `directory-files' for Tramp files."
+  (unless (file-exists-p directory)
+    (tramp-error
+     (tramp-dissect-file-name directory) tramp-file-missing
+     "No such file or directory" directory))
   (when (file-directory-p directory)
     (setq directory (file-name-as-directory (expand-file-name directory)))
     (with-parsed-tramp-file-name directory nil
@@ -575,7 +583,8 @@ connection if a previous connection has died for some 
reason."
       vec "gid-string" (tramp-get-local-gid 'string)))
 
 (defun tramp-rclone-send-command (vec &rest args)
-  "Send the COMMAND to connection VEC."
+  "Send a command to connection VEC.
+The command is the list of strings ARGS."
   (with-current-buffer (tramp-get-connection-buffer vec)
     (erase-buffer)
     (let ((flags (tramp-get-method-parameter
diff --git a/tramp-sh.el b/tramp-sh.el
index 3c80c58..59a93a8 100644
--- a/tramp-sh.el
+++ b/tramp-sh.el
@@ -25,6 +25,10 @@
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
+;;; Commentary:
+
+;; The file name handler implementation for ssh-alike remote connections.
+
 ;;; Code:
 
 (eval-when-compile (require 'cl-lib))
@@ -1249,6 +1253,7 @@ component is used as the target of the symlink."
            (tramp-do-file-attributes-with-ls v localname id-format))))))))
 
 (defun tramp-sh--quoting-style-options (vec)
+  "Quoting style options to be used for VEC."
   (or
    (tramp-get-ls-command-with
     vec "--quoting-style=literal --show-control-chars")
@@ -1713,6 +1718,10 @@ of."
   (directory &optional full match nosort id-format)
   "Like `directory-files-and-attributes' for Tramp files."
   (unless id-format (setq id-format 'integer))
+  (unless (file-exists-p directory)
+    (tramp-error
+     (tramp-dissect-file-name directory) tramp-file-missing
+     "No such file or directory" directory))
   (when (file-directory-p directory)
     (setq directory (expand-file-name directory))
     (let* ((temp
@@ -1923,6 +1932,10 @@ tramp-sh-handle-file-name-all-completions: internal 
error accessing `%s': `%s'"
   (let ((t1 (tramp-tramp-file-p dirname))
        (t2 (tramp-tramp-file-p newname)))
     (with-parsed-tramp-file-name (if t1 dirname newname) nil
+      (unless (file-exists-p dirname)
+       (tramp-error
+        v tramp-file-missing
+        "Copying directory" "No such file or directory" dirname))
       (if (and (not copy-contents)
               (tramp-get-method-parameter v 'tramp-copy-recursive)
               ;; When DIRNAME and NEWNAME are remote, they must have
@@ -2011,6 +2024,9 @@ file names."
                           (apply #'file-extended-attributes (list filename)))))
 
       (with-parsed-tramp-file-name (if t1 filename newname) nil
+       (unless (file-exists-p filename)
+         (tramp-error
+          v tramp-file-missing "No such file or directory" filename))
        (when (and (not ok-if-already-exists) (file-exists-p newname))
          (tramp-error v 'file-already-exists newname))
        (when (and (file-directory-p newname)
@@ -2502,6 +2518,8 @@ The method used must be an out-of-band method."
   "Like `make-directory' for Tramp files."
   (setq dir (expand-file-name dir))
   (with-parsed-tramp-file-name dir nil
+    (when (and (null parents) (file-exists-p dir))
+      (tramp-error v 'file-already-exists "Directory already exists %s" dir))
     ;; When PARENTS is non-nil, DIR could be a chain of non-existent
     ;; directories a/b/c/...  Instead of checking, we simply flush the
     ;; whole cache.
@@ -3663,7 +3681,7 @@ Fall back to normal file name handler if no Tramp handler 
exists."
        p))))
 
 (defun tramp-sh-gio-monitor-process-filter (proc string)
-  "Read output from \"gio monitor\" and add corresponding file-notify events."
+  "Read output from \"gio monitor\" and add corresponding `file-notify' 
events."
   (let ((events (process-get proc 'events))
        (remote-prefix
         (with-current-buffer (process-buffer proc)
@@ -3723,7 +3741,7 @@ Fall back to normal file name handler if no Tramp handler 
exists."
 
 (defun tramp-sh-gvfs-monitor-dir-process-filter (proc string)
   "Read output from \"gvfs-monitor-dir\" and add corresponding \
-file-notify events."
+`file-notify' events."
   (let ((events (process-get proc 'events))
        (remote-prefix
         (with-current-buffer (process-buffer proc)
@@ -3773,7 +3791,7 @@ file-notify events."
     (process-put proc 'rest-string string)))
 
 (defun tramp-sh-inotifywait-process-filter (proc string)
-  "Read output from \"inotifywait\" and add corresponding file-notify events."
+  "Read output from \"inotifywait\" and add corresponding `file-notify' 
events."
   (let ((events (process-get proc 'events)))
     (tramp-message proc 6 "%S\n%s" proc string)
     (dolist (line (split-string string "[\n\r]+" 'omit))
@@ -3893,11 +3911,11 @@ hosts, or files, disagree."
 
 (defun tramp-find-executable
   (vec progname dirlist &optional ignore-tilde ignore-path)
-  "Searches for PROGNAME in $PATH and all directories mentioned in DIRLIST.
+  "Search for PROGNAME in $PATH and all directories mentioned in DIRLIST.
 First arg VEC specifies the connection, PROGNAME is the program
 to search for, and DIRLIST gives the list of directories to
 search.  If IGNORE-TILDE is non-nil, directory names starting
-with `~' will be ignored. If IGNORE-PATH is non-nil, searches
+with `~' will be ignored.  If IGNORE-PATH is non-nil, searches
 only in DIRLIST.
 
 Returns the absolute file name of PROGNAME, if found, and nil otherwise.
@@ -3951,7 +3969,7 @@ This function expects to be in the right *tramp* buffer."
 ;; send it.  This is likely not due to PATH_MAX, but PIPE_BUF.  We
 ;; check it, and use a temporary file in case of.  See Bug#33781.
 (defun tramp-set-remote-path (vec)
-  "Sets the remote environment PATH to existing directories.
+  "Set the remote environment PATH to existing directories.
 I.e., for each directory in `tramp-remote-path', it is tested
 whether it exists and if so, it is added to the environment
 variable PATH."
@@ -4044,7 +4062,7 @@ file exists and nonzero exit status otherwise."
     extra-args))
 
 (defun tramp-open-shell (vec shell)
-  "Opens shell SHELL."
+  "Open shell SHELL."
   (with-tramp-progress-reporter
       vec 5 (format-message "Opening remote shell `%s'" shell)
     ;; Find arguments for this shell.
@@ -4098,7 +4116,7 @@ file exists and nonzero exit status otherwise."
      (tramp-get-connection-process vec) "remote-shell" shell)))
 
 (defun tramp-find-shell (vec)
-  "Opens a shell on the remote host which groks tilde expansion."
+  "Open a shell on the remote host which groks tilde expansion."
   (with-current-buffer (tramp-get-buffer vec)
     (let ((default-shell (tramp-get-method-parameter vec 'tramp-remote-shell))
          shell)
@@ -5095,8 +5113,8 @@ function waits for output unless NOOUTPUT is set."
 (defun tramp-send-command-and-check
   (vec command &optional subshell dont-suppress-err)
   "Run COMMAND and check its exit status.
-Sends `echo $?' along with the COMMAND for checking the exit status.
-If COMMAND is nil, just sends `echo $?'.  Returns t if the exit
+Send `echo $?' along with the COMMAND for checking the exit status.
+If COMMAND is nil, just send `echo $?'.  Return t if the exit
 status is 0, and nil otherwise.
 
 If the optional argument SUBSHELL is non-nil, the command is
@@ -5248,7 +5266,7 @@ Return ATTR."
     attr))
 
 (defun tramp-shell-case-fold (string)
-  "Converts STRING to shell glob pattern which ignores case."
+  "Convert STRING to shell glob pattern which ignores case."
   (mapconcat
    (lambda (c)
      (if (equal (downcase c) (upcase c))
@@ -5292,7 +5310,7 @@ Return ATTR."
 ;; Variables local to connection.
 
 (defun tramp-get-remote-path (vec)
-  "Compile list of remote directories for $PATH.
+  "Compile list of remote directories for PATH.
 Nonexistent directories are removed from spec."
   (with-current-buffer (tramp-get-connection-buffer vec)
     ;; Expand connection-local variables.
diff --git a/tramp-smb.el b/tramp-smb.el
index 27c321b..38149da 100644
--- a/tramp-smb.el
+++ b/tramp-smb.el
@@ -319,14 +319,14 @@ This can be used to disable echo etc."
 ;; tramp-loaddefs.el.  Otherwise, there would be recursive autoloading.
 ;;;###tramp-autoload
 (defsubst tramp-smb-file-name-p (filename)
-  "Check if it's a filename for SMB servers."
+  "Check if it's a FILENAME for SMB servers."
   (and (tramp-tramp-file-p filename)
        (string= (tramp-file-name-method (tramp-dissect-file-name filename))
                tramp-smb-method)))
 
 ;;;###tramp-autoload
 (defun tramp-smb-file-name-handler (operation &rest args)
-  "Invoke the SMB related OPERATION.
+  "Invoke the SMB related OPERATION and ARGS.
 First arg specifies the OPERATION, second arg is a list of arguments to
 pass to the OPERATION."
   (let ((fn (assoc operation tramp-smb-file-name-handler-alist)))
@@ -415,6 +415,10 @@ pass to the OPERATION."
       (with-parsed-tramp-file-name (if t1 dirname newname) nil
        (with-tramp-progress-reporter
            v 0 (format "Copying %s to %s" dirname newname)
+         (unless (file-exists-p dirname)
+           (tramp-error
+            v tramp-file-missing
+            "Copying directory" "No such file or directory" dirname))
          (when (and (file-directory-p newname)
                     (not (tramp-compat-directory-name-p newname)))
            (tramp-error v 'file-already-exists newname))
@@ -570,6 +574,13 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
     (if (file-directory-p filename)
        (copy-directory filename newname keep-date 'parents 'copy-contents)
 
+      (unless (file-exists-p filename)
+       (tramp-error
+        (tramp-dissect-file-name
+         (if (tramp-tramp-file-p filename) filename newname))
+        tramp-file-missing
+        "Copying file" "No such file or directory" filename))
+
       (let ((tmpfile (file-local-copy filename)))
        (if tmpfile
            ;; Remote filename.
@@ -669,6 +680,10 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
 (defun tramp-smb-handle-directory-files
   (directory &optional full match nosort)
   "Like `directory-files' for Tramp files."
+  (unless (file-exists-p directory)
+    (tramp-error
+     (tramp-dissect-file-name directory) tramp-file-missing
+     "No such file or directory" directory))
   (let ((result (mapcar #'directory-file-name
                        (file-name-all-completions "" directory))))
     ;; Discriminate with regexp.
@@ -829,7 +844,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
                    device))))))))       ;11 file system number
 
 (defun tramp-smb-do-file-attributes-with-stat (vec &optional id-format)
-  "Implement `file-attributes' for Tramp files using stat command."
+  "Implement `file-attributes' for Tramp files using `stat' command."
   (tramp-message
    vec 5 "file attributes with stat: %s" (tramp-file-name-localname vec))
   (let* (size id link uid gid atime mtime ctime mode inode)
@@ -946,29 +961,31 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
     (unless (file-directory-p filename)
       (setq filename (file-name-directory filename)))
     (with-parsed-tramp-file-name (expand-file-name filename) nil
-      (tramp-message v 5 "file system info: %s" localname)
-      (tramp-smb-send-command v (format "du %s/*" (tramp-smb-get-localname v)))
-      (with-current-buffer (tramp-get-connection-buffer v)
-       (let (total avail blocksize)
-         (goto-char (point-min))
-         (forward-line)
-         (when (looking-at
-                (eval-when-compile
-                  (concat "[[:space:]]*\\([[:digit:]]+\\)"
-                          " blocks of size \\([[:digit:]]+\\)"
-                          "\\. \\([[:digit:]]+\\) blocks available")))
-           (setq blocksize (string-to-number (match-string 2))
-                 total (* blocksize (string-to-number (match-string 1)))
-                 avail (* blocksize (string-to-number (match-string 3)))))
-         (forward-line)
-         (when (looking-at "Total number of bytes: \\([[:digit:]]+\\)")
-           ;; The used number of bytes is not part of the result.  As
-           ;; side effect, we store it as file property.
-           (tramp-set-file-property
-            v localname "used-bytes" (string-to-number (match-string 1))))
-         ;; Result.
-         (when (and total avail)
-           (list total (- total avail) avail)))))))
+      (when (tramp-smb-get-share v)
+       (tramp-message v 5 "file system info: %s" localname)
+       (tramp-smb-send-command
+        v (format "du %s/*" (tramp-smb-get-localname v)))
+       (with-current-buffer (tramp-get-connection-buffer v)
+         (let (total avail blocksize)
+           (goto-char (point-min))
+           (forward-line)
+           (when (looking-at
+                  (eval-when-compile
+                    (concat "[[:space:]]*\\([[:digit:]]+\\)"
+                            " blocks of size \\([[:digit:]]+\\)"
+                            "\\. \\([[:digit:]]+\\) blocks available")))
+             (setq blocksize (string-to-number (match-string 2))
+                   total (* blocksize (string-to-number (match-string 1)))
+                   avail (* blocksize (string-to-number (match-string 3)))))
+           (forward-line)
+           (when (looking-at "Total number of bytes: \\([[:digit:]]+\\)")
+             ;; The used number of bytes is not part of the result.
+             ;; As side effect, we store it as file property.
+             (tramp-set-file-property
+              v localname "used-bytes" (string-to-number (match-string 1))))
+           ;; Result.
+           (when (and total avail)
+             (list total (- total avail) avail))))))))
 
 (defun tramp-smb-handle-file-writable-p (filename)
   "Like `file-writable-p' for Tramp files."
@@ -1122,6 +1139,8 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
   (unless (file-name-absolute-p dir)
     (setq dir (expand-file-name dir default-directory)))
   (with-parsed-tramp-file-name dir nil
+    (when (and (null parents) (file-exists-p dir))
+      (tramp-error v 'file-already-exists "Directory already exists %s" dir))
     (let* ((ldir (file-name-directory dir)))
       ;; Make missing directory parts.
       (when (and parents
@@ -1331,6 +1350,10 @@ component is used as the target of the symlink."
 
   (with-parsed-tramp-file-name
       (if (tramp-tramp-file-p filename) filename newname) nil
+    (unless (file-exists-p filename)
+      (tramp-error
+       v tramp-file-missing
+       "Renaming file" "No such file or directory" filename))
     (when (and (not ok-if-already-exists) (file-exists-p newname))
       (tramp-error v 'file-already-exists newname))
     (when (and (file-directory-p newname)
@@ -1507,7 +1530,7 @@ component is used as the target of the symlink."
        (tramp-flush-connection-property v "process-buffer")))))
 
 (defun tramp-smb-handle-substitute-in-file-name (filename)
-  "Like `handle-substitute-in-file-name' for Tramp files.
+  "Like `substitute-in-file-name' for Tramp files.
 \"//\" 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.
@@ -1835,7 +1858,7 @@ are listed.  Result is the list (LOCALNAME MODE SIZE 
MTIME)."
                  (buffer-substring (point) (point-at-eol)) nil 'omit)))))))))
 
 (defun tramp-smb-get-stat-capability (vec)
-  "Check whether the SMB server supports the STAT command."
+  "Check whether the SMB server supports the `stat' command."
   ;; When we are not logged in yet, we return nil.
   (if (and (tramp-smb-get-share vec)
           (process-live-p (tramp-get-connection-process vec)))
@@ -2094,7 +2117,7 @@ Removes smb prompt.  Returns nil if an error message has 
appeared."
   (tramp-smb-send-command vec "$rawui.WindowSize = $winsize"))
 
 (defun tramp-smb-shell-quote-argument (s)
-  "Similar to `shell-quote-argument', but uses windows cmd syntax."
+  "Similar to `shell-quote-argument', but uses Windows cmd syntax."
   (let ((system-type 'ms-dos))
     (tramp-unquote-shell-quote-argument s)))
 
diff --git a/tramp-sudoedit.el b/tramp-sudoedit.el
index bfc9b3b..2a588f7 100644
--- a/tramp-sudoedit.el
+++ b/tramp-sudoedit.el
@@ -66,7 +66,7 @@ See `tramp-actions-before-shell' for more info.")
   '((access-file . tramp-handle-access-file)
     (add-name-to-file . tramp-sudoedit-handle-add-name-to-file)
     (byte-compiler-base-file-name . ignore)
-    ;; `copy-directory' performed by default handler.
+    (copy-directory . tramp-handle-copy-directory)
     (copy-file . tramp-sudoedit-handle-copy-file)
     (delete-directory . tramp-sudoedit-handle-delete-directory)
     (delete-file . tramp-sudoedit-handle-delete-file)
@@ -143,14 +143,14 @@ See `tramp-actions-before-shell' for more info.")
 ;; tramp-loaddefs.el.  Otherwise, there would be recursive autoloading.
 ;;;###tramp-autoload
 (defsubst tramp-sudoedit-file-name-p (filename)
-  "Check if it's a filename for SUDOEDIT."
+  "Check if it's a FILENAME for SUDOEDIT."
   (and (tramp-tramp-file-p filename)
        (string= (tramp-file-name-method (tramp-dissect-file-name filename))
                tramp-sudoedit-method)))
 
 ;;;###tramp-autoload
 (defun tramp-sudoedit-file-name-handler (operation &rest args)
-  "Invoke the SUDOEDIT handler for OPERATION.
+  "Invoke the SUDOEDIT handler for OPERATION and ARGS.
 First arg specifies the OPERATION, second arg is a list of arguments to
 pass to the OPERATION."
   (let ((fn (assoc operation tramp-sudoedit-file-name-handler-alist)))
@@ -241,6 +241,10 @@ absolute file names."
          (msg-operation (if (eq op 'copy) "Copying" "Renaming")))
 
       (with-parsed-tramp-file-name (if t1 filename newname) nil
+       (unless (file-exists-p filename)
+         (tramp-error
+          v tramp-file-missing
+          "%s file" msg-operation "No such file or directory" filename))
        (when (and (not ok-if-already-exists) (file-exists-p newname))
          (tramp-error v 'file-already-exists newname))
        (when (and (file-directory-p newname)
@@ -583,6 +587,8 @@ the result will be a local, non-Tramp, file name."
   "Like `make-directory' for Tramp files."
   (setq dir (expand-file-name dir))
   (with-parsed-tramp-file-name dir nil
+    (when (and (null parents) (file-exists-p dir))
+      (tramp-error v 'file-already-exists "Directory already exists %s" dir))
     ;; When PARENTS is non-nil, DIR could be a chain of non-existent
     ;; directories a/b/c/...  Instead of checking, we simply flush the
     ;; whole cache.
@@ -743,8 +749,7 @@ ID-FORMAT valid values are `string' and `integer'."
 
 ;; Used in `tramp-sudoedit-sudo-actions'.
 (defun tramp-sudoedit-action-sudo (proc vec)
-  "Check, whether a sudo process has finished.
-Remove unneeded output."
+  "Check, whether a sudo process has finished.  Remove unneeded output."
   ;; There might be pending output for the exit status.
   (unless (process-live-p proc)
     (while (tramp-accept-process-output proc 0))
@@ -860,7 +865,7 @@ In case there is no valid Lisp expression, it raises an 
error."
                (car args) (buffer-string)))))))
 
 (defun tramp-sudoedit-send-command-string (vec &rest args)
-  "Run command ARGS and return the output as astring."
+  "Run command ARGS and return the output as a string."
   (when (apply #'tramp-sudoedit-send-command vec args)
     (with-current-buffer (tramp-get-connection-buffer vec)
       (tramp-message vec 6 "\n%s" (buffer-string))
diff --git a/tramp.el b/tramp.el
index 606c5c0..c81eaf3 100644
--- a/tramp.el
+++ b/tramp.el
@@ -7,7 +7,7 @@
 ;; Maintainer: Michael Albinus <address@hidden>
 ;; Keywords: comm, processes
 ;; Package: tramp
-;; Version: 2.4.2.4
+;; Version: 2.4.2.5
 ;; Package-Requires: ((emacs "24.4"))
 ;; URL: https://savannah.gnu.org/projects/tramp
 
@@ -115,7 +115,7 @@ in `backup-directory-alist'.  If a Tramp file is backed up, 
and DIRECTORY
 is a local file name, the backup directory is prepended with Tramp file
 name prefix \(method, user, host) of file.
 
-\(setq tramp-backup-directory-alist backup-directory-alist)
+  (setq tramp-backup-directory-alist backup-directory-alist)
 
 gives the same backup policy for Tramp files on their hosts like the
 policy for local files."
@@ -457,15 +457,20 @@ interpreted as a regular expression which always matches."
   :version "24.3"
   :type 'boolean)
 
+;; For some obscure technical reasons, `system-name' on w32 returns
+;; either lower case or upper case letters.  See
+;; <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=38079#20>.
 (defcustom tramp-restricted-shell-hosts-alist
   (when (memq system-type '(windows-nt))
-    (list (concat "\\`" (regexp-quote (system-name)) "\\'")))
+    (list (format "\\`\\(%s\\|%s\\)\\'"
+                 (regexp-quote (downcase (system-name)))
+                 (regexp-quote (upcase (system-name))))))
   "List of hosts, which run a restricted shell.
 This is a list of regular expressions, which denote hosts running
-a registered shell like \"rbash\".  Those hosts can be used as
+a restricted shell like \"rbash\".  Those hosts can be used as
 proxies only, see `tramp-default-proxies-alist'.  If the local
-host runs a registered shell, it shall be added to this list, too."
-  :version "24.3"
+host runs a restricted shell, it shall be added to this list, too."
+  :version "27.1"
   :type '(repeat (regexp :tag "Host regexp")))
 
 (defcustom tramp-local-host-regexp
@@ -522,7 +527,7 @@ usually suffice.")
 (defconst tramp-echoed-echo-mark-regexp
   (format "%s\\(\b\\( \b\\)?\\)\\{%d\\}"
          tramp-echo-mark-marker tramp-echo-mark-marker-length)
-  "Regexp which matches `tramp-echo-mark' as it gets echoed by
+  "Regexp which matches `tramp-echo-mark' as it gets echoed by \
 the remote shell.")
 
 (defcustom tramp-local-end-of-line
@@ -718,7 +723,7 @@ Used in user option `tramp-syntax'.  There are further 
variables
 to be set, depending on VALUE."
   ;; Check allowed values.
   (unless (memq value (tramp-syntax-values))
-    (tramp-user-error "Wrong `tramp-syntax' %s" value))
+    (tramp-user-error nil "Wrong `tramp-syntax' %s" value))
   ;; Cleanup existing buffers.
   (unless (eq (symbol-value symbol) value)
     (tramp-cleanup-all-buffers))
@@ -754,14 +759,14 @@ to be set, depending on VALUE."
   (tramp-set-syntax 'tramp-syntax (tramp-compat-tramp-syntax)))
 
 (defun tramp-syntax-values ()
-  "Return possible values of `tramp-syntax', a list"
+  "Return possible values of `tramp-syntax', a list."
   (let ((values (cdr (get 'tramp-syntax 'custom-type))))
     (setq values (mapcar #'last values)
          values (mapcar #'car values))
     values))
 
 (defun tramp-lookup-syntax (alist)
-  "Look up a syntax string in ALIST according to `tramp-compat-tramp-syntax.'
+  "Look up a syntax string in ALIST according to `tramp-compat-tramp-syntax'.
 Raise an error if `tramp-syntax' is invalid."
   (or (cdr (assq (tramp-compat-tramp-syntax) alist))
       (error "Wrong `tramp-syntax' %s" tramp-syntax)))
@@ -773,6 +778,7 @@ Raise an error if `tramp-syntax' is invalid."
   "Alist mapping Tramp syntax to strings beginning Tramp file names.")
 
 (defun tramp-build-prefix-format ()
+  "Return `tramp-prefix-format' according to `tramp-syntax'."
   (tramp-lookup-syntax tramp-prefix-format-alist))
 
 (defvar tramp-prefix-format nil ;Initialized when defining `tramp-syntax'!
@@ -780,6 +786,7 @@ Raise an error if `tramp-syntax' is invalid."
 Used in `tramp-make-tramp-file-name'.")
 
 (defun tramp-build-prefix-regexp ()
+  "Return `tramp-prefix-regexp'."
   (concat "^" (regexp-quote tramp-prefix-format)))
 
 (defvar tramp-prefix-regexp nil ;Initialized when defining `tramp-syntax'!
@@ -793,6 +800,7 @@ Should always start with \"^\". Derived from 
`tramp-prefix-format'.")
   "Alist mapping Tramp syntax to regexps matching methods identifiers.")
 
 (defun tramp-build-method-regexp ()
+  "Return `tramp-method-regexp' according to `tramp-syntax'."
   (tramp-lookup-syntax tramp-method-regexp-alist))
 
 (defvar tramp-method-regexp nil ;Initialized when defining `tramp-syntax'!
@@ -806,6 +814,7 @@ The `ftp' syntax does not support methods.")
   "Alist mapping Tramp syntax to the delimiter after the method.")
 
 (defun tramp-build-postfix-method-format ()
+  "Return `tramp-postfix-method-format' according to `tramp-syntax'."
   (tramp-lookup-syntax tramp-postfix-method-format-alist))
 
 (defvar tramp-postfix-method-format nil ;Init'd when defining `tramp-syntax'!
@@ -814,6 +823,7 @@ The `ftp' syntax does not support methods.
 Used in `tramp-make-tramp-file-name'.")
 
 (defun tramp-build-postfix-method-regexp ()
+  "Return `tramp-postfix-method-regexp'."
   (regexp-quote tramp-postfix-method-format))
 
 (defvar tramp-postfix-method-regexp nil ;Init'd when defining `tramp-syntax'!
@@ -857,6 +867,7 @@ Derived from `tramp-postfix-user-format'.")
   "Alist mapping Tramp syntax to strings prefixing IPv6 addresses.")
 
 (defun tramp-build-prefix-ipv6-format ()
+  "Return `tramp-prefix-ipv6-format' according to `tramp-syntax'."
   (tramp-lookup-syntax tramp-prefix-ipv6-format-alist))
 
 (defvar tramp-prefix-ipv6-format nil ;Initialized when defining `tramp-syntax'!
@@ -864,6 +875,7 @@ Derived from `tramp-postfix-user-format'.")
 Used in `tramp-make-tramp-file-name'.")
 
 (defun tramp-build-prefix-ipv6-regexp ()
+  "Return `tramp-prefix-ipv6-regexp'."
   (regexp-quote tramp-prefix-ipv6-format))
 
 (defvar tramp-prefix-ipv6-regexp nil ;Initialized when defining `tramp-syntax'!
@@ -883,6 +895,7 @@ Derived from `tramp-prefix-ipv6-format'.")
   "Alist mapping Tramp syntax to suffix for IPv6 addresses.")
 
 (defun tramp-build-postfix-ipv6-format ()
+  "Return `tramp-postfix-ipv6-format' according to `tramp-syntax'."
   (tramp-lookup-syntax tramp-postfix-ipv6-format-alist))
 
 (defvar tramp-postfix-ipv6-format nil ;Initialized when defining 
`tramp-syntax'!
@@ -890,6 +903,7 @@ Derived from `tramp-prefix-ipv6-format'.")
 Used in `tramp-make-tramp-file-name'.")
 
 (defun tramp-build-postfix-ipv6-regexp ()
+  "Return `tramp-postfix-ipv6-regexp'."
   (regexp-quote tramp-postfix-ipv6-format))
 
 (defvar tramp-postfix-ipv6-regexp nil ;Initialized when defining 
`tramp-syntax'!
@@ -926,6 +940,7 @@ Derived from `tramp-postfix-hop-format'.")
   "Alist mapping Tramp syntax to strings between host and local names.")
 
 (defun tramp-build-postfix-host-format ()
+  "Return `tramp-postfix-host-format' according to `tramp-syntax'."
   (tramp-lookup-syntax tramp-postfix-host-format-alist))
 
 (defvar tramp-postfix-host-format nil ;Initialized when defining 
`tramp-syntax'!
@@ -933,6 +948,7 @@ Derived from `tramp-postfix-hop-format'.")
 Used in `tramp-make-tramp-file-name'.")
 
 (defun tramp-build-postfix-host-regexp ()
+  "Return `tramp-postfix-host-regexp'."
   (regexp-quote tramp-postfix-host-format))
 
 (defvar tramp-postfix-host-regexp nil ;Initialized when defining 
`tramp-syntax'!
@@ -943,10 +959,10 @@ Derived from `tramp-postfix-host-format'.")
   "Regexp matching localnames.")
 
 (defconst tramp-unknown-id-string "UNKNOWN"
-  "String used to denote an unknown user or group")
+  "String used to denote an unknown user or group.")
 
 (defconst tramp-unknown-id-integer -1
-  "Integer used to denote an unknown user or group")
+  "Integer used to denote an unknown user or group.")
 
 ;;; File name format:
 
@@ -999,6 +1015,7 @@ means the opening parentheses are counted to identify the 
pair.
 See also `tramp-file-name-regexp'.")
 
 (defun tramp-build-file-name-regexp ()
+  "Return `tramp-file-name-regexp'."
   (car tramp-file-name-structure))
 
 ;;;###autoload
@@ -1067,6 +1084,7 @@ See `tramp-file-name-structure' for more explanations.")
   "Alist mapping incomplete Tramp file names.")
 
 (defun tramp-build-completion-file-name-regexp ()
+  "Return `tramp-completion-file-name-regexp' according to `tramp-syntax'."
   (tramp-lookup-syntax tramp-completion-file-name-regexp-alist))
 
 (defvar tramp-completion-file-name-regexp
@@ -1141,13 +1159,13 @@ checked via the following code:
 In the Emacs normally running Tramp, evaluate the above code
 \(replace \"xxx\" and \"yyy\" by the remote user and host name,
 respectively).  You can do this, for example, by pasting it into
-the `*scratch*' buffer and then hitting C-j with the cursor after the
+the `*scratch*' buffer and then hitting `C-j' with the cursor after the
 last closing parenthesis.  Note that it works only if you have configured
 \"ssh\" to run without password query, see ssh-agent(1).
 
 You will see the number of bytes sent successfully to the remote host.
 If that number exceeds 1000, you can stop the execution by hitting
-C-g, because your Emacs is likely clean.
+`C-g', because your Emacs is likely clean.
 
 When it is necessary to set `tramp-chunksize', you might consider to
 use an out-of-the-band method \(like \"scp\") instead of an internal one
@@ -1159,7 +1177,7 @@ about the value `tramp-chunksize' should be set.  Maybe 
you could just
 experiment a bit, e.g. changing the values of `init' and `step'
 in the third line of the code.
 
-Please raise a bug report via \"M-x tramp-bug\" if your system needs
+Please raise a bug report via \\[tramp-bug] if your system needs
 this variable to be set as well."
   :type '(choice (const nil) integer))
 
@@ -1311,8 +1329,8 @@ entry does not exist, return nil."
        t))
 
 (defun tramp-find-method (method user host)
-  "Return the right method string to use.
-This is METHOD, if non-nil. Otherwise, do a lookup in
+  "Return the right method string to use depending on USER and HOST.
+This is METHOD, if non-nil.  Otherwise, do a lookup in
 `tramp-default-method-alist' and `tramp-default-method'."
   (when (and method
             (or (string-equal method "")
@@ -1336,8 +1354,8 @@ This is METHOD, if non-nil. Otherwise, do a lookup in
       (propertize result 'tramp-default t))))
 
 (defun tramp-find-user (method user host)
-  "Return the right user string to use.
-This is USER, if non-nil. Otherwise, do a lookup in
+  "Return the right user string to use depending on METHOD and HOST.
+This is USER, if non-nil.  Otherwise, do a lookup in
 `tramp-default-user-alist' and `tramp-default-user'."
   (let ((result
         (or user
@@ -1357,8 +1375,8 @@ This is USER, if non-nil. Otherwise, do a lookup in
       (propertize result 'tramp-default t))))
 
 (defun tramp-find-host (method user host)
-  "Return the right host string to use.
-This is HOST, if non-nil. Otherwise, do a lookup in
+  "Return the right host string to use depending on METHOD and USER.
+This is HOST, if non-nil.  Otherwise, do a lookup in
 `tramp-default-host-alist' and `tramp-default-host'."
   (let ((result
         (or (and (> (length host) 0) host)
@@ -1383,7 +1401,7 @@ The structure consists of method, user, domain, host, 
port,
 localname (file name on remote host), and hop.
 
 Unless NODEFAULT is non-nil, method, user and host are expanded
-to their default values. For the other file name parts, no
+to their default values.  For the other file name parts, no
 default values are used."
   (save-match-data
     (unless (tramp-tramp-file-p name)
@@ -1558,7 +1576,8 @@ necessary only.  This function will be used in file name 
completion."
          (when localname localname)))
 
 (defun tramp-get-buffer (vec &optional dont-create)
-  "Get the connection buffer to be used for VEC."
+  "Get the connection buffer to be used for VEC.
+Unless DONT-CREATE, the buffer is created when it doesn't exist yet."
   (or (get-buffer (tramp-buffer-name vec))
       (unless dont-create
        (with-current-buffer (get-buffer-create (tramp-buffer-name vec))
@@ -1574,6 +1593,7 @@ necessary only.  This function will be used in file name 
completion."
 
 (defun tramp-get-connection-buffer (vec &optional dont-create)
   "Get the connection buffer to be used for VEC.
+Unless DONT-CREATE, the buffer is created when it doesn't exist yet.
 In case a second asynchronous communication has been started, it is different
 from `tramp-get-buffer'."
   (or (tramp-get-connection-property vec "process-buffer" nil)
@@ -1628,10 +1648,11 @@ version, the function does nothing."
       (format "*debug tramp/%s %s*" method host-port))))
 
 (defconst tramp-debug-outline-regexp
-  (concat
-   "[0-9]+:[0-9]+:[0-9]+\\.[0-9]+ " ;; Timestamp.
-   "\\(?:\\(#<thread .+>\\) \\)?"   ;; Thread.
-   "[a-z0-9-]+ (\\([0-9]+\\)) #")   ;; Function name, verbosity.
+  (eval-when-compile
+    (concat
+     "[0-9]+:[0-9]+:[0-9]+\\.[0-9]+ " ;; Timestamp.
+     "\\(?:\\(#<thread .+>\\) \\)?"   ;; Thread.
+     "[a-z0-9-]+ (\\([0-9]+\\)) #"))  ;; Function name, verbosity.
   "Used for highlighting Tramp debug buffers in `outline-mode'.")
 
 (defconst tramp-debug-font-lock-keywords
@@ -1657,7 +1678,11 @@ The outline level is equal to the verbosity of the Tramp 
message."
       ;; Activate `outline-mode'.  This runs `text-mode-hook' and
       ;; `outline-mode-hook'.  We must prevent that local processes
       ;; die.  Yes: I've seen `flyspell-mode', which starts "ispell".
-      (let ((default-directory (tramp-compat-temporary-file-directory)))
+      ;; `(custom-declare-variable outline-minor-mode-prefix ...)'
+      ;; raises on error in `(outline-mode)', we don't want to see it
+      ;; in the traces.
+      (let ((default-directory (tramp-compat-temporary-file-directory))
+           signal-hook-function)
        (outline-mode))
       (set (make-local-variable 'outline-level) 'tramp-debug-outline-level)
       (set (make-local-variable 'font-lock-keywords)
@@ -1668,7 +1693,7 @@ The outline level is equal to the verbosity of the Tramp 
message."
     (current-buffer)))
 
 (defsubst tramp-debug-message (vec fmt-string &rest arguments)
-  "Append message to debug buffer.
+  "Append message to debug buffer of VEC.
 Message is formatted with FMT-STRING as control string and the remaining
 ARGUMENTS to actually emit the message (if applicable)."
   (with-current-buffer (tramp-get-debug-buffer vec)
@@ -1809,7 +1834,8 @@ function is meant for debugging purposes."
   "Emit an error.
 VEC-OR-PROC identifies the connection to use, SIGNAL is the
 signal identifier to be raised, remaining arguments passed to
-`tramp-message'.  Finally, signal SIGNAL is raised."
+`tramp-message'.  Finally, signal SIGNAL is raised with
+FMT-STRING and ARGUMENTS."
   (let (tramp-message-show-message signal-hook-function)
     (tramp-backtrace vec-or-proc)
     (unless arguments
@@ -1900,8 +1926,13 @@ the resulting error message."
 ;; This function provides traces in case of errors not triggered by
 ;; Tramp functions.
 (defun tramp-signal-hook-function (error-symbol data)
-  "Funtion to be called via `signal-hook-function'."
-  (tramp-error (car tramp-current-connection) error-symbol "%s" data))
+  "Function to be called via `signal-hook-function'."
+  ;; `custom-initialize-*' functions provoke `void-variable' errors.
+  ;; We don't want to see them in the backtrace.
+  (unless (eq error-symbol 'void-variable)
+    (tramp-error
+     (car tramp-current-connection) error-symbol
+     "%s" (mapconcat (lambda (x) (format "%s" x)) data " "))))
 
 (defmacro with-parsed-tramp-file-name (filename var &rest body)
   "Parse a Tramp filename and make components available in the body.
@@ -1990,7 +2021,7 @@ FILE must be a local file name on a connection identified 
via VEC."
 (font-lock-add-keywords 'emacs-lisp-mode '("\\<with-tramp-file-property\\>"))
 
 (defmacro with-tramp-connection-property (key property &rest body)
-  "Check in Tramp for property PROPERTY, otherwise executes BODY and set."
+  "Check in Tramp for property PROPERTY, otherwise execute BODY and set."
   `(let ((value (tramp-get-connection-property ,key ,property 'undef)))
     (when (eq value 'undef)
       ;; We cannot pass ,@body as parameter to
@@ -2121,8 +2152,8 @@ coding system might not be determined.  This function 
repairs it."
 
 (defun tramp-run-real-handler (operation args)
   "Invoke normal file name handler for OPERATION.
-First arg specifies the OPERATION, second arg is a list of arguments to
-pass to the OPERATION."
+First arg specifies the OPERATION, second arg ARGS is a list of
+arguments to pass to the OPERATION."
   (let* ((inhibit-file-name-handlers
          `(tramp-file-name-handler
            tramp-vc-file-name-handler
@@ -2229,7 +2260,7 @@ Must be handled by the callers."
       (with-current-buffer (process-buffer (nth 0 args))
        default-directory)))
    ;; Unknown file primitive.
-   (t (error "unknown file I/O primitive: %s" operation))))
+   (t (error "Unknown file I/O primitive: %s" operation))))
 
 (defun tramp-find-foreign-file-name-handler (filename &optional _operation)
   "Return foreign file name handler if exists."
@@ -2286,7 +2317,7 @@ preventing reentrant calls of Tramp.")
 
 ;; Main function.
 (defun tramp-file-name-handler (operation &rest args)
-  "Invoke Tramp file name handler.
+  "Invoke Tramp file name handler for OPERATION and ARGS.
 Fall back to normal file name handler if no Tramp file name handler exists.
 If Emacs is compiled --with-threads, the body is protected by a mutex."
   (let ((filename (apply #'tramp-file-name-for-operation operation args))
@@ -2400,7 +2431,7 @@ If Emacs is compiled --with-threads, the body is 
protected by a mutex."
       (tramp-run-real-handler operation args))))
 
 (defun tramp-completion-file-name-handler (operation &rest args)
-  "Invoke Tramp file name completion handler.
+  "Invoke Tramp file name completion handler for OPERATION and ARGS.
 Falls back to normal file name handler if no Tramp file name handler exists."
   (let ((fn (assoc operation tramp-completion-file-name-handler-alist)))
     (if (and fn tramp-mode)
@@ -2644,7 +2675,7 @@ not in completion mode."
 ;; Method, host name and user name completion for a file.
 (defun tramp-completion-handle-file-name-completion
   (filename directory &optional predicate)
-  "Like `file-name-completion' for Tramp files."
+  "Like `file-name-completion' for partial Tramp files."
   ;; Suppress eager completion on not connected hosts.
   (let ((non-essential t))
     (try-completion
@@ -2671,7 +2702,7 @@ not in completion mode."
 ;; "/x:y@""/[x/y@"      "/x:y@z" "/[x/y@z"   "/x:y@z:" "/[x/y@z]"
 ;;["x" "y" nil nil]     ["x" "y" "z" nil]    ["x" "y" "z" ""]
 (defun tramp-completion-dissect-file-name (name)
-  "Return a list of `tramp-file-name' structures.
+  "Return a list of `tramp-file-name' structures for NAME.
 They are collected by `tramp-completion-dissect-file-name1'."
   (let* ((x-nil "\\|\\(\\)")
         (tramp-completion-ipv6-regexp
@@ -2744,7 +2775,7 @@ They are collected by 
`tramp-completion-dissect-file-name1'."
        tramp-completion-file-name-structure6)))))
 
 (defun tramp-completion-dissect-file-name1 (structure name)
-  "Return a `tramp-file-name' structure matching STRUCTURE.
+  "Return a `tramp-file-name' structure for NAME matching STRUCTURE.
 The structure consists of remote method, remote user,
 remote host and localname (filename on remote host)."
   (save-match-data
@@ -3051,6 +3082,20 @@ User is always nil."
      filename newname 'ok-if-already-exists 'keep-time
      'preserve-uid-gid 'preserve-permissions)))
 
+(defun tramp-handle-copy-directory
+  (directory newname &optional keep-date parents copy-contents)
+  "Like `copy-directory' for Tramp files."
+  ;; `copy-directory' creates NEWNAME before running this check.  So
+  ;; we do it ourselves.
+  (unless (file-exists-p directory)
+    (tramp-error
+     (tramp-dissect-file-name directory) tramp-file-missing
+     "No such file or directory" directory))
+  ;; We must do it file-wise.
+  (tramp-run-real-handler
+   'copy-directory
+   (list directory newname keep-date parents copy-contents)))
+
 (defun tramp-handle-directory-file-name (directory)
   "Like `directory-file-name' for Tramp files."
   ;; If localname component of filename is "/", leave it unchanged.
@@ -3065,6 +3110,10 @@ User is always nil."
 
 (defun tramp-handle-directory-files (directory &optional full match nosort)
   "Like `directory-files' for Tramp files."
+  (unless (file-exists-p directory)
+    (tramp-error
+     (tramp-dissect-file-name directory) tramp-file-missing
+     "No such file or directory" directory))
   (when (file-directory-p directory)
     (setq directory (file-name-as-directory (expand-file-name directory)))
     (let ((temp (nreverse (file-name-all-completions "" directory)))
@@ -3173,7 +3222,7 @@ User is always nil."
 
 ;; Localname manipulation functions that grok Tramp localnames...
 (defun tramp-handle-file-name-as-directory (file)
-  "Like `file-name-as-directory' but aware of Tramp files."
+  "Like `file-name-as-directory' for Tramp files."
   ;; `file-name-as-directory' would be sufficient except localname is
   ;; the empty string.
   (let ((v (tramp-dissect-file-name file t)))
@@ -3260,7 +3309,7 @@ User is always nil."
      (try-completion filename hits-ignored-extensions))))
 
 (defun tramp-handle-file-name-directory (file)
-  "Like `file-name-directory' but aware of Tramp files."
+  "Like `file-name-directory' for Tramp files."
   ;; Everything except the last filename thing is the directory.  We
   ;; cannot apply `with-parsed-tramp-file-name', because this expands
   ;; the remote file name parts.
@@ -3273,7 +3322,7 @@ User is always nil."
           'noloc))))
 
 (defun tramp-handle-file-name-nondirectory (file)
-  "Like `file-name-nondirectory' but aware of Tramp files."
+  "Like `file-name-nondirectory' for Tramp files."
   (with-parsed-tramp-file-name file nil
     (tramp-run-real-handler #'file-name-nondirectory (list localname))))
 
@@ -3290,9 +3339,13 @@ User is always nil."
 (defun tramp-handle-file-regular-p (filename)
   "Like `file-regular-p' for Tramp files."
   (and (file-exists-p filename)
-       (eq ?-
-          (aref (tramp-compat-file-attribute-modes (file-attributes filename))
-                0))))
+       ;; Sometimes, `file-attributes' does not return a proper value
+       ;; even if `file-exists-p' does.
+       (ignore-errors
+        (eq ?-
+            (aref
+             (tramp-compat-file-attribute-modes (file-attributes filename))
+             0)))))
 
 (defun tramp-handle-file-remote-p (filename &optional identification connected)
   "Like `file-remote-p' for Tramp files."
@@ -4303,7 +4356,7 @@ If both files are local, the function returns t."
           (string-equal (file-remote-p file1) (file-remote-p file2)))))
 
 (defun tramp-mode-string-to-int (mode-string)
-  "Convert a ten-letter `drwxrwxrwx'-style mode string into mode bits."
+  "Convert a ten-letter \"drwxrwxrwx\"-style MODE-STRING into mode bits."
   (let* (case-fold-search
         (mode-chars (string-to-vector mode-string))
          (owner-read (aref mode-chars 1))
@@ -4382,7 +4435,7 @@ If both files are local, the function returns t."
 This is used to map a mode number to a permission string.")
 
 (defun tramp-file-mode-from-int (mode)
-  "Turn an integer representing a file mode into an ls(1)-like string."
+  "Turn an integer representing a file MODE into an ls(1)-like string."
   (let ((type  (cdr
                 (assoc (logand (ash mode -12) 15) tramp-file-mode-type-map)))
        (user   (logand (ash mode -6) 7))
@@ -4938,8 +4991,6 @@ name of a process or buffer, or nil to default to the 
current buffer."
 (defun tramp-unload-tramp ()
   "Discard Tramp from loading remote files."
   (interactive)
-  ;; ange-ftp settings must be re-enabled.
-  (tramp-compat-funcall 'tramp-ftp-enable-ange-ftp)
   ;; Maybe it's not loaded yet.
   (ignore-errors (unload-feature 'tramp 'force)))
 
diff --git a/tramp.info b/tramp.info
index 9ba957a..c973fef 100644
--- a/tramp.info
+++ b/tramp.info
@@ -21,10 +21,10 @@ END-INFO-DIR-ENTRY
 
 File: tramp.info,  Node: Top,  Next: Overview,  Prev: (dir),  Up: (dir)
 
-TRAMP 2.4.2.4 User Manual
+TRAMP 2.4.2.5 User Manual
 *************************
 
-This file documents TRAMP 2.4.2.4, a remote file editing package for
+This file documents TRAMP 2.4.2.5, a remote file editing package for
 Emacs.
 
    TRAMP stands for “Transparent Remote (file) Access, Multiple
@@ -113,6 +113,7 @@ Using TRAMP
 * Ad-hoc multi-hops::           Declaring multiple hops in the file name.
 * Remote processes::            Integration with other Emacs packages.
 * Cleanup remote connections::  Cleanup remote connections.
+* Renaming remote files::       Renaming remote files.
 * Archive file names::          Access to files in file archives.
 
 How file names, directories and localnames are mangled and managed
@@ -1069,7 +1070,7 @@ File: tramp.info,  Node: Default User,  Next: Default 
Host,  Prev: Default Metho
      A Caution: TRAMP will override any default user specified in the
      configuration files outside Emacs, such as ‘~/.ssh/config’.  To
      stop TRAMP from applying the default value, set the corresponding
-     alist entry to nil:
+     alist entry to ‘nil’:
 
           (add-to-list 'tramp-default-user-alist
                        '("ssh" "\\`here\\.somewhere\\.else\\'" nil))
@@ -2060,6 +2061,7 @@ Emacs that may cause missed prompts when using TRAMP.
 * Ad-hoc multi-hops::           Declaring multiple hops in the file name.
 * Remote processes::            Integration with other Emacs packages.
 * Cleanup remote connections::  Cleanup remote connections.
+* Renaming remote files::       Renaming remote files.
 * Archive file names::          Access to files in file archives.
 
 
@@ -2526,15 +2528,16 @@ To open ‘powershell’ as a remote shell, use this:
            explicit-powershell-args '("-file" "-"))
 
 
-File: tramp.info,  Node: Cleanup remote connections,  Next: Archive file 
names,  Prev: Remote processes,  Up: Usage
+File: tramp.info,  Node: Cleanup remote connections,  Next: Renaming remote 
files,  Prev: Remote processes,  Up: Usage
 
 5.6 Cleanup remote connections
 ==============================
 
 TRAMP provides several ways to flush remote connections.
 
- -- Command: tramp-cleanup-connection vec
-     This command flushes all connection related objects.  ‘vec’ is the
+ -- Command: tramp-cleanup-connection vec &optional keep-debug
+          keep-password
+     This command flushes all connection related objects.  VEC is the
      internal representation of a remote connection.  When called
      interactively, this command lists active remote connections in the
      minibuffer.  Each connection is of the format ‘/method:user@host:’.
@@ -2545,9 +2548,12 @@ TRAMP provides several ways to flush remote connections.
      Conveniences::).  It also deletes session timers (*note Predefined
      connection information::) and connection buffers.
 
+     If KEEP-DEBUG is non-‘nil’, the debug buffer is kept.  A non-‘nil’
+     KEEP-PASSWORD preserves the password cache.
+
  -- Command: tramp-cleanup-this-connection
-     Flushes only the current buffer’s remote connection objects, the
-     same as in ‘tramp-cleanup-connection’.
+     Flushes the current buffer’s remote connection objects, the same as
+     in ‘tramp-cleanup-connection’.
 
  -- Command: tramp-cleanup-all-connections
      Flushes all active remote connection objects, the same as in
@@ -2560,13 +2566,105 @@ TRAMP provides several ways to flush remote 
connections.
      all buffers related to remote connections.
 
 
-File: tramp.info,  Node: Archive file names,  Prev: Cleanup remote 
connections,  Up: Usage
+File: tramp.info,  Node: Renaming remote files,  Next: Archive file names,  
Prev: Cleanup remote connections,  Up: Usage
+
+5.7 Renaming remote files
+=========================
+
+Sometimes, it is desirable to safe file contents of buffers visiting a
+given remote host.  This could happen for example, if the local host
+changes its network integration, and the remote host is not reachable
+anymore.
+
+ -- Command: tramp-rename-files source target
+     Replace in all buffers the visiting file name from SOURCE to
+     TARGET.  SOURCE is a remote directory name, which could contain
+     also a localname part.  TARGET is the directory name SOURCE is
+     replaced with.  Often, TARGET is a remote directory name on another
+     host, but it can also be a local directory name.  If TARGET has no
+     local part, the local part from SOURCE is used.
+
+     If TARGET is ‘nil’, it is selected according to the first match in
+     ‘tramp-default-rename-alist’.  If called interactively, this match
+     is offered as initial value for selection.
+
+     On all buffers, which have a ‘buffer-file-name’ matching SOURCE,
+     this name is modified by replacing SOURCE with TARGET.  This is
+     applied by calling ‘set-visited-file-name’.  The new
+     ‘buffer-file-name’ is prompted for modification in the minibuffer.
+     The buffers are marked modified, and must be saved explicitly.
+
+     If user option ‘tramp-confirm-rename-file-names’ is nil, changing
+     the file name happens without confirmation.  This requires a
+     matching entry in ‘tramp-default-rename-alist’.
+
+     Remote buffers related to the remote connection identified by
+     SOURCE, which are not visiting files, or which are visiting files
+     not matching SOURCE, are not modified.
+
+     Interactively, TARGET is selected from ‘tramp-default-rename-alist’
+     without confirmation if the prefix argument is non-‘nil’.
+
+     The remote connection identified by SOURCE is flushed by
+     ‘tramp-cleanup-connection’.
+
+ -- Command: tramp-rename-these-files target
+     Replace visiting file names to TARGET.  The current buffer must be
+     related to a remote connection.  In all buffers, which are visiting
+     a file with the same directory name, the buffer file name is
+     changed.
+
+     Interactively, TARGET is selected from ‘tramp-default-rename-alist’
+     without confirmation if the prefix argument is non-‘nil’.
+
+ -- User Option: tramp-default-rename-alist
+     The default target for renaming remote buffer file names.  This is
+     an alist of cons cells ‘(source . target)’.  The first matching
+     item specifies the target to be applied for renaming buffer file
+     names from source via ‘tramp-rename-files’.  ‘source’ is a regular
+     expressions, which matches a remote file name.  ‘target’ must be a
+     directory name, which could be remote (including remote directories
+     Tramp infers by default, such as ‘/method:user@host:’).
+
+     ‘target’ can contain the patterns ‘%m’, ‘%u’ or ‘%h’, which are
+     replaced by the method name, user name or host name of ‘source’
+     when calling ‘tramp-rename-files’.
+
+     ‘source’ could also be a Lisp form, which will be evaluated.  The
+     result must be a string or nil, which is interpreted as a regular
+     expression which always matches.
+
+     Example entries:
 
-5.7 Archive file names
+          ("/ssh:badhost:/path/to/dir/"
+           . "/ssh:goodhost:/path/to/another/dir/")
+
+     would trigger renaming of buffer file names on ‘badhost’ to
+     ‘goodhost’, including changing the directory name.
+
+          ("/ssh:.+\\.company\\.org:" . "/ssh:multi.hop|ssh:%h:")
+
+     routes all connections to a host in ‘company.org’ via
+     ‘/ssh:multi.hop:’, which might be useful when using Emacs outside
+     the company network.
+
+          (nil . "~/saved-files/%m:%u@%h/")
+
+     saves all remote files locally, with a directory name including
+     method name, user name and host name of the remote connection.
+
+ -- User Option: tramp-confirm-rename-file-names
+     Whether renaming a buffer file name by ‘tramp-rename-files’ or
+     ‘tramp-rename-these-files’ must be confirmed.
+
+
+File: tramp.info,  Node: Archive file names,  Prev: Renaming remote files,  
Up: Usage
+
+5.8 Archive file names
 ======================
 
 TRAMP offers also transparent access to files inside file archives.
-This is possible only on machines which have installed GVFS (the GNOME
+This is possible only on hosts which have installed GVFS (the GNOME
 Virtual File System), *note GVFS-based methods::.  Internally, file
 archives are mounted via the GVFS ‘archive’ method.
 
@@ -3284,6 +3382,19 @@ File: tramp.info,  Node: Frequently Asked Questions,  
Next: Files directories an
      buffer is remote.  See the optional arguments of ‘file-remote-p’
      for determining details of the remote connection.
 
+   • How to save files when a remote host isn’t reachable anymore?
+
+     If the local machine Emacs is running on changes its network
+     integration, remote hosts could become unreachable.  This happens
+     for example, if the local machine is moved between your office and
+     your home without restarting Emacs.
+
+     In such cases, the command ‘tramp-rename-files’ can be used to
+     alter remote buffers’ method, host, and/or directory names.  This
+     permits saving their contents in the same location via another
+     network path, or somewhere else entirely (including locally).
+     *note Renaming remote files::.
+
    • How to disable other packages from calling TRAMP?
 
      There are packages that call TRAMP without the user ever entering a
@@ -3957,13 +4068,13 @@ Function Index
 * tramp-change-syntax:                   Change file name syntax.
                                                                (line 10)
 * tramp-cleanup-all-buffers:             Cleanup remote connections.
-                                                               (line 29)
+                                                               (line 33)
 * tramp-cleanup-all-connections:         Cleanup remote connections.
-                                                               (line 24)
+                                                               (line 28)
 * tramp-cleanup-connection:              Cleanup remote connections.
                                                                (line  8)
 * tramp-cleanup-this-connection:         Cleanup remote connections.
-                                                               (line 20)
+                                                               (line 24)
 * tramp-get-completion-function:         Customizing Completion.
                                                                (line 16)
 * tramp-parse-etc-group:                 Customizing Completion.
@@ -3984,6 +4095,10 @@ Function Index
                                                                (line 46)
 * tramp-parse-sknownhosts:               Customizing Completion.
                                                                (line 63)
+* tramp-rename-files:                    Renaming remote files.
+                                                               (line 11)
+* tramp-rename-these-files:              Renaming remote files.
+                                                               (line 43)
 * tramp-set-completion-function:         Customizing Completion.
                                                                (line 25)
 
@@ -4050,6 +4165,8 @@ Variable Index
                                                               (line  70)
 * tramp-completion-use-auth-sources:     File name completion.
                                                               (line  37)
+* tramp-confirm-rename-file-names:       Renaming remote files.
+                                                              (line  88)
 * tramp-connection-properties:           Predefined connection information.
                                                               (line   9)
 * tramp-default-host:                    Default Host.        (line   6)
@@ -4058,6 +4175,8 @@ Variable Index
 * tramp-default-method-alist:            Default Method.      (line  17)
 * tramp-default-proxies-alist:           Multi-hops.          (line  13)
 * tramp-default-remote-path:             Remote programs.     (line  19)
+* tramp-default-rename-alist:            Renaming remote files.
+                                                              (line  52)
 * tramp-default-user:                    Default User.        (line   6)
 * tramp-default-user-alist:              Default User.        (line  14)
 * tramp-encoding-shell:                  Remote shell setup.  (line  31)
@@ -4067,14 +4186,14 @@ Variable Index
 * tramp-histfile-override:               Frequently Asked Questions.
                                                               (line 281)
 * tramp-ignored-file-name-regexp:        Frequently Asked Questions.
-                                                              (line 584)
+                                                              (line 597)
 * tramp-inline-compress-commands:        Inline methods.      (line  25)
 * tramp-inline-compress-start-size:      Inline methods.      (line  25)
 * tramp-local-host-regexp:               Frequently Asked Questions.
                                                               (line 165)
 * tramp-methods:                         Customizing Methods. (line   6)
 * tramp-mode:                            Frequently Asked Questions.
-                                                              (line 578)
+                                                              (line 591)
 * tramp-own-remote-path:                 Remote programs.     (line  32)
 * tramp-password-prompt-regexp:          Remote shell setup.  (line  65)
 * tramp-persistency-file-name:           Connection caching.  (line   6)
@@ -4360,6 +4479,8 @@ Concept Index
 * rsh (with rcp method):                 External methods.    (line  17)
 * rsh method:                            Inline methods.      (line  32)
 * rsync method:                          External methods.    (line  37)
+* save remote files:                     Renaming remote files.
+                                                              (line   6)
 * scp method:                            External methods.    (line  25)
 * scpx method:                           External methods.    (line  48)
 * scpx method with cygwin:               Windows setup hints. (line  21)
@@ -4429,60 +4550,61 @@ Concept Index
 
 Tag Table:
 Node: Top933
-Node: Overview5366
-Node: Obtaining TRAMP10700
-Node: Quick Start Guide13147
-Ref: Quick Start Guide: File name syntax13924
-Ref: Quick Start Guide: ssh and plink methods15026
-Ref: Quick Start Guide: su, sudo and sg methods15570
-Ref: Quick Start Guide: ssh, plink, su, sudo and sg methods16134
-Ref: Quick Start Guide: sudoedit method16664
-Ref: Quick Start Guide: smb method17075
-Ref: Quick Start Guide: GVFS-based methods17406
-Ref: Quick Start Guide: GNOME Online Accounts based methods17802
-Ref: Quick Start Guide: Android18344
-Ref: Quick Start Guide: rclone method18576
-Node: Configuration18903
-Node: Connection types21375
-Node: Inline methods22789
-Node: External methods27751
-Node: GVFS-based methods38389
-Node: Default Method41658
-Node: Default User44675
-Node: Default Host46198
-Node: Multi-hops47330
-Node: Firewalls51522
-Node: Customizing Methods52979
-Node: Customizing Completion55319
-Node: Password handling58809
-Ref: Using an authentication file59279
-Ref: Caching passwords60781
-Node: Connection caching61299
-Node: Predefined connection information62229
-Node: Remote programs66103
-Node: Remote shell setup69024
-Node: Android shell setup78640
-Node: Auto-save and Backup81027
-Node: Windows setup hints84102
-Node: Usage85722
-Node: File name syntax87020
-Node: Change file name syntax89027
-Node: File name completion90458
-Node: Ad-hoc multi-hops93613
-Node: Remote processes95679
-Ref: Running a debugger on a remote host104437
-Node: Cleanup remote connections106407
-Node: Archive file names107941
-Node: Bug Reports112314
-Node: Frequently Asked Questions114696
-Node: Files directories and localnames137135
-Node: Localname deconstruction137571
-Node: External packages138224
-Node: Traces and Profiles140269
-Node: GNU Free Documentation License142238
-Node: Function Index167609
-Node: Variable Index170213
-Node: Concept Index177548
+Node: Overview5421
+Node: Obtaining TRAMP10755
+Node: Quick Start Guide13202
+Ref: Quick Start Guide: File name syntax13979
+Ref: Quick Start Guide: ssh and plink methods15081
+Ref: Quick Start Guide: su, sudo and sg methods15625
+Ref: Quick Start Guide: ssh, plink, su, sudo and sg methods16189
+Ref: Quick Start Guide: sudoedit method16719
+Ref: Quick Start Guide: smb method17130
+Ref: Quick Start Guide: GVFS-based methods17461
+Ref: Quick Start Guide: GNOME Online Accounts based methods17857
+Ref: Quick Start Guide: Android18399
+Ref: Quick Start Guide: rclone method18631
+Node: Configuration18958
+Node: Connection types21430
+Node: Inline methods22844
+Node: External methods27806
+Node: GVFS-based methods38444
+Node: Default Method41713
+Node: Default User44730
+Node: Default Host46259
+Node: Multi-hops47391
+Node: Firewalls51583
+Node: Customizing Methods53040
+Node: Customizing Completion55380
+Node: Password handling58870
+Ref: Using an authentication file59340
+Ref: Caching passwords60842
+Node: Connection caching61360
+Node: Predefined connection information62290
+Node: Remote programs66164
+Node: Remote shell setup69085
+Node: Android shell setup78701
+Node: Auto-save and Backup81088
+Node: Windows setup hints84163
+Node: Usage85783
+Node: File name syntax87136
+Node: Change file name syntax89143
+Node: File name completion90574
+Node: Ad-hoc multi-hops93729
+Node: Remote processes95795
+Ref: Running a debugger on a remote host104553
+Node: Cleanup remote connections106523
+Node: Renaming remote files108224
+Node: Archive file names112443
+Node: Bug Reports116808
+Node: Frequently Asked Questions119190
+Node: Files directories and localnames142269
+Node: Localname deconstruction142705
+Node: External packages143358
+Node: Traces and Profiles145403
+Node: GNU Free Documentation License147372
+Node: Function Index172743
+Node: Variable Index175621
+Node: Concept Index183230
 
 End Tag Table
 
diff --git a/trampver.el b/trampver.el
index 977210f..d13d5f9 100644
--- a/trampver.el
+++ b/trampver.el
@@ -23,6 +23,11 @@
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
+;;; Commentary:
+
+;; Convenience functions around the Tramp version. Partly generated
+;; during Tramp configuration.
+
 ;;; Code:
 
 ;; In the Tramp GIT, the version number is auto-frobbed from tramp.el,
@@ -31,7 +36,7 @@
 ;; aclocal.m4; should be changed only there.
 
 ;;;###tramp-autoload
-(defconst tramp-version "2.4.2.4"
+(defconst tramp-version "2.4.2.5"
   "This version of Tramp.")
 
 ;;;###tramp-autoload
@@ -65,7 +70,7 @@
 ;; Check for Emacs version.
 (let ((x   (if (not (string-lessp emacs-version "24.4"))
       "ok"
-    (format "Tramp 2.4.2.4 is not fit for %s"
+    (format "Tramp 2.4.2.5 is not fit for %s"
             (replace-regexp-in-string "\n" "" (emacs-version))))))
   (unless (string-equal "ok" x) (error "%s" x)))
 



reply via email to

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