aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorEli Zaretskii2000-05-23 13:19:38 +0000
committerEli Zaretskii2000-05-23 13:19:38 +0000
commit41ac433f6646ebb2cd6d1de4ee6f123b42679b85 (patch)
treed0eb71eb0ef4d04fe1b2dd3afa48bb688fcf94b3 /lisp
parent46600ab15361b60202da10fd5cac6f8c4f0bdc21 (diff)
downloademacs-41ac433f6646ebb2cd6d1de4ee6f123b42679b85.tar.gz
emacs-41ac433f6646ebb2cd6d1de4ee6f123b42679b85.zip
(make-backup-file-name-1): Replace slashes with `!'
rather than `|' (which is not allowed on Windows). Replace the drive letters with a string "drive_X".
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/files.el40
2 files changed, 36 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 78ae669dfc7..f778179b87f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12000-05-23 Eli Zaretskii <eliz@is.elta.co.il>
2
3 * files.el (make-backup-file-name-1): Replace slashes with `!'
4 rather than `|' (which is not allowed on Windows). Replace the
5 drive letters with a string "drive_X".
6
12000-05-23 Gerd Moellmann <gerd@gnu.org> 72000-05-23 Gerd Moellmann <gerd@gnu.org>
2 8
3 * progmodes/sh-script.el (sh-ancestor-alist): Add `bash2'. 9 * progmodes/sh-script.el (sh-ancestor-alist): Add `bash2'.
diff --git a/lisp/files.el b/lisp/files.el
index 0758247b603..b56d15aeafb 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2231,7 +2231,7 @@ names matching REGEXP will be made in DIRECTORY. DIRECTORY may be
2231relative or absolute. If it is absolute, so that all matching files 2231relative or absolute. If it is absolute, so that all matching files
2232are backed up into the same directory, the file names in this 2232are backed up into the same directory, the file names in this
2233directory will be the full name of the file backed up with all 2233directory will be the full name of the file backed up with all
2234directory separators changed to `|' to prevent clashes. This will not 2234directory separators changed to `!' to prevent clashes. This will not
2235work correctly if your filesystem truncates the resulting name. 2235work correctly if your filesystem truncates the resulting name.
2236 2236
2237For the common case of all backups going into one directory, the alist 2237For the common case of all backups going into one directory, the alist
@@ -2274,7 +2274,7 @@ doesn't exist, it is created."
2274(defun make-backup-file-name-1 (file) 2274(defun make-backup-file-name-1 (file)
2275 "Subroutine of `make-backup-file-name' and `find-backup-file-name'." 2275 "Subroutine of `make-backup-file-name' and `find-backup-file-name'."
2276 (let ((alist backup-directory-alist) 2276 (let ((alist backup-directory-alist)
2277 elt backup-directory) 2277 elt backup-directory dir-sep-string)
2278 (while alist 2278 (while alist
2279 (setq elt (pop alist)) 2279 (setq elt (pop alist))
2280 (if (string-match (car elt) file) 2280 (if (string-match (car elt) file)
@@ -2287,14 +2287,34 @@ doesn't exist, it is created."
2287 (make-directory backup-directory 'parents) 2287 (make-directory backup-directory 'parents)
2288 (file-error file))) 2288 (file-error file)))
2289 (if (file-name-absolute-p backup-directory) 2289 (if (file-name-absolute-p backup-directory)
2290 ;; Make the name unique by substituting directory 2290 (progn
2291 ;; separators. It may not really be worth bothering about 2291 (when (memq system-type '(windows-nt ms-dos))
2292 ;; doubling `|'s in the original name... 2292 ;; Normalize DOSish file names: convert all slashes to
2293 (expand-file-name 2293 ;; directory-sep-char, downcase the drive letter, if any,
2294 (subst-char-in-string 2294 ;; and replace the leading "x:" with "/drive_x".
2295 directory-sep-char ?| 2295 (or (file-name-absolute-p file)
2296 (replace-regexp-in-string "|" "||" file)) 2296 (setq file (expand-file-name file))) ; make defaults explicit
2297 backup-directory) 2297 (setq dir-sep-string (char-to-string directory-sep-char))
2298 (or (eq directory-sep-char ?/)
2299 (subst-char-in-string ?/ ?\\ file))
2300 (or (eq directory-sep-char ?\\)
2301 (subst-char-in-string ?\\ ?/ file))
2302 (if (eq (aref file 1) ?:)
2303 (setq file (concat dir-sep-string
2304 "drive_"
2305 (char-to-string (downcase (aref file 0)))
2306 (if (eq (aref file 2) directory-sep-char)
2307 ""
2308 dir-sep-string)
2309 (substring file 2)))))
2310 ;; Make the name unique by substituting directory
2311 ;; separators. It may not really be worth bothering about
2312 ;; doubling `!'s in the original name...
2313 (expand-file-name
2314 (subst-char-in-string
2315 directory-sep-char ?!
2316 (replace-regexp-in-string "!" "!!" file))
2317 backup-directory))
2298 (expand-file-name (file-name-nondirectory file) 2318 (expand-file-name (file-name-nondirectory file)
2299 (file-name-as-directory 2319 (file-name-as-directory
2300 (expand-file-name backup-directory 2320 (expand-file-name backup-directory