aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2007-07-01 01:57:31 +0000
committerStefan Monnier2007-07-01 01:57:31 +0000
commit14fd09e56e5f28f7e4fc9a634c556dedd21233dd (patch)
tree5cf26526502f4b4a0ac6cf0b12ee8f6537a8c6bd
parent4d02fc25640fe8f43702df874f107d7100d80a17 (diff)
downloademacs-14fd09e56e5f28f7e4fc9a634c556dedd21233dd.tar.gz
emacs-14fd09e56e5f28f7e4fc9a634c556dedd21233dd.zip
(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.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/files.el27
2 files changed, 28 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2dc82bf403e..3186832bca9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12007-07-01 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * files.el (find-file-confirm-inexistent-file): New var.
4 (find-file, find-file-other-window, find-file-other-frame)
5 (find-file-read-only, find-file-read-only-other-window)
6 (find-file-read-only-other-frame): Use it.
7
12007-06-30 Stefan Monnier <monnier@iro.umontreal.ca> 82007-06-30 Stefan Monnier <monnier@iro.umontreal.ca>
2 9
3 * emacs-lisp/rx.el (rx-constituents): Fix up `anything'. 10 * emacs-lisp/rx.el (rx-constituents): Fix up `anything'.
diff --git a/lisp/files.el b/lisp/files.el
index 952736f06d7..80f5d0dac08 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1051,6 +1051,9 @@ Recursive uses of the minibuffer will not be affected."
1051 ,@body) 1051 ,@body)
1052 (remove-hook 'minibuffer-setup-hook ,hook))))) 1052 (remove-hook 'minibuffer-setup-hook ,hook)))))
1053 1053
1054(defvar find-file-confirm-inexistent-file t
1055 "If non-nil, `find-file' will require confirmation before visiting a new file.")
1056
1054(defun find-file-read-args (prompt mustmatch) 1057(defun find-file-read-args (prompt mustmatch)
1055 (list (let ((find-file-default 1058 (list (let ((find-file-default
1056 (and buffer-file-name 1059 (and buffer-file-name
@@ -1074,7 +1077,9 @@ suppress wildcard expansion by setting `find-file-wildcards' to nil.
1074 1077
1075To visit a file without any kind of conversion and without 1078To visit a file without any kind of conversion and without
1076automatically choosing a major mode, use \\[find-file-literally]." 1079automatically choosing a major mode, use \\[find-file-literally]."
1077 (interactive (find-file-read-args "Find file: " nil)) 1080 (interactive
1081 (find-file-read-args "Find file: "
1082 (if find-file-confirm-inexistent-file 'confirm-only)))
1078 (let ((value (find-file-noselect filename nil nil wildcards))) 1083 (let ((value (find-file-noselect filename nil nil wildcards)))
1079 (if (listp value) 1084 (if (listp value)
1080 (mapcar 'switch-to-buffer (nreverse value)) 1085 (mapcar 'switch-to-buffer (nreverse value))
@@ -1091,7 +1096,9 @@ type M-n to pull it into the minibuffer.
1091 1096
1092Interactively, or if WILDCARDS is non-nil in a call from Lisp, 1097Interactively, or if WILDCARDS is non-nil in a call from Lisp,
1093expand wildcards (if any) and visit multiple files." 1098expand wildcards (if any) and visit multiple files."
1094 (interactive (find-file-read-args "Find file in other window: " nil)) 1099 (interactive
1100 (find-file-read-args "Find file in other window: "
1101 (if find-file-confirm-inexistent-file 'confirm-only)))
1095 (let ((value (find-file-noselect filename nil nil wildcards))) 1102 (let ((value (find-file-noselect filename nil nil wildcards)))
1096 (if (listp value) 1103 (if (listp value)
1097 (progn 1104 (progn
@@ -1111,7 +1118,9 @@ type M-n to pull it into the minibuffer.
1111 1118
1112Interactively, or if WILDCARDS is non-nil in a call from Lisp, 1119Interactively, or if WILDCARDS is non-nil in a call from Lisp,
1113expand wildcards (if any) and visit multiple files." 1120expand wildcards (if any) and visit multiple files."
1114 (interactive (find-file-read-args "Find file in other frame: " nil)) 1121 (interactive
1122 (find-file-read-args "Find file in other frame: "
1123 (if find-file-confirm-inexistent-file 'confirm-only)))
1115 (let ((value (find-file-noselect filename nil nil wildcards))) 1124 (let ((value (find-file-noselect filename nil nil wildcards)))
1116 (if (listp value) 1125 (if (listp value)
1117 (progn 1126 (progn
@@ -1134,7 +1143,9 @@ file names with wildcards."
1134 "Edit file FILENAME but don't allow changes. 1143 "Edit file FILENAME but don't allow changes.
1135Like \\[find-file] but marks buffer as read-only. 1144Like \\[find-file] but marks buffer as read-only.
1136Use \\[toggle-read-only] to permit editing." 1145Use \\[toggle-read-only] to permit editing."
1137 (interactive (find-file-read-args "Find file read-only: " nil)) 1146 (interactive
1147 (find-file-read-args "Find file read-only: "
1148 (if find-file-confirm-inexistent-file 'confirm-only)))
1138 (unless (or (and wildcards find-file-wildcards 1149 (unless (or (and wildcards find-file-wildcards
1139 (not (string-match "\\`/:" filename)) 1150 (not (string-match "\\`/:" filename))
1140 (string-match "[[*?]" filename)) 1151 (string-match "[[*?]" filename))
@@ -1149,7 +1160,9 @@ Use \\[toggle-read-only] to permit editing."
1149 "Edit file FILENAME in another window but don't allow changes. 1160 "Edit file FILENAME in another window but don't allow changes.
1150Like \\[find-file-other-window] but marks buffer as read-only. 1161Like \\[find-file-other-window] but marks buffer as read-only.
1151Use \\[toggle-read-only] to permit editing." 1162Use \\[toggle-read-only] to permit editing."
1152 (interactive (find-file-read-args "Find file read-only other window: " nil)) 1163 (interactive
1164 (find-file-read-args "Find file read-only other window: "
1165 (if find-file-confirm-inexistent-file 'confirm-only)))
1153 (unless (or (and wildcards find-file-wildcards 1166 (unless (or (and wildcards find-file-wildcards
1154 (not (string-match "\\`/:" filename)) 1167 (not (string-match "\\`/:" filename))
1155 (string-match "[[*?]" filename)) 1168 (string-match "[[*?]" filename))
@@ -1164,7 +1177,9 @@ Use \\[toggle-read-only] to permit editing."
1164 "Edit file FILENAME in another frame but don't allow changes. 1177 "Edit file FILENAME in another frame but don't allow changes.
1165Like \\[find-file-other-frame] but marks buffer as read-only. 1178Like \\[find-file-other-frame] but marks buffer as read-only.
1166Use \\[toggle-read-only] to permit editing." 1179Use \\[toggle-read-only] to permit editing."
1167 (interactive (find-file-read-args "Find file read-only other frame: " nil)) 1180 (interactive
1181 (find-file-read-args "Find file read-only other frame: "
1182 (if find-file-confirm-inexistent-file 'confirm-only)))
1168 (unless (or (and wildcards find-file-wildcards 1183 (unless (or (and wildcards find-file-wildcards
1169 (not (string-match "\\`/:" filename)) 1184 (not (string-match "\\`/:" filename))
1170 (string-match "[[*?]" filename)) 1185 (string-match "[[*?]" filename))