emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r112235: Fix the non-creation of back


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112235: Fix the non-creation of backup files in temporary-file directory on Windows.
Date: Sat, 06 Apr 2013 10:41:09 +0300
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 112235
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2013-04-06 10:41:09 +0300
message:
  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.
modified:
  lisp/ChangeLog
  lisp/files.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-04-05 22:22:12 +0000
+++ b/lisp/ChangeLog    2013-04-06 07:41:09 +0000
@@ -1,3 +1,11 @@
+2013-04-06  Eli Zaretskii  <address@hidden>
+
+       * 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.
+
 2013-04-05  Stefan Monnier  <address@hidden>
 
        * emacs-lisp/package.el (package-compute-transaction): Fix last fix.

=== modified file 'lisp/files.el'
--- a/lisp/files.el     2013-03-24 06:42:25 +0000
+++ b/lisp/files.el     2013-04-06 07:41:09 +0000
@@ -4180,23 +4180,31 @@
   "Default `backup-enable-predicate' function.
 Checks for files in `temporary-file-directory',
 `small-temporary-file-directory', and /tmp."
-  (not (or (let ((comp (compare-strings temporary-file-directory 0 nil
-                                       name 0 nil)))
-            ;; Directory is under temporary-file-directory.
-            (and (not (eq comp t))
-                 (< comp (- (length temporary-file-directory)))))
-          (let ((comp (compare-strings "/tmp" 0 nil
-                                       name 0 nil)))
-            ;; Directory is under /tmp.
-            (and (not (eq comp t))
-                 (< comp (- (length "/tmp")))))
-          (if small-temporary-file-directory
-              (let ((comp (compare-strings small-temporary-file-directory
-                                           0 nil
-                                           name 0 nil)))
-                ;; Directory is under small-temporary-file-directory.
-                (and (not (eq comp t))
-                     (< comp (- (length small-temporary-file-directory)))))))))
+  (let ((temporary-file-directory temporary-file-directory)
+       caseless)
+    ;; On MS-Windows, file-truename will convert short 8+3 alises to
+    ;; their long file-name equivalents, so compare-strings does TRT.
+    (if (memq system-type '(ms-dos windows-nt))
+       (setq temporary-file-directory (file-truename temporary-file-directory)
+             name (file-truename name)
+             caseless t))
+    (not (or (let ((comp (compare-strings temporary-file-directory 0 nil
+                                         name 0 nil caseless)))
+              ;; Directory is under temporary-file-directory.
+              (and (not (eq comp t))
+                   (< comp (- (length temporary-file-directory)))))
+            (let ((comp (compare-strings "/tmp" 0 nil
+                                         name 0 nil)))
+              ;; Directory is under /tmp.
+              (and (not (eq comp t))
+                   (< comp (- (length "/tmp")))))
+            (if small-temporary-file-directory
+                (let ((comp (compare-strings small-temporary-file-directory
+                                             0 nil
+                                             name 0 nil caseless)))
+                  ;; Directory is under small-temporary-file-directory.
+                  (and (not (eq comp t))
+                       (< comp (- (length 
small-temporary-file-directory))))))))))
 
 (defun make-backup-file-name (file)
   "Create the non-numeric backup file name for FILE.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]