changeset 3944:5e740ac08e39

(set-visited-file-name): Rename the old auto save file.
author Richard M. Stallman <rms@gnu.org>
date Thu, 01 Jul 1993 18:39:58 +0000
parents cbdf67dd68d0
children 7a8d0a08eac7
files lisp/files.el
diffstat 1 files changed, 15 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Thu Jul 01 04:04:32 1993 +0000
+++ b/lisp/files.el	Thu Jul 01 18:39:58 1993 +0000
@@ -1093,17 +1093,21 @@
        (progn
 	 (make-local-variable 'backup-inhibited)
 	 (setq backup-inhibited t)))
-  ;; If auto-save was not already on, turn it on if appropriate.
-  (if (not buffer-auto-save-file-name)
-      (and buffer-file-name auto-save-default
-	   (auto-save-mode t))
-    ;; If auto save is on, start using a new name.
-    ;; We deliberately don't rename or delete the old auto save
-    ;; for the old visited file name.  This is because perhaps
-    ;; the user wants to save the new state and then compare with the
-    ;; previous state from the auto save file.
-    (setq buffer-auto-save-file-name
-	  (make-auto-save-file-name)))
+  (let ((oauto buffer-auto-save-file-name))
+    ;; If auto-save was not already on, turn it on if appropriate.
+    (if (not buffer-auto-save-file-name)
+	(and buffer-file-name auto-save-default
+	     (auto-save-mode t))
+      ;; If auto save is on, start using a new name.
+      ;; We deliberately don't rename or delete the old auto save
+      ;; for the old visited file name.  This is because perhaps
+      ;; the user wants to save the new state and then compare with the
+      ;; previous state from the auto save file.
+      (setq buffer-auto-save-file-name
+	    (make-auto-save-file-name)))
+    ;; Rename the old auto save file if any.
+    (and oauto buffer-auto-save-file-name
+	 (rename-file oauto buffer-auto-save-file-name t)))
   (if buffer-file-name
       (set-buffer-modified-p t)))