diff options
author | Richard M. Stallman <rms@gnu.org> | 1993-07-01 18:39:58 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1993-07-01 18:39:58 +0000 |
commit | c77a81cf65069ecd8749437b46abc53a304fc917 (patch) | |
tree | 00d3bc85d6838475df9c0c29d3591b11b1229520 /lisp/files.el | |
parent | b3e1e05cfea48f453113947b06d22924012e24ca (diff) | |
download | emacs-c77a81cf65069ecd8749437b46abc53a304fc917.tar.gz |
(set-visited-file-name): Rename the old auto save file.
Diffstat (limited to 'lisp/files.el')
-rw-r--r-- | lisp/files.el | 26 |
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." (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))) |