diff options
author | Richard M. Stallman <[email protected]> | 1994-09-20 04:27:40 +0000 |
---|---|---|
committer | Richard M. Stallman <[email protected]> | 1994-09-20 04:27:40 +0000 |
commit | 6782610c408e3220fe2447a144ca4ac42f36fa19 (patch) | |
tree | a72b7e8010f4f24ce2f20feec15adb8c30f0691a /lisp/files.el | |
parent | c56fbd24449cc73394bce8e3b720f918f7ffa2c8 (diff) |
(basic-save-buffer-1): If writing temp file fails
or a precious file, restore the old visited file modtime.
Diffstat (limited to 'lisp/files.el')
-rw-r--r-- | lisp/files.el | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lisp/files.el b/lisp/files.el index bfc4abafa3..b26da5dde7 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1668,7 +1668,8 @@ the last real save, but optional arg FORCE non-nil means delete anyway." ;; This requires write access to the containing dir, ;; which is why we don't try it if we don't have that access. (let ((realname buffer-file-name) - tempname temp nogood i succeed) + tempname temp nogood i succeed + (old-modtime (visited-file-modtime))) (setq i 0) (setq nogood t) ;; Find the temporary name to write under. @@ -1683,7 +1684,10 @@ the last real save, but optional arg FORCE non-nil means delete anyway." (setq succeed t)) ;; If writing the temp file fails, ;; delete the temp file. - (or succeed (delete-file tempname))) + (or succeed + (progn + (delete-file tempname) + (set-visited-file-modtime old-modtime)))) ;; Since we have created an entirely new file ;; and renamed it, make sure it gets the ;; right permission bits set. |