Next: Auto-saving and recovery
Up: emacs
Previous: Modes
Files, buffers, and windows
Each buffer has a name. By default, buffers that are associated with
particular files have the name of that file (not including the name of
the directory containing it), possibly followed by a number in angle
brackets to distinguish multiple files (from different directories)
with the same name.
- C-x C-f
- prompts for a file name
and sets the current window to displaying that file
in a buffer by the same
name. If a buffer displaying that file already exists, this command
merely switches the window to that buffer. If the file does not
exist, the buffer is initially empty. The buffer is subsequently
associated with the file.
This process is called finding
the file.
- C-x 4 C-f
- prompts for a file name, goes to the next window
on the screen (creating a new one, if there is only one), and then
acts like C-x C-f.
- C-x C-s
- saves the current buffer in its associated file,
if the buffer has been modified. If the file being saved exists, then
the old version is first renamed to have a tilde (~ ) appended to
its name, if no such file yet exists.
- C-x C-w
- prompts for a file name and saves the current
buffer into that file. Generally, it is preferable and safer
to use C-x C-f or
C-x 4 C-f and then use C-x C-s, but
sometimes this command is handy.
- C-x i
- prompts for a file name and inserts that file at
the point. It does not associate the inserted file with the current buffer.
- M-x revert-buffer
- throws away the contents of the current
buffer and restores the contents of the associated file. It will ask
you to confirm these actions before taking them.
- C-x o
- makes another window on the screen (if any) the
current window.
- C-x 0
- deletes the current window, expanding another window
to take its place. The buffer being displayed in the current window
is not affected.
- C-x 1
- makes the current window the only window on the
screen, deleting all others. The buffers being displayed in the
deleted windows are not affected.
- C-x 2
- splits the current window into two vertically (one
on top of the other), both displaying the same buffer.
- C-x 3
- splits the current window into two horizontally
(beside each other), each displaying the same buffer.
- C-x b
- prompts for a buffer name and switches the current
window to that buffer. When trying to move to a buffer associated
with a file, it is better to use the file finding commands.
- C-x C-b
- lists the active buffers in a window.
- C-x k
- prompts for a buffer name
and deletes that buffer, displaying some other buffer in the current
window. You will be warned if the contents of the buffer have been
modified and not yet saved.
Subsections
Next: Auto-saving and recovery
Up: emacs
Previous: Modes
Karl W Knight
2003-01-05