# HG changeset patch # User Richard M. Stallman # Date 795563478 0 # Node ID f6c97f56c8b6be41d030c7cb4bc65b5309f71cac # Parent 302f676eeca0a67b8c3222e98f6af970a43ea59f (write-file): Query if file exists already. diff -r 302f676eeca0 -r f6c97f56c8b6 lisp/files.el --- 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))