changeset 81673:da0809ff8ac8

(find-file-confirm-inexistent-file): New var. (find-file, find-file-other-window, find-file-other-frame) (find-file-read-only, find-file-read-only-other-window) (find-file-read-only-other-frame): Use it.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 01 Jul 2007 01:57:31 +0000
parents 3f6e5ebf9c3b
children 09e67b1211db
files lisp/ChangeLog lisp/files.el
diffstat 2 files changed, 28 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Jul 01 01:57:21 2007 +0000
+++ b/lisp/ChangeLog	Sun Jul 01 01:57:31 2007 +0000
@@ -1,3 +1,10 @@
+2007-07-01  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* files.el (find-file-confirm-inexistent-file): New var.
+	(find-file, find-file-other-window, find-file-other-frame)
+	(find-file-read-only, find-file-read-only-other-window)
+	(find-file-read-only-other-frame): Use it.
+
 2007-06-30  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* emacs-lisp/rx.el (rx-constituents): Fix up `anything'.
--- a/lisp/files.el	Sun Jul 01 01:57:21 2007 +0000
+++ b/lisp/files.el	Sun Jul 01 01:57:31 2007 +0000
@@ -1051,6 +1051,9 @@
 	     ,@body)
 	 (remove-hook 'minibuffer-setup-hook ,hook)))))
 
+(defvar find-file-confirm-inexistent-file t
+  "If non-nil, `find-file' will require confirmation before visiting a new file.")
+
 (defun find-file-read-args (prompt mustmatch)
   (list (let ((find-file-default
 	       (and buffer-file-name
@@ -1074,7 +1077,9 @@
 
 To visit a file without any kind of conversion and without
 automatically choosing a major mode, use \\[find-file-literally]."
-  (interactive (find-file-read-args "Find file: " nil))
+  (interactive
+   (find-file-read-args "Find file: "
+                        (if find-file-confirm-inexistent-file 'confirm-only)))
   (let ((value (find-file-noselect filename nil nil wildcards)))
     (if (listp value)
 	(mapcar 'switch-to-buffer (nreverse value))
@@ -1091,7 +1096,9 @@
 
 Interactively, or if WILDCARDS is non-nil in a call from Lisp,
 expand wildcards (if any) and visit multiple files."
-  (interactive (find-file-read-args "Find file in other window: " nil))
+  (interactive
+   (find-file-read-args "Find file in other window: "
+                        (if find-file-confirm-inexistent-file 'confirm-only)))
   (let ((value (find-file-noselect filename nil nil wildcards)))
     (if (listp value)
 	(progn
@@ -1111,7 +1118,9 @@
 
 Interactively, or if WILDCARDS is non-nil in a call from Lisp,
 expand wildcards (if any) and visit multiple files."
-  (interactive (find-file-read-args "Find file in other frame: " nil))
+  (interactive
+   (find-file-read-args "Find file in other frame: "
+                        (if find-file-confirm-inexistent-file 'confirm-only)))
   (let ((value (find-file-noselect filename nil nil wildcards)))
     (if (listp value)
 	(progn
@@ -1134,7 +1143,9 @@
   "Edit file FILENAME but don't allow changes.
 Like \\[find-file] but marks buffer as read-only.
 Use \\[toggle-read-only] to permit editing."
-  (interactive (find-file-read-args "Find file read-only: " nil))
+  (interactive
+   (find-file-read-args "Find file read-only: "
+                        (if find-file-confirm-inexistent-file 'confirm-only)))
   (unless (or (and wildcards find-file-wildcards
 		   (not (string-match "\\`/:" filename))
 		   (string-match "[[*?]" filename))
@@ -1149,7 +1160,9 @@
   "Edit file FILENAME in another window but don't allow changes.
 Like \\[find-file-other-window] but marks buffer as read-only.
 Use \\[toggle-read-only] to permit editing."
-  (interactive (find-file-read-args "Find file read-only other window: " nil))
+  (interactive
+   (find-file-read-args "Find file read-only other window: "
+                        (if find-file-confirm-inexistent-file 'confirm-only)))
   (unless (or (and wildcards find-file-wildcards
 		   (not (string-match "\\`/:" filename))
 		   (string-match "[[*?]" filename))
@@ -1164,7 +1177,9 @@
   "Edit file FILENAME in another frame but don't allow changes.
 Like \\[find-file-other-frame] but marks buffer as read-only.
 Use \\[toggle-read-only] to permit editing."
-  (interactive (find-file-read-args "Find file read-only other frame: " nil))
+  (interactive
+   (find-file-read-args "Find file read-only other frame: "
+                        (if find-file-confirm-inexistent-file 'confirm-only)))
   (unless (or (and wildcards find-file-wildcards
 		   (not (string-match "\\`/:" filename))
 		   (string-match "[[*?]" filename))