diff options
| author | Stefan Monnier | 2015-04-07 14:56:54 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2015-04-07 14:56:54 -0400 |
| commit | d60dbd81bec6dcb6b78200e07021b9a6ebf861ea (patch) | |
| tree | ec736d2013451a41a970a133a6bf271cbdfa9bb0 | |
| parent | a137ff5025bbfe8aa3cd49814726c4b37ee3311d (diff) | |
| download | emacs-d60dbd81bec6dcb6b78200e07021b9a6ebf861ea.tar.gz emacs-d60dbd81bec6dcb6b78200e07021b9a6ebf861ea.zip | |
Fixes: debbugs:20257
* lisp/files.el (set-visited-file-name): Clear auto-save if nil.
| -rw-r--r-- | lisp/files.el | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lisp/files.el b/lisp/files.el index 0fdf0048ac4..eca52e0ddd3 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -3931,17 +3931,19 @@ the old visited file has been renamed to the new name FILENAME." | |||
| 3931 | (make-local-variable 'backup-inhibited) | 3931 | (make-local-variable 'backup-inhibited) |
| 3932 | (setq backup-inhibited t))) | 3932 | (setq backup-inhibited t))) |
| 3933 | (let ((oauto buffer-auto-save-file-name)) | 3933 | (let ((oauto buffer-auto-save-file-name)) |
| 3934 | ;; If auto-save was not already on, turn it on if appropriate. | 3934 | (cond ((null filename) |
| 3935 | (if (not buffer-auto-save-file-name) | 3935 | (setq buffer-auto-save-file-name nil)) |
| 3936 | (and buffer-file-name auto-save-default | 3936 | ((not buffer-auto-save-file-name) |
| 3937 | (auto-save-mode t)) | 3937 | ;; If auto-save was not already on, turn it on if appropriate. |
| 3938 | ;; If auto save is on, start using a new name. | 3938 | (and buffer-file-name auto-save-default (auto-save-mode t))) |
| 3939 | ;; We deliberately don't rename or delete the old auto save | 3939 | (t |
| 3940 | ;; for the old visited file name. This is because perhaps | 3940 | ;; If auto save is on, start using a new name. We |
| 3941 | ;; the user wants to save the new state and then compare with the | 3941 | ;; deliberately don't rename or delete the old auto save |
| 3942 | ;; previous state from the auto save file. | 3942 | ;; for the old visited file name. This is because |
| 3943 | (setq buffer-auto-save-file-name | 3943 | ;; perhaps the user wants to save the new state and then |
| 3944 | (make-auto-save-file-name))) | 3944 | ;; compare with the previous state from the auto save |
| 3945 | ;; file. | ||
| 3946 | (setq buffer-auto-save-file-name (make-auto-save-file-name)))) | ||
| 3945 | ;; Rename the old auto save file if any. | 3947 | ;; Rename the old auto save file if any. |
| 3946 | (and oauto buffer-auto-save-file-name | 3948 | (and oauto buffer-auto-save-file-name |
| 3947 | (file-exists-p oauto) | 3949 | (file-exists-p oauto) |