annotate man/xemacs/buffers.texi @ 5686:c6b1500299a7

recenter-top-bottom synced from GNU and new default for C-l Partial implementation of recenter-top-bottom. GNU has support for scroll-margin that is not in XEmacs so that is left out. lisp/ChangeLog: 2012-09-18 Mats Lidell <matsl@xemacs.org> * window-xemacs.el (recenter-positions): New defcustom. (recenter-top-bottom): New command. (recenter-last-op): New defvar. * replace.el (perform-replace): Let-bind recenter-last-op to nil. For def=recenter, replace `recenter' with `recenter-top-bottom' that is called with `this-command' and `last-command' let-bound to `recenter-top-bottom'. When the last `def' was not `recenter', set `recenter-last-op' to nil. * keydefs.el (global-map): Make recenter-top-bottom new default for C-l. etc/ChangeLog: 2012-09-18 Mats Lidell <matsl@xemacs.org> * TUTORIAL: Updated due to recenter-top-bottom man/ChangeLog: 2012-09-18 Mats Lidell <matsl@xemacs.org> * lispref/windows.texi (Vertical Scrolling): Added recenter-top-bottom and recenter-positions * xemacs/display.texi (Display): Rearranged and added documentation due to new function recenter-top-bottom.
author Mats Lidell <mats.lidell@cag.se>
date Tue, 18 Sep 2012 08:58:28 +0200
parents abe6d1db359e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 @node Buffers, Windows, Files, Top
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 @chapter Using Multiple Buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 @cindex buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 Text you are editing in Emacs resides in an object called a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 @dfn{buffer}. Each time you visit a file, Emacs creates a buffer to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 hold the file's text. Each time you invoke Dired, Emacs creates a buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 to hold the directory listing. If you send a message with @kbd{C-x m},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 a buffer named @samp{*mail*} is used to hold the text of the message.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 When you ask for a command's documentation, it appears in a buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 called @samp{*Help*}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 @cindex selected buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 @cindex current buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 At any time, one and only one buffer is @dfn{selected}. It is also
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 called the @dfn{current buffer}. Saying a command operates on ``the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 buffer'' really means that the command operates on the selected
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 buffer, as most commands do.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 When Emacs creates multiple windows, each window has a chosen buffer which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 is displayed there, but at any time only one of the windows is selected and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 its chosen buffer is the selected buffer. Each window's mode line displays
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 the name of the buffer the window is displaying (@pxref{Windows}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 Each buffer has a name which can be of any length but is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 case-sensitive. You can select a buffer using its name. Most
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 buffers are created when you visit files; their names are derived from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 the files' names. You can also create an empty buffer with any name you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 want. A newly started Emacs has a buffer named @samp{*scratch*} which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 you can use for evaluating Lisp expressions in Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 Each buffer records what file it is visiting, whether it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 modified, and what major mode and minor modes are in effect in it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (@pxref{Major Modes}). Any Emacs variable can be made @dfn{local to} a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 particular buffer, meaning its value in that buffer can be different from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 the value in other buffers. @xref{Locals}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 * Select Buffer:: Creating a new buffer or reselecting an old one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 * List Buffers:: Getting a list of buffers that exist.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 * Misc Buffer:: Renaming; changing read-onliness; copying text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 * Kill Buffer:: Killing buffers you no longer need.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 * Several Buffers:: How to go through the list of all buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 and operate variously on several of them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 @node Select Buffer, List Buffers, Buffers, Buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 @section Creating and Selecting Buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 @cindex changing buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 @cindex switching buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 @item C-x b @var{buffer} @key{RET}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 Select or create a buffer named @var{buffer} (@code{switch-to-buffer}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 @item C-x 4 b @var{buffer} @key{RET}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 Similar, but select a buffer named @var{buffer} in another window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (@code{switch-to-buffer-other-window}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 @item M-x switch-to-other-buffer @var{n}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 Switch to the previous buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 @kindex C-x 4 b
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 @kindex C-x 5 b
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 @findex switch-to-buffer-other-window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 @kindex C-x b
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 @findex switch-to-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 @findex switch-to-buffer-other-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 To select a buffer named @var{bufname}, type @kbd{C-x b @var{bufname}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 @key{RET}}. This is the command @code{switch-to-buffer} with argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 @var{bufname}. You can use completion on an abbreviation for the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 name you want (@pxref{Completion}). An empty argument to @kbd{C-x b}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 specifies the most recently selected buffer that is not displayed in any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 window.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 Most buffers are created when you visit files, or use Emacs commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 that display text. You can also create a buffer explicitly by typing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 @kbd{C-x b @var{bufname} @key{RET}}, which creates a new, empty buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 that is not visiting any file, and selects it for editing. The new
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 buffer's major mode is determined by the value of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 @code{default-major-mode} (@pxref{Major Modes}). Buffers not visiting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 files are usually used for making notes to yourself. If you try to save
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 one, you are asked for the file name to use.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 The function @code{switch-to-buffer-other-frame} is similar to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 @code{switch-to-buffer} except that it creates a new frame in which to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 display the selected buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 @findex switch-to-other-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 Use @kbd{M-x switch-to-other-buffer} to visit the previous buffer. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 you supply a positive integer @var{n}, the @var{n}th most recent buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 is displayed. If you supply an argument of 0, the current buffer is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 moved to the bottom of the buffer stack.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 Note that you can also use @kbd{C-x C-f} and any other command for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 visiting a file to switch buffers. @xref{Visiting}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 @node List Buffers, Misc Buffer, Select Buffer, Buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 @section Listing Existing Buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 @item C-x C-b
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 List the existing buffers (@code{list-buffers}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 @kindex C-x C-b
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 @findex list-buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 To print a list of all existing buffers, type @kbd{C-x C-b}. Each
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 line in the list shows one buffer's name, major mode, and visited file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 A @samp{*} at the beginning of a line indicates the buffer has been
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 ``modified''. If several buffers are modified, it may be time to save
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 some with @kbd{C-x s} (@pxref{Saving}). A @samp{%} indicates a read-only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 buffer. A @samp{.} marks the selected buffer. Here is an example of a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 buffer list:@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 MR Buffer Size Mode File
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 -- ------ ---- ---- ----
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 .* emacs.tex 383402 Texinfo /u2/emacs/man/emacs.tex
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 0
diff changeset
120 *Help* 1287 Fundamental
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 files.el 23076 Emacs-Lisp /u2/emacs/lisp/files.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 % RMAIL 64042 RMAIL /u/rms/RMAIL
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 0
diff changeset
123 *% man 747 Dired /u2/emacs/man/
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 net.emacs 343885 Fundamental /u/rms/net.emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 fileio.c 27691 C /u2/emacs/src/fileio.c
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 NEWS 67340 Text /u2/emacs/etc/NEWS
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 0
diff changeset
127 *scratch* 0 Lisp Interaction
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 Note that the buffer @samp{*Help*} was made by a help request; it is not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 visiting any file. The buffer @code{man} was made by Dired on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 directory @file{/u2/emacs/man/}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 As you move the mouse over the @samp{*Buffer List*} buffer, the lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 are highlighted. This visual cue indicates that clicking the right
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 mouse button (@code{button3}) will pop up a menu of commands on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 buffer represented by this line. This menu duplicates most of those
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 commands which are bound to keys in the @samp{*Buffer List*} buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 @node Misc Buffer, Kill Buffer, List Buffers, Buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 @section Miscellaneous Buffer Operations
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 @item C-x C-q
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 Toggle read-only status of buffer (@code{toggle-read-only}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 @item M-x rename-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 Change the name of the current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 @item M-x view-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 Scroll through a buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 @cindex read-only buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 @kindex C-x C-q
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 @findex toggle-read-only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 @vindex buffer-read-only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 A buffer can be @dfn{read-only}, which means that commands to change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 its text are not allowed. Normally, read-only buffers are created by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 subsystems such as Dired and Rmail that have special commands to operate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 on the text. Emacs also creates a read-only buffer if you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 visit a file that is protected. To make changes in a read-only buffer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 use the command @kbd{C-x C-q} (@code{toggle-read-only}). It makes a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 read-only buffer writable, and makes a writable buffer read-only. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 works by setting the variable @code{buffer-read-only}, which has a local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 value in each buffer and makes a buffer read-only if its value is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 non-@code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 @findex rename-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 @kbd{M-x rename-buffer} changes the name of the current buffer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 prompting for the new name in the minibuffer. There is no default. If you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 specify a name that is used by a different buffer, an error is signalled and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 renaming is not done.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 @findex view-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 @kbd{M-x view-buffer} is similar to @kbd{M-x view-file} (@pxref{Misc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 File Ops}), but it examines an already existing Emacs buffer. View mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 provides convenient commands for scrolling through the buffer but not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 for changing it. When you exit View mode, the resulting value of point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 remains in effect.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 To copy text from one buffer to another, use the commands @kbd{M-x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 append-to-buffer} and @kbd{M-x insert-buffer}. @xref{Accumulating
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 Text}.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 @node Kill Buffer, Several Buffers, Misc Buffer, Buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 @section Killing Buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 After using Emacs for a while, you may accumulate a large number of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 buffers and may want to eliminate the ones you no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 longer need. There are several commands for doing this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 @c WideCommands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 @item C-x k
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 Kill a buffer, specified by name (@code{kill-buffer}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 @item M-x kill-some-buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 Offer to kill each buffer, one by one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 @findex kill-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 @findex kill-some-buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 @kindex C-x k
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 @kbd{C-x k} (@code{kill-buffer}) kills one buffer, whose name you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 specify in the minibuffer. If you type just @key{RET} in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 minibuffer, the default, killing the current buffer, is used. If the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 current buffer is killed, the buffer that has been selected recently but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 does not appear in any window now is selected. If the buffer being
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 killed contains unsaved changes, you are asked to confirm with @kbd{yes}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 before the buffer is killed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 The command @kbd{M-x kill-some-buffers} asks about each buffer, one by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 one. An answer of @kbd{y} means to kill the buffer. Killing the current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 buffer or a buffer containing unsaved changes selects a new buffer or asks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 for confirmation just like @code{kill-buffer}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 @node Several Buffers,, Kill Buffer, Buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 @section Operating on Several Buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 @cindex buffer menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 The @dfn{buffer-menu} facility is like a ``Dired for buffers''; it allows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 you to request operations on various Emacs buffers by editing a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 buffer containing a list of them. You can save buffers, kill them
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (here called @dfn{deleting} them, for consistency with Dired), or display
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 @item M-x buffer-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 Begin editing a buffer listing all Emacs buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 @findex buffer-menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 The command @code{buffer-menu} writes a list of all Emacs buffers into
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 the buffer @samp{*Buffer List*}, and selects that buffer in Buffer Menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 mode. The buffer is read-only. You can only change it using the special
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 commands described in this section. Most of the commands are graphic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 characters. You can use Emacs cursor motion commands in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 @samp{*Buffer List*} buffer. If the cursor is on a line describing a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 buffer, the following special commands apply to that buffer:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 @item d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 Request to delete (kill) the buffer, then move down. A @samp{D} before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 the buffer name on a line indicates a deletion request. Requested
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 deletions actually take place when you use the @kbd{x} command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 @item k
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 Synonym for @kbd{d}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 @item C-d
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 Like @kbd{d} but move up afterwards instead of down.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 @item s
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
251 Request to save the buffer. An @samp{S} before the buffer name on a line
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 indicates the request. Requested saves actually take place when you use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 the @kbd{x} command. You can request both saving and deletion for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 same buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 @item ~
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 Mark buffer ``unmodified''. The command @kbd{~} does this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 immediately when typed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 @item x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 Perform previously requested deletions and saves.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 @item u
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 Remove any request made for the current line, and move down.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 @item @key{DEL}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 Move to previous line and remove any request made for that line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 All commands that add or remove flags to request later operations
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 also move down a line. They accept a numeric argument as a repeat count,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 unless otherwise specified.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 There are also special commands to use the buffer list to select another
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 buffer, and to specify one or more other buffers for display in additional
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 windows.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 @item 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 Select the buffer in a full-frame window. This command takes effect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 immediately.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 @item 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 Immediately set up two windows, with this buffer in one and the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 buffer selected before @samp{*Buffer List*} in the other.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 @item f
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 Immediately select the buffer in place of the @samp{*Buffer List*} buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 @item o
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 Immediately select the buffer in another window as if by @kbd{C-x 4 b},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 leaving @samp{*Buffer List*} visible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 @item q
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 Immediately select this buffer, and display any buffers previously
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 flagged with the @kbd{m} command in other windows. If there are no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 buffers flagged with @kbd{m}, this command is equivalent to @kbd{1}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 @item m
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 Flag this buffer to be displayed in another window if the @kbd{q}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 command is used. The request shows as a @samp{>} at the beginning of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 the line. The same buffer may not have both a delete request and a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 display request.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 Going back between a @code{buffer-menu} buffer and other Emacs buffers is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 easy. You can, for example, switch from the @samp{*Buffer List*}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 buffer to another Emacs buffer, and edit there. You can then reselect the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 @code{buffer-menu} buffer and perform operations already
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 requested, or you can kill that buffer or pay no further attention to it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 All that @code{buffer-menu} does directly is create and select a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 suitable buffer, and turn on Buffer Menu mode. All the other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 capabilities of the buffer menu are implemented by special commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 provided in Buffer Menu mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 The only difference between @code{buffer-menu} and @code{list-buffers} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 that @code{buffer-menu} selects the @samp{*Buffer List*} buffer and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 @code{list-buffers} does not. If you run @code{list-buffers} (that is,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 type @kbd{C-x C-b}) and select the buffer list manually, you can use all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 the commands described here.