(emacs)Basic Files


Next: Basic Help Prev: Erasing Up: Basic

Files
=====

   The commands above are sufficient for creating and altering text in
an Emacs buffer; the more advanced Emacs commands just make things
easier.  But to keep any text permanently you must put it in a "file".
Files are named units of text which are stored by the operating system
for you to retrieve later by name.  To look at or use the contents of a
file in any way, including editing the file with Emacs, you must
specify the file name.

   Consider a file named `/usr/rms/foo.c'.  In Emacs, to begin editing
this file, type

     C-x C-f /usr/rms/foo.c RET

Here the file name is given as an "argument" to the command `C-x C-f'
(`find-file').  That command uses the "minibuffer" to read the
argument, and you type RET to terminate the argument (*note
Minibuffer::.).

   Emacs obeys the command by "visiting" the file: creating a buffer,
copying the contents of the file into the buffer, and then displaying
the buffer for you to edit.  Then you can make changes, and "save" the
file by typing `C-x C-s' (`save-buffer').  This makes the changes
permanent by copying the altered contents of the buffer back into the
file `/usr/rms/foo.c'.  Until you save, the changes exist only inside
Emacs, and the file `foo.c' is unaltered.

   To create a file, just visit the file with `C-x C-f' as if it
already existed.  This creates an empty buffer in which you can insert
the text you want to put in the file.  The file is actually created when
you save this buffer with `C-x C-s'.

   Of course, there is a lot more to learn about using files.  *Note
Files::.


automatically generated by info2www