changeset 8937:065d01c10c78

(basic-save-buffer-1): If writing temp file fails or a precious file, restore the old visited file modtime.
author Richard M. Stallman <rms@gnu.org>
date Tue, 20 Sep 1994 04:27:40 +0000
parents bcf92490217e
children 16c1ca187613
files lisp/files.el
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Tue Sep 20 04:27:27 1994 +0000
+++ b/lisp/files.el	Tue Sep 20 04:27:40 1994 +0000
@@ -1668,7 +1668,8 @@
 	  ;; 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 @@
 		       (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.