diff options
| -rw-r--r-- | lisp/files.el | 54 |
1 files changed, 19 insertions, 35 deletions
diff --git a/lisp/files.el b/lisp/files.el index 9a79b2a0c73..8021e1bbed5 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -4653,41 +4653,25 @@ The function `find-backup-file-name' also uses this." | |||
| 4653 | ;; "/drive_x". | 4653 | ;; "/drive_x". |
| 4654 | (or (file-name-absolute-p file) | 4654 | (or (file-name-absolute-p file) |
| 4655 | (setq file (expand-file-name file))) ; make defaults explicit | 4655 | (setq file (expand-file-name file))) ; make defaults explicit |
| 4656 | (cond | 4656 | ;; Replace any invalid file-name characters (for the |
| 4657 | ((file-remote-p file) | 4657 | ;; case of backing up remote files). |
| 4658 | ;; Remove the leading slash, if any, to prevent | 4658 | (setq file (expand-file-name (convert-standard-filename file))) |
| 4659 | ;; expand-file-name from adding a drive letter. | 4659 | (if (eq (aref file 1) ?:) |
| 4660 | (and (memq (aref file 0) '(?/ ?\\)) | 4660 | (setq file (concat "/" |
| 4661 | (setq file (substring file 1))) | 4661 | "drive_" |
| 4662 | ;; Replace any invalid file-name characters. | 4662 | (char-to-string (downcase (aref file 0))) |
| 4663 | (setq file (convert-standard-filename file)) | 4663 | (if (eq (aref file 2) ?/) |
| 4664 | ;; Replace slashes to make the file name unique, and | 4664 | "" |
| 4665 | ;; prepend backup-directory. | 4665 | "/") |
| 4666 | (expand-file-name | 4666 | (substring file 2))))) |
| 4667 | (subst-char-in-string | 4667 | ;; Make the name unique by substituting directory |
| 4668 | ?/ ?! | 4668 | ;; separators. It may not really be worth bothering about |
| 4669 | (replace-regexp-in-string "!" "!!" | 4669 | ;; doubling `!'s in the original name... |
| 4670 | (concat "/" file))) | 4670 | (expand-file-name |
| 4671 | backup-directory)) | 4671 | (subst-char-in-string |
| 4672 | (t | 4672 | ?/ ?! |
| 4673 | ;; Replace any invalid file-name characters. | 4673 | (replace-regexp-in-string "!" "!!" file)) |
| 4674 | (setq file (expand-file-name (convert-standard-filename file))) | 4674 | backup-directory)) |
| 4675 | (if (eq (aref file 1) ?:) | ||
| 4676 | (setq file (concat "/" | ||
| 4677 | "drive_" | ||
| 4678 | (char-to-string (downcase (aref file 0))) | ||
| 4679 | (if (eq (aref file 2) ?/) | ||
| 4680 | "" | ||
| 4681 | "/") | ||
| 4682 | (substring file 2)))) | ||
| 4683 | ;; Make the name unique by substituting directory | ||
| 4684 | ;; separators. It may not really be worth bothering about | ||
| 4685 | ;; doubling `!'s in the original name... | ||
| 4686 | (expand-file-name | ||
| 4687 | (subst-char-in-string | ||
| 4688 | ?/ ?! | ||
| 4689 | (replace-regexp-in-string "!" "!!" file)) | ||
| 4690 | backup-directory))))) | ||
| 4691 | (expand-file-name (file-name-nondirectory file) | 4675 | (expand-file-name (file-name-nondirectory file) |
| 4692 | (file-name-as-directory abs-backup-directory)))))) | 4676 | (file-name-as-directory abs-backup-directory)))))) |
| 4693 | 4677 | ||