This commit was generated by cvs2svn to compensate for changes in r6453,
[chise/xemacs-chise.git.1] / info / new-users-guide.info-1
1 This is Info file ../../info/new-users-guide.info, produced by Makeinfo
2 version 1.68 from the input file new-users-guide.texi.
3
4 INFO-DIR-SECTION XEmacs Editor
5 START-INFO-DIR-ENTRY
6 * Intro: (new-users-guide).     Introduction to the XEmacs Editor.
7 END-INFO-DIR-ENTRY
8
9    This manual serves as an introduction to the XEmacs editor.
10
11    Copyright (C) 1985, 1986, 1988 Richard M. Stallman.  Copyright (C)
12 1991, 1992, 1993, 1994 Lucid, Inc.  Copyright (C) 1993, 1994 Sun
13 Microsystems, Inc.
14
15    Permission is granted to make and distribute verbatim copies of this
16 manual provided the copyright notice and this permission notice are
17 preserved on all copies.
18
19 \1f
20 File: new-users-guide.info,  Node: Top,  Next: Intro,  Prev: (dir),  Up: (dir)
21
22    The Emacs Editor ****************
23
24    Emacs is the extensible, customizable, self-documenting real-time
25 display editor.  This Info file will help you get started on using
26 XEmacs.  It corresponds to XEmacs version 19.13.
27
28 * Menu:
29
30 * Intro::                       Introduction to XEmacs editor
31
32 Indices, nodes containing large menus
33 * Key Index::                   An item for each standard Emacs key sequence.
34 * Command Index::               An item for each command and function name
35 * Variable Index::              An item for each variable in User-Guide
36 * Concept Index::               An item for the concepts introduced
37
38 Entering, Exiting and Editing Emacs
39 * Entering::                    Starting Emacs from the shell and Exiting
40 * Windows and Menus::           Description of Pull-down menus
41 * Edit::                        Basic Editing commands
42
43 Other Features of XEmacs
44 * Customization Basics::        Customize Emacs menus and keybindings
45 * Help::                        Help menu and other help commands
46 * Modes::                       Major and Minor modes in XEmacs
47 * Files::                       Visiting, Saving and Listing Files
48 * Other Customizations::        Customizing Variables, Modes, etc
49 * Select and Move::             Selecting text and moving text
50 * Search and Replace::          Searching and Replacing text
51
52
53
54  -- The Detailed Node Listing --
55
56 Entering and Exiting Emacs
57
58 * Enter::                       Entering Emacs from the shell
59 * Frame::                       Basic information about the XEmacs Frame
60 * Exiting::                     Exiting Emacs
61 * Mode Line::                   Interpreting the mode line.
62 * Echo Area::                   Bottom of the frame where you interact
63                                 with Emacs.
64
65 XEmacs Windows and Menus
66
67 * XEmacs Window::               Manipulating XEmacs Windows
68 * Pull-down Menus::             Description of XEmacs Pull-down Menus
69
70 Pull-down menus
71
72 * File menu::                   Items on the File Menu
73 * Edit menu::                   Items on the Edit Menu
74 * Options Menu::                Items on the Options Menu
75 * Buffers Menu::                Items on the Buffers Menu
76 * Help menu::                   The Help Menu at the extreme right on
77                                 the frame
78
79 Basic Editing Commands
80
81 * Insert::                      Insert text in Emacs by simply typing at
82                                 the cursor position.
83 * Cursor Position::             Moving Around the cursor in the buffer,
84 * Erase::                       Different commands for erasing text
85 * Numeric Argument::            Giving Numeric Arguments to commands
86 * Undo::                        Undoing Changes made by mistake
87
88 Customize key bindings and menus
89
90 * Customizing key Bindings::    Changing Key Bindings
91 * Customizing Menus::           Adding, Deleting, Enabling and Disabling Menus
92
93 Help
94
95 * The Help Menu::               Items on the Help Menu
96
97 Major and Minor Modes
98
99 * Major Modes::                 Choosing Major Modes
100 * Minor Modes::                 Auto-Fill, Abbrev and other minor modes
101
102 Emacs Files
103
104 * File Names::                  How to type and edit file name arguments.
105 * Visiting::                    Visiting a file prepares Emacs to edit the file.
106 * Saving Files::                How to save Emacs files.
107
108 Other Customizations
109
110 * Setting Variables::           Customizing Emacs variables
111 * Init File::                   Some examples of Lisp expressions in
112                                 .emacs file
113
114 Selecting and Moving Text
115
116 * Selecting Text::              Select a region of text by setting the Mark
117 * Mouse::                       Selecting Text with Mouse
118 * Region Operation::            Various ways to operate on a selected text
119 * Moving Text::                 Moving Text
120 * Accumulating text::           Accumulating Text from several buffers
121
122 No sub menu for the node search and replace
123
124 \1f
125 File: new-users-guide.info,  Node: Intro,  Next: Key Index,  Prev: Top,  Up: Top
126
127 Introduction
128 ************
129
130    You are reading about XEmacs which is a self-documenting,
131 customizable, extensible real-time display editor.
132
133    XEmacs is a "display" editor because normally the text being edited
134 is visible on the screen and is updated automatically as you type.
135 *Note Display: (xemacs)Frame.
136
137    It is a "real-time" editor because the display is updated very
138 frequently, usually after each character or pair of characters you type.
139 This minimizes the amount of information you must keep in your head as
140 you edit.  *Note Real-time: (xemacs)Basic.
141
142    It is advanced because it provides facilities that go beyond simple
143 insertion and deletion: filling of text; automatic indentation of
144 programs; viewing two or more files at once; and dealing in terms of
145 characters, words, lines, sentences, paragraphs, and pages, as well as
146 expressions and comments in several different programming languages.
147 It is much easier to type one command meaning "go to the end of the
148 paragraph" than to find that spot with simple cursor keys.
149
150    "Self-documenting" means that at any time you can type a special
151 character, `Control-h', to find out what your options are.  You can
152 also use `C-h' to find out what a command does, or to find all the
153 commands relevant to a topic.  *Note Help: (xemacs)Help.
154
155    "Customizable" means you can change the definitions of Emacs
156 commands.  For example, if you use a programming language in which
157 comments start with `<**' and end with `**>', you can tell the Emacs
158 comment manipulation commands to use those strings (*note Comments:
159 (xemacs)Comments.).  Another sort of customization is rearrangement of
160 the command set.  For example, you can set up the four basic cursor
161 motion commands (up, down, left and right) on keys in a diamond pattern
162 on the keyboard if you prefer.  *Note Customization:
163 (xemacs)Customization.
164
165    "Extensible" means you can go beyond simple customization and write
166 entirely new commands, programs in the Lisp language to be run by
167 Emacs's own Lisp interpreter.  Emacs is an "on-line extensible" system:
168 it is divided into many functions that call each other.  You can
169 redefine any function in the middle of an editing session and replace
170 any part of Emacs without making a separate copy of all of Emacs.  Most
171 of the editing commands of Emacs are written in Lisp; the few
172 exceptions could have been written in Lisp but are written in C for
173 efficiency.  Only a programmer can write an extension to Emacs, but
174 anybody can use it afterward.
175
176 \1f
177 File: new-users-guide.info,  Node: Entering,  Next: Windows and Menus,  Prev: Concept Index,  Up: Top
178
179 Entering and Exiting Emacs
180 **************************
181
182    While using Emacs you should be familiar with the following three
183 terms:
184
185 Buffer
186      A buffer is a region of memory holding characters. It is the basic
187      editing unit; one buffer corresponds to one piece of text being
188      edited. You can have multiple buffers but you can edit only one
189      buffer at any one time. For more information, *Note Buffers:
190      (xemacs)Buffers.
191
192 File
193      A file is a region of disk space holding characters. Emacs edits a
194      file by reading it into a buffer, editing that buffer and writing
195      out the buffer back to the file. To save your work permanently you
196      have to write it to a file.  So after you load and work with a
197      file, you have to save it back.
198
199 Windows
200      A window is a rectangular region in which a buffer is displayed.
201      You can open multiple windows with multiple buffers and edit them
202      by selecting the corresponding buffer. Initially, when you start
203      emacs, it will automatically open up a window for you.
204
205 * Menu:
206
207 * Enter::                       Entering Emacs from the shell
208 * Frame::                      Basic information about the XEmacs Frame
209 * Exiting::                     Exiting Emacs
210 * Mode Line::                   Interpreting the mode line.
211 * Echo Area::                   Bottom of the frame where you interact
212                                 with Emacs.
213
214 \1f
215 File: new-users-guide.info,  Node: Enter,  Next: Frame,  Prev: Entering,  Up: Entering
216
217 Entering Emacs
218 ==============
219
220    To enter Emacs type `xemacs' and press the Return key at the shell
221 i.e. `xemacs <RET>'.  This will bring up an emacs window with
222 `*scratch*' as the default buffer because Emacs must always have a
223 buffer to work on. Then choose the Open... option from the File menu on
224 the menubar at the top of the frame. It will prompt you to enter a
225 filename. After you enter the filename, Emacs will read that file into
226 the current buffer. You can also type :
227      xemacs <filename> <RET>
228    directly which will bring up an Emacs frame with the "filename" as
229 the buffer.
230
231 \1f
232 File: new-users-guide.info,  Node: Frame,  Next: Exiting,  Prev: Enter,  Up: Entering
233
234 Emacs Frame
235 ===========
236
237    When you run XEmacs under X, a menu bar on top of the Emacs frame
238 provides access to pull-down menus of file, edit, and help-related
239 commands. The menus only provide convenient shortcuts, the options that
240 they provide are available via key commands. You can invoke those
241 commands from the keyboard also. For many of the options, their
242 corresponding key commands are displayed right besides them. The five
243 default menus on the menubar that you will see on the frame are File,
244 Edit, Options, Buffers and Help. *Note XEmacs Pull-down Menus:
245 (xemacs)XEmacs Pull-down Menus, for detailed information on the
246 functions provided by the pull-down menus.
247
248    The Emacs frame has a rectangle shaped box at the extreme right and
249 you can drag it up or down to scroll the window accordingly. Clicking
250 on the arrows also serves the same purpose.
251
252    The last line in your window is `the Mode line' which will give you
253 a description of what's going on in that particular window. *Note Mode
254 Line::, for more information. Below the mode line is the `Echo area'.
255 Emacs uses this area to interact with the user. *Note Echo Area::.
256
257    If you wish to open another file in a new window after you enter
258 XEmacs, select Open in New Frame... from the File menu, which will
259 prompt you for a filename and open a new window with that filename as
260 the current buffer. If you want to open a new file in the same window,
261 select Open.. from the File menu. You need to enter XEmacs only once,
262 you can edit multiple files by opening several other frames or by
263 switching between buffers.
264
265 \1f
266 File: new-users-guide.info,  Node: Exiting,  Next: Mode Line,  Prev: Frame,  Up: Entering
267
268 Exiting Emacs
269 =============
270
271    There are two commands for exiting Emacs, one for "suspending" Emacs
272 and the other for "killing" Emacs. "Suspending" means stopping Emacs
273 temporarily and returning control to the shell, allowing you to resume
274 editing later in the same Emacs job, with the same files, same kill
275 ring, same undo history, and so on.  This is the usual way to exit.
276 "Killing" Emacs means destroying the Emacs job.  You can run Emacs
277 again later, but you will get a fresh Emacs; there is no way to resume
278 the same editing session after it has been killed.
279
280 `C-z'
281      Suspend Emacs (`suspend-emacs').  If used under the X window
282      system, this command will shrink the X window containing the Emacs
283      frame to an icon. Clicking on the icon will resume that Emacs
284      process again. *Note Exiting Emacs: (xemacs)Exiting Emacs.
285
286 `C-x C-c'
287      Kill Emacs (`save-buffers-kill-emacs'). You can also select Exit
288      Emacs option from the File menu to kill that Emacs process. If you
289      haven't saved the file, Emacs will ask you if you wish to save the
290      file before killing that process.
291
292 \1f
293 File: new-users-guide.info,  Node: Mode Line,  Next: Echo Area,  Prev: Exiting,  Up: Entering
294
295 The Mode Line
296 =============
297
298    When you enter XEmacs, each text window's last line is a "mode line"
299 which describes what is going on in that window. Normally, the mode
300 line looks like :
301
302      --CH-XEmacs: BUF     (MAJOR MINOR)----POS------
303
304 This gives information about the buffer being displayed in the window:
305 the buffer's name, what major and minor modes are in use, whether the
306 buffer's text has been changed, and how far down the buffer you are
307 currently looking.
308
309    The CH contains :
310 `**'
311      if the text in the buffer has been edited
312
313 `--'
314      if the text in the buffer has not been edited
315
316 `%%'
317      if the buffer is a read-only-buffer i.e. it cannot be edited
318
319    BUF is the name of the window's chosen "buffer". If you are editing
320 a file (which is the selected buffer), the file name appears in BUF.
321 *Note Buffers: (xemacs)Buffers.
322
323    POS contains :
324 `All'
325      if your entire file is visible on the screen.
326
327 `Top'
328      if you are looking at the beginning of the file.
329
330 `Bot'
331      if you are looking at the end of the file.
332
333 `NN%'
334      NN will be a number corresponding to the percentage of the file
335      above the top of the screen, for example `52', which means that 52%
336      of the file is above the top of the screen.
337
338    MAJOR is the name of the "major mode" in effect in the buffer.  At
339 any time, each buffer is in one and only one major mode.  The available
340 major modes include Fundamental mode (the least specialized), Text
341 mode, Lisp mode, and C mode.  *Note Major Modes: (xemacs)Major Modes,
342 for details on how the modes differ and how you select one.
343
344    MINOR is a list of some of the "minor modes" that are turned on in
345 the window's chosen buffer.  For example, `Fill' means that Auto Fill
346 mode is on which means that lines are broken automatically when they
347 become too wide. *Note Minor Modes: (xemacs)Minor Modes, for more
348 information on various minor modes and how to enable them.
349
350    You can also display time in the mode line. *Note The Mode Line:
351 (xemacs)The Mode Line, for more information regarding the mode line.
352
353 \1f
354 File: new-users-guide.info,  Node: Echo Area,  Prev: Mode Line,  Up: Entering
355
356 The Echo Area
357 =============
358
359    The line at the bottom of the frame (below the mode line) is the
360 "echo area".  Emacs uses this area to communicate with you:
361
362    *   The "echo area" will print out the characters that you type. For
363      example, if you choose the Open... option from the File menu you
364      might get the following in the echo area:
365
366           Find file: /usr/lib/x11/
367
368      Now you need to give a file name to open, for example if the file
369      name is `myfile', you will type `myfile' after `/usr/lib/x11/' and
370      press the <Return> key. If you pause for more than a second while
371      typing, you will see the characters that you type in the "echo
372      area".
373
374    *   The "echo area" also prints error messages. For example, if you
375      misspell `usr' and type `/urs/lib/x11/myfile' <RETURN> in the
376      above example you might get an error message. Since Emacs will not
377      be able to find the `/urs' directory, the "echo area" will say:
378
379           error--> Opening directory: no such file or directory, /urs/lib/x11/myfile
380
381      This error message will be accompanied by a beep. Some XEmacs
382      commands will print informative messages in the "echo area". *Note
383      The Echo Area: (xemacs)The Echo Area, for more information on the
384      "echo area".
385
386 \1f
387 File: new-users-guide.info,  Node: Windows and Menus,  Next: Edit,  Prev: Entering,  Up: Top
388
389 XEmacs Windows and Menus
390 ************************
391
392    The first section of this chapter will show you how you can
393 manipulate XEmacs Windows and the other section will explain the
394 Pull-down Menus of an XEmacs window.
395
396 * Menu:
397
398 * XEmacs Window::               Manipulating XEmacs Windows
399 * Pull-down Menus::             Description of XEmacs Pull-down Menus
400
401 \1f
402 File: new-users-guide.info,  Node: XEmacs Window,  Next: Pull-down Menus,  Prev: Windows and Menus,  Up: Windows and Menus
403
404 XEmacs Windows
405 ==============
406
407    When you use XEmacs under X, you can open multiple windows and each
408 window can display one buffer or multiple parts of one buffer. Each
409 window will have its own "mode line" and "echo area". At any one time
410 there is only one "selected window" and the buffer it displays is the
411 "selected buffer". There are some commands for manipulating windows:
412
413 `M-C-v'
414      This command will scroll the window which is not "selected"
415      (`scroll-other-window').
416
417 `C-x 0'
418      This command will get rid of the selected window (`delete-window').
419      That is a zero. If there is more than one Emacs frame, deleting the
420      sole remaining window on that frame deletes the frame as well. If
421      the current frame is the only frame, it is not deleted.
422
423 `C-x 1'
424      This command will get rid of all the windows except the selected
425      one.  (`delete-other-windows'). For example, if you use the
426      Describe variable option from the Help menu, the window will split
427      vertically and the bottom window will contain documentation for
428      that variable. After you are done looking at that variable's
429      documentation you might want to come back to your original single
430      window. Just type `C-x 1' after your cursor is in the top window
431      (the window which you want to keep) and hit <RET>.
432
433 `C-x 2'
434      This command will split the selected window into two windows, one
435      above the other (`split-window-vertically'). Both the windows will
436      start out by displaying the same buffer. The window in which you
437      have your cursor will be your "selected window".
438
439 `C-x 3'
440      This will split the selected window into two windows positioned
441      side by side (`split-window-horizontally'). A line of vertical
442      bars will separate the window.
443
444 You can select a buffer in another window by using some other commands.
445 These commands all have a prefix key `C-x 4'
446 `C-x 4 b BUFNAME <RET>'
447      This command will select a buffer BUFNAME in another window.  This
448      runs `switch-to-buffer-other-window'. It will prompt you for a
449      buffername.
450
451 `C-x 4 f FILENAME <RET>'
452      Visit file FILENAME and select its buffer in another window.  This
453      runs `find-file-other-window'.  *Note Visiting: (xemacs)Visiting.
454      It will prompt you for a filename.
455
456 `C-x 4 d DIRECTORY <RET>'
457      Select a Dired buffer for directory DIRECTORY in another window.
458      This runs `dired-other-window'.  *Note Dired: (xemacs)Dired.
459
460 `C-x 4 m'
461      Start composing a mail message in another window.  This runs
462      `mail-other-window', and its same-window version is `C-x m'.
463      *Note Sending Mail: (xemacs)Sending Mail, for information on how
464      to Send Mail using XEmacs. *Note Reading Mail With Rmail:
465      (xemacs)Reading Mail With Rmail, for information on reading mail
466      using Rmail.
467
468    If you click the right button on the mouse on a mode line, you will
469 get a menu with following options:
470 Delete Window
471      Choosing this menu will remove the window above this modeline from
472      the frame.
473
474 Delete Other Windows
475      Delete all windows on the frame except for the one above this
476      modeline.
477
478 Split Window
479      Split the window above the mode line in half, creating another
480      window.
481
482 Split Window Horizontally
483      Split the window above the mode line in half horizontally, so that
484      there will be two windows side-by-side.
485
486 Balance Windows
487      Readjust the sizes of all windows on the frame until all windows
488      have roughly the same number of lines.
489
490 \1f
491 File: new-users-guide.info,  Node: Pull-down Menus,  Prev: XEmacs Window,  Up: Windows and Menus
492
493 XEmacs Pull-down Menus
494 ======================
495
496    When you run XEmacs under X, each Emacs frame has a menu-bar at the
497 top which provides commands for editing, help and other options. All
498 these options are also available via key commands, the menus just
499 provide convenient short-cuts. The key commands are displayed right
500 besides some of the options. The following is a brief description of
501 the four default menus on the menu bar:
502
503 * Menu:
504
505 * File menu::                   Items on the File menu
506 * Edit menu::                   Items on the Edit menu
507 * Options Menu::                Items on the Options Menu
508 * Buffers Menu::                Items on the Buffers Menu
509 * Help menu::                   The Help Menu at the extreme right on
510                                 the frame
511
512 \1f
513 File: new-users-guide.info,  Node: File menu,  Next: Edit menu,  Prev: Pull-down Menus,  Up: Pull-down Menus
514
515 The File Menu
516 -------------
517
518    The File menu bar contains the following items. To choose a
519 particular option, press the left mouse button and drag it to the item
520 you wish to select. Then release the button.
521
522 Open...
523      This option will prompt you for a file name. You will get a
524      message in the echo area:
525
526           Find File:
527
528      After Find File, there might be a directory path also. After you
529      type the file name and press <RET> the file will be loaded into a
530      new buffer.
531
532 Open in New Frame...
533      It prompts you for a file name and loads that file in a new buffer
534      in a new frame. You can open many frames for the same Emacs
535      session. You can delete the frame by selecting Delete Frame.
536
537 Insert File...
538      Prompts you for a filename and inserts the contents of this
539      filename in your current buffer. Position your cursor at the place
540      you wish to insert the file and select this option. You will get
541      the following message in the echo area:
542
543           Insert file:
544
545      Insert the file name and press <RET>.
546
547 Save <Buffername>
548      It saves the changes you have made to the buffer. If you have made
549      changes which are not saved yet, the option will appear dark,
550      otherwise it will be light and unselectable. If you do not wish to
551      save the changes, select Revert Buffer.
552
553 Save As...
554      Prompts you for a filename and saves the current buffer in that
555      file. It loads the new file if the filename you specify is
556      different from the one you were working with.
557
558 Print Buffer <buffername>
559      Prints a hardcopy of the current or "selected" buffer.
560
561 New Frame
562      Opens a new frame with *scratch* as the default buffer. It doesn't
563      prompt you for a filename. To open a file you need to go to that
564      frame and select Open...
565
566 Split Frame
567      Splits the current window into two equal-sized windows with the
568      same buffer. To get back a single frame, select Un-Split (Keep
569      This). *Note XEmacs Window::, for more information about windows.
570
571 Un-Split (Keep This)
572      If the frame contains multiple windows, it will remove all windows
573      except the selected one.
574
575 Un-Split (Keep Others)
576      If the frame contains multiple windows, it will remove the selected
577      window and keep the other one.
578
579 Revert Buffer <buffername>
580      If you do not wish to save the changes you made to the file since
581      you opened it, select this option. It will restore the last saved
582      version of the file to the current buffer.
583
584 Kill Buffer <buffername>
585      It will kill the current buffer. If will prompt you if there are
586      unsaved changes.
587
588 Exit Emacs
589      It will kill the Emacs "process" as opposed to simply killing the
590      "buffer". Before it kills the process, it will prompt you as to
591      which unsaved buffers you wish to save by going through the list
592      of the buffers.
593
594 * Menu:
595
596 * Edit menu::                   Items on the Edit Menu
597 * Options Menu::                Items on the Options Menu
598 * Buffers Menu::                Items on the Buffers Menu
599 * Help menu::                   The Help Menu at the extreme right on
600                                 the frame
601
602 \1f
603 File: new-users-guide.info,  Node: Edit menu,  Next: Options Menu,  Prev: File menu,  Up: Pull-down Menus
604
605 The Edit Menu
606 -------------
607
608    Most of the commands in this menu work on a block of text or a
609 selected region. The text will be highlighted as you select it.
610 Undo
611      Undoes the previous command.  If you type something by mistake you
612      can use this command. For example, if you select Insert File...
613      from the File menu and insert a wrong file by mistake, you can
614      select this item and it will remove the inserted file. It undoes a
615      batch of text which is worth an emacs command.
616
617 Cut
618      Removes the selected text block from the current buffer, makes it
619      the X clipboard selection, and places it in the kill ring (*note
620      Moving Text::.). Before executing this command, you have to select
621      a region using Emacs region selection commands or with the mouse.
622      *Note Selecting Text::.
623
624 Copy
625      Makes a selected text block the X clipboard selection, and places
626      it in the kill ring.  You can select text using one of the Emacs
627      region selection commands or by selecting a text region with the
628      mouse. *Note Selecting Text::, for more information.
629
630 Paste
631      Inserts the current value of the X clipboard selection in the
632      current buffer.  Note that this is not necessarily the same as the
633      Emacs `yank' command, because the Emacs kill ring and the X
634      clipboard selection are not the same thing.  You can paste in text
635      you have placed in the clipboard using Copy or Cut.  You can also
636      use Paste to insert text that was pasted into the clipboard from
637      other applications. *Note X Clipboard Selection: (xemacs)X
638      Clipboard Selection, for information on using Clipboard Selection.
639
640 Clear
641      Removes the selected text block from the current buffer but does
642      not place it in the kill ring or the X clipboard selection. You
643      will not be able to get this text back.
644
645 Start Macro Recording
646      After selecting this, Emacs will remember every keystroke you type
647      until End Macro Recording is selected.
648
649 End Macro Recording
650      Selecting this tells emacs to stop remembering your keystrokes.
651
652 Execute Last Macro
653      Selecting this item will cause emacs to re-interpret all of the
654      keystrokes which were saved between selections of the Start Macro
655      Recording and End Macro Recording menu items.  You can now execute
656      the most recent keyboard macro. *Note Keyboard Macros:
657      (xemacs)Keyboard Macros, for further information.
658
659 \1f
660 File: new-users-guide.info,  Node: Options Menu,  Next: Buffers Menu,  Prev: Edit menu,  Up: Pull-down Menus
661
662 The Options Menu
663 ----------------
664
665    There are sub-menus for some of the menus which you will need to
666 select. If sub-menus exist for an item, they will be displayed
667 automatically when you drag the mouse on that item. The items in this
668 menu provide some fancy editing operations.
669
670 Read Only
671      Selecting this item will cause the buffer to visit the file in a
672      read-only mode. Changes to the file will not be allowed.
673
674 Case Sensitive Search
675      Selecting this item will cause searches to be case-sensitive. If
676      its not selected then searches will ignore case. This option is
677      local to the buffer. For example, if this item is selected and you
678      are searching for `Smile', then an occurrence of `smile' will not
679      be recognized because of the smaller case of `s'.
680
681 Overstrike
682      After selecting this item, when you type letters they will replace
683      existing text on a one-to-one basis, rather than pushing it to the
684      right. At the end of a line, such characters extend the line.
685      Before a tab, such characters insert until the tab is filled in.
686
687 Auto Delete Selection
688      Selecting this item will cause automatic deletion of the selected
689      region. After you select a region and hit the <RET> key, the
690      selected text will be deleted. The typed text will replace the
691      selection if the selection is active (i.e. if its highlighted). If
692      the option is not selected then the typed text is just inserted at
693      the cursor.
694
695 Teach Extended Commands
696      After you  select this item, any time you execute a command with
697      `M-x' which has a shorter keybinding, you will be shown the
698      alternate binding before the command executes. For example if you
699      type `M-x find-file-other-window' which performs the same function
700      as the Open in Other Window... in File menu you will see the
701      following message:
702
703           M-x find-file-other-window (bound to keys: C-x 4 f, C-x 4 C-f)
704
705 Syntax Highlighting
706      You can customize your `.emacs' file to include the font-lock mode
707      so that when you select this item, the comments will be displayed
708      in one face, strings in another, reserved words in another, and so
709      on. *Note Customization: (xemacs)Customization, for more
710      information on customizing `.emacs' file.  After selecting this
711      item, you will find your code a lot easier to read. When Fonts is
712      selected, different parts of the program will appear in different
713      Fonts. When Colors is selected, then the program will be displayed
714      in different colors. Selecting None causes the program to appear in
715      just one Font and Color. Selecting Less resets the Fonts and Colors
716      to a fast, minimal set of decorations. Selecting More resets the
717      Fonts and Colors to a larger set of decorations. For example, if
718      Less is selected (which is the default setting) then you might have
719      all comments in green color. It does not matter what the comments
720      contain. Whereas, if More is selected then a function name in the
721      comments themselves might appear in a different Color or Font. Even
722      though the comments themselves might appear in green color, a
723      function name "within" the comments might appear in red color.
724
725 Paren Highlighting
726      After selecting Blink from this item, if you place the cursor on a
727      parenthesis, the matching parenthesis will blink. If you select
728      Highlight and place the cursor on a parenthesis, the whole
729      expression of the parenthesis under the cursor will be highlighted.
730      Selecting None will turn off the options (regarding Paren
731      Highlighting) which you had selected earlier.
732
733 Font
734      You can select any Font for your program by choosing from one of
735      the available Fonts. The whole buffer will be converted to the
736      Font you select.
737
738 Size
739      You can select any size for the text in your buffer (ranging from
740      2 to 24) by selecting the appropriate option.
741
742 Weight
743      You can choose either Bold or Medium for the weight of the text of
744      your buffer.
745
746 Buffers Menu Length...
747      Prompts you for the number of buffers to display. Then it will
748      display that number of most recently selected buffers.
749
750 Buffers Sub-Menus
751      After selection of this item the Buffers menu will contain several
752      commands, as submenus of each buffer line. If this item is
753      unselected, then there are no submenus for each buffer line, the
754      only command available will be selecting that buffer.
755
756 Save Options
757      Selecting this item will save the current settings of your Options
758      menu to your `.emacs' file so that the next time you start XEmacs,
759      you won't need to select the options again.
760
761 \1f
762 File: new-users-guide.info,  Node: Buffers Menu,  Next: Help menu,  Prev: Options Menu,  Up: Pull-down Menus
763
764 The Buffers Menu
765 ----------------
766
767    The Buffers menu provides a selection of up to ten buffers and the
768 item List All Buffers, which provides a Buffer List. If you select
769 Buffers Sub-menus from the Options menu, you will get some sub-menus
770 for each of the buffer listing.
771
772 \1f
773 File: new-users-guide.info,  Node: Help menu,  Prev: Buffers Menu,  Up: Pull-down Menus
774
775 The Help Menu
776 -------------
777
778    The Help Menu gives you access to Emacs Info and provides a menu
779 equivalent for some of the choices you have when using `C-h'.  *Note
780 Help::, for more information.
781
782    The Describe variable and Describe function will provide
783 documentation for the corresponding variable or function. The Help menu
784 also gives access to UNIX online manual pages via the UNIX Manual...
785 option.
786
787 \1f
788 File: new-users-guide.info,  Node: Edit,  Next: Customization Basics,  Prev: Windows and Menus,  Up: Top
789
790 Basic Editing Commands
791 **********************
792
793    This chapter will introduce you to some basic editing commands. You
794 can also learn the basic editing commands by typing `Control-h t'
795 (`help-with-tutorial' OR by selecting Emacs Tutorial from the Help menu
796 on the menu bar. Most of the Emacs commands will use the <CONTROL> key
797 or the <META> key. The following abbreviations will be used for the
798 <CONTROL> and <META> key in this manual:
799
800 `C-<chr>'
801      This means that you should hold down the <CONTROL> key while typing
802      `<chr>'. For example, if the command is `C-g', you should hold the
803      <CONTROL> key and type <g>.
804
805 `M-<chr>'
806      This means that you should hold down the `META' key while typing
807      `<chr>'. If there is no `META' key on your keyboard, use the `ESC'
808      key instead. For example, if the command is `M-x', then type
809      `ESC', release it and type `x'.
810
811    The following abbreviations will be used for some other keys:
812
813 <SPC>
814      Space bar.
815
816 <RET>
817      Return key.
818
819 <LFD>
820      Linefeed key.
821
822 <TAB>
823      Tab.
824
825 <ESC>
826      Escape.
827
828 <SFT>
829      Shift.
830
831 * Menu:
832
833 * Insert::                      Insert text in Emacs by simply typing at
834                                 the cursor position.
835 * Cursor Position::             Moving Around the cursor in the buffer,
836 * Erase::                       Different commands for erasing text
837 * Numeric Argument::            Giving Numeric Arguments to commands
838 * Undo::                        Undoing Changes made by mistake
839
840 \1f
841 File: new-users-guide.info,  Node: Insert,  Next: Cursor Position,  Prev: Edit,  Up: Edit
842
843 Inserting Text
844 ==============
845
846    To insert printing characters into the text you are editing, just
847 type them. Emacs will automatically insert the characters that you type
848 into the buffer at the cursor. The cursor moves forward, but if you
849 prefer to have text characters replace (overwrite) existing text
850 characters, you can enable the Overstrike option from the Options menu
851 in the menu bar.
852
853    To "delete" text you have just inserted, use <DEL>.  <DEL> deletes
854 the character BEFORE the cursor (not the one that the cursor is on top
855 of or under; that is the character AFTER the cursor).  The cursor and
856 all characters after it move backwards.  Therefore, if you type a
857 printing character and then type <DEL>, they cancel out.
858
859    To end a line and start typing a new one, type <RET>.  This inserts
860 a newline character in the buffer.  If point is in the middle of a
861 line, <RET> splits the line.  Typing <DEL> when the cursor is at the
862 beginning of a line rubs out the newline before the line, thus joining
863 the line with the preceding line.
864
865    Emacs automatically splits lines when they become too long, if you
866 turn on a special mode called "Auto Fill" mode.  *Note Filling:
867 (xemacs)Filling, for information on using Auto Fill mode.
868
869 \1f
870 File: new-users-guide.info,  Node: Cursor Position,  Next: Erase,  Prev: Insert,  Up: Edit
871
872 Moving Around
873 =============
874
875    The following commands will allow you to move the cursor around the
876 screen. The actual function names corresponding to these commands are
877 given in parenthesis. You can also invoke these commands by typing `M-x
878 <function name>'. You can do this for any command in XEmacs.
879
880 `C-b'
881      Move the cursor backward one character (`backward-char').
882
883 `C-f'
884      Move the cursor forward one character (`forward-char').
885
886 `C-p'
887      Move the cursor up one line vertically (`previous-line').
888
889 `C-n'
890      Move the cursor down one line vertically (`next-line').
891
892 `C-a'
893      Move the cursor to the beginning of the line (`beginning-of-line').
894
895 `C-e'
896      Move the cursor to the end of the line (`end-of-line').
897
898 `M-f'
899      Move the cursor forward one word (`forward-word').
900
901 `M-b'
902      Move the cursor backword one word (`backward-word').
903
904 `M-<'
905      Move the cursor to the top of the buffer (`beginning-of-buffer').
906
907 `M->'
908      Move the cursor to the end of the buffer (`end-of-buffer').
909
910 `M-x goto-char RET <number> RET'
911      To enable this command type `M-x goto-char', and hit <RETURN> key.
912      In the "echo area" you will see:
913
914           Goto char:
915
916      You should then type in a number right after the colon and hit the
917      `RETURN' key again. After reading a number N this command will
918      move the cursor to character number N.  Position 1 is the
919      beginning of the buffer. For example, if you type `M-x goto-char
920      RET 200 RET', then the cursor will move to the 200th character
921      starting from the beginning of the buffer.
922
923 `M-x goto-line RET <number> RET'
924      To enable this command type `M-x goto-line', and hit the <RETURN>
925      key. After you see `Goto line:' in the "echo area", type in a
926      number N and hit <RETURN> key again. This command will position
927      the cursor on the nth line starting from the beginning of the
928      buffer.
929
930 `M-x what-line RET'
931      This command will display the current line number in the echo area.
932
933 \1f
934 File: new-users-guide.info,  Node: Erase,  Next: Numeric Argument,  Prev: Cursor Position,  Up: Edit
935
936 Erasing Text
937 ============
938
939 `<DEL>'
940      If you press <DEL> i.e. the "delete" key, it will delete the
941      character before the cursor (`delete-backward-char').
942
943 `C-d'
944      This will delete the character after the cursor (`delete-char').
945
946 `C-k'
947      Kill to the end of the line (`kill-line'). If you kill the line by
948      mistake you can "yank" or `paste' it back by typing `C-y'. *Note
949      Moving Text::, for more information on yanking.
950
951 `M-d'
952      Kill forward to the end of the next word (`kill-word').
953
954 `M-<DEL>'
955      Kill back to the beginning of the previous word
956      (`backward-kill-word').
957
958 `M-k'
959      Kill to the end of current sentence (`kill-sentence').
960
961 `M-z CHAR'
962      Kill up to next occurrence of CHAR (`zap-to-char'). To use this
963      command type `M-z'. You will see the following statement in the
964      echo area :
965
966           Zap to char:
967
968      Type any char and press the <RET> key. For example, if you type
969      `p' then the entire text starting from the position of the cursor
970      until the first occurrence of `p' is killed.
971
972 \1f
973 File: new-users-guide.info,  Node: Numeric Argument,  Next: Undo,  Prev: Erase,  Up: Edit
974
975 Giving Numeric Arguments
976 ========================
977
978    Any Emacs command can be given a "numeric argument".  Some commands
979 interpret the argument as a repetition count.  For example, if you want
980 to move forward ten characters, you could type `C-f' ten times.
981 However, a more efficient way to do this would be to give an argument
982 of ten to the key `C-f' (the command `forward-char', move forward one
983 character). Negative arguments are also allowed. Often they tell a
984 command to move or act backwards. For example, if you want to move down
985 ten lines, type the following:
986      C-u 10 C-n RET
987
988 After you press <RET> key, the cursor will move ten lines downward. You
989 can also type:
990      M-10 C-n RET
991
992 Both `C-u' and `M-' allow you to give numeric arguments. If you want to
993 move ten lines backward, you can also give negative arguments, like:
994      C-u -10 C-n RET
995
996 OR you could also type:
997      M--10 C-n RET
998
999 You can obviously use `C-b' to move backward rather than giving
1000 negative arguments to `C-n'. *Note Numeric Arguments: (xemacs)Numeric
1001 Arguments, for more information on numeric arguments.
1002
1003 \1f
1004 File: new-users-guide.info,  Node: Undo,  Prev: Numeric Argument,  Up: Edit
1005
1006 Undoing Changes
1007 ===============
1008
1009    When you are editing a buffer, you might type something by mistake.
1010 Emacs allows you to undo all changes you make to a buffer (but not more
1011 than 8000 characters). Each buffer in Emacs keeps a record of the
1012 changes made to it individually, so the undo command applies to the
1013 current buffer. There are two undo commands:
1014
1015 `C-x u'
1016      Undo one batch of changes (usually, one command's worth).
1017      (`undo').
1018
1019 `C-_'
1020      The same as above, but this command might not be obvious to type
1021      on some keyboards so it might be better to use the above command.
1022
1023    *Note Undoing Changes: (xemacs)Undoing Changes, for more information
1024 on undoing changes.
1025
1026 \1f
1027 File: new-users-guide.info,  Node: Customization Basics,  Next: Help,  Prev: Edit,  Up: Top
1028
1029 Customize key bindings and menus
1030 ********************************
1031
1032    When you start Emacs, it reads the file `~/.emacs' in your home
1033 directory. You can use this file to initialize and customize Emacs to
1034 your liking. This file should contain lisp-code. You can customize your
1035 `.emacs' file to create new menus, disable menus, change key bindings,
1036 enable a minor mode, etc. Any kind of customization affects only a
1037 particular Emacs job that you do them in. If you want to save your
1038 customizations `permanently' i.e. for future use also, you have to put
1039 it in your `.emacs' file. After you make changes to your `.emacs' file
1040 and save it, the changes will be effective only after you start Emacs
1041 again i.e. for a new Emacs process. To try out some of the examples in
1042 this section, highlight that region and evaluate the region by giving
1043 the command `M-x eval-region'. You will be able to see the results of
1044 your customizations in that Emacs session only (*note Lisp Eval:
1045 (xemacs)Lisp Eval.).
1046
1047 * Menu:
1048
1049 * Customizing key Bindings::    Changing Key Bindings
1050 * Customizing Menus::           Adding, Deleting, Enabling and Disabling Menus
1051
1052 \1f
1053 File: new-users-guide.info,  Node: Customizing key Bindings,  Next: Customizing Menus,  Prev: Customization Basics,  Up: Customization Basics
1054
1055 Customize key bindings
1056 ======================
1057
1058    Most of Emacs commands use key sequences. *Note Keystrokes:
1059 (xemacs)Keystrokes, for more information about Keys and Commands. In
1060 Emacs, the keys themselves carry no meaning unless they are bound to a
1061 function. For example, `C-n' moves the cursor to the next line because
1062 its bound to the function next-line. Similarly, `C-p' moves to the
1063 previous line because its bound to the function previous-line. The
1064 functions themselves define a particular behavior. You can customize
1065 the key `C-n' to move to the previous line by binding it to
1066 previous-line and `C-p' to move to the next line by binding it to
1067 next-line. To bind keys to globally run commands you need to use the
1068 following syntax in your .emacs file:
1069
1070      `(global-set-key KEYS CMD)'
1071
1072 Here, `global-set-key' is a function which will bind the "keys" to the
1073 specified "cmd". For example, if you type the following in your .emacs
1074 file:
1075
1076      (global-set-key "\C-p" 'next-line)
1077      (global-set-key "\C-n" 'previous-line)
1078
1079 then `C-p' will move to the next line and `C-n' to the previous line.
1080
1081    You can also disable a key binding, by using `nil' as the CMD in the
1082 syntax stated above. Here, `nil' stands for `false' which means disable
1083 a command or turn off a feature. If you want to enable a command or
1084 turn on a particular feature use `t' which stands for `true'.  For
1085 example, if you do not wish `C-x C-c' to `Exit Emacs' you can type the
1086 following expression in your `.emacs' file:
1087
1088      (global-set-key "\C-x\C-c" nil)
1089
1090 You might want to have this statement in your `.emacs' file because its
1091 easy to hit this command by mistake and it could be annoying to exit
1092 Emacs unintentionally. There is a Exit Emacs option in the File menu
1093 which you might want to use instead. To make a particular key undefined
1094 you can also use:
1095
1096      (global-unset-key "\C-x\C-c")
1097
1098 Now if you use the command `C-x C-c', you will get an error saying that
1099 the command is undefined.
1100
1101    Some other customizations you could try are:
1102    *      (global-set-key 'button3 'beginning-of-buffer)
1103
1104      Now when you press the third button of your mouse, the cursor will
1105      be placed at the `beginning-of-buffer'.
1106
1107    *      (global-set-key 'f1 'goto-line)
1108
1109      If you press the <F1> key, you will be prompted for a line number.
1110      After you type the line number and hit <RET>, the cursor will be
1111      placed on that line number.
1112
1113    *      (global-set-key 'f2 'undo)
1114
1115      Pressing <F2> will undo the last command. If you have a <undo> key
1116      on your keyboard, try binding that key to the undo command.
1117
1118    Another syntax for customizing key bindings is: `(define-key KEYMAP
1119 KEYS DEF)' It defines KEYS to run DEF in the keymap KEYMAP.
1120
1121    KEYMAP is a keymap object which records the bindings of keys to the
1122 commands that they run.
1123
1124    KEYS is the sequence of keystrokes to bind.
1125
1126    DEF is anything that can be a key's definition:
1127
1128    Look at the following two examples:
1129
1130      (define-key global-map "\C-xl" 'make-symbolic-link)
1131      (define-key c-mode-map "\C-xl" 'make-symbolic-link)
1132
1133 Both the examples bind the key `C-xl' to run the function
1134 `make-symbolic-link' (*note Misc File Ops: (xemacs)Misc File Ops.).
1135 However, the second example will bind the key only for C mode. *Note
1136 Major Modes: (xemacs)Major Modes, for more information on Major Modes
1137 in XEmacs.
1138
1139 \1f
1140 File: new-users-guide.info,  Node: Customizing Menus,  Prev: Customizing key Bindings,  Up: Customization Basics
1141
1142 Customizing Menus
1143 =================
1144
1145    You can customize any of the  XEmacs Pull-down-Menus. You can create
1146 your own menu, delete an existing one, enable a menu or disable a menu.
1147 For more information on the default menus available to you, *Note
1148 Pull-down Menus::.
1149
1150    Some of the functions which are available to you for customization
1151 are:
1152   1. add-menu-item: (MENU-NAME ITEM-NAME FUNCTION ENABLED-P &OPTIONAL
1153      BEFORE)
1154
1155      This function will add a menu item to a menu, creating the menu
1156      first if necessary. If the named item already exists, the menu
1157      will remain unchanged. For example, if you add the following
1158      example to your `.emacs' file or evaluate it (*note Customization
1159      Basics::.),
1160
1161           (add-menu-item '("Edit") "Replace String" replace-string t "Clear")
1162
1163      a sub-menu Replace String will be created under Edit menu before
1164      the sub-menu Clear. The Edit menu will now look like:
1165
1166           Undo                    C-x u
1167           Cut                     cut
1168           Copy                    copy
1169           Paste                   paste
1170           Replace String
1171           Clear
1172           Start Macro Recording   C-x(
1173           End Macro Recording     C-x)
1174           Execute Last Macro      C-xe
1175
1176      Replace String will now execute the function `replace-string'.
1177      Select this menu item. Emacs will prompt you for a string name to
1178      be replaced. Type a string and hit <RET>. Now type a new string to
1179      replace the old string and hit <RET>. All occurrences of the old
1180      string will be replaced by the new string. In this example,
1181
1182      `Edit' is the MENU-NAME which identifies the menu into which the
1183      new menu item should be inserted.
1184
1185      `Replace String' is the ITEM-NAME which names the menu item to be
1186      added.
1187
1188      `replace-string' is the FUNCTION i.e. the command to be invoked
1189      when the menu item "Replace String" is selected.
1190
1191      `t' is the ENABLED-P parameter which controls whether the menu
1192      item is selectable or not. This parameter can be either `t'
1193      (selectable), `nil' (not selectable), or a form to evaluate. This
1194      form is evaluated just before the menu is displayed, and the menu
1195      item will be selectable if the form returns non-`nil'.
1196
1197      `Clear' is the &OPTIONAL BEFORE parameter which is the name of the
1198      menu before which the new menu or sub-menu should be added. The
1199      &OPTIONAL string means that this parameter is optional. You do not
1200      need to specify this parameter. If you do not specify this
1201      parameter in the example above, the Replace String menu item will
1202      be added at the end of the list of sub-menus in the Edit menu i.e.
1203      after Execute Last Macro.
1204
1205      If you wish to add a new menu to the menubar, try:
1206
1207           (add-menu-item nil "Bot" 'end-of-buffer t)
1208
1209      This will create a new menu Bot on the menu bar. Selecting this
1210      menu will take you to the end of the buffer. Using `nil' for the
1211      parameter MENU-NAME will create a new menu. Your menu-bar will now
1212      look like:
1213
1214           File Edit Options Buffers Bot                         Help
1215
1216      The following example will illustrate how you can add sub-menus to
1217      the submenus themselves:
1218
1219           (add-menu-item '("File" "Management") "Copy File" 'copy-file t)
1220           (add-menu-item '("File" "Management") "Delete File" 'delete-file t)
1221           (add-menu-item '("File" "Management") "Rename File" 'rename-file t)
1222
1223      This will create a sub-menu Management under the File menu. When
1224      you select the submenu Management, it will contain three submenus:
1225      Copy File, Delete File and Rename File.
1226
1227   2. delete-menu-item: (MENU-PATH) This function will remove the menu
1228      item defined by MENU-NAME from the menu hierarchy. Look at the
1229      following examples and the comments just above them which specify
1230      what the examples do.
1231
1232           ;; deletes the "Replace String" menu item created earlier
1233           (delete-menu-item '("Edit" "Replace String"))
1234           
1235           ;; deletes the "Bot" menu created earlier
1236           (delete-menu-item '("Bot"))
1237           
1238           ;; deletes the sub-menu "Copy File" created earlier
1239           (delete-menu-item '("File" "File Management" "Copy File"))
1240           
1241           ;; deletes the sub-menu "Delete File" created earlier
1242           (delete-menu-item '("File" "Management" "Delete File"))
1243           
1244           ;; deletes the sub-menu "Rename File" created earlier
1245           (delete-menu-item '("File" "Management" "Rename File"))
1246
1247   3. disable-menu-item: (MENU-NAME) Disables the specified menu item.
1248      The following example
1249
1250           (disable-menu-item '("File" "Management" "Copy File"))
1251
1252      will make the Copy File item unselectable. This menu-item would
1253      still be there but it will appear faded which would mean that it
1254      cannot be selected.
1255
1256   4. enable-menu-item: (MENU-NAME) Enables the specified previously
1257      disabled menu item.
1258
1259           (enable-menu-item '("File" "Management" "Copy File"))
1260
1261      This will enable the sub-menu Copy File, which was disabled by the
1262      earlier command.
1263
1264   5. relabel-menu-item: (MENU-NAME NEW-NAME) Change the string of the
1265      menu item specified by MENU-NAME to NEW-NAME.
1266
1267           (relabel-menu-item '("File" "Open...") "Open File")
1268
1269      This example will rename the Open... menu item from the File menu
1270      to Open File.
1271
1272