1 This is ../info/new-users-guide.info, produced by makeinfo version 4.0
2 from new-users-guide/new-users-guide.texi.
4 INFO-DIR-SECTION XEmacs Editor
6 * Intro: (new-users-guide). Introduction to the XEmacs Editor.
9 This manual serves as an introduction to the XEmacs editor.
11 Copyright (C) 1985, 1986, 1988 Richard M. Stallman. Copyright (C)
12 1991, 1992, 1993, 1994 Lucid, Inc. Copyright (C) 1993, 1994 Sun
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.
20 File: new-users-guide.info, Node: Top, Next: Intro, Prev: (dir), Up: (dir)
25 Emacs is the extensible, customizable, self-documenting real-time
26 display editor. This Info file will help you get started on using
27 XEmacs. It corresponds to XEmacs version 19.13.
31 * Intro:: Introduction to XEmacs editor
33 Indices, nodes containing large menus
34 * Key Index:: An item for each standard Emacs key sequence.
35 * Command Index:: An item for each command and function name
36 * Variable Index:: An item for each variable in User-Guide
37 * Concept Index:: An item for the concepts introduced
39 Entering, Exiting and Editing Emacs
40 * Entering:: Starting Emacs from the shell and Exiting
41 * Windows and Menus:: Description of Pull-down menus
42 * Edit:: Basic Editing commands
44 Other Features of XEmacs
45 * Customization Basics:: Customize Emacs menus and keybindings
46 * Help:: Help menu and other help commands
47 * Modes:: Major and Minor modes in XEmacs
48 * Files:: Visiting, Saving and Listing Files
49 * Other Customizations:: Customizing Variables, Modes, etc
50 * Select and Move:: Selecting text and moving text
51 * Search and Replace:: Searching and Replacing text
55 --- The Detailed Node Listing ---
57 Entering and Exiting Emacs
59 * Enter:: Entering Emacs from the shell
60 * Frame:: Basic information about the XEmacs Frame
61 * Exiting:: Exiting Emacs
62 * Mode Line:: Interpreting the mode line.
63 * Echo Area:: Bottom of the frame where you interact
66 XEmacs Windows and Menus
68 * XEmacs Window:: Manipulating XEmacs Windows
69 * Pull-down Menus:: Description of XEmacs Pull-down Menus
73 * File menu:: Items on the File Menu
74 * Edit menu:: Items on the Edit Menu
75 * Options Menu:: Items on the Options Menu
76 * Buffers Menu:: Items on the Buffers Menu
77 * Help menu:: The Help Menu at the extreme right on
80 Basic Editing Commands
82 * Insert:: Insert text in Emacs by simply typing at
84 * Cursor Position:: Moving Around the cursor in the buffer,
85 * Erase:: Different commands for erasing text
86 * Numeric Argument:: Giving Numeric Arguments to commands
87 * Undo:: Undoing Changes made by mistake
89 Customize key bindings and menus
91 * Customizing key Bindings:: Changing Key Bindings
92 * Customizing Menus:: Adding, Deleting, Enabling and Disabling Menus
96 * The Help Menu:: Items on the Help Menu
100 * Major Modes:: Choosing Major Modes
101 * Minor Modes:: Auto-Fill, Abbrev and other minor modes
105 * File Names:: How to type and edit file name arguments.
106 * Visiting:: Visiting a file prepares Emacs to edit the file.
107 * Saving Files:: How to save Emacs files.
111 * Setting Variables:: Customizing Emacs variables
112 * Init File:: Some examples of Lisp expressions in
115 Selecting and Moving Text
117 * Selecting Text:: Select a region of text by setting the Mark
118 * Mouse:: Selecting Text with Mouse
119 * Region Operation:: Various ways to operate on a selected text
120 * Moving Text:: Moving Text
121 * Accumulating text:: Accumulating Text from several buffers
123 No sub menu for the node search and replace
126 File: new-users-guide.info, Node: Intro, Next: Key Index, Prev: Top, Up: Top
131 You are reading about XEmacs which is a self-documenting,
132 customizable, extensible real-time display editor.
134 XEmacs is a "display" editor because normally the text being edited
135 is visible on the screen and is updated automatically as you type.
136 *Note Display: (xemacs)Frame.
138 It is a "real-time" editor because the display is updated very
139 frequently, usually after each character or pair of characters you type.
140 This minimizes the amount of information you must keep in your head as
141 you edit. *Note Real-time: (xemacs)Basic.
143 It is advanced because it provides facilities that go beyond simple
144 insertion and deletion: filling of text; automatic indentation of
145 programs; viewing two or more files at once; and dealing in terms of
146 characters, words, lines, sentences, paragraphs, and pages, as well as
147 expressions and comments in several different programming languages.
148 It is much easier to type one command meaning "go to the end of the
149 paragraph" than to find that spot with simple cursor keys.
151 "Self-documenting" means that at any time you can type a special
152 character, `Control-h', to find out what your options are. You can
153 also use `C-h' to find out what a command does, or to find all the
154 commands relevant to a topic. *Note Help: (xemacs)Help.
156 "Customizable" means you can change the definitions of Emacs
157 commands. For example, if you use a programming language in which
158 comments start with `<**' and end with `**>', you can tell the Emacs
159 comment manipulation commands to use those strings (*note Comments:
160 (xemacs)Comments.). Another sort of customization is rearrangement of
161 the command set. For example, you can set up the four basic cursor
162 motion commands (up, down, left and right) on keys in a diamond pattern
163 on the keyboard if you prefer. *Note Customization:
164 (xemacs)Customization.
166 "Extensible" means you can go beyond simple customization and write
167 entirely new commands, programs in the Lisp language to be run by
168 Emacs's own Lisp interpreter. Emacs is an "on-line extensible" system:
169 it is divided into many functions that call each other. You can
170 redefine any function in the middle of an editing session and replace
171 any part of Emacs without making a separate copy of all of Emacs. Most
172 of the editing commands of Emacs are written in Lisp; the few
173 exceptions could have been written in Lisp but are written in C for
174 efficiency. Only a programmer can write an extension to Emacs, but
175 anybody can use it afterward.
178 File: new-users-guide.info, Node: Entering, Next: Windows and Menus, Prev: Concept Index, Up: Top
180 Entering and Exiting Emacs
181 **************************
183 While using Emacs you should be familiar with the following three
187 A buffer is a region of memory holding characters. It is the basic
188 editing unit; one buffer corresponds to one piece of text being
189 edited. You can have multiple buffers but you can edit only one
190 buffer at any one time. For more information, *Note Buffers:
194 A file is a region of disk space holding characters. Emacs edits a
195 file by reading it into a buffer, editing that buffer and writing
196 out the buffer back to the file. To save your work permanently you
197 have to write it to a file. So after you load and work with a
198 file, you have to save it back.
201 A window is a rectangular region in which a buffer is displayed.
202 You can open multiple windows with multiple buffers and edit them
203 by selecting the corresponding buffer. Initially, when you start
204 emacs, it will automatically open up a window for you.
208 * Enter:: Entering Emacs from the shell
209 * Frame:: Basic information about the XEmacs Frame
210 * Exiting:: Exiting Emacs
211 * Mode Line:: Interpreting the mode line.
212 * Echo Area:: Bottom of the frame where you interact
216 File: new-users-guide.info, Node: Enter, Next: Frame, Prev: Entering, Up: Entering
221 To enter Emacs type `xemacs' and press the Return key at the shell
222 i.e. `xemacs <RET>'. This will bring up an emacs window with
223 `*scratch*' as the default buffer because Emacs must always have a
224 buffer to work on. Then choose the Open... option from the File menu on
225 the menubar at the top of the frame. It will prompt you to enter a
226 filename. After you enter the filename, Emacs will read that file into
227 the current buffer. You can also type :
228 xemacs <filename> <RET>
229 directly which will bring up an Emacs frame with the "filename" as
233 File: new-users-guide.info, Node: Frame, Next: Exiting, Prev: Enter, Up: Entering
238 When you run XEmacs under X, a menu bar on top of the Emacs frame
239 provides access to pull-down menus of file, edit, and help-related
240 commands. The menus only provide convenient shortcuts, the options that
241 they provide are available via key commands. You can invoke those
242 commands from the keyboard also. For many of the options, their
243 corresponding key commands are displayed right besides them. The five
244 default menus on the menubar that you will see on the frame are File,
245 Edit, Options, Buffers and Help. *Note XEmacs Pull-down Menus:
246 (xemacs)XEmacs Pull-down Menus, for detailed information on the
247 functions provided by the pull-down menus.
249 The Emacs frame has a rectangle shaped box at the extreme right and
250 you can drag it up or down to scroll the window accordingly. Clicking
251 on the arrows also serves the same purpose.
253 The last line in your window is `the Mode line' which will give you
254 a description of what's going on in that particular window. *Note Mode
255 Line::, for more information. Below the mode line is the `Echo area'.
256 Emacs uses this area to interact with the user. *Note Echo Area::.
258 If you wish to open another file in a new window after you enter
259 XEmacs, select Open in New Frame... from the File menu, which will
260 prompt you for a filename and open a new window with that filename as
261 the current buffer. If you want to open a new file in the same window,
262 select Open.. from the File menu. You need to enter XEmacs only once,
263 you can edit multiple files by opening several other frames or by
264 switching between buffers.
267 File: new-users-guide.info, Node: Exiting, Next: Mode Line, Prev: Frame, Up: Entering
272 There are two commands for exiting Emacs, one for "suspending" Emacs
273 and the other for "killing" Emacs. "Suspending" means stopping Emacs
274 temporarily and returning control to the shell, allowing you to resume
275 editing later in the same Emacs job, with the same files, same kill
276 ring, same undo history, and so on. This is the usual way to exit.
277 "Killing" Emacs means destroying the Emacs job. You can run Emacs
278 again later, but you will get a fresh Emacs; there is no way to resume
279 the same editing session after it has been killed.
282 Suspend Emacs (`suspend-emacs'). If used under the X window
283 system, this command will shrink the X window containing the Emacs
284 frame to an icon. Clicking on the icon will resume that Emacs
285 process again. *Note Exiting Emacs: (xemacs)Exiting Emacs.
288 Kill Emacs (`save-buffers-kill-emacs'). You can also select Exit
289 Emacs option from the File menu to kill that Emacs process. If you
290 haven't saved the file, Emacs will ask you if you wish to save the
291 file before killing that process.
294 File: new-users-guide.info, Node: Mode Line, Next: Echo Area, Prev: Exiting, Up: Entering
299 When you enter XEmacs, each text window's last line is a "mode line"
300 which describes what is going on in that window. Normally, the mode
303 --CH-XEmacs: BUF (MAJOR MINOR)----POS------
305 This gives information about the buffer being displayed in the window:
306 the buffer's name, what major and minor modes are in use, whether the
307 buffer's text has been changed, and how far down the buffer you are
312 if the text in the buffer has been edited
315 if the text in the buffer has not been edited
318 if the buffer is a read-only-buffer i.e. it cannot be edited
320 BUF is the name of the window's chosen "buffer". If you are editing
321 a file (which is the selected buffer), the file name appears in BUF.
322 *Note Buffers: (xemacs)Buffers.
326 if your entire file is visible on the screen.
329 if you are looking at the beginning of the file.
332 if you are looking at the end of the file.
335 NN will be a number corresponding to the percentage of the file
336 above the top of the screen, for example `52', which means that 52%
337 of the file is above the top of the screen.
339 MAJOR is the name of the "major mode" in effect in the buffer. At
340 any time, each buffer is in one and only one major mode. The available
341 major modes include Fundamental mode (the least specialized), Text
342 mode, Lisp mode, and C mode. *Note Major Modes: (xemacs)Major Modes,
343 for details on how the modes differ and how you select one.
345 MINOR is a list of some of the "minor modes" that are turned on in
346 the window's chosen buffer. For example, `Fill' means that Auto Fill
347 mode is on which means that lines are broken automatically when they
348 become too wide. *Note Minor Modes: (xemacs)Minor Modes, for more
349 information on various minor modes and how to enable them.
351 You can also display time in the mode line. *Note The Mode Line:
352 (xemacs)The Mode Line, for more information regarding the mode line.
355 File: new-users-guide.info, Node: Echo Area, Prev: Mode Line, Up: Entering
360 The line at the bottom of the frame (below the mode line) is the
361 "echo area". Emacs uses this area to communicate with you:
363 * The "echo area" will print out the characters that you type. For
364 example, if you choose the Open... option from the File menu you
365 might get the following in the echo area:
367 Find file: /usr/lib/x11/
369 Now you need to give a file name to open, for example if the file
370 name is `myfile', you will type `myfile' after `/usr/lib/x11/' and
371 press the <Return> key. If you pause for more than a second while
372 typing, you will see the characters that you type in the "echo
375 * The "echo area" also prints error messages. For example, if you
376 misspell `usr' and type `/urs/lib/x11/myfile' <RETURN> in the
377 above example you might get an error message. Since Emacs will not
378 be able to find the `/urs' directory, the "echo area" will say:
380 error--> Opening directory: no such file or directory, /urs/lib/x11/myfile
382 This error message will be accompanied by a beep. Some XEmacs
383 commands will print informative messages in the "echo area". *Note
384 The Echo Area: (xemacs)The Echo Area, for more information on the
388 File: new-users-guide.info, Node: Windows and Menus, Next: Edit, Prev: Entering, Up: Top
390 XEmacs Windows and Menus
391 ************************
393 The first section of this chapter will show you how you can
394 manipulate XEmacs Windows and the other section will explain the
395 Pull-down Menus of an XEmacs window.
399 * XEmacs Window:: Manipulating XEmacs Windows
400 * Pull-down Menus:: Description of XEmacs Pull-down Menus
403 File: new-users-guide.info, Node: XEmacs Window, Next: Pull-down Menus, Prev: Windows and Menus, Up: Windows and Menus
408 When you use XEmacs under X, you can open multiple windows and each
409 window can display one buffer or multiple parts of one buffer. Each
410 window will have its own "mode line" and "echo area". At any one time
411 there is only one "selected window" and the buffer it displays is the
412 "selected buffer". There are some commands for manipulating windows:
415 This command will scroll the window which is not "selected"
416 (`scroll-other-window').
419 This command will get rid of the selected window (`delete-window').
420 That is a zero. If there is more than one Emacs frame, deleting the
421 sole remaining window on that frame deletes the frame as well. If
422 the current frame is the only frame, it is not deleted.
425 This command will get rid of all the windows except the selected
426 one. (`delete-other-windows'). For example, if you use the
427 Describe variable option from the Help menu, the window will split
428 vertically and the bottom window will contain documentation for
429 that variable. After you are done looking at that variable's
430 documentation you might want to come back to your original single
431 window. Just type `C-x 1' after your cursor is in the top window
432 (the window which you want to keep) and hit <RET>.
435 This command will split the selected window into two windows, one
436 above the other (`split-window-vertically'). Both the windows will
437 start out by displaying the same buffer. The window in which you
438 have your cursor will be your "selected window".
441 This will split the selected window into two windows positioned
442 side by side (`split-window-horizontally'). A line of vertical
443 bars will separate the window.
445 You can select a buffer in another window by using some other commands.
446 These commands all have a prefix key `C-x 4'
447 `C-x 4 b BUFNAME <RET>'
448 This command will select a buffer BUFNAME in another window. This
449 runs `switch-to-buffer-other-window'. It will prompt you for a
452 `C-x 4 f FILENAME <RET>'
453 Visit file FILENAME and select its buffer in another window. This
454 runs `find-file-other-window'. *Note Visiting: (xemacs)Visiting.
455 It will prompt you for a filename.
457 `C-x 4 d DIRECTORY <RET>'
458 Select a Dired buffer for directory DIRECTORY in another window.
459 This runs `dired-other-window'. *Note Dired: (xemacs)Dired.
462 Start composing a mail message in another window. This runs
463 `mail-other-window', and its same-window version is `C-x m'.
464 *Note Sending Mail: (xemacs)Sending Mail, for information on how
465 to Send Mail using XEmacs. *Note Reading Mail With Rmail:
466 (xemacs)Reading Mail With Rmail, for information on reading mail
469 If you click the right button on the mouse on a mode line, you will
470 get a menu with following options:
472 Choosing this menu will remove the window above this modeline from
476 Delete all windows on the frame except for the one above this
480 Split the window above the mode line in half, creating another
483 Split Window Horizontally
484 Split the window above the mode line in half horizontally, so that
485 there will be two windows side-by-side.
488 Readjust the sizes of all windows on the frame until all windows
489 have roughly the same number of lines.
492 File: new-users-guide.info, Node: Pull-down Menus, Prev: XEmacs Window, Up: Windows and Menus
494 XEmacs Pull-down Menus
495 ======================
497 When you run XEmacs under X, each Emacs frame has a menu-bar at the
498 top which provides commands for editing, help and other options. All
499 these options are also available via key commands, the menus just
500 provide convenient short-cuts. The key commands are displayed right
501 besides some of the options. The following is a brief description of
502 the four default menus on the menu bar:
506 * File menu:: Items on the File menu
507 * Edit menu:: Items on the Edit menu
508 * Options Menu:: Items on the Options Menu
509 * Buffers Menu:: Items on the Buffers Menu
510 * Help menu:: The Help Menu at the extreme right on
514 File: new-users-guide.info, Node: File menu, Next: Edit menu, Prev: Pull-down Menus, Up: Pull-down Menus
519 The File menu bar contains the following items. To choose a
520 particular option, press the left mouse button and drag it to the item
521 you wish to select. Then release the button.
524 This option will prompt you for a file name. You will get a
525 message in the echo area:
529 After Find File, there might be a directory path also. After you
530 type the file name and press <RET> the file will be loaded into a
534 It prompts you for a file name and loads that file in a new buffer
535 in a new frame. You can open many frames for the same Emacs
536 session. You can delete the frame by selecting Delete Frame.
539 Prompts you for a filename and inserts the contents of this
540 filename in your current buffer. Position your cursor at the place
541 you wish to insert the file and select this option. You will get
542 the following message in the echo area:
546 Insert the file name and press <RET>.
549 It saves the changes you have made to the buffer. If you have made
550 changes which are not saved yet, the option will appear dark,
551 otherwise it will be light and unselectable. If you do not wish to
552 save the changes, select Revert Buffer.
555 Prompts you for a filename and saves the current buffer in that
556 file. It loads the new file if the filename you specify is
557 different from the one you were working with.
559 Print Buffer <buffername>
560 Prints a hardcopy of the current or "selected" buffer.
563 Opens a new frame with *scratch* as the default buffer. It doesn't
564 prompt you for a filename. To open a file you need to go to that
565 frame and select Open...
568 Splits the current window into two equal-sized windows with the
569 same buffer. To get back a single frame, select Un-Split (Keep
570 This). *Note XEmacs Window::, for more information about windows.
573 If the frame contains multiple windows, it will remove all windows
574 except the selected one.
576 Un-Split (Keep Others)
577 If the frame contains multiple windows, it will remove the selected
578 window and keep the other one.
580 Revert Buffer <buffername>
581 If you do not wish to save the changes you made to the file since
582 you opened it, select this option. It will restore the last saved
583 version of the file to the current buffer.
585 Kill Buffer <buffername>
586 It will kill the current buffer. If will prompt you if there are
590 It will kill the Emacs "process" as opposed to simply killing the
591 "buffer". Before it kills the process, it will prompt you as to
592 which unsaved buffers you wish to save by going through the list
597 * Edit menu:: Items on the Edit Menu
598 * Options Menu:: Items on the Options Menu
599 * Buffers Menu:: Items on the Buffers Menu
600 * Help menu:: The Help Menu at the extreme right on
604 File: new-users-guide.info, Node: Edit menu, Next: Options Menu, Prev: File menu, Up: Pull-down Menus
609 Most of the commands in this menu work on a block of text or a
610 selected region. The text will be highlighted as you select it.
612 Undoes the previous command. If you type something by mistake you
613 can use this command. For example, if you select Insert File...
614 from the File menu and insert a wrong file by mistake, you can
615 select this item and it will remove the inserted file. It undoes a
616 batch of text which is worth an emacs command.
619 Removes the selected text block from the current buffer, makes it
620 the X clipboard selection, and places it in the kill ring (*note
621 Moving Text::). Before executing this command, you have to select
622 a region using Emacs region selection commands or with the mouse.
623 *Note Selecting Text::.
626 Makes a selected text block the X clipboard selection, and places
627 it in the kill ring. You can select text using one of the Emacs
628 region selection commands or by selecting a text region with the
629 mouse. *Note Selecting Text::, for more information.
632 Inserts the current value of the X clipboard selection in the
633 current buffer. Note that this is not necessarily the same as the
634 Emacs `yank' command, because the Emacs kill ring and the X
635 clipboard selection are not the same thing. You can paste in text
636 you have placed in the clipboard using Copy or Cut. You can also
637 use Paste to insert text that was pasted into the clipboard from
638 other applications. *Note X Clipboard Selection: (xemacs)X
639 Clipboard Selection, for information on using Clipboard Selection.
642 Removes the selected text block from the current buffer but does
643 not place it in the kill ring or the X clipboard selection. You
644 will not be able to get this text back.
646 Start Macro Recording
647 After selecting this, Emacs will remember every keystroke you type
648 until End Macro Recording is selected.
651 Selecting this tells emacs to stop remembering your keystrokes.
654 Selecting this item will cause emacs to re-interpret all of the
655 keystrokes which were saved between selections of the Start Macro
656 Recording and End Macro Recording menu items. You can now execute
657 the most recent keyboard macro. *Note Keyboard Macros:
658 (xemacs)Keyboard Macros, for further information.
661 File: new-users-guide.info, Node: Options Menu, Next: Buffers Menu, Prev: Edit menu, Up: Pull-down Menus
666 There are sub-menus for some of the menus which you will need to
667 select. If sub-menus exist for an item, they will be displayed
668 automatically when you drag the mouse on that item. The items in this
669 menu provide some fancy editing operations.
672 Selecting this item will cause the buffer to visit the file in a
673 read-only mode. Changes to the file will not be allowed.
675 Case Sensitive Search
676 Selecting this item will cause searches to be case-sensitive. If
677 its not selected then searches will ignore case. This option is
678 local to the buffer. For example, if this item is selected and you
679 are searching for `Smile', then an occurrence of `smile' will not
680 be recognized because of the smaller case of `s'.
683 After selecting this item, when you type letters they will replace
684 existing text on a one-to-one basis, rather than pushing it to the
685 right. At the end of a line, such characters extend the line.
686 Before a tab, such characters insert until the tab is filled in.
688 Auto Delete Selection
689 Selecting this item will cause automatic deletion of the selected
690 region. After you select a region and hit the <RET> key, the
691 selected text will be deleted. The typed text will replace the
692 selection if the selection is active (i.e. if its highlighted). If
693 the option is not selected then the typed text is just inserted at
696 Teach Extended Commands
697 After you select this item, any time you execute a command with
698 `M-x' which has a shorter keybinding, you will be shown the
699 alternate binding before the command executes. For example if you
700 type `M-x find-file-other-window' which performs the same function
701 as the Open in Other Window... in File menu you will see the
704 M-x find-file-other-window (bound to keys: C-x 4 f, C-x 4 C-f)
707 You can customize your `.emacs' file to include the font-lock mode
708 so that when you select this item, the comments will be displayed
709 in one face, strings in another, reserved words in another, and so
710 on. *Note Customization: (xemacs)Customization, for more
711 information on customizing `.emacs' file. After selecting this
712 item, you will find your code a lot easier to read. When Fonts is
713 selected, different parts of the program will appear in different
714 Fonts. When Colors is selected, then the program will be displayed
715 in different colors. Selecting None causes the program to appear in
716 just one Font and Color. Selecting Less resets the Fonts and Colors
717 to a fast, minimal set of decorations. Selecting More resets the
718 Fonts and Colors to a larger set of decorations. For example, if
719 Less is selected (which is the default setting) then you might have
720 all comments in green color. It does not matter what the comments
721 contain. Whereas, if More is selected then a function name in the
722 comments themselves might appear in a different Color or Font. Even
723 though the comments themselves might appear in green color, a
724 function name "within" the comments might appear in red color.
727 After selecting Blink from this item, if you place the cursor on a
728 parenthesis, the matching parenthesis will blink. If you select
729 Highlight and place the cursor on a parenthesis, the whole
730 expression of the parenthesis under the cursor will be highlighted.
731 Selecting None will turn off the options (regarding Paren
732 Highlighting) which you had selected earlier.
735 You can select any Font for your program by choosing from one of
736 the available Fonts. The whole buffer will be converted to the
740 You can select any size for the text in your buffer (ranging from
741 2 to 24) by selecting the appropriate option.
744 You can choose either Bold or Medium for the weight of the text of
747 Buffers Menu Length...
748 Prompts you for the number of buffers to display. Then it will
749 display that number of most recently selected buffers.
752 After selection of this item the Buffers menu will contain several
753 commands, as submenus of each buffer line. If this item is
754 unselected, then there are no submenus for each buffer line, the
755 only command available will be selecting that buffer.
758 Selecting this item will save the current settings of your Options
759 menu to your `.emacs' file so that the next time you start XEmacs,
760 you won't need to select the options again.
763 File: new-users-guide.info, Node: Buffers Menu, Next: Help menu, Prev: Options Menu, Up: Pull-down Menus
768 The Buffers menu provides a selection of up to ten buffers and the
769 item List All Buffers, which provides a Buffer List. If you select
770 Buffers Sub-menus from the Options menu, you will get some sub-menus
771 for each of the buffer listing.
774 File: new-users-guide.info, Node: Help menu, Prev: Buffers Menu, Up: Pull-down Menus
779 The Help Menu gives you access to Emacs Info and provides a menu
780 equivalent for some of the choices you have when using `C-h'. *Note
781 Help::, for more information.
783 The Describe variable and Describe function will provide
784 documentation for the corresponding variable or function. The Help menu
785 also gives access to UNIX online manual pages via the UNIX Manual...
789 File: new-users-guide.info, Node: Edit, Next: Customization Basics, Prev: Windows and Menus, Up: Top
791 Basic Editing Commands
792 **********************
794 This chapter will introduce you to some basic editing commands. You
795 can also learn the basic editing commands by typing `Control-h t'
796 (`help-with-tutorial' OR by selecting Emacs Tutorial from the Help menu
797 on the menu bar. Most of the Emacs commands will use the <CONTROL> key
798 or the <META> key. The following abbreviations will be used for the
799 <CONTROL> and <META> key in this manual:
802 This means that you should hold down the <CONTROL> key while typing
803 `<chr>'. For example, if the command is `C-g', you should hold the
804 <CONTROL> key and type <g>.
807 This means that you should hold down the `META' key while typing
808 `<chr>'. If there is no `META' key on your keyboard, use the `ESC'
809 key instead. For example, if the command is `M-x', then type
810 `ESC', release it and type `x'.
812 The following abbreviations will be used for some other keys:
834 * Insert:: Insert text in Emacs by simply typing at
836 * Cursor Position:: Moving Around the cursor in the buffer,
837 * Erase:: Different commands for erasing text
838 * Numeric Argument:: Giving Numeric Arguments to commands
839 * Undo:: Undoing Changes made by mistake
842 File: new-users-guide.info, Node: Insert, Next: Cursor Position, Prev: Edit, Up: Edit
847 To insert printing characters into the text you are editing, just
848 type them. Emacs will automatically insert the characters that you type
849 into the buffer at the cursor. The cursor moves forward, but if you
850 prefer to have text characters replace (overwrite) existing text
851 characters, you can enable the Overstrike option from the Options menu
854 To "delete" text you have just inserted, use <DEL>. <DEL> deletes
855 the character BEFORE the cursor (not the one that the cursor is on top
856 of or under; that is the character AFTER the cursor). The cursor and
857 all characters after it move backwards. Therefore, if you type a
858 printing character and then type <DEL>, they cancel out.
860 To end a line and start typing a new one, type <RET>. This inserts
861 a newline character in the buffer. If point is in the middle of a
862 line, <RET> splits the line. Typing <DEL> when the cursor is at the
863 beginning of a line rubs out the newline before the line, thus joining
864 the line with the preceding line.
866 Emacs automatically splits lines when they become too long, if you
867 turn on a special mode called "Auto Fill" mode. *Note Filling:
868 (xemacs)Filling, for information on using Auto Fill mode.
871 File: new-users-guide.info, Node: Cursor Position, Next: Erase, Prev: Insert, Up: Edit
876 The following commands will allow you to move the cursor around the
877 screen. The actual function names corresponding to these commands are
878 given in parenthesis. You can also invoke these commands by typing `M-x
879 <function name>'. You can do this for any command in XEmacs.
882 Move the cursor backward one character (`backward-char').
885 Move the cursor forward one character (`forward-char').
888 Move the cursor up one line vertically (`previous-line').
891 Move the cursor down one line vertically (`next-line').
894 Move the cursor to the beginning of the line (`beginning-of-line').
897 Move the cursor to the end of the line (`end-of-line').
900 Move the cursor forward one word (`forward-word').
903 Move the cursor backword one word (`backward-word').
906 Move the cursor to the top of the buffer (`beginning-of-buffer').
909 Move the cursor to the end of the buffer (`end-of-buffer').
911 `M-x goto-char RET <number> RET'
912 To enable this command type `M-x goto-char', and hit <RETURN> key.
913 In the "echo area" you will see:
917 You should then type in a number right after the colon and hit the
918 `RETURN' key again. After reading a number N this command will
919 move the cursor to character number N. Position 1 is the
920 beginning of the buffer. For example, if you type `M-x goto-char
921 RET 200 RET', then the cursor will move to the 200th character
922 starting from the beginning of the buffer.
924 `M-x goto-line RET <number> RET'
925 To enable this command type `M-x goto-line', and hit the <RETURN>
926 key. After you see `Goto line:' in the "echo area", type in a
927 number N and hit <RETURN> key again. This command will position
928 the cursor on the nth line starting from the beginning of the
932 This command will display the current line number in the echo area.
935 File: new-users-guide.info, Node: Erase, Next: Numeric Argument, Prev: Cursor Position, Up: Edit
941 If you press <DEL> i.e. the "delete" key, it will delete the
942 character before the cursor (`delete-backward-char').
945 This will delete the character after the cursor (`delete-char').
948 Kill to the end of the line (`kill-line'). If you kill the line by
949 mistake you can "yank" or `paste' it back by typing `C-y'. *Note
950 Moving Text::, for more information on yanking.
953 Kill forward to the end of the next word (`kill-word').
956 Kill back to the beginning of the previous word
957 (`backward-kill-word').
960 Kill to the end of current sentence (`kill-sentence').
963 Kill up to next occurrence of CHAR (`zap-to-char'). To use this
964 command type `M-z'. You will see the following statement in the
969 Type any char and press the <RET> key. For example, if you type
970 `p' then the entire text starting from the position of the cursor
971 until the first occurrence of `p' is killed.
974 File: new-users-guide.info, Node: Numeric Argument, Next: Undo, Prev: Erase, Up: Edit
976 Giving Numeric Arguments
977 ========================
979 Any Emacs command can be given a "numeric argument". Some commands
980 interpret the argument as a repetition count. For example, if you want
981 to move forward ten characters, you could type `C-f' ten times.
982 However, a more efficient way to do this would be to give an argument
983 of ten to the key `C-f' (the command `forward-char', move forward one
984 character). Negative arguments are also allowed. Often they tell a
985 command to move or act backwards. For example, if you want to move down
986 ten lines, type the following:
989 After you press <RET> key, the cursor will move ten lines downward. You
993 Both `C-u' and `M-' allow you to give numeric arguments. If you want to
994 move ten lines backward, you can also give negative arguments, like:
997 OR you could also type:
1000 You can obviously use `C-b' to move backward rather than giving
1001 negative arguments to `C-n'. *Note Numeric Arguments: (xemacs)Numeric
1002 Arguments, for more information on numeric arguments.
1005 File: new-users-guide.info, Node: Undo, Prev: Numeric Argument, Up: Edit
1010 When you are editing a buffer, you might type something by mistake.
1011 Emacs allows you to undo all changes you make to a buffer (but not more
1012 than 8000 characters). Each buffer in Emacs keeps a record of the
1013 changes made to it individually, so the undo command applies to the
1014 current buffer. There are two undo commands:
1017 Undo one batch of changes (usually, one command's worth).
1021 The same as above, but this command might not be obvious to type
1022 on some keyboards so it might be better to use the above command.
1024 *Note Undoing Changes: (xemacs)Undoing Changes, for more information
1028 File: new-users-guide.info, Node: Customization Basics, Next: Help, Prev: Edit, Up: Top
1030 Customize key bindings and menus
1031 ********************************
1033 When you start Emacs, it reads the file `~/.emacs' in your home
1034 directory. You can use this file to initialize and customize Emacs to
1035 your liking. This file should contain lisp-code. You can customize your
1036 `.emacs' file to create new menus, disable menus, change key bindings,
1037 enable a minor mode, etc. Any kind of customization affects only a
1038 particular Emacs job that you do them in. If you want to save your
1039 customizations `permanently' i.e. for future use also, you have to put
1040 it in your `.emacs' file. After you make changes to your `.emacs' file
1041 and save it, the changes will be effective only after you start Emacs
1042 again i.e. for a new Emacs process. To try out some of the examples in
1043 this section, highlight that region and evaluate the region by giving
1044 the command `M-x eval-region'. You will be able to see the results of
1045 your customizations in that Emacs session only (*note Lisp Eval:
1046 (xemacs)Lisp Eval.).
1050 * Customizing key Bindings:: Changing Key Bindings
1051 * Customizing Menus:: Adding, Deleting, Enabling and Disabling Menus
1054 File: new-users-guide.info, Node: Customizing key Bindings, Next: Customizing Menus, Prev: Customization Basics, Up: Customization Basics
1056 Customize key bindings
1057 ======================
1059 Most of Emacs commands use key sequences. *Note Keystrokes:
1060 (xemacs)Keystrokes, for more information about Keys and Commands. In
1061 Emacs, the keys themselves carry no meaning unless they are bound to a
1062 function. For example, `C-n' moves the cursor to the next line because
1063 its bound to the function next-line. Similarly, `C-p' moves to the
1064 previous line because its bound to the function previous-line. The
1065 functions themselves define a particular behavior. You can customize
1066 the key `C-n' to move to the previous line by binding it to
1067 previous-line and `C-p' to move to the next line by binding it to
1068 next-line. To bind keys to globally run commands you need to use the
1069 following syntax in your .emacs file:
1071 `(global-set-key KEYS CMD)'
1073 Here, `global-set-key' is a function which will bind the "keys" to the
1074 specified "cmd". For example, if you type the following in your .emacs
1077 (global-set-key "\C-p" 'next-line)
1078 (global-set-key "\C-n" 'previous-line)
1080 then `C-p' will move to the next line and `C-n' to the previous line.
1082 You can also disable a key binding, by using `nil' as the CMD in the
1083 syntax stated above. Here, `nil' stands for `false' which means disable
1084 a command or turn off a feature. If you want to enable a command or
1085 turn on a particular feature use `t' which stands for `true'. For
1086 example, if you do not wish `C-x C-c' to `Exit Emacs' you can type the
1087 following expression in your `.emacs' file:
1089 (global-set-key "\C-x\C-c" nil)
1091 You might want to have this statement in your `.emacs' file because its
1092 easy to hit this command by mistake and it could be annoying to exit
1093 Emacs unintentionally. There is a Exit Emacs option in the File menu
1094 which you might want to use instead. To make a particular key undefined
1097 (global-unset-key "\C-x\C-c")
1099 Now if you use the command `C-x C-c', you will get an error saying that
1100 the command is undefined.
1102 Some other customizations you could try are:
1103 * (global-set-key 'button3 'beginning-of-buffer)
1105 Now when you press the third button of your mouse, the cursor will
1106 be placed at the `beginning-of-buffer'.
1108 * (global-set-key 'f1 'goto-line)
1110 If you press the <F1> key, you will be prompted for a line number.
1111 After you type the line number and hit <RET>, the cursor will be
1112 placed on that line number.
1114 * (global-set-key 'f2 'undo)
1116 Pressing <F2> will undo the last command. If you have a <undo> key
1117 on your keyboard, try binding that key to the undo command.
1119 Another syntax for customizing key bindings is: `(define-key KEYMAP
1120 KEYS DEF)' It defines KEYS to run DEF in the keymap KEYMAP.
1122 KEYMAP is a keymap object which records the bindings of keys to the
1123 commands that they run.
1125 KEYS is the sequence of keystrokes to bind.
1127 DEF is anything that can be a key's definition:
1129 Look at the following two examples:
1131 (define-key global-map "\C-xl" 'make-symbolic-link)
1132 (define-key c-mode-map "\C-xl" 'make-symbolic-link)
1134 Both the examples bind the key `C-xl' to run the function
1135 `make-symbolic-link' (*note Misc File Ops: (xemacs)Misc File Ops.).
1136 However, the second example will bind the key only for C mode. *Note
1137 Major Modes: (xemacs)Major Modes, for more information on Major Modes
1141 File: new-users-guide.info, Node: Customizing Menus, Prev: Customizing key Bindings, Up: Customization Basics
1146 You can customize any of the XEmacs Pull-down-Menus. You can create
1147 your own menu, delete an existing one, enable a menu or disable a menu.
1148 For more information on the default menus available to you, *Note
1151 Some of the functions which are available to you for customization
1153 1. add-menu-item: (MENU-NAME ITEM-NAME FUNCTION ENABLED-P &optional
1156 This function will add a menu item to a menu, creating the menu
1157 first if necessary. If the named item already exists, the menu
1158 will remain unchanged. For example, if you add the following
1159 example to your `.emacs' file or evaluate it (*note Customization
1162 (add-menu-item '("Edit") "Replace String" replace-string t "Clear")
1164 a sub-menu Replace String will be created under Edit menu before
1165 the sub-menu Clear. The Edit menu will now look like:
1173 Start Macro Recording C-x(
1174 End Macro Recording C-x)
1175 Execute Last Macro C-xe
1177 Replace String will now execute the function `replace-string'.
1178 Select this menu item. Emacs will prompt you for a string name to
1179 be replaced. Type a string and hit <RET>. Now type a new string to
1180 replace the old string and hit <RET>. All occurrences of the old
1181 string will be replaced by the new string. In this example,
1183 `Edit' is the MENU-NAME which identifies the menu into which the
1184 new menu item should be inserted.
1186 `Replace String' is the ITEM-NAME which names the menu item to be
1189 `replace-string' is the FUNCTION i.e. the command to be invoked
1190 when the menu item "Replace String" is selected.
1192 `t' is the ENABLED-P parameter which controls whether the menu
1193 item is selectable or not. This parameter can be either `t'
1194 (selectable), `nil' (not selectable), or a form to evaluate. This
1195 form is evaluated just before the menu is displayed, and the menu
1196 item will be selectable if the form returns non-`nil'.
1198 `Clear' is the &OPTIONAL BEFORE parameter which is the name of the
1199 menu before which the new menu or sub-menu should be added. The
1200 &OPTIONAL string means that this parameter is optional. You do not
1201 need to specify this parameter. If you do not specify this
1202 parameter in the example above, the Replace String menu item will
1203 be added at the end of the list of sub-menus in the Edit menu i.e.
1204 after Execute Last Macro.
1206 If you wish to add a new menu to the menubar, try:
1208 (add-menu-item nil "Bot" 'end-of-buffer t)
1210 This will create a new menu Bot on the menu bar. Selecting this
1211 menu will take you to the end of the buffer. Using `nil' for the
1212 parameter MENU-NAME will create a new menu. Your menu-bar will now
1215 File Edit Options Buffers Bot Help
1217 The following example will illustrate how you can add sub-menus to
1218 the submenus themselves:
1220 (add-menu-item '("File" "Management") "Copy File" 'copy-file t)
1221 (add-menu-item '("File" "Management") "Delete File" 'delete-file t)
1222 (add-menu-item '("File" "Management") "Rename File" 'rename-file t)
1224 This will create a sub-menu Management under the File menu. When
1225 you select the submenu Management, it will contain three submenus:
1226 Copy File, Delete File and Rename File.
1228 2. delete-menu-item: (MENU-PATH) This function will remove the menu
1229 item defined by MENU-NAME from the menu hierarchy. Look at the
1230 following examples and the comments just above them which specify
1231 what the examples do.
1233 ;; deletes the "Replace String" menu item created earlier
1234 (delete-menu-item '("Edit" "Replace String"))
1236 ;; deletes the "Bot" menu created earlier
1237 (delete-menu-item '("Bot"))
1239 ;; deletes the sub-menu "Copy File" created earlier
1240 (delete-menu-item '("File" "File Management" "Copy File"))
1242 ;; deletes the sub-menu "Delete File" created earlier
1243 (delete-menu-item '("File" "Management" "Delete File"))
1245 ;; deletes the sub-menu "Rename File" created earlier
1246 (delete-menu-item '("File" "Management" "Rename File"))
1248 3. disable-menu-item: (MENU-NAME) Disables the specified menu item.
1249 The following example
1251 (disable-menu-item '("File" "Management" "Copy File"))
1253 will make the Copy File item unselectable. This menu-item would
1254 still be there but it will appear faded which would mean that it
1257 4. enable-menu-item: (MENU-NAME) Enables the specified previously
1260 (enable-menu-item '("File" "Management" "Copy File"))
1262 This will enable the sub-menu Copy File, which was disabled by the
1265 5. relabel-menu-item: (MENU-NAME NEW-NAME) Change the string of the
1266 menu item specified by MENU-NAME to NEW-NAME.
1268 (relabel-menu-item '("File" "Open...") "Open File")
1270 This example will rename the Open... menu item from the File menu