Revert "Fix backing up remote files in local directories on MS-Windows"

This reverts commit 8c8b673288.
This commit is contained in:
John Wiegley 2017-12-01 12:42:58 -08:00
parent f52d79500b
commit 1e25cd79ff

View file

@ -4653,41 +4653,25 @@ The function `find-backup-file-name' also uses this."
;; "/drive_x". ;; "/drive_x".
(or (file-name-absolute-p file) (or (file-name-absolute-p file)
(setq file (expand-file-name file))) ; make defaults explicit (setq file (expand-file-name file))) ; make defaults explicit
(cond ;; Replace any invalid file-name characters (for the
((file-remote-p file) ;; case of backing up remote files).
;; Remove the leading slash, if any, to prevent (setq file (expand-file-name (convert-standard-filename file)))
;; expand-file-name from adding a drive letter. (if (eq (aref file 1) ?:)
(and (memq (aref file 0) '(?/ ?\\)) (setq file (concat "/"
(setq file (substring file 1))) "drive_"
;; Replace any invalid file-name characters. (char-to-string (downcase (aref file 0)))
(setq file (convert-standard-filename file)) (if (eq (aref file 2) ?/)
;; Replace slashes to make the file name unique, and ""
;; prepend backup-directory. "/")
(expand-file-name (substring file 2)))))
(subst-char-in-string ;; Make the name unique by substituting directory
?/ ?! ;; separators. It may not really be worth bothering about
(replace-regexp-in-string "!" "!!" ;; doubling `!'s in the original name...
(concat "/" file))) (expand-file-name
backup-directory)) (subst-char-in-string
(t ?/ ?!
;; Replace any invalid file-name characters. (replace-regexp-in-string "!" "!!" file))
(setq file (expand-file-name (convert-standard-filename file))) backup-directory))
(if (eq (aref file 1) ?:)
(setq file (concat "/"
"drive_"
(char-to-string (downcase (aref file 0)))
(if (eq (aref file 2) ?/)
""
"/")
(substring file 2))))
;; Make the name unique by substituting directory
;; separators. It may not really be worth bothering about
;; doubling `!'s in the original name...
(expand-file-name
(subst-char-in-string
?/ ?!
(replace-regexp-in-string "!" "!!" file))
backup-directory)))))
(expand-file-name (file-name-nondirectory file) (expand-file-name (file-name-nondirectory file)
(file-name-as-directory abs-backup-directory)))))) (file-name-as-directory abs-backup-directory))))))