428
+ − 1 @comment node-name, next, previous, up
+ − 2 @node Entering, Windows and Menus, Concept Index, Top
+ − 3 @chapter Entering and Exiting Emacs
+ − 4 @cindex buffer
+ − 5 @cindex file
+ − 6 @cindex windows
+ − 7
+ − 8 While using Emacs you should be familiar with the following three terms:
+ − 9
+ − 10 @table @asis
+ − 11 @item Buffer
+ − 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
+ − 16 Manual}.
+ − 17
+ − 18 @item File
+ − 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.
+ − 23
+ − 24 @item Windows
+ − 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.
+ − 29 @end table
+ − 30
+ − 31 @comment node-name, next, previous, up
+ − 32 @menu
+ − 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
+ − 38 with Emacs.
+ − 39 @end menu
+ − 40
+ − 41 @node Enter, Frame, Entering, Entering
+ − 42 @section Entering Emacs
+ − 43 @cindex entering Emacs
+ − 44 @cindex entering XEmacs
+ − 45
+ − 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
+ − 53 also type :
+ − 54 @example
+ − 55 @kbd{xemacs <filename> @key{RET}}
+ − 56 @end example
+ − 57 directly which will bring up
+ − 58 an Emacs frame with the @dfn{filename} as the buffer.
+ − 59
+ − 60
+ − 61 @comment
+ − 62 @node Frame, Exiting, Enter, Entering
+ − 63 @section Emacs Frame
+ − 64 @cindex open another file
+ − 65
+ − 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.
+ − 76
+ − 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.
+ − 80
+ − 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}.
+ − 86
+ − 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.
+ − 94
+ − 95
+ − 96 @comment new section
+ − 97 @node Exiting, Mode Line, Frame, Entering
+ − 98 @section Exiting Emacs
+ − 99 @cindex exiting
+ − 100 @cindex killing Emacs
+ − 101 @cindex suspending
+ − 102 @cindex shrinking XEmacs frame
+ − 103
+ − 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
+ − 107 resume editing
+ − 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.
+ − 113
+ − 114 @kindex C-z
+ − 115 @findex suspend-emacs
+ − 116 @kindex C-x C-c
+ − 117 @findex save-buffers-kill-emacs
+ − 118
+ − 119 @table @kbd
+ − 120 @item C-z
+ − 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}.
+ − 125
+ − 126 @item C-x C-c
+ − 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.
+ − 131 @end table
+ − 132
+ − 133
+ − 134
+ − 135 @comment node-name, next, previous, up
+ − 136 @node Mode Line, Echo Area, Exiting, Entering
+ − 137 @section The Mode Line
+ − 138 @cindex mode line
+ − 139 @cindex top level
+ − 140
+ − 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 :
+ − 144
+ − 145 @example
+ − 146 @cartouche
+ − 147 --@var{ch}-XEmacs: @var{buf} (@var{major} @var{minor})----@var{pos}------
+ − 148 @end cartouche
+ − 149 @end example
+ − 150
+ − 151 @noindent
+ − 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
+ − 155 looking.
+ − 156
+ − 157 The @var{ch} contains :
+ − 158 @table @samp
+ − 159 @item **
+ − 160 if the text in the buffer has been edited
+ − 161
+ − 162 @item --
+ − 163 if the text in the buffer has not been edited
+ − 164
+ − 165 @item %%
+ − 166 if the buffer is a read-only-buffer i.e. it cannot be edited
+ − 167 @end table
+ − 168
+ − 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}.
+ − 172
+ − 173 @var{pos} contains :
+ − 174 @table @samp
+ − 175 @item All
+ − 176 if your entire file is visible on the screen.
+ − 177 @item Top
+ − 178 if you are looking at the beginning of the file.
+ − 179 @item Bot
+ − 180 if you are looking at the end of the file.
+ − 181 @item @var{nn}%
+ − 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.
+ − 185 @end table
+ − 186
+ − 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.
+ − 193
+ − 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.
+ − 200
+ − 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
+ − 203 mode line.
+ − 204
+ − 205
+ − 206 @comment node-name, next, previous, up
+ − 207 @node Echo Area, , Mode Line, Entering
+ − 208 @section The Echo Area
+ − 209 @cindex echo area
+ − 210
+ − 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:
+ − 213
+ − 214 @itemize @bullet
+ − 215 @item
+ − 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:
+ − 219
+ − 220 @example
+ − 221 Find file: /usr/lib/x11/
+ − 222 @end example
+ − 223
+ − 224 @noindent
+ − 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}.
+ − 230 @item
+ − 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:
+ − 236
+ − 237 @example
+ − 238 @error{} Opening directory: no such file or directory, /urs/lib/x11/myfile
+ − 239 @end example
+ − 240
+ − 241 @noindent
+ − 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
+ − 245 area}.
+ − 246 @end itemize
+ − 247
+ − 248
+ − 249
+ − 250
+ − 251
+ − 252