diff options
| author | Eli Zaretskii | 2013-04-06 10:41:09 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2013-04-06 10:41:09 +0300 |
| commit | 33bb237a73a4ba97f21e673dac36b1f8c1299289 (patch) | |
| tree | fd1904d5ce25925f8990cb052fc0f43c67766fff | |
| parent | cd542620197df6fefe2c2bebca1967ec84e8fa7c (diff) | |
| download | emacs-33bb237a73a4ba97f21e673dac36b1f8c1299289.tar.gz emacs-33bb237a73a4ba97f21e673dac36b1f8c1299289.zip | |
Fix the non-creation of backup files in temporary-file directory on Windows.
lisp/files.el (normal-backup-enable-predicate): On MS-Windows and
MS-DOS compare truenames of temporary-file-directory and of the
file, so that 8+3 aliases (usually found in $TEMP on Windows)
don't fail comparison by compare-strings. Also, compare file
names case-insensitively on MS-Windows and MS-DOS.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/files.el | 42 |
2 files changed, 33 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1af9905c7e3..8b249977e4e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2013-04-06 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * files.el (normal-backup-enable-predicate): On MS-Windows and | ||
| 4 | MS-DOS compare truenames of temporary-file-directory and of the | ||
| 5 | file, so that 8+3 aliases (usually found in $TEMP on Windows) | ||
| 6 | don't fail comparison by compare-strings. Also, compare file | ||
| 7 | names case-insensitively on MS-Windows and MS-DOS. | ||
| 8 | |||
| 1 | 2013-04-05 Stefan Monnier <monnier@iro.umontreal.ca> | 9 | 2013-04-05 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 10 | ||
| 3 | * emacs-lisp/package.el (package-compute-transaction): Fix last fix. | 11 | * emacs-lisp/package.el (package-compute-transaction): Fix last fix. |
diff --git a/lisp/files.el b/lisp/files.el index 06958622d14..d098f0fcec7 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -4180,23 +4180,31 @@ ignored." | |||
| 4180 | "Default `backup-enable-predicate' function. | 4180 | "Default `backup-enable-predicate' function. |
| 4181 | Checks for files in `temporary-file-directory', | 4181 | Checks for files in `temporary-file-directory', |
| 4182 | `small-temporary-file-directory', and /tmp." | 4182 | `small-temporary-file-directory', and /tmp." |
| 4183 | (not (or (let ((comp (compare-strings temporary-file-directory 0 nil | 4183 | (let ((temporary-file-directory temporary-file-directory) |
| 4184 | name 0 nil))) | 4184 | caseless) |
| 4185 | ;; Directory is under temporary-file-directory. | 4185 | ;; On MS-Windows, file-truename will convert short 8+3 alises to |
| 4186 | (and (not (eq comp t)) | 4186 | ;; their long file-name equivalents, so compare-strings does TRT. |
| 4187 | (< comp (- (length temporary-file-directory))))) | 4187 | (if (memq system-type '(ms-dos windows-nt)) |
| 4188 | (let ((comp (compare-strings "/tmp" 0 nil | 4188 | (setq temporary-file-directory (file-truename temporary-file-directory) |
| 4189 | name 0 nil))) | 4189 | name (file-truename name) |
| 4190 | ;; Directory is under /tmp. | 4190 | caseless t)) |
| 4191 | (and (not (eq comp t)) | 4191 | (not (or (let ((comp (compare-strings temporary-file-directory 0 nil |
| 4192 | (< comp (- (length "/tmp"))))) | 4192 | name 0 nil caseless))) |
| 4193 | (if small-temporary-file-directory | 4193 | ;; Directory is under temporary-file-directory. |
| 4194 | (let ((comp (compare-strings small-temporary-file-directory | 4194 | (and (not (eq comp t)) |
| 4195 | 0 nil | 4195 | (< comp (- (length temporary-file-directory))))) |
| 4196 | name 0 nil))) | 4196 | (let ((comp (compare-strings "/tmp" 0 nil |
| 4197 | ;; Directory is under small-temporary-file-directory. | 4197 | name 0 nil))) |
| 4198 | (and (not (eq comp t)) | 4198 | ;; Directory is under /tmp. |
| 4199 | (< comp (- (length small-temporary-file-directory))))))))) | 4199 | (and (not (eq comp t)) |
| 4200 | (< comp (- (length "/tmp"))))) | ||
| 4201 | (if small-temporary-file-directory | ||
| 4202 | (let ((comp (compare-strings small-temporary-file-directory | ||
| 4203 | 0 nil | ||
| 4204 | name 0 nil caseless))) | ||
| 4205 | ;; Directory is under small-temporary-file-directory. | ||
| 4206 | (and (not (eq comp t)) | ||
| 4207 | (< comp (- (length small-temporary-file-directory)))))))))) | ||
| 4200 | 4208 | ||
| 4201 | (defun make-backup-file-name (file) | 4209 | (defun make-backup-file-name (file) |
| 4202 | "Create the non-numeric backup file name for FILE. | 4210 | "Create the non-numeric backup file name for FILE. |