diff options
| author | Richard M. Stallman | 1996-06-29 19:50:56 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-06-29 19:50:56 +0000 |
| commit | 6a6b62f802347f8f6bf85497871d33cb0b2f33f5 (patch) | |
| tree | e69a3bb9c96316dc6bdc5cce4785428f1bd6bd02 | |
| parent | 544174d9e7e4b0bf9a05c32ffd7687df6017dc9c (diff) | |
| download | emacs-6a6b62f802347f8f6bf85497871d33cb0b2f33f5.tar.gz emacs-6a6b62f802347f8f6bf85497871d33cb0b2f33f5.zip | |
(set-visited-file-name): New optional arg NO-QUERY.
| -rw-r--r-- | lisp/files.el | 8 |
1 files changed, 6 insertions, 2 deletions
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.") | |||
| 1415 | (set var val)))) | 1415 | (set var val)))) |
| 1416 | 1416 | ||
| 1417 | 1417 | ||
| 1418 | (defun set-visited-file-name (filename) | 1418 | (defun set-visited-file-name (filename &optional no-query) |
| 1419 | "Change name of file visited in current buffer to FILENAME. | 1419 | "Change name of file visited in current buffer to FILENAME. |
| 1420 | The next time the buffer is saved it will go in the newly specified file. | 1420 | The next time the buffer is saved it will go in the newly specified file. |
| 1421 | nil or empty string as argument means make buffer not be visiting any file. | 1421 | nil or empty string as argument means make buffer not be visiting any file. |
| 1422 | Remember to delete the initial contents of the minibuffer | 1422 | Remember to delete the initial contents of the minibuffer |
| 1423 | if you wish to pass an empty string as the argument." | 1423 | if you wish to pass an empty string as the argument. |
| 1424 | |||
| 1425 | The optional second argument NO-QUERY, if non-nil, inhibits asking for | ||
| 1426 | confirmation in the case where the file FILENAME already exists." | ||
| 1424 | (interactive "FSet visited file name: ") | 1427 | (interactive "FSet visited file name: ") |
| 1425 | (if (buffer-base-buffer) | 1428 | (if (buffer-base-buffer) |
| 1426 | (error "An indirect buffer cannot visit a file")) | 1429 | (error "An indirect buffer cannot visit a file")) |
| @@ -1437,6 +1440,7 @@ if you wish to pass an empty string as the argument." | |||
| 1437 | (setq filename truename)))) | 1440 | (setq filename truename)))) |
| 1438 | (let ((buffer (and filename (find-buffer-visiting filename)))) | 1441 | (let ((buffer (and filename (find-buffer-visiting filename)))) |
| 1439 | (and buffer (not (eq buffer (current-buffer))) | 1442 | (and buffer (not (eq buffer (current-buffer))) |
| 1443 | (not no-query) | ||
| 1440 | (not (y-or-n-p (message "A buffer is visiting %s; proceed? " | 1444 | (not (y-or-n-p (message "A buffer is visiting %s; proceed? " |
| 1441 | filename))) | 1445 | filename))) |
| 1442 | (error "Aborted"))) | 1446 | (error "Aborted"))) |