aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1993-07-01 18:39:58 +0000
committerRichard M. Stallman1993-07-01 18:39:58 +0000
commitc77a81cf65069ecd8749437b46abc53a304fc917 (patch)
tree00d3bc85d6838475df9c0c29d3591b11b1229520
parentb3e1e05cfea48f453113947b06d22924012e24ca (diff)
downloademacs-c77a81cf65069ecd8749437b46abc53a304fc917.tar.gz
emacs-c77a81cf65069ecd8749437b46abc53a304fc917.zip
(set-visited-file-name): Rename the old auto save file.
-rw-r--r--lisp/files.el26
1 files changed, 15 insertions, 11 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 3782a794727..66adbba5f20 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1093,17 +1093,21 @@ if you wish to pass an empty string as the argument."
1093 (progn 1093 (progn
1094 (make-local-variable 'backup-inhibited) 1094 (make-local-variable 'backup-inhibited)
1095 (setq backup-inhibited t))) 1095 (setq backup-inhibited t)))
1096 ;; If auto-save was not already on, turn it on if appropriate. 1096 (let ((oauto buffer-auto-save-file-name))
1097 (if (not buffer-auto-save-file-name) 1097 ;; If auto-save was not already on, turn it on if appropriate.
1098 (and buffer-file-name auto-save-default 1098 (if (not buffer-auto-save-file-name)
1099 (auto-save-mode t)) 1099 (and buffer-file-name auto-save-default
1100 ;; If auto save is on, start using a new name. 1100 (auto-save-mode t))
1101 ;; We deliberately don't rename or delete the old auto save 1101 ;; If auto save is on, start using a new name.
1102 ;; for the old visited file name. This is because perhaps 1102 ;; We deliberately don't rename or delete the old auto save
1103 ;; the user wants to save the new state and then compare with the 1103 ;; for the old visited file name. This is because perhaps
1104 ;; previous state from the auto save file. 1104 ;; the user wants to save the new state and then compare with the
1105 (setq buffer-auto-save-file-name 1105 ;; previous state from the auto save file.
1106 (make-auto-save-file-name))) 1106 (setq buffer-auto-save-file-name
1107 (make-auto-save-file-name)))
1108 ;; Rename the old auto save file if any.
1109 (and oauto buffer-auto-save-file-name
1110 (rename-file oauto buffer-auto-save-file-name t)))
1107 (if buffer-file-name 1111 (if buffer-file-name
1108 (set-buffer-modified-p t))) 1112 (set-buffer-modified-p t)))
1109 1113