![]() |
![]() emacs
|
![]() |
![]() |
When you are editing a file in emacs
, you are not really
editing the file itself, but a copy of it which is stored in
the computer's memory (and on the disk in files with names like
filename
~). The copy in memory is also known as a file
buffer. Each file has it's own separate buffer and emacs allows you to edit
multiple buffers. Emacs uses buffers to allow you to
edit multiple files.
The command to start editing another file is the find file command. The
find file command is C-x C-f
, followed by the
filename. If the file
doesn't exist, emacs
will create a new file for you with
that name. Finding a file makes a new buffer inside
emacs
. Try creating a new buffer by finding your home page.
C-x C-f public-html/index.html
Once you are editing more than one buffer, it is handy to be able to see a
list of all the buffers currently active in emacs
. The
way to do this is C-x C-b
. After you enter this
command a list of buffers will appear in a split screen. If you wish to switch
to a different buffer, you can
click on the name with your mouse and then press
1
. If you don't have a mouse, use C-x
o
to switch to the buffer window. Try switching your buffers back and
forth.
To get rid of the
buffer list type C-x 1
. This command tells emacs
that you only want
to view on window at a time. (This will be covered further in the "Windows"
section.) If you already know
the file you wish to edit, you have two more options. You can use the
find
command again or use C-x b
filename
. (The last buffer used is the default, so if you want
that one you can skip the filename
.)
If you do make changes to one file, then switch to another file, keep in
mind that emacs
does not automatically save the first file. The
changes only remain in the file's buffer.
You can save the buffer you are currently editing with
C-x C-s
, C-x C-w
filename to save the file to
a different name, or you can use the command
C-x s
to save all buffers. If you issue the save all buffers,
emacs
will then prompt
you as to whether to save each particular file.
To exit a buffer without exiting emacs use C-x k
to kill the
current. This command will warn you if the file has not been saved. If you
type this
command by accident C-g
will save your buffer and bring you back
to it.
We have now covered the basic emacs
commands. In the next couple of sections, we will be dealing with some
convenient commands. Let's start
with explaining more about the Mode line.
![]() |
![]() emacs
|
![]() |
![]() |