]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix Bug#29149
authorMichael Albinus <michael.albinus@gmx.de>
Mon, 20 Nov 2017 13:28:22 +0000 (14:28 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Mon, 20 Nov 2017 13:28:22 +0000 (14:28 +0100)
* lisp/net/tramp.el (tramp-drop-volume-letter): Handle also
backup file names.
(tramp-handle-find-backup-file-name):
Call `tramp-drop-volume-letter' on the results.  (Bug#29149)

lisp/net/tramp.el

index aadfcadebcf6a876b1bf4e9e8cd8c6e6d28a1959..efd31b26be64af14244b8531b815801327511440 100644 (file)
@@ -1858,7 +1858,8 @@ letter into the file name.  This function removes it."
      (if (tramp-compat-file-name-quoted-p name)
         'tramp-compat-file-name-quote 'identity)
      (let ((name (tramp-compat-file-name-unquote name)))
-       (if (string-match "\\`[a-zA-Z]:/" name)
+       ;; A volume letter could occur also in encoded backup file names.
+       (if (string-match "\\(\\`[[:alpha:]]:/\\|/!drive_[[:alpha:]]\\)" name)
           (replace-match "/" nil t name)
         name)))))
 
@@ -3222,21 +3223,23 @@ User is always nil."
 (defun tramp-handle-find-backup-file-name (filename)
   "Like `find-backup-file-name' for Tramp files."
   (with-parsed-tramp-file-name filename nil
-    (let ((backup-directory-alist
-          (if tramp-backup-directory-alist
-              (mapcar
-               (lambda (x)
-                 (cons
-                  (car x)
-                  (if (and (stringp (cdr x))
-                           (file-name-absolute-p (cdr x))
-                           (not (tramp-tramp-file-p (cdr x))))
-                      (tramp-make-tramp-file-name
-                       method user domain host port (cdr x) hop)
-                    (cdr x))))
-               tramp-backup-directory-alist)
-            backup-directory-alist)))
-      (tramp-run-real-handler 'find-backup-file-name (list filename)))))
+    (mapcar
+     'tramp-drop-volume-letter
+     (let ((backup-directory-alist
+           (if tramp-backup-directory-alist
+               (mapcar
+                (lambda (x)
+                  (cons
+                   (car x)
+                   (if (and (stringp (cdr x))
+                            (file-name-absolute-p (cdr x))
+                            (not (tramp-tramp-file-p (cdr x))))
+                       (tramp-make-tramp-file-name
+                        method user domain host port (cdr x) hop)
+                     (cdr x))))
+                tramp-backup-directory-alist)
+             backup-directory-alist)))
+       (tramp-run-real-handler 'find-backup-file-name (list filename))))))
 
 (defun tramp-handle-insert-directory
   (filename switches &optional wildcard full-directory-p)