From: Richard M. Stallman Date: Sat, 29 Jun 1996 19:50:56 +0000 (+0000) Subject: (set-visited-file-name): New optional arg NO-QUERY. X-Git-Tag: emacs-19.34~292 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6a6b62f802347f8f6bf85497871d33cb0b2f33f5;p=emacs.git (set-visited-file-name): New optional arg NO-QUERY. --- diff --git a/lisp/files.el b/lisp/files.el index 943622064f3..fe1a7234d7a 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1415,12 +1415,15 @@ in order to initialize other data structure based on them.") (set var val)))) -(defun set-visited-file-name (filename) +(defun set-visited-file-name (filename &optional no-query) "Change name of file visited in current buffer to FILENAME. The next time the buffer is saved it will go in the newly specified file. nil or empty string as argument means make buffer not be visiting any file. Remember to delete the initial contents of the minibuffer -if you wish to pass an empty string as the argument." +if you wish to pass an empty string as the argument. + +The optional second argument NO-QUERY, if non-nil, inhibits asking for +confirmation in the case where the file FILENAME already exists." (interactive "FSet visited file name: ") (if (buffer-base-buffer) (error "An indirect buffer cannot visit a file")) @@ -1437,6 +1440,7 @@ if you wish to pass an empty string as the argument." (setq filename truename)))) (let ((buffer (and filename (find-buffer-visiting filename)))) (and buffer (not (eq buffer (current-buffer))) + (not no-query) (not (y-or-n-p (message "A buffer is visiting %s; proceed? " filename))) (error "Aborted")))