Add 2012 to FSF copyright years for Emacs files
[bpt/emacs.git] / doc / emacs / screen.texi
CommitLineData
8cf51b2c 1@c This is part of the Emacs manual.
acaf905b 2@c Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2012
8838673e 3@c Free Software Foundation, Inc.
8cf51b2c
GM
4@c See file emacs.texi for copying conditions.
5@node Screen, User Input, Acknowledgments, Top
6@chapter The Organization of the Screen
7@cindex screen
de0bde62
CY
8@cindex frame
9
10 On a graphical display, such as on GNU/Linux using the X Window
11System, Emacs occupies a ``graphical window''. On a text-only
12terminal, Emacs occupies the entire terminal screen. We will use the
13term @dfn{frame} to mean a graphical window or terminal screen
14occupied by Emacs. Emacs behaves very similarly on both kinds of
15frames. It normally starts out with just one frame, but you can
16create additional frames if you wish (@pxref{Frames}).
17
18 Each frame consists of several distinct regions. At the top of the
af07efeb
CY
19frame is a @dfn{menu bar}, which allows you to access commands via a
20series of menus. On a graphical display, directly below the menu bar
21is a @dfn{tool bar}, a row of icons that perform editing commands if
de0bde62
CY
22you click on them. At the very bottom of the frame is an @dfn{echo
23area}, where informative messages are displayed and where you enter
24information when Emacs asks for it.
af07efeb
CY
25
26 The main area of the frame, below the tool bar (if one exists) and
de0bde62
CY
27above the echo area, is called @dfn{the window}. Henceforth in this
28manual, we will use the word ``window'' in this sense. Graphical
29display systems commonly use the word ``window'' with a different
30meaning; but, as stated above, we refer to those ``graphical windows''
31as ``frames''.
32
33 An Emacs window is where the @dfn{buffer}---the text you are
34editing---is displayed. On a graphical display, the window possesses
35a @dfn{scroll bar} on one side, which can be used to scroll through
36the buffer. The last line of the window is a @dfn{mode line}. This
af07efeb
CY
37displays various information about what is going on in the buffer,
38such as whether there are unsaved changes, the editing modes that are
39in use, the current line number, and so forth.
40
41 When you start Emacs, there is normally only one window in the
42frame. However, you can subdivide this window horizontally or
43vertically to create multiple windows, each of which can independently
de0bde62
CY
44display a buffer (@pxref{Windows}).
45
46 At any time, one window is the @dfn{selected window}. On a
47graphical display, the selected window shows a more prominent cursor
48(usually solid and blinking); other windows show a less prominent
49cursor (usually a hollow box). On a text terminal, there is only one
50cursor, which is shown in the selected window. The buffer displayed
51in the selected window is called the @dfn{current buffer}, and it is
52where editing happens. Most Emacs commands implicitly apply to the
53current buffer; the text displayed in unselected windows is mostly
54visible for reference. If you use multiple frames on a graphical
55display, selecting a particular frame selects a window in that frame.
8cf51b2c
GM
56
57@menu
8838673e
GM
58* Point:: The place in the text where editing commands operate.
59* Echo Area:: Short messages appear at the bottom of the screen.
60* Mode Line:: Interpreting the mode line.
61* Menu Bar:: How to use the menu bar.
8cf51b2c
GM
62@end menu
63
64@node Point
65@section Point
66@cindex point
67@cindex cursor
68
de0bde62
CY
69 The cursor in the selected window shows the location where most
70editing commands take effect, which is called @dfn{point}@footnote{The
71term ``point'' comes from the character @samp{.}, which was the
72command in TECO (the language in which the original Emacs was written)
73for accessing the editing position.}. Many Emacs commands move point
74to different places in the buffer; for example, you can place point by
af07efeb
CY
75clicking mouse button 1 (normally the left button) at the desired
76location.
8cf51b2c 77
de0bde62
CY
78 By default, the cursor in the selected window is drawn as a solid
79block and appears to be @emph{on} a character, but you should think of
80point as @emph{between} two characters; it is situated @emph{before}
81the character under the cursor. For example, if your text looks like
82@samp{frob} with the cursor over the @samp{b}, then point is between
83the @samp{o} and the @samp{b}. If you insert the character @samp{!}
84at that position, the result is @samp{fro!b}, with point between the
85@samp{!} and the @samp{b}. Thus, the cursor remains over the
86@samp{b}, as before.
8cf51b2c
GM
87
88 If you are editing several files in Emacs, each in its own buffer,
de0bde62
CY
89each buffer has its own value of point. A buffer that is not
90currently displayed remembers its value of point if you later display
91it again. Furthermore, if a buffer is displayed in multiple windows,
92each of those windows has its own value of point.
93
94 @xref{Cursor Display}, for options that control how Emacs displays
95the cursor.
8cf51b2c
GM
96
97@node Echo Area
98@section The Echo Area
99@cindex echo area
100
af07efeb
CY
101 The line at the very bottom of the frame is the @dfn{echo area}. It
102is used to display small amounts of text for various purposes.
8cf51b2c 103
de0bde62
CY
104@cindex echoing
105 The echo area is so-named because one of the things it is used for
106is @dfn{echoing}, which means displaying the characters of a
107multi-character command as you type. Single-character commands are
108not echoed. Multi-character commands (@pxref{Keys}) are echoed if you
109pause for more than a second in the middle of a command. Emacs then
110echoes all the characters of the command so far, to prompt you for the
111rest. Once echoing has started, the rest of the command echoes
112immediately as you type it. This behavior is designed to give
113confident users fast response, while giving hesitant users maximum
114feedback.
115
116@cindex error message
117@cindex echo area message
118 The echo area is also used to display an @dfn{error message} when a
119command cannot do its job. Error messages may be accompanied by
120beeping or by flashing the screen.
121
122 Some commands display informative messages in the echo area to tell
123you what the command has done, or to provide you with some specific
124information. These @dfn{informative} messages, unlike error messages,
125are not accompanied with a beep or flash. For example, @kbd{C-x =}
126(hold down @key{CTRL} and type @kbd{x}, then let go of @key{CTRL} and
127type @kbd{=}) displays a message describing the character at point,
128its position in the buffer, and its current column in the window.
129Commands that take a long time often display messages ending in
130@samp{...} while they are working (sometimes also indicating how much
131progress has been made, as a percentage), and add @samp{done} when
132they are finished.
8cf51b2c
GM
133
134@cindex @samp{*Messages*} buffer
135@cindex saved echo area messages
136@cindex messages saved from echo area
8cf51b2c 137@vindex message-log-max
de0bde62 138 Informative echo area messages are saved in a special buffer named
af07efeb
CY
139@samp{*Messages*}. (We have not explained buffers yet; see
140@ref{Buffers}, for more information about them.) If you miss a
141message that appeared briefly on the screen, you can switch to the
142@samp{*Messages*} buffer to see it again. The @samp{*Messages*}
143buffer is limited to a certain number of lines, specified by the
144variable @code{message-log-max}. (We have not explained variables
145either; see @ref{Variables}, for more information about them.) Beyond
146this limit, one line is deleted from the beginning whenever a new
147message line is added at the end.
148
de0bde62
CY
149 @xref{Display Custom}, for options that control how Emacs uses the
150echo area.
151
af07efeb
CY
152@cindex minibuffer
153 The echo area is also used to display the @dfn{minibuffer}, a
154special window where you can input arguments to commands, such as the
155name of a file to be edited. When the minibuffer is in use, the text
de0bde62
CY
156displayed in the echo area begins with a @dfn{prompt string}, and the
157active cursor appears within the minibuffer, which is temporarily
158considered the selected window. You can always get out of the
159minibuffer by typing @kbd{C-g}. @xref{Minibuffer}.
8cf51b2c
GM
160
161@node Mode Line
162@section The Mode Line
163@cindex mode line
164@cindex top level
8cf51b2c 165
af07efeb
CY
166 At the bottom of each window is a @dfn{mode line}, which describes
167what is going on in the current buffer. When there is only one
168window, the mode line appears right above the echo area; it is the
169next-to-last line in the frame. On a graphical display, the mode line
de0bde62
CY
170is drawn with a 3D box appearance. Emacs also usually draws the mode
171line of the selected window with a different color than that of
172unselected windows, in order to make it stand out.
8cf51b2c 173
af07efeb 174 The text displayed in the mode line has the following format:
8cf51b2c
GM
175
176@example
de0bde62 177 @var{cs}:@var{ch}-@var{fr} @var{buf} @var{pos} @var{line} (@var{major} @var{minor})
8cf51b2c
GM
178@end example
179
180@noindent
de0bde62
CY
181On a text-only terminal, this text is followed by a series of dashes
182extending to the right edge of the window. These dashes are omitted
183on a graphical display.
184
af07efeb
CY
185The @var{cs} string and the colon character after it describe the
186character set and newline convention used for the current buffer.
de0bde62
CY
187Normally, Emacs automatically handles these settings for you, but it
188is sometimes useful to have this information.
189
190 @var{cs} describes the character set of the text in the buffer
191(@pxref{Coding Systems}). If it is a dash (@samp{-}), that indicates
bfd779dd 192no special character set handling (with the possible exception of
de0bde62
CY
193end-of-line conventions, described in the next paragraph). @samp{=}
194means no conversion whatsoever, and is usually used for files
195containing non-textual data. Other characters represent various
af07efeb 196@dfn{coding systems}---for example, @samp{1} represents ISO Latin-1.
de0bde62
CY
197
198 On a text-only terminal, @var{cs} is preceded by two additional
199characters that describe the coding systems for keyboard input and
200terminal output. Furthermore, if you are using an input method,
201@var{cs} is preceded by a string that identifies the input method
202(@pxref{Input Methods}).
203
204@cindex end-of-line convention, mode-line indication
205 The character after @var{cs} is usually a colon. If a different
206string is displayed, that indicates a nontrivial end-of-line
207convention for encoding a file. Usually, lines of text are separated
208by @dfn{newline characters} in a file, but two other conventions are
209sometimes used. The MS-DOS convention uses a ``carriage-return''
af07efeb
CY
210character followed by a ``linefeed'' character; when editing such
211files, the colon changes to either a backslash (@samp{\}) or
de0bde62
CY
212@samp{(DOS)}, depending on the operating system. Another convention,
213employed by older Macintosh systems, uses a ``carriage-return''
214character instead of a newline; when editing such files, the colon
af07efeb
CY
215changes to either a forward slash (@samp{/}) or @samp{(Mac)}. On some
216systems, Emacs displays @samp{(Unix)} instead of the colon for files
217that use newline as the line separator.
218
219 The next element on the mode line is the string indicated by
220@var{ch}. This shows two dashes (@samp{--}) if the buffer displayed
221in the window has the same contents as the corresponding file on the
222disk; i.e., if the buffer is ``unmodified''. If the buffer is
223modified, it shows two stars (@samp{**}). For a read-only buffer, it
224shows @samp{%*} if the buffer is modified, and @samp{%%} otherwise.
225
226 The character after @var{ch} is normally a dash (@samp{-}).
227However, if the default-directory for the current buffer is on a
228remote machine, @samp{@@} is displayed instead (@pxref{File Names}).
8cf51b2c
GM
229
230 @var{fr} gives the selected frame name (@pxref{Frames}). It appears
231only on text-only terminals. The initial frame's name is @samp{F1}.
232
af07efeb
CY
233 @var{buf} is the name of the buffer displayed in the window.
234Usually, this is the same as the name of a file you are editing.
235@xref{Buffers}.
8cf51b2c 236
de0bde62
CY
237 @var{pos} tells you whether there is additional text above the top
238of the window, or below the bottom. If your buffer is small and all
239of it is visible in the window, @var{pos} is @samp{All}. Otherwise,
240it is @samp{Top} if you are looking at the beginning of the buffer,
241@samp{Bot} if you are looking at the end of the buffer, or
242@samp{@var{nn}%}, where @var{nn} is the percentage of the buffer above
243the top of the window. With Size Indication mode, you can display the
244size of the buffer as well. @xref{Optional Mode Line}.
8cf51b2c 245
af07efeb
CY
246 @var{line} is the character @samp{L} followed by the line number at
247point. (You can display the current column number too, by turning on
248Column Number mode. @xref{Optional Mode Line}.)
8cf51b2c 249
af07efeb
CY
250 @var{major} is the name of the @dfn{major mode} used in the buffer.
251A major mode is a principal editing mode for the buffer, such as Text
de0bde62
CY
252mode, Lisp mode, C mode, and so forth. @xref{Major Modes}. Some
253major modes display additional information after the major mode name.
254For example, Compilation buffers and Shell buffers display the status
255of the subprocess.
8cf51b2c 256
de0bde62
CY
257 @var{minor} is a list of some of the enabled @dfn{minor modes},
258which are optional editing modes that provide additional features on
259top of the major mode. @xref{Minor Modes}.
8cf51b2c 260
af07efeb 261 Some features are listed together with the minor modes whenever they
7ee6a1d3 262are turned on, even though they are not really minor modes.
af07efeb
CY
263@samp{Narrow} means that the buffer being displayed has editing
264restricted to only a portion of its text (@pxref{Narrowing}).
265@samp{Def} means that a keyboard macro is currently being defined
266(@pxref{Keyboard Macros}).
8cf51b2c
GM
267
268 In addition, if Emacs is inside a recursive editing level, square
269brackets (@samp{[@dots{}]}) appear around the parentheses that
270surround the modes. If Emacs is in one recursive editing level within
271another, double square brackets appear, and so on. Since recursive
de0bde62
CY
272editing levels affect Emacs globally, such square brackets appear in
273the mode line of every window. @xref{Recursive Edit}.
8cf51b2c 274
af07efeb
CY
275 You can change the appearance of the mode line as well as the format
276of its contents. @xref{Optional Mode Line}. In addition, the mode
277line is mouse-sensitive; clicking on different parts of the mode line
278performs various commands. @xref{Mode Line Mouse}.
8cf51b2c
GM
279
280@node Menu Bar
281@section The Menu Bar
282@cindex menu bar
283
284 Each Emacs frame normally has a @dfn{menu bar} at the top which you
285can use to perform common operations. There's no need to list them
286here, as you can more easily see them yourself.
287
288@kindex M-`
289@kindex F10
290@findex tmm-menubar
291@findex menu-bar-open
292 On a graphical display, you can use the mouse to choose a command
de0bde62 293from the menu bar. An arrow on the right edge of a menu item means it
af07efeb 294leads to a subsidiary menu, or @dfn{submenu}. A @samp{...} at the end
de0bde62
CY
295of a menu item means that the command will prompt you for further
296input before it actually does anything.
8cf51b2c 297
af07efeb
CY
298 Some of the commands in the menu bar have ordinary key bindings as
299well; if so, a key binding is shown in parentheses after the item
300itself. To view the full command name and documentation for a menu
301item, type @kbd{C-h k}, and then select the menu bar with the mouse in
302the usual way (@pxref{Key Help}).
8cf51b2c 303
af07efeb
CY
304 Instead of using the mouse, you can also invoke the first menu bar
305item by pressing @key{F10} (to run the command @code{menu-bar-open}).
306You can then navigate the menus with the arrow keys. To activate a
307selected menu item, press @key{RET}; to cancel menu navigation, press
308@key{ESC}.
8cf51b2c 309
de0bde62
CY
310 On a text-only terminal, you can use the menu bar by typing
311@kbd{M-`} or @key{F10} (these run the command @code{tmm-menubar}).
312This lets you select a menu item with the keyboard. A provisional
313choice appears in the echo area. You can use the up and down arrow
314keys to move through the menu to different items, and then you can
315type @key{RET} to select the item. Each menu item is also designated
316by a letter or digit (usually the initial of some word in the item's
317name). This letter or digit is separated from the item name by
318@samp{=>}. You can type the item's letter or digit to select the
319item.