1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-17 17:58:46 +00:00

(set-visited-file-name): Rename the old auto save file.

This commit is contained in:
Richard M. Stallman 1993-07-01 18:39:58 +00:00
parent b3e1e05cfe
commit c77a81cf65

View File

@ -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)))