diff options
author | Richard M. Stallman <rms@gnu.org> | 1995-03-18 21:51:18 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1995-03-18 21:51:18 +0000 |
commit | d5b30adcfd6cdf22c48f4bc59fd522502d0bf620 (patch) | |
tree | 61d3a8a16252f422ad421178435a040078c6939a /lisp/files.el | |
parent | 4e11917290aa5e5826991280a1e2f56954c6c013 (diff) | |
download | emacs-d5b30adcfd6cdf22c48f4bc59fd522502d0bf620.tar.gz |
(write-file): Query if file exists already.
Diffstat (limited to 'lisp/files.el')
-rw-r--r-- | lisp/files.el | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lisp/files.el b/lisp/files.el index be311583ec9..6abe596ef01 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1344,6 +1344,9 @@ old name in that directory." (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)) |