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