1 @comment node-name, next, previous, up
2 @node Entering, Windows and Menus, Concept Index, Top
3 @chapter Entering and Exiting Emacs
8 While using Emacs you should be familiar with the following three terms:
12 A @b{buffer} is a region of memory holding characters. It is the basic
13 editing unit; one buffer corresponds to one piece of text being
14 edited. You can have multiple buffers but you can edit only one buffer
15 at any one time. For more information, @xref{Buffers,,,xemacs,XEmacs User's
19 A @b{file} is a region of disk space holding characters. Emacs edits a file by
20 reading it into a buffer, editing that buffer and writing out the buffer
21 back to the file. To save your work permanently you have to write it to a file.
22 So after you load and work with a file, you have to save it back.
25 A @b{window} is a rectangular region in which a buffer is displayed. You can
26 open multiple windows with multiple buffers and edit them by selecting the
27 corresponding buffer. Initially, when you start emacs, it will automatically
28 open up a window for you.
31 @comment node-name, next, previous, up
33 * Enter:: Entering Emacs from the shell
34 * Frame:: Basic information about the XEmacs Frame
35 * Exiting:: Exiting Emacs
36 * Mode Line:: Interpreting the mode line.
37 * Echo Area:: Bottom of the frame where you interact
41 @node Enter, Frame, Entering, Entering
42 @section Entering Emacs
43 @cindex entering Emacs
44 @cindex entering XEmacs
46 To enter Emacs type @kbd{xemacs} and press the Return key at the
47 shell i.e. @kbd{xemacs @key{RET}}.
48 This will bring up an emacs window with @samp{*scratch*} as the default
49 buffer because Emacs must always have a buffer to work on. Then choose
50 the @b{Open...} option from the @b{File} menu on the menubar at the top
51 of the frame. It will prompt you to enter a filename. After you enter
52 the filename, Emacs will read that file into the current buffer. You can
55 @kbd{xemacs <filename> @key{RET}}
57 directly which will bring up
58 an Emacs frame with the @dfn{filename} as the buffer.
62 @node Frame, Exiting, Enter, Entering
64 @cindex open another file
66 When you run XEmacs under X, a menu bar on top of the Emacs frame
67 provides access to pull-down menus of file, edit, and help-related
68 commands. The menus only provide convenient shortcuts, the options that
69 they provide are available via key commands. You can invoke those
70 commands from the keyboard also. For many of the options, their
71 corresponding key commands are displayed right besides them. The five
72 default menus on the menubar that you will see on the frame are
73 @b{File}, @b{Edit}, @b{Options}, @b{Buffers} and @b{Help}. @xref{XEmacs
74 Pull-down Menus,,,xemacs,XEmacs User's Manual}, for detailed information on
75 the functions provided by the pull-down menus.
77 The Emacs frame has a rectangle shaped box at the extreme right and you can
78 drag it up or down to scroll the window accordingly. Clicking on the
79 arrows also serves the same purpose.
81 The last line in your window is @samp{the Mode line} which will give
82 you a description of what's going on in that particular
83 window. @xref{Mode Line}, for more
84 information. Below the mode line is the @samp{Echo area}. Emacs uses
85 this area to interact with the user. @xref{Echo Area}.
87 If you wish to open another file in a new window after you enter
88 XEmacs, select @b{Open in New Frame...} from the @b{File} menu, which
89 will prompt you for a filename and open a new window with that filename
90 as the current buffer. If you want to open a new file in the same
91 window, select @b{Open..} from the @b{File} menu. You need to enter
92 XEmacs only once, you can edit multiple files by opening several other
93 frames or by switching between buffers.
97 @node Exiting, Mode Line, Frame, Entering
98 @section Exiting Emacs
100 @cindex killing Emacs
102 @cindex shrinking XEmacs frame
104 There are two commands for exiting Emacs, one for @dfn{suspending} Emacs
105 and the other for @dfn{killing} Emacs. @dfn{Suspending} means stopping
106 Emacs temporarily and returning control to the shell, allowing you to
108 later in the same Emacs job, with the same files, same kill ring, same
109 undo history, and so on. This is the usual way to exit. @dfn{Killing}
110 Emacs means destroying the Emacs job. You can run Emacs again later,
111 but you will get a fresh Emacs; there is no way to resume the same
112 editing session after it has been killed.
115 @findex suspend-emacs
117 @findex save-buffers-kill-emacs
121 Suspend Emacs (@code{suspend-emacs}). If used under the X window system,
122 this command will shrink the X window containing the Emacs frame to an
123 icon. Clicking on the icon will resume that Emacs process
124 again. @xref{Exiting Emacs,,,xemacs,XEmacs User's Manual}.
127 Kill Emacs (@code{save-buffers-kill-emacs}). You can also select
128 @b{Exit Emacs} option from the @b{File} menu to kill that Emacs
129 process. If you haven't saved the file, Emacs will ask you if you wish
130 to save the file before killing that process.
135 @comment node-name, next, previous, up
136 @node Mode Line, Echo Area, Exiting, Entering
137 @section The Mode Line
141 When you enter XEmacs, each text window's last line is a @dfn{mode
142 line} which describes what is going on in that window. Normally, the
143 mode line looks like :
147 --@var{ch}-XEmacs: @var{buf} (@var{major} @var{minor})----@var{pos}------
152 This gives information about the buffer being displayed in the window: the
153 buffer's name, what major and minor modes are in use, whether the buffer's
154 text has been changed, and how far down the buffer you are currently
157 The @var{ch} contains :
160 if the text in the buffer has been edited
163 if the text in the buffer has not been edited
166 if the buffer is a read-only-buffer i.e. it cannot be edited
169 @var{buf} is the name of the window's chosen @dfn{buffer}. If you are
170 editing a file (which is the selected buffer), the file name appears
171 in @var{buf}. @xref{Buffers,,,xemacs,XEmacs User's Manual}.
176 if your entire file is visible on the screen.
178 if you are looking at the beginning of the file.
180 if you are looking at the end of the file.
182 @var{nn} will be a number corresponding to the percentage of the file
183 above the top of the screen, for example @samp{52}, which means that 52%
184 of the file is above the top of the screen.
187 @var{major} is the name of the @dfn{major mode} in effect in the
188 buffer. At any time, each buffer is in one and only one major mode.
189 The available major modes include Fundamental mode (the least
190 specialized), Text mode, Lisp mode, and C mode. @xref{Major
191 Modes,,,xemacs,XEmacs User's Manual}, for details on how the modes differ
192 and how you select one.
194 @var{minor} is a list of some of the @dfn{minor modes} that are
195 turned on in the window's chosen buffer. For example, @samp{Fill} means
196 that Auto Fill mode is on which means that lines are broken
197 automatically when they become too wide. @xref{Minor
198 Modes,,,xemacs,XEmacs User's Manual}, for more information on various
199 minor modes and how to enable them.
201 You can also display time in the mode line. @xref{The Mode
202 Line,,,xemacs,XEmacs User's Manual}, for more information regarding the
206 @comment node-name, next, previous, up
207 @node Echo Area, , Mode Line, Entering
208 @section The Echo Area
211 The line at the bottom of the frame (below the mode line) is the
212 @dfn{echo area}. Emacs uses this area to communicate with you:
216 The @dfn{echo area} will print out the characters that you type. For
217 example, if you choose the @b{Open...} option from the @b{File} menu you
218 might get the following in the echo area:
221 Find file: /usr/lib/x11/
225 Now you need to give a file name to open, for example if the file name
226 is @file{myfile}, you will type @file{myfile} after
227 @file{/usr/lib/x11/} and press the @key{Return} key. If you pause for
228 more than a second while typing, you will see the characters that you
229 type in the @dfn{echo area}.
231 The @dfn{echo area} also prints error messages. For example, if you
232 misspell @samp{usr} and type @file{/urs/lib/x11/myfile} @key{RETURN} in
233 the above example you might get an error message. Since
234 Emacs will not be able to find the @file{/urs}
235 directory, the @dfn{echo area} will say:
238 @error{} Opening directory: no such file or directory, /urs/lib/x11/myfile
242 This error message will be accompanied by a beep. Some XEmacs commands
243 will print informative messages in the @dfn{echo area}. @xref{The Echo
244 Area,,,xemacs,XEmacs User's Manual}, for more information on the @dfn{echo