find-file(2)find-file - Load a file
n find-file "file-name" (C-x C-f)
find-file finds the named file file-name. If it is already in a buffer, make that buffer active in the current window, otherwise attempt to create a new buffer and read the file into it.
The numeric argument n is used to modify the default behavior of the command, where the bits are defined as follows:
0x01
0x02
0x04
0x08
0x10
Text files are usually thought of as named collections of text residing on disk (or some other storage medium). In MicroEmacs the disk based versions of files come into play only when reading into or writing out buffers. The link between the physical file and the buffer is through the associated file name.
MicroEmacs permits full file names, i.e. you can specify:
disk:\directories\filename.extension
or (UNIX)
/directories/filename.extension
If the disk and directories are not specified, the current buffers disk/ directory is used. Several points should be noted in respect to the methods that MicroEmacs utilizes in the handling of files:-
If you do not wish to perform any edits but merely browse the file(s), add the view(2m) mode to the buffer or ask for the file to be read in for viewing only.
If the file does not exist and the variable $rcs-file(5) is set then the existence of the RCS file is tested. If the rcs file exists then it will be checked out using a command-line created from the variable $rcs-co-com(5). If the check-out is successful then this file is loaded.
This raw interface for supporting file revision control systems has been adapted to support SCCS and Visual Source Safe see help on variable $rcs-file for more information and examples.
MicroEmacs supports http file loading, this is available by default on UNIX systems and most windows platforms (socket libraries not available on all win95 machines or earlier). When available a http file can be loaded by simply executing find-file and giving the http file name, i.e. "http://user:password@address:port/file". Only the http://, address and /file components are mandatory, the rest can usually be omitted. e.g.:
find-file "http://www.jasspa.com/index.html"
See help page on %http-proxy-addr(5) for information on HTTP proxy server support.
The progress of the HTTP transfer, and the HTTP commands issued, may be viewed in the *http-console* buffer. This is popped up depending on the setting of the %http-flags(5) variable.
MicroEmacs can be compiled to support https using OpenSSL, when available the interface is the same as for http except the prefix is https://. When loading https URLs the libcrypt and libssl OpenSSL dynamic libraries must be available at runtime, if they are not available the function returns an error. The %http-flags(5) variable can be used to alter the behaviour, in particular the 'i' flag which can be used to ignore certificate errors.
MicroEmacs supports ftp file loading, this is identical to http except the prefix ftp:// is used as opposed to http://. The user name and password defaults to anonymous and "ftp@example.com" in the absence of both these fields. If the user name is supplied but not the password the password will be prompted for; this can be useful as the password will not be stored or written to the history file. Connection is by default on port 21.
find-file "ftp://<me>:<password>@members.xoom.com/jasspa/index.html"
See also ftp(3).
The progress of the FTP transfer, and the FTP commands issued, may be viewed in the *ftp-console* buffer. This is popped up depending on the setting of the %ftp-flags(5) variable.
There are two standards for secure FTP, explicit and implicit.
Explicit ftp typically uses the default port 21 and the initial connection is established without encryption, the client then explicitly requests secure comms, hopefully before the user name and password are submitted. MicroEmacs supports explicit ftp by using a non-standard ftpe:// URL prefix, this allows an explicit ftp URL to be distinguish from an open ftp request. Note that the ftp server may refuse the request to make the connection secure, this is not considered a failure by MicroEmacs so the *ftp-console* should be checked if secure comms is required.
Like HTTPS, implicit ftp requires a secure connect to be established up front, by default it uses port 990. MicroEmacs supports implicit ftp by using the standard ftps:// URL prefix (not to be confused with sftp which is used to denote file transfer through an ssh connection).
The base name part (i.e. not the path) of file-name can contain wild-card characters compatible with most file systems, namely:-
?
[abc]
[a-d]
[^abc]
*
If the name matches more than one file, a buffer will be created for each matching file. Note that these are not the same wild-card characters used by regex.
For ftp and http then a ftp console window is opened up to show the progress of the transfer (when configured), this is described in ftp(3).
The automatic loading of very large files can be avoided by setting the variable $file-size-prompt(5) to an appropriate size.
auto(2m), binary(2m), crypt(2m), rbin(2m), time(2m), view(2m), buffer-mode(2), file-attrib(3), file-op(2), find-hfile(3), ftp(3), next-window-find-file(2), page-bfile(3), page-file(3), read-file(2), save-buffer(2), view-file(2), write-buffer(2), $file-size-prompt(5), $rcs-file(5), %ftp-flags(5), %http-flags(5), %http-proxy-addr(5), %sock-send-timeout(5).
(c) Copyright JASSPA 2025
Last Modified: 2025/08/28
Generated On: 2025/09/29