comparison lispref/files.texi @ 70657:9a270d0b2af7

(Visiting Functions): Rewrite in find-file-noselect.
author Richard M. Stallman <rms@gnu.org>
date Sun, 14 May 2006 22:50:02 +0000
parents 97f1ae99fe30
children 7733ed75db62 a5812696f7bf
comparison
equal deleted inserted replaced
70656:182680a57573 70657:9a270d0b2af7
112 When @code{find-file} is called interactively, it prompts for 112 When @code{find-file} is called interactively, it prompts for
113 @var{filename} in the minibuffer. 113 @var{filename} in the minibuffer.
114 @end deffn 114 @end deffn
115 115
116 @defun find-file-noselect filename &optional nowarn rawfile wildcards 116 @defun find-file-noselect filename &optional nowarn rawfile wildcards
117 This function is the guts of all the file-visiting functions. It finds 117 This function is the guts of all the file-visiting functions. It
118 or creates a buffer visiting the file @var{filename}, and returns it. 118 returns a buffer visiting the file @var{filename}. You may make the
119 It uses an existing buffer if there is one, and otherwise creates a new 119 buffer current or display it in a window if you wish, but this
120 buffer and reads the file into it. You may make the buffer current or 120 function does not do so.
121 display it in a window if you wish, but this function does not do so. 121
122 122 The function returns an existing buffer if there is one; otherwise it
123 If @var{wildcards} is non-@code{nil}, 123 creates a new buffer and reads the file into it. When
124 then @code{find-file-noselect} expands wildcard 124 @code{find-file-noselect} uses an existing buffer, it first verifies
125 characters in @var{filename} and visits all the matching files. 125 that the file has not changed since it was last visited or saved in
126 126 that buffer. If the file has changed, this function asks the user
127 When @code{find-file-noselect} uses an existing buffer, it first 127 whether to reread the changed file. If the user says @samp{yes}, any
128 verifies that the file has not changed since it was last visited or 128 edits previously made in the buffer are lost.
129 saved in that buffer. If the file has changed, then this function asks 129
130 the user whether to reread the changed file. If the user says 130 Reading the file involves decoding the file's contents (@pxref{Coding
131 @samp{yes}, any changes previously made in the buffer are lost. 131 Systems}), including end-of-line conversion, and format conversion
132 (@pxref{Format Conversion}). If @var{wildcards} is non-@code{nil},
133 then @code{find-file-noselect} expands wildcard characters in
134 @var{filename} and visits all the matching files.
132 135
133 This function displays warning or advisory messages in various peculiar 136 This function displays warning or advisory messages in various peculiar
134 cases, unless the optional argument @var{nowarn} is non-@code{nil}. For 137 cases, unless the optional argument @var{nowarn} is non-@code{nil}. For
135 example, if it needs to create a buffer, and there is no file named 138 example, if it needs to create a buffer, and there is no file named
136 @var{filename}, it displays the message @samp{(New file)} in the echo 139 @var{filename}, it displays the message @samp{(New file)} in the echo
137 area, and leaves the buffer empty. 140 area, and leaves the buffer empty.
138
139 Reading the file(s) into their respective buffers involves decoding
140 the files' contents (@pxref{Coding Systems}), including end-of-line
141 conversion.
142 141
143 The @code{find-file-noselect} function normally calls 142 The @code{find-file-noselect} function normally calls
144 @code{after-find-file} after reading the file (@pxref{Subroutines of 143 @code{after-find-file} after reading the file (@pxref{Subroutines of
145 Visiting}). That function sets the buffer major mode, parses local 144 Visiting}). That function sets the buffer major mode, parses local
146 variables, warns the user if there exists an auto-save file more recent 145 variables, warns the user if there exists an auto-save file more recent
147 than the file just visited, and finishes by running the functions in 146 than the file just visited, and finishes by running the functions in
148 @code{find-file-hook}. 147 @code{find-file-hook}.
149 148
150 If the optional argument @var{rawfile} is non-@code{nil}, then 149 If the optional argument @var{rawfile} is non-@code{nil}, then
151 @code{after-find-file} is not called, and the 150 @code{after-find-file} is not called, and the
152 @code{find-file-not-found-functions} are not run in case of failure. What's 151 @code{find-file-not-found-functions} are not run in case of failure.
153 more, a non-@code{nil} @var{rawfile} value suppresses coding system 152 What's more, a non-@code{nil} @var{rawfile} value suppresses coding
154 conversion (@pxref{Coding Systems}) and format conversion (@pxref{Format 153 system conversion and format conversion.
155 Conversion}).
156 154
157 The @code{find-file-noselect} function usually returns the buffer that 155 The @code{find-file-noselect} function usually returns the buffer that
158 is visiting the file @var{filename}. But, if wildcards are actually 156 is visiting the file @var{filename}. But, if wildcards are actually
159 used and expanded, it returns a list of buffers that are visiting the 157 used and expanded, it returns a list of buffers that are visiting the
160 various files. 158 various files.