summaryrefslogtreecommitdiffstats
path: root/slackbook/html/emacs-buffers.html
blob: 53516de8119a099c4d4b2c3cbab9689dd63dd542 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<title>Buffers</title>
<meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" />
<link rel="HOME" title="Slackware Linux Essentials" href="index.html" />
<link rel="UP" title="Emacs" href="emacs.html" />
<link rel="PREVIOUS" title="Emacs" href="emacs.html" />
<link rel="NEXT" title="Modes" href="emacs-modes.html" />
<link rel="STYLESHEET" type="text/css" href="docbook.css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"
alink="#0000FF">
<div class="NAVHEADER">
<table summary="Header navigation table" width="100%" border="0" cellpadding="0"
cellspacing="0">
<tr>
<th colspan="3" align="center">Slackware Linux Essentials</th>
</tr>

<tr>
<td width="10%" align="left" valign="bottom"><a href="emacs.html"
accesskey="P">Prev</a></td>
<td width="80%" align="center" valign="bottom">Chapter 17 Emacs</td>
<td width="10%" align="right" valign="bottom"><a href="emacs-modes.html"
accesskey="N">Next</a></td>
</tr>
</table>

<hr align="LEFT" width="100%" />
</div>

<div class="SECT1">
<h1 class="SECT1"><a id="EMACS-BUFFERS" name="EMACS-BUFFERS">17.2 Buffers</a></h1>

<p>In Emacs, the concept of &#8220;buffers&#8221; is essential. Every file that you open
is loaded into its own buffer. Furthermore, Emacs has several special buffers, which do
not contain a file but are used for other things. Such special buffers usually have a
name that starts and ends with an asterisk. For example, the buffer that Emacs shows when
it is first started, is the so-called *scratch* buffer. In the *scratch* buffer, you can
type text in the normal way, but text that is typed there is not saved when Emacs is
closed.</p>

<p>There is one other special buffer you need to know about, and that is the minibuffer.
This buffer consists of only one line, and is always on the screen: it is the very last
line of the Emacs window, below the status bar for the current buffer. The minibuffer is
where Emacs shows messages for the user, and it is also the place where commands that
require some user input are executed. For example, when you open a file, Emacs will ask
for its name in the minibuffer.</p>

<p>Switching from one buffer to another can be done with the command <b
class="KEYCAP">C</b>-<b class="KEYCAP">x</b> <b class="KEYCAP">b</b>. This will prompt
you for the name of a buffer (a buffer's name is usually the name of the file you are
editing in it), and it gives a default choice, which is normally the buffer that you were
in before you switched to or created the current buffer. Just hitting <span
class="emphasis"><i class="EMPHASIS">Enter</i></span> will switch to that default
buffer.</p>

<p>If you want to switch to another buffer than the default offered by Emacs, just type
its name. Note that you can use so-called <b class="KEYCAP">Tab</b>-completion here: type
the first few letters of the buffer's name and hit <b class="KEYCAP">Tab</b>; Emacs will
then complete the name of the buffer. <b class="KEYCAP">Tab</b> completion works
everywhere in Emacs where it makes sense.</p>

<p>You can get a list of open buffers by hitting <b class="KEYCAP">C</b>-<b
class="KEYCAP">x</b> <b class="KEYCAP">C</b>-<b class="KEYCAP">b</b>. This command will
usually split the screen in two, displaying the buffer you were working in in the top
half, and a new buffer called *Buffer List* in the bottom half. This buffer contains a
list of all the buffers, their sizes and modes, and the files, if any, that those buffers
are visiting (as it is called in Emacs). You can get rid of this split screen by typing
<b class="KEYCAP">C</b>-<b class="KEYCAP">x</b> <b class="KEYCAP">1</b>.</p>

<div class="NOTE">
<table class="NOTE" width="100%" border="0">
<tr>
<td width="25" align="CENTER" valign="TOP"><img src="./imagelib/admon/note.png"
hspace="5" alt="Note" /></td>
<td align="LEFT" valign="TOP">
<p>Under X, the list of buffers is also available in the Buffer menu in the menu bar.</p>
</td>
</tr>
</table>
</div>
</div>

<div class="NAVFOOTER">
<hr align="LEFT" width="100%" />
<table summary="Footer navigation table" width="100%" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td width="33%" align="left" valign="top"><a href="emacs.html"
accesskey="P">Prev</a></td>
<td width="34%" align="center" valign="top"><a href="index.html"
accesskey="H">Home</a></td>
<td width="33%" align="right" valign="top"><a href="emacs-modes.html"
accesskey="N">Next</a></td>
</tr>

<tr>
<td width="33%" align="left" valign="top">Emacs</td>
<td width="34%" align="center" valign="top"><a href="emacs.html"
accesskey="U">Up</a></td>
<td width="33%" align="right" valign="top">Modes</td>
</tr>
</table>
</div>
</body>
</html>