actually contains wildcard characters. You can disable the wildcard
feature by customizing @code{find-file-wildcards}.
+@cindex visiting files asynchronously
+@vindex find-file-asynchronously
+ Sometimes, it is handy to visit a file asynchronously. This means,
+while loading the file into its buffer Emacs keeps responsive, and you
+can continue to edit other files, or call commands. This is
+controlled by the user option @code{find-file-asynchronously}. If
+this option is @code{nil} (the default), visiting a file is performed
+synchronously. A regexp value let files, which name matches the
+regexp, being visited asynchronously, and synchronously otherwise.
+The value @code{t} forces asynchronous visiting of files
+unconditionally.
+
+If you want to visit all remote files asynchronously, you should set
+
+@example
+@group
+(customize-set-variable
+ 'find-file-asynchronously tramp-file-name-regexp
+ "Visit remote files asynchronously")
+@end group
+@end example
+
+ With a prefix argument @kbd{C-u}, the meaning of
+@code{find-file-asynchronously} will be reverted. If this user option
+is @code{nil}, visiting a file is performed asynchronously. Contrary,
+if this user option is non-@code{nil}, visiting a file is performed
+synchronously.
+
@kindex C-x C-v
@findex find-alternate-file
If you visit the wrong file unintentionally by typing its name
temporary buffer. Visiting the file is not necessary and takes longer.
@xref{Reading from Files}.
-@deffn Command find-file filename &optional wildcards
+@deffn Command find-file filename &optional wildcards async
This command selects a buffer visiting the file @var{filename},
using an existing buffer if there is one, and otherwise creating a
new buffer and reading the file into it. It also returns that buffer.
function is basically equivalent to:
@smallexample
-(switch-to-buffer (find-file-noselect filename nil nil wildcards))
+(switch-to-buffer
+ (find-file-noselect filename nil nil wildcards async))
@end smallexample
@noindent
interactive call, then @code{find-file} expands wildcard characters in
@var{filename} and visits all the matching files.
+If @var{async} is non-@code{nil}, the file will be loaded into the
+buffer asynchronously. Interactively, this is indicated by either
+setting user option @code{find-file-asynchronously} to non-@code{nil},
+or by a prefix argument.
+
When @code{find-file} is called interactively, it prompts for
@var{filename} in the minibuffer.
@end deffn
-@deffn Command find-file-literally filename
+@deffn Command find-file-literally filename &optional async
This command visits @var{filename}, like @code{find-file} does, but it
does not perform any format conversions (@pxref{Format Conversion}),
character code conversions (@pxref{Coding Systems}), or end-of-line
conversions (@pxref{Coding System Basics, End of line conversion}).
-The buffer visiting the file is made unibyte, and its major mode is
-Fundamental mode, regardless of the file name. File local variable
-specifications in the file (@pxref{File Local Variables}) are
-ignored, and automatic decompression and adding a newline at the end
-of the file due to @code{require-final-newline} (@pxref{Saving
-Buffers, require-final-newline}) are also disabled.
+If called interactively, the argument @var{async} is determined like
+in @code{find-file}. The buffer visiting the file is made unibyte,
+and its major mode is Fundamental mode, regardless of the file name.
+File local variable specifications in the file (@pxref{File Local
+Variables}) are ignored, and automatic decompression and adding a
+newline at the end of the file due to @code{require-final-newline}
+(@pxref{Saving Buffers, require-final-newline}) are also disabled.
Note that if Emacs already has a buffer visiting the same file
non-literally, it will not visit the same file literally, but instead
@code{insert-file-contents-literally} (@pxref{Reading from Files}).
@end deffn
-@defun find-file-noselect filename &optional nowarn rawfile wildcards
+@defun find-file-noselect filename &optional nowarn rawfile wildcards async
This function is the guts of all the file-visiting functions. It
returns a buffer visiting the file @var{filename}. You may make the
buffer current or display it in a window if you wish, but this
Systems}), including end-of-line conversion, and format conversion
(@pxref{Format Conversion}). If @var{wildcards} is non-@code{nil},
then @code{find-file-noselect} expands wildcard characters in
-@var{filename} and visits all the matching files.
+@var{filename} and visits all the matching files. If @var{async} is
+non-@code{nil} and there are several matching files due to expansion
+of wildcard characters, every file will be loaded in an own thread.
This function displays warning or advisory messages in various peculiar
cases, unless the optional argument @var{nowarn} is non-@code{nil}. For
@end example
@end defun
-@deffn Command find-file-other-window filename &optional wildcards
+@deffn Command find-file-other-window filename &optional wildcards async
This command selects a buffer visiting the file @var{filename}, but
does so in a window other than the selected window. It may use
another existing window or split a window; see @ref{Switching
@var{filename}.
@end deffn
-@deffn Command find-file-read-only filename &optional wildcards
+@deffn Command find-file-read-only filename &optional wildcards async
This command selects a buffer visiting the file @var{filename}, like
@code{find-file}, but it marks the buffer as read-only. @xref{Read Only
Buffers}, for related functions and variables.
and never treat wildcard characters specially.
@end defopt
+@defopt find-file-asynchronously
+If this variable is non-@code{nil}, a file will be visited
+asynchronously when called interactively. If it is a regular
+expression, it must match the file name to be visited. This behavior
+is toggled by a prefix argument to the interactive call of the file
+visiting command.
+@end defopt
+
@defopt find-file-hook
The value of this variable is a list of functions to be called after a
file is visited. The file's local-variables specification (if any) will
file literally, as in 'find-file-literally', which speeds up
navigation and editing of large files.
---- (Documentation to be added)
++++
** Files can be visited asynchronously.
-If the file visiting commands are prefixed like 'C-u C-x C-f ...', the
-files are loaded asynchronously into the respective buffers. I.e.,
-Emacs is still responsive while loading the files, which is useful
-especially for remote files. See the node "(emacs) Visiting" in the
-user manual for the supported commands..
+If the new user option 'find-file-asynchronously' has a proper non-nil
+value, interactive file visiting commands load the file asynchronously
+into the respective buffer. I.e., Emacs is still responsive while
+loading the files, which is useful especially for remote files. See
+the node "(emacs) Visiting" in the user manual for the supported
+commands.
\f
* Changes in Specialized Modes and Packages in Emacs 27.1
If ASYNC is non-nil, the file will be loaded into the buffer
asynchronously. Interactively, this is indicated by either
-setting `find-file-asynchronously' to nil, or by a prefix
+setting `find-file-asynchronously' to non-nil, or by a prefix
argument.
To visit a file without any kind of conversion and without
expand wildcards (if any) and visit multiple files.
If ASYNC is non-nil, the file will be loaded into the buffer
-asynchronously. Interactively, this is indicated by a prefix
+asynchronously. Interactively, this is indicated by either
+setting `find-file-asynchronously' to non-nil, or by a prefix
argument."
(interactive
(find-file-read-args "Find file in other window: "
expand wildcards (if any) and visit multiple files.
If ASYNC is non-nil, the file will be loaded into the buffer
-asynchronously. Interactively, this is indicated by a prefix
+asynchronously. Interactively, this is indicated by either
+setting `find-file-asynchronously' to non-nil, or by a prefix
argument."
(interactive
(find-file-read-args "Find file in other frame: "
file names with wildcards.
If ASYNC is non-nil, the file will be loaded into the buffer
-asynchronously. Interactively, this is indicated by a prefix
+asynchronously. Interactively, this is indicated by either
+setting `find-file-asynchronously' to non-nil, or by a prefix
argument."
(interactive
(find-file-read-args "Find existing file: " t))
expand wildcards (if any) and replace the file with multiple files.
If ASYNC is non-nil, the file will be loaded into the buffer
-asynchronously. Interactively, this is indicated by a prefix
+asynchronously. Interactively, this is indicated by either
+setting `find-file-asynchronously' to non-nil, or by a prefix
argument."
(interactive
(save-selected-window
expand wildcards (if any) and replace the file with multiple files.
If ASYNC is non-nil, the file will be loaded into the buffer
-asynchronously. Interactively, this is indicated by a prefix
+asynchronously. Interactively, this is indicated by either
+setting `find-file-asynchronously' to non-nil, or by a prefix
argument.
If the current buffer is an indirect buffer, or the base buffer
this command asks you whether to visit it literally instead.
If ASYNC is non-nil, the file will be loaded into the buffer
-asynchronously. Interactively, this is indicated by a prefix
+asynchronously. Interactively, this is indicated by either
+setting `find-file-asynchronously' to non-nil, or by a prefix
argument.
In non-interactive use, the value is the buffer where the file is