comparison lisp/files.el @ 78775:341710df3f8a

(find-file, find-file-other-window, find-file-other-frame, find-file-existing) (find-file-read-only, find-file-read-only-other-window) (find-file-read-only-other-frame, find-alternate-file-other-window) (find-alternate-file): Doc fixes.
author Eli Zaretskii <eliz@gnu.org>
date Thu, 13 Sep 2007 08:26:34 +0000
parents fca68e956b9b
children 279dcb8bebb0
comparison
equal deleted inserted replaced
78774:a4cabf2eaad3 78775:341710df3f8a
1066 creating one if none already exists. 1066 creating one if none already exists.
1067 Interactively, the default if you just type RET is the current directory, 1067 Interactively, the default if you just type RET is the current directory,
1068 but the visited file name is available through the minibuffer history: 1068 but the visited file name is available through the minibuffer history:
1069 type M-n to pull it into the minibuffer. 1069 type M-n to pull it into the minibuffer.
1070 1070
1071 You can visit files on remote machines by specifying something
1072 like /ssh:SOME_REMOTE_MACHINE:FILE for the file name. You can
1073 also visit local files as a different user by specifying
1074 /sudo::FILE for the file name. See the documentation of
1075 `tramp-methods' and the Tramp Info manual, for more about this.
1076
1071 Interactively, or if WILDCARDS is non-nil in a call from Lisp, 1077 Interactively, or if WILDCARDS is non-nil in a call from Lisp,
1072 expand wildcards (if any) and visit multiple files. You can 1078 expand wildcards (if any) and visit multiple files. You can
1073 suppress wildcard expansion by setting `find-file-wildcards' to nil. 1079 suppress wildcard expansion by setting `find-file-wildcards' to nil.
1074 1080
1075 To visit a file without any kind of conversion and without 1081 To visit a file without any kind of conversion and without
1080 (mapcar 'switch-to-buffer (nreverse value)) 1086 (mapcar 'switch-to-buffer (nreverse value))
1081 (switch-to-buffer value)))) 1087 (switch-to-buffer value))))
1082 1088
1083 (defun find-file-other-window (filename &optional wildcards) 1089 (defun find-file-other-window (filename &optional wildcards)
1084 "Edit file FILENAME, in another window. 1090 "Edit file FILENAME, in another window.
1085 May create a new window, or reuse an existing one. 1091
1086 See the function `display-buffer'. 1092 Like \\[find-file] (which see), but creates a new window or reuses
1093 an existing one. See the function `display-buffer'.
1087 1094
1088 Interactively, the default if you just type RET is the current directory, 1095 Interactively, the default if you just type RET is the current directory,
1089 but the visited file name is available through the minibuffer history: 1096 but the visited file name is available through the minibuffer history:
1090 type M-n to pull it into the minibuffer. 1097 type M-n to pull it into the minibuffer.
1091 1098
1100 (mapcar 'switch-to-buffer (cdr value)))) 1107 (mapcar 'switch-to-buffer (cdr value))))
1101 (switch-to-buffer-other-window value)))) 1108 (switch-to-buffer-other-window value))))
1102 1109
1103 (defun find-file-other-frame (filename &optional wildcards) 1110 (defun find-file-other-frame (filename &optional wildcards)
1104 "Edit file FILENAME, in another frame. 1111 "Edit file FILENAME, in another frame.
1105 May create a new frame, or reuse an existing one. 1112
1106 See the function `display-buffer'. 1113 Like \\[find-file] (which see), but creates a new frame or reuses
1114 an existing one. See the function `display-buffer'.
1107 1115
1108 Interactively, the default if you just type RET is the current directory, 1116 Interactively, the default if you just type RET is the current directory,
1109 but the visited file name is available through the minibuffer history: 1117 but the visited file name is available through the minibuffer history:
1110 type M-n to pull it into the minibuffer. 1118 type M-n to pull it into the minibuffer.
1111 1119
1120 (mapcar 'switch-to-buffer (cdr value)))) 1128 (mapcar 'switch-to-buffer (cdr value))))
1121 (switch-to-buffer-other-frame value)))) 1129 (switch-to-buffer-other-frame value))))
1122 1130
1123 (defun find-file-existing (filename) 1131 (defun find-file-existing (filename)
1124 "Edit the existing file FILENAME. 1132 "Edit the existing file FILENAME.
1125 Like \\[find-file] but only allow a file that exists, and do not allow 1133 Like \\[find-file], but only allow a file that exists, and do not allow
1126 file names with wildcards." 1134 file names with wildcards."
1127 (interactive (nbutlast (find-file-read-args "Find existing file: " t))) 1135 (interactive (nbutlast (find-file-read-args "Find existing file: " t)))
1128 (if (and (not (interactive-p)) (not (file-exists-p filename))) 1136 (if (and (not (interactive-p)) (not (file-exists-p filename)))
1129 (error "%s does not exist" filename) 1137 (error "%s does not exist" filename)
1130 (find-file filename) 1138 (find-file filename)
1131 (current-buffer))) 1139 (current-buffer)))
1132 1140
1133 (defun find-file-read-only (filename &optional wildcards) 1141 (defun find-file-read-only (filename &optional wildcards)
1134 "Edit file FILENAME but don't allow changes. 1142 "Edit file FILENAME but don't allow changes.
1135 Like \\[find-file] but marks buffer as read-only. 1143 Like \\[find-file], but marks buffer as read-only.
1136 Use \\[toggle-read-only] to permit editing." 1144 Use \\[toggle-read-only] to permit editing."
1137 (interactive (find-file-read-args "Find file read-only: " nil)) 1145 (interactive (find-file-read-args "Find file read-only: " nil))
1138 (unless (or (and wildcards find-file-wildcards 1146 (unless (or (and wildcards find-file-wildcards
1139 (not (string-match "\\`/:" filename)) 1147 (not (string-match "\\`/:" filename))
1140 (string-match "[[*?]" filename)) 1148 (string-match "[[*?]" filename))
1145 (if (listp value) value (list value))) 1153 (if (listp value) value (list value)))
1146 value)) 1154 value))
1147 1155
1148 (defun find-file-read-only-other-window (filename &optional wildcards) 1156 (defun find-file-read-only-other-window (filename &optional wildcards)
1149 "Edit file FILENAME in another window but don't allow changes. 1157 "Edit file FILENAME in another window but don't allow changes.
1150 Like \\[find-file-other-window] but marks buffer as read-only. 1158 Like \\[find-file-other-window], but marks buffer as read-only.
1151 Use \\[toggle-read-only] to permit editing." 1159 Use \\[toggle-read-only] to permit editing."
1152 (interactive (find-file-read-args "Find file read-only other window: " nil)) 1160 (interactive (find-file-read-args "Find file read-only other window: " nil))
1153 (unless (or (and wildcards find-file-wildcards 1161 (unless (or (and wildcards find-file-wildcards
1154 (not (string-match "\\`/:" filename)) 1162 (not (string-match "\\`/:" filename))
1155 (string-match "[[*?]" filename)) 1163 (string-match "[[*?]" filename))
1160 (if (listp value) value (list value))) 1168 (if (listp value) value (list value)))
1161 value)) 1169 value))
1162 1170
1163 (defun find-file-read-only-other-frame (filename &optional wildcards) 1171 (defun find-file-read-only-other-frame (filename &optional wildcards)
1164 "Edit file FILENAME in another frame but don't allow changes. 1172 "Edit file FILENAME in another frame but don't allow changes.
1165 Like \\[find-file-other-frame] but marks buffer as read-only. 1173 Like \\[find-file-other-frame], but marks buffer as read-only.
1166 Use \\[toggle-read-only] to permit editing." 1174 Use \\[toggle-read-only] to permit editing."
1167 (interactive (find-file-read-args "Find file read-only other frame: " nil)) 1175 (interactive (find-file-read-args "Find file read-only other frame: " nil))
1168 (unless (or (and wildcards find-file-wildcards 1176 (unless (or (and wildcards find-file-wildcards
1169 (not (string-match "\\`/:" filename)) 1177 (not (string-match "\\`/:" filename))
1170 (string-match "[[*?]" filename)) 1178 (string-match "[[*?]" filename))
1176 value)) 1184 value))
1177 1185
1178 (defun find-alternate-file-other-window (filename &optional wildcards) 1186 (defun find-alternate-file-other-window (filename &optional wildcards)
1179 "Find file FILENAME as a replacement for the file in the next window. 1187 "Find file FILENAME as a replacement for the file in the next window.
1180 This command does not select that window. 1188 This command does not select that window.
1189
1190 See \\[find-file] for the possible forms of the FILENAME argument.
1181 1191
1182 Interactively, or if WILDCARDS is non-nil in a call from Lisp, 1192 Interactively, or if WILDCARDS is non-nil in a call from Lisp,
1183 expand wildcards (if any) and replace the file with multiple files." 1193 expand wildcards (if any) and replace the file with multiple files."
1184 (interactive 1194 (interactive
1185 (save-selected-window 1195 (save-selected-window
1201 1211
1202 (defun find-alternate-file (filename &optional wildcards) 1212 (defun find-alternate-file (filename &optional wildcards)
1203 "Find file FILENAME, select its buffer, kill previous buffer. 1213 "Find file FILENAME, select its buffer, kill previous buffer.
1204 If the current buffer now contains an empty file that you just visited 1214 If the current buffer now contains an empty file that you just visited
1205 \(presumably by mistake), use this command to visit the file you really want. 1215 \(presumably by mistake), use this command to visit the file you really want.
1216
1217 See \\[find-file] for the possible forms of the FILENAME argument.
1206 1218
1207 Interactively, or if WILDCARDS is non-nil in a call from Lisp, 1219 Interactively, or if WILDCARDS is non-nil in a call from Lisp,
1208 expand wildcards (if any) and replace the file with multiple files. 1220 expand wildcards (if any) and replace the file with multiple files.
1209 1221
1210 If the current buffer is an indirect buffer, or the base buffer 1222 If the current buffer is an indirect buffer, or the base buffer