changeset 11063:f6c97f56c8b6

(write-file): Query if file exists already.
author Richard M. Stallman <rms@gnu.org>
date Sat, 18 Mar 1995 21:51:18 +0000
parents 302f676eeca0
children bf32108711c6
files lisp/files.el
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Sat Mar 18 18:13:23 1995 +0000
+++ b/lisp/files.el	Sat Mar 18 21:51:18 1995 +0000
@@ -1344,6 +1344,9 @@
 	(if (and (file-directory-p filename) buffer-file-name)
 	    (setq filename (concat (file-name-as-directory filename)
 				   (file-name-nondirectory buffer-file-name))))
+	(if (file-exists-p filename)
+	    (or (y-or-n-p "File `%s' exists; overwrite? " filename)
+		(error "Canceled")))
 	(set-visited-file-name filename)))
   (set-buffer-modified-p t)
   (save-buffer))