1 This is ../info/new-users-guide.info, produced by makeinfo version 4.6
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, customizable,
132 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 terms:
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:
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.
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.
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
215 File: new-users-guide.info, Node: Enter, Next: Frame, Prev: Entering, Up: Entering
220 To enter Emacs type `xemacs' and press the Return key at the shell i.e.
221 `xemacs <RET>'. This will bring up an emacs window with `*scratch*' as
222 the default buffer because Emacs must always have a buffer to work on.
223 Then choose the Open... option from the File menu on the menubar at the
224 top of the frame. It will prompt you to enter a filename. After you
225 enter the filename, Emacs will read that file into the current buffer.
227 xemacs <filename> <RET>
228 directly which will bring up an Emacs frame with the "filename" as
232 File: new-users-guide.info, Node: Frame, Next: Exiting, Prev: Enter, Up: Entering
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.
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.
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::.
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.
266 File: new-users-guide.info, Node: Exiting, Next: Mode Line, Prev: Frame, Up: Entering
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.
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.
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.
293 File: new-users-guide.info, Node: Mode Line, Next: Echo Area, Prev: Exiting, Up: Entering
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
302 --CH-XEmacs: BUF (MAJOR MINOR)----POS------
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
311 if the text in the buffer has been edited
314 if the text in the buffer has not been edited
317 if the buffer is a read-only-buffer i.e. it cannot be edited
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.
325 if your entire file is visible on the screen.
328 if you are looking at the beginning of the file.
331 if you are looking at the end of the file.
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.
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.
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.
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.
354 File: new-users-guide.info, Node: Echo Area, Prev: Mode Line, Up: Entering
359 The line at the bottom of the frame (below the mode line) is the "echo
360 area". Emacs uses this area to communicate with you:
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:
366 Find file: /usr/lib/x11/
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
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:
379 error--> Opening directory: no such file or directory, /urs/lib/x11/myfile
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
387 File: new-users-guide.info, Node: Windows and Menus, Next: Edit, Prev: Entering, Up: Top
389 XEmacs Windows and Menus
390 ************************
392 The first section of this chapter will show you how you can manipulate
393 XEmacs Windows and the other section will explain the Pull-down Menus of
398 * XEmacs Window:: Manipulating XEmacs Windows
399 * Pull-down Menus:: Description of XEmacs Pull-down Menus
402 File: new-users-guide.info, Node: XEmacs Window, Next: Pull-down Menus, Prev: Windows and Menus, Up: Windows and Menus
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:
414 This command will scroll the window which is not "selected"
415 (`scroll-other-window').
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.
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>.
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".
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.
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
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.
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.
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
468 If you click the right button on the mouse on a mode line, you will
469 get a menu with following options:
471 Choosing this menu will remove the window above this modeline from
475 Delete all windows on the frame except for the one above this
479 Split the window above the mode line in half, creating another
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.
487 Readjust the sizes of all windows on the frame until all windows
488 have roughly the same number of lines.
491 File: new-users-guide.info, Node: Pull-down Menus, Prev: XEmacs Window, Up: Windows and Menus
493 XEmacs Pull-down Menus
494 ======================
496 When you run XEmacs under X, each Emacs frame has a menu-bar at the top
497 which provides commands for editing, help and other options. All these
498 options are also available via key commands, the menus just provide
499 convenient short-cuts. The key commands are displayed right besides
500 some of the options. The following is a brief description of the four
501 default menus on the menu bar:
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
513 File: new-users-guide.info, Node: File menu, Next: Edit menu, Prev: Pull-down Menus, Up: Pull-down Menus
518 The File menu bar contains the following items. To choose a particular
519 option, press the left mouse button and drag it to the item you wish to
520 select. Then release the button.
523 This option will prompt you for a file name. You will get a
524 message in the echo area:
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
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.
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:
545 Insert the file name and press <RET>.
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.
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.
558 Print Buffer <buffername>
559 Prints a hardcopy of the current or "selected" buffer.
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...
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.
572 If the frame contains multiple windows, it will remove all windows
573 except the selected one.
575 Un-Split (Keep Others)
576 If the frame contains multiple windows, it will remove the selected
577 window and keep the other one.
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.
584 Kill Buffer <buffername>
585 It will kill the current buffer. If will prompt you if there are
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
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 selected
610 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 `init.el' 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 `init.el' 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 `init.el' 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 item
769 List All Buffers, which provides a Buffer List. If you select Buffers
770 Sub-menus from the Options menu, you will get some sub-menus for each
771 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 can
795 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 type
848 them. Emacs will automatically insert the characters that you type into
849 the buffer at the cursor. The cursor moves forward, but if you prefer
850 to have text characters replace (overwrite) existing text characters,
851 you can enable the Overstrike option from the Options menu in the 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 backward 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.
936 File: new-users-guide.info, Node: Erase, Next: Numeric Argument, Prev: Cursor Position, Up: Edit
942 If you press <DEL> i.e. the "delete" key, it will delete the
943 character before the cursor (`delete-backward-char').
946 This will delete the character after the cursor (`delete-char').
949 Kill to the end of the line (`kill-line'). If you kill the line by
950 mistake you can "yank" or `paste' it back by typing `C-y'. *Note
951 Moving Text::, for more information on yanking.
954 Kill forward to the end of the next word (`kill-word').
957 Kill back to the beginning of the previous word
958 (`backward-kill-word').
961 Kill to the end of current sentence (`kill-sentence').
964 Kill up to next occurrence of CHAR (`zap-to-char'). To use this
965 command type `M-z'. You will see the following statement in the
970 Type any char and press the <RET> key. For example, if you type
971 `p' then the entire text starting from the position of the cursor
972 until the first occurrence of `p' is killed.
975 File: new-users-guide.info, Node: Numeric Argument, Next: Undo, Prev: Erase, Up: Edit
977 Giving Numeric Arguments
978 ========================
980 Any Emacs command can be given a "numeric argument". Some commands
981 interpret the argument as a repetition count. For example, if you want
982 to move forward ten characters, you could type `C-f' ten times.
983 However, a more efficient way to do this would be to give an argument
984 of ten to the key `C-f' (the command `forward-char', move forward one
985 character). Negative arguments are also allowed. Often they tell a
986 command to move or act backwards. For example, if you want to move down
987 ten lines, type the following:
990 After you press <RET> key, the cursor will move ten lines downward. You
994 Both `C-u' and `M-' allow you to give numeric arguments. If you want to
995 move ten lines backward, you can also give negative arguments, like:
998 OR you could also type:
1001 You can obviously use `C-b' to move backward rather than giving
1002 negative arguments to `C-n'. *Note Numeric Arguments: (xemacs)Numeric
1003 Arguments, for more information on numeric arguments.
1006 File: new-users-guide.info, Node: Undo, Prev: Numeric Argument, Up: Edit
1011 When you are editing a buffer, you might type something by mistake.
1012 Emacs allows you to undo all changes you make to a buffer (but not more
1013 than 8000 characters). Each buffer in Emacs keeps a record of the
1014 changes made to it individually, so the undo command applies to the
1015 current buffer. There are two undo commands:
1018 Undo one batch of changes (usually, one command's worth).
1022 The same as above, but this command might not be obvious to type
1023 on some keyboards so it might be better to use the above command.
1025 *Note Undoing Changes: (xemacs)Undoing Changes, for more information
1029 File: new-users-guide.info, Node: Customization Basics, Next: Help, Prev: Edit, Up: Top
1031 Customize key bindings and menus
1032 ********************************
1034 When you start Emacs, it reads the file `~/.xemacs/init.el' in the
1035 `.xemacs/' subdirectory of your home directory. You can use this file
1036 to initialize and customize Emacs to your liking. This file should
1037 contain lisp-code. You can customize your `init.el' file to create new
1038 menus, disable menus, change key bindings, enable a minor mode, etc.
1039 Any kind of customization affects only a particular Emacs job that you
1040 do them in. If you want to save your customizations `permanently' i.e.
1041 for future use also, you have to put it in your `init.el' file. After
1042 you make changes to your `init.el' file and save it, the changes will
1043 be effective only after you start Emacs again i.e. for a new Emacs
1044 process. To try out some of the examples in this section, highlight
1045 that region and evaluate the region by giving the command `M-x
1046 eval-region'. You will be able to see the results of your
1047 customizations in that Emacs session only (*note Lisp Eval:
1048 (xemacs)Lisp Eval.).
1052 * Customizing key Bindings:: Changing Key Bindings
1053 * Customizing Menus:: Adding, Deleting, Enabling and Disabling Menus
1056 File: new-users-guide.info, Node: Customizing key Bindings, Next: Customizing Menus, Prev: Customization Basics, Up: Customization Basics
1058 Customize key bindings
1059 ======================
1061 Most of Emacs commands use key sequences. *Note Keystrokes:
1062 (xemacs)Keystrokes, for more information about Keys and Commands. In
1063 Emacs, the keys themselves carry no meaning unless they are bound to a
1064 function. For example, `C-n' moves the cursor to the next line because
1065 its bound to the function next-line. Similarly, `C-p' moves to the
1066 previous line because its bound to the function previous-line. The
1067 functions themselves define a particular behavior. You can customize
1068 the key `C-n' to move to the previous line by binding it to
1069 previous-line and `C-p' to move to the next line by binding it to
1070 next-line. To bind keys to globally run commands you need to use the
1071 following syntax in your init.el file:
1073 `(global-set-key KEYS CMD)'
1075 Here, `global-set-key' is a function which will bind the "keys" to the
1076 specified "cmd". For example, if you type the following in your init.el
1079 (global-set-key "\C-p" 'next-line)
1080 (global-set-key "\C-n" 'previous-line)
1082 then `C-p' will move to the next line and `C-n' to the previous line.
1084 You can also disable a key binding, by using `nil' as the CMD in the
1085 syntax stated above. Here, `nil' stands for `false' which means disable
1086 a command or turn off a feature. If you want to enable a command or
1087 turn on a particular feature use `t' which stands for `true'. For
1088 example, if you do not wish `C-x C-c' to `Exit Emacs' you can type the
1089 following expression in your `init.el' file:
1091 (global-set-key "\C-x\C-c" nil)
1093 You might want to have this statement in your `init.el' file because
1094 its easy to hit this command by mistake and it could be annoying to exit
1095 Emacs unintentionally. There is an Exit Emacs option in the File menu
1096 which you might want to use instead. To make a particular key undefined
1099 (global-unset-key "\C-x\C-c")
1101 Now if you use the command `C-x C-c', you will get an error saying that
1102 the command is undefined.
1104 Some other customizations you could try are:
1105 * (global-set-key 'button3 'beginning-of-buffer)
1107 Now when you press the third button of your mouse, the cursor will
1108 be placed at the `beginning-of-buffer'.
1110 * (global-set-key 'f1 'goto-line)
1112 If you press the <F1> key, you will be prompted for a line number.
1113 After you type the line number and hit <RET>, the cursor will be
1114 placed on that line number.
1116 * (global-set-key 'f2 'undo)
1118 Pressing <F2> will undo the last command. If you have a <undo> key
1119 on your keyboard, try binding that key to the undo command.
1121 Another syntax for customizing key bindings is: `(define-key KEYMAP
1122 KEYS DEF)' It defines KEYS to run DEF in the keymap KEYMAP.
1124 KEYMAP is a keymap object which records the bindings of keys to the
1125 commands that they run.
1127 KEYS is the sequence of keystrokes to bind.
1129 DEF is anything that can be a key's definition:
1131 Look at the following two examples:
1133 (define-key global-map "\C-xl" 'make-symbolic-link)
1134 (define-key c-mode-map "\C-xl" 'make-symbolic-link)
1136 Both the examples bind the key `C-xl' to run the function
1137 `make-symbolic-link' (*note Misc File Ops: (xemacs)Misc File Ops.).
1138 However, the second example will bind the key only for C mode. *Note
1139 Major Modes: (xemacs)Major Modes, for more information on Major Modes
1143 File: new-users-guide.info, Node: Customizing Menus, Prev: Customizing key Bindings, Up: Customization Basics
1148 You can customize any of the XEmacs Pull-down-Menus. You can create
1149 your own menu, delete an existing one, enable a menu or disable a menu.
1150 For more information on the default menus available to you, *Note
1153 Some of the functions which are available to you for customization
1155 1. add-menu-item: (MENU-NAME ITEM-NAME FUNCTION ENABLED-P &optional
1158 This function will add a menu item to a menu, creating the menu
1159 first if necessary. If the named item already exists, the menu
1160 will remain unchanged. For example, if you add the following
1161 example to your `init.el' file or evaluate it (*note Customization
1164 (add-menu-item '("Edit") "Replace String" replace-string t "Clear")
1166 a sub-menu Replace String will be created under Edit menu before
1167 the sub-menu Clear. The Edit menu will now look like:
1175 Start Macro Recording C-x(
1176 End Macro Recording C-x)
1177 Execute Last Macro C-xe
1179 Replace String will now execute the function `replace-string'.
1180 Select this menu item. Emacs will prompt you for a string name to
1181 be replaced. Type a string and hit <RET>. Now type a new string to
1182 replace the old string and hit <RET>. All occurrences of the old
1183 string will be replaced by the new string. In this example,
1185 `Edit' is the MENU-NAME which identifies the menu into which the
1186 new menu item should be inserted.
1188 `Replace String' is the ITEM-NAME which names the menu item to be
1191 `replace-string' is the FUNCTION i.e. the command to be invoked
1192 when the menu item "Replace String" is selected.
1194 `t' is the ENABLED-P parameter which controls whether the menu
1195 item is selectable or not. This parameter can be either `t'
1196 (selectable), `nil' (not selectable), or a form to evaluate. This
1197 form is evaluated just before the menu is displayed, and the menu
1198 item will be selectable if the form returns non-`nil'.
1200 `Clear' is the &OPTIONAL BEFORE parameter which is the name of the
1201 menu before which the new menu or sub-menu should be added. The
1202 &OPTIONAL string means that this parameter is optional. You do not
1203 need to specify this parameter. If you do not specify this
1204 parameter in the example above, the Replace String menu item will
1205 be added at the end of the list of sub-menus in the Edit menu i.e.
1206 after Execute Last Macro.
1208 If you wish to add a new menu to the menubar, try:
1210 (add-menu-item nil "Bot" 'end-of-buffer t)
1212 This will create a new menu Bot on the menu bar. Selecting this
1213 menu will take you to the end of the buffer. Using `nil' for the
1214 parameter MENU-NAME will create a new menu. Your menu-bar will now
1217 File Edit Options Buffers Bot Help
1219 The following example will illustrate how you can add sub-menus to
1220 the submenus themselves:
1222 (add-menu-item '("File" "Management") "Copy File" 'copy-file t)
1223 (add-menu-item '("File" "Management") "Delete File" 'delete-file t)
1224 (add-menu-item '("File" "Management") "Rename File" 'rename-file t)
1226 This will create a sub-menu Management under the File menu. When
1227 you select the submenu Management, it will contain three submenus:
1228 Copy File, Delete File and Rename File.
1230 2. delete-menu-item: (MENU-PATH) This function will remove the menu
1231 item defined by MENU-NAME from the menu hierarchy. Look at the
1232 following examples and the comments just above them which specify
1233 what the examples do.
1235 ;; deletes the "Replace String" menu item created earlier
1236 (delete-menu-item '("Edit" "Replace String"))
1238 ;; deletes the "Bot" menu created earlier
1239 (delete-menu-item '("Bot"))
1241 ;; deletes the sub-menu "Copy File" created earlier
1242 (delete-menu-item '("File" "File Management" "Copy File"))
1244 ;; deletes the sub-menu "Delete File" created earlier
1245 (delete-menu-item '("File" "Management" "Delete File"))
1247 ;; deletes the sub-menu "Rename File" created earlier
1248 (delete-menu-item '("File" "Management" "Rename File"))
1250 3. disable-menu-item: (MENU-NAME) Disables the specified menu item.
1251 The following example
1253 (disable-menu-item '("File" "Management" "Copy File"))
1255 will make the Copy File item unselectable. This menu-item would
1256 still be there but it will appear faded which would mean that it
1259 4. enable-menu-item: (MENU-NAME) Enables the specified previously
1262 (enable-menu-item '("File" "Management" "Copy File"))
1264 This will enable the sub-menu Copy File, which was disabled by the
1267 5. relabel-menu-item: (MENU-NAME NEW-NAME) Change the string of the
1268 menu item specified by MENU-NAME to NEW-NAME.
1270 (relabel-menu-item '("File" "Open...") "Open File")
1272 This example will rename the Open... menu item from the File menu
1277 File: new-users-guide.info, Node: Help, Next: Modes, Prev: Customization Basics, Up: Top
1282 XEmacs provides a comprehensive Help facility. On the extreme right of
1283 the menu-bar there is a Help menu. There are several help commands
1284 provided by this menu. You can also use `C-h' for invoking the Help
1285 facility. Type "?" for a list of keys you can type after typing `C-h'.
1286 If you want more information on what your options are and what kind of
1287 help you can get type "?" again. You will get a listing of all the keys
1288 you can type and what they will do. Initially if you want help, type
1293 * The Help Menu:: Items on the Help menu
1296 File: new-users-guide.info, Node: The Help Menu, Prev: Help, Up: Help
1301 When you click on the Help menu with any of the mouse buttons you will
1302 get the following menu items:
1305 Selecting this item will take you to the Info page which is the
1306 online documentation browsing system. You can simply click on the
1307 highlighted items and "Info" will take you to the document
1308 providing information about that topic.
1311 After you select this item, you will get a documentation on the
1312 major and minor modes which are enabled in the buffer you are
1313 working with. *Note Modes::, for information on Modes.
1316 After you select this item, you will see the following message in
1319 List symbols matching regexp:
1321 If you type "mode" and hit <RET>, you will get a list of all the
1322 symbols (like functions and commands). You can now get
1323 documentation on any of the given symbols by "clicking" on any of
1324 the symbols (i.e. drag your mouse on the appropriate symbol and
1325 release the button). For example, if you "click" on the
1326 'auto-fill-mode' you will get the following message in the window
1333 Toggle auto-fill mode.
1334 With arg, turn auto-fill mode on if and only if arg is positive.
1335 In auto-fill mode, inserting a space at a column beyond `fill-column'
1336 automatically breaks the line at a previous space.
1342 variable not documented
1345 Selecting this item will prompt you for a string just like when you
1346 select Hyper Apropos.... After you give a string name, you will get
1347 a listing of all the functions and commands containing that string
1348 name with a very short description about what that command does.
1351 After you select this item, you will be prompted for a string name
1356 Now you can give any string name, for example "mode" and hit
1357 <RET>. You will get a listing of all the variables and commands
1358 containing that string i.e "mode" with a short description of its
1362 Select this item and you will get a listing of all the keys and the
1363 commands that they execute. Depending on which Major mode your
1364 buffer is in, you will get a listing of the special keybindings
1365 for that particular buffer also. For example, if you are in
1366 "Texinfo" mode, part of your list will contain:
1368 C-c C-c n texinfo-insert-@node
1369 C-c C-c o texinfo-insert-@noindent
1370 C-c C-c s texinfo-insert-@samp
1371 C-c C-c t texinfo-insert-@table
1372 C-c C-c v texinfo-insert-@var
1373 C-c C-c x texinfo-insert-@example
1374 C-c C-c { texinfo-insert-braces
1376 These keybindings apply only to "Texinfo" mode. *Note Modes::, for
1377 more information on various modes.
1380 After you select this item, you will be see the following message
1384 After you type a command key sequence, full documentation of that
1385 command will be displayed. For example if you type `C-g', you will
1386 see the following documentation for `C-g':
1389 Signal a `quit' condition.
1390 This means that `C-g' will quit whatever command you gave earlier.
1392 Describe Function...
1393 This menu item provides documentation for a function. After you
1394 select this item, it will prompt you for a function name in the
1397 Describe function (default <some function name>):
1399 If you hit <RET> without giving a function name, you will get
1400 documentation for that default function name, otherwise if you
1401 type a function name and hit <RET>, you will get documentation for
1404 Describe Variable...
1405 You can get documentation on any variable by selecting this menu
1406 item. It is similar to Describe Function and will prompt you for a
1410 After you select this item you will be prompted for a Unix command
1411 for which you wish to see the man page. You will see the following
1412 message in the echo area:
1414 Manual entry: (default <some name>)
1416 Now you can type any command, for example type `who' and press
1417 <RET>. You will get the man page for the Unix command `who' which
1418 lists who is on the system.
1421 Select this item and you will get a tutorial on Emacs. It is good
1425 Select this item and you will get a lot of historical and current
1429 For more information on the Help facility, *Note Help: (xemacs)Help.
1432 File: new-users-guide.info, Node: Modes, Next: Files, Prev: Help, Up: Top
1434 Major and Minor Modes
1435 *********************
1437 XEmacs is "language sensitive". It has several "major" and "minor"
1438 modes. The major modes customize Emacs to edit text of a particular
1439 sort. There are major modes for C, Lisp, Emacs Lisp, LaTeX, English
1440 etc. Within each major mode, certain functions and keys are redefined
1441 to "suit" that particular sort of text. The minor modes provide certain
1442 features which can be turned off or on at any time. Emacs can only be
1443 in one major mode at any time, but it can turn on several minor modes
1444 at the same time. After you have selected any major or minor mode, you
1445 can select Describe Mode from the Help menu and you will get
1446 documentation about those modes.
1450 * Major Modes:: Choosing Major Modes
1451 * Minor Modes:: Auto-Fill, Abbrev and other minor modes
1454 File: new-users-guide.info, Node: Major Modes, Next: Minor Modes, Prev: Modes, Up: Modes
1459 Emacs has several major modes which customize Emacs to edit text of
1460 various sorts. You can have only one major mode at any time. Within each
1461 major mode, Emacs redefines certain functions (like cursor movement,
1462 indentation and text killing) to suit the needs of the text being
1463 edited. When you are editing a specific type of text you should switch
1464 to the appropriate mode. If you are working with C code, you should
1465 switch to C mode; if you are working with Lisp code, then switch to lisp
1466 mode and if you are working with English text switch to Text mode.
1468 When you open a file to work on, Emacs usually selects the
1469 appropriate mode. For example, if you open a file called `guide.c' then
1470 Emacs will select the C mode because of the ".c" extension of the file.
1471 To explicitly select a mode type the following command:
1473 ;;; selects lisp mode
1479 To select any other mode, just add the major mode name before the
1480 '-mode'. The current mode in which you are in will be displayed in
1481 parenthesis in the mode-line at the bottom of the frame. All major
1482 modes have some special keybindings and you can get a listing of those
1483 keybindings by selecting List Keybindings from the Help menu on the
1486 Some of the available modes in XEmacs are :
1489 When you start XEmacs, usually you start with the default
1490 "Fundamental" mode. This mode has no special definitions or
1494 Use this mode when you have to format a text with nroff before it
1495 can be available in readable form. It redefines some indentation
1496 commands. *Note Nroff Mode: (xemacs)Nroff Mode, for information on
1500 Use this mode if you are using the LaTeX text-formatter. It
1501 provides commands for insertion of quotes, braces and other
1502 characters. It also allows you to format the buffer for printing.
1503 *Note TeX Mode: (xemacs)TeX Mode, for information on this mode.
1506 Texinfo is a documentation system that uses a single source file to
1507 produce both printed output and on-line documentation. When you
1508 use this mode, there will be some special keybindings for
1509 inserting some characters and executing some commands.
1511 This info file which you are reading right now is produced by
1515 Use this mode for editing outlines. When you enable this mode, you
1516 can make part of the text temporarily invisible so that you can
1517 see the overall structure of the outline. *Note Outline Mode:
1518 (xemacs)Outline Mode, for information on this mode.
1521 Use this mode for C programs. It will redefine some indentation
1522 commands. *Note C Indent: (xemacs)C Indent.
1525 Use this mode for Lisp programs. Look at the XEmacs User's Manual
1526 for more information.
1529 Use this mode for Fortran programs. This mode provides special
1530 commands to move around and some other indentation commands. For
1531 more information on this mode, *Note Fortran: (xemacs)Fortran.
1534 This is the picture mode which you can use to create a picture out
1535 of text characters. *Note Picture: (xemacs)Picture, for more
1539 Use asm-mode for editing files of assembler code. Look at the file
1540 ` /usr/local/lib/xemacs-VERSION/lisp/modes/asm.el' for more
1544 There are some other modes and commands for working with other kinds
1545 of text or programs. Emacs also provides commands for reading and
1546 sending Mail. For more information on these features look at the XEmacs
1547 Manual. Emacs also provides the functions of a desk calendar, with a
1548 diary of past or planned events. For more information on the calendar
1549 mode look at the manual for Calendar Mode and Diary.
1552 File: new-users-guide.info, Node: Minor Modes, Prev: Major Modes, Up: Modes
1557 The minor modes in Emacs provide some optional features which you can
1558 turn on or off. Any number of minor modes can be active at the same time
1559 with any major mode. You can enable a minor mode in one buffer and
1560 disable it in other mode. To enable a minor mode, for example the
1561 font-lock mode type the following command:
1565 To enable the other minor modes, replace the "font-lock" with the name
1566 of the minor mode. To disable the mode type the command again. A
1567 positive argument will always turn the mode on. Whenever you type this
1568 command, it will turn the mode on if it was off, OR it will turn it off
1569 if it was on i.e. it toggles. Look at the mode-line at the bottom of the
1570 frame. If it says FLock in parentheses, then it means that this mode is
1571 on, otherwise it is off.
1573 The following are some of the minor modes available in XEmacs. To
1574 enable any one of them type "M-x" in front of them.
1577 You can also choose this mode by selecting the Syntax Highlighting
1578 menu item from the Options menu on the menu-bar at the top. If you
1579 wish to have this mode enabled permanently, choose Save Options
1580 from the Options menu. *Note Options Menu::, for more information
1581 on the Options menu. You can also add statements in your
1582 `init.el' file. For each major mode in which you wish to enable
1583 this minor mode, you need a statement in your `init.el' file. The
1584 following example shows how to enable the font-lock mode when the
1585 major mode is c-mode.
1587 (add-hook 'c-mode-hook 'turn-on-font-lock)
1589 *Note Other Customizations::.
1591 When you enable this mode, the text will be displayed in different
1592 colors and fonts depending on the type of the text. This makes the
1593 text very easy to read and understand. For example, comments might
1594 be displayed in red, variables in black, functions in blue and
1595 other keywords in different colors and fonts. When you select More
1596 from the Syntax Highlighting option, you get very detailed display
1597 of colors and fonts; function names within comments themselves
1598 might appear in a different font and color.
1601 Enabling this mode will provide automatic word-wrapping. The <SPC>
1602 key will break lines i.e. insert newlines as you type to prevent
1603 lines from becoming too long.
1606 When you enable this mode, the text that you type will replace the
1607 existing text rather than moving it to the right (the default
1608 case). You can enable this mode by selecting Overstrike menu-item
1609 from the Options menu from the menu-bar.
1612 After you enable this mode, you can define words which will expand
1613 into some different text i.e. you can define abbreviations. For
1614 example, you might define "expand" to "expand will eventually
1615 expand to this text". After this definition you will be able to
1616 get "expand will eventually expand to this text" simply by typing
1620 *Note Abbrevs: (xemacs)Abbrevs, for more information on this mode
1621 and on defining abbreviations.
1624 After you enable this mode in a buffer, the contents of that
1625 buffer will be saved periodically. This will reduce the amount you
1626 might lose in case of a system crash.
1629 After you enable this mode, the line number at which your cursor is
1630 present will be displayed continuously in the mode line.
1633 To enable this command, just type
1636 Do not add the "-mode" to it. You can also select the Paren
1637 Highlighting option from the Options menu. After you enable this
1638 command, put your cursor on one of the left parenthesis. The other
1639 matching parenthesis will start blinking. *Note Options Menu::,
1640 for more information on the Paren Highlighting option.
1642 For information on some other modes, look at the XEmacs User's Manual
1643 and the associated files.
1646 File: new-users-guide.info, Node: Files, Next: Other Customizations, Prev: Modes, Up: Top
1651 The basic unit of stored data in Unix is the "file". To edit a file,
1652 you must tell Emacs to read the file into a buffer. This is called
1653 "visiting" the file. You can now edit the buffer and to save the
1654 changes you must write the buffer back to the file.
1656 In addition to visiting and saving files, Emacs can delete, copy,
1657 rename, and append to files, and operate on file directories.
1661 * File Names:: How to type and edit file name arguments.
1662 * Visiting:: Visiting a file prepares Emacs to edit the file.
1663 * Saving Files:: How to save Emacs files.
1666 File: new-users-guide.info, Node: File Names, Next: Visiting, Prev: Files, Up: Files
1671 Most of the Emacs commands that operate on a file require you to
1672 specify a file name. For example, you might specify the file name
1673 initially when you enter Emacs :
1677 After you hit <RET>, you will enter XEmacs with "myfile" read into the
1678 current buffer. If you do not specify the filename when entering Emacs,
1679 you can use the Open... option from the File menu. You will be prompted
1680 for a filename in the echo area:
1682 Find file: /usr/workspace/
1684 Type in a file name which you want to open after the "/" and hit <RET>.
1685 The specified file will be read into the current buffer. The
1686 "/usr/workspace" might be the "default directory". When Emacs prompts
1687 you for a file, it uses the default-directory unless you specify a
1688 directory. You can see what the default directory of the current buffer
1689 is by using the Describe Variable option from the Help menu. When Emacs
1690 prompts you for the variable name to describe, type
1691 `default-directory'. If you wish to open a file in some other
1692 directory, use <DEL> or the <BackSpace> key to go back and type the
1693 path name of the new directory.
1695 You can create a new directory by typing `M-x make-directory'. This
1696 command will prompt you for a directory name:
1698 Create directory: /usr/workspace/
1700 After you type a directory name and press <RET>, a new directory with
1701 the specified name will be created. If you do not wish to create a new
1702 directory, then simply press `C-g' to quit the command. Similarly, you
1703 can also remove a directory by using the command `remove-directory'.
1704 The command `M-x pwd' will print the current buffer's default
1705 directory. For more information on file names, *Note File Names:
1709 File: new-users-guide.info, Node: Visiting, Next: Saving Files, Prev: File Names, Up: Files
1714 To edit a file in Emacs you need to "visit" it. "Visiting" a file means
1715 copying its contents (or reading them) into the current buffer. Emacs
1716 will create a new buffer for each file that you visit. The buffer will
1717 be named after the file that you open. If you open a file
1718 `/usr/workspace/myfile.texinfo', the buffer will be called
1719 "myfile.texinfo". If a buffer with this name already exists, a unique
1720 name will be constructed by appending `<2>', `<3>', etc. If this is the
1721 second buffer with the same name, a "<2>" will be appended, "<3>" for a
1722 third buffer and so on. The name of the buffer which is being displayed
1723 in the window will be shown both at the top and bottom of the frame.
1724 Once you are in XEmacs, you can use the following commands:
1727 This command will visit a file (`find-file'). It will prompt you
1728 for a file name to visit. The Open... option from the File menu
1729 does the same thing:
1731 Find file: /usr/workspace/
1733 Type in a filename and press <RET>. You will see a new buffer on
1734 the screen with its name in the mode-line. If the filename you
1735 specify already exists in Emacs, the buffer containing that file
1736 will be selected. You will get an error message if the filename
1737 does not exist. If you still press <RET>, a new buffer with the
1738 given filename will be displayed on the screen.
1741 This command (`find-alternate-file'), will visit a different file
1742 instead of the one visited last. It is similar to `C-c C-f' except
1743 that it kills the current buffer (after offering to save it).
1746 This command will visit a file in another frame
1747 (`find-file-other-frame') without changing the current window or
1748 frame. The Open in New Frame... from the File menu will do the
1749 same thing. It will prompt you for a file name in the echo area.
1750 After you type the file name and press <RET>, the specified file
1751 will be read into a new buffer and displayed on a new frame.
1754 File: new-users-guide.info, Node: Saving Files, Prev: Visiting, Up: Files
1759 The changes that you make after visiting a file will not be saved
1760 unless you save the buffer. When you save the buffer, Emacs writes the
1761 current contents of the buffer into the visited file. Some commands to
1765 This command will permanently save the current buffer in its
1766 visited file (`save-buffer'). You will see the following message
1767 in the echo area if you save a file called "myfile.texinfo" :
1769 Wrote /usr/workspace/myfile.texinfo
1771 Try using this command twice. You will get the above message the
1772 first time you use this command, the second time you will get the
1775 (No changes need to be saved)
1777 This message indicates that you haven't made any changes since the
1778 last time you saved the file.
1781 This command will save all the buffers in their visited files
1782 (`save-some-buffers'). It will prompt you for typing yes or no:
1784 Save file /usr/workspace/myfile.texinfo? (y or n)
1786 You will get the above message for all the buffers. Type "y" if
1787 you want to save the buffer.
1790 This command will prompt you for a file name and save the current
1791 buffer in that file. (`write-file'). You will see the following
1792 message in the echo area:
1794 Write file: /usr/workspace/
1796 After you type in a file name, press <RET>. The buffer will be
1797 saved in a new file. You can make copies of a particular file
1800 You can also undo all the changes made since the file was visited or
1801 saved by reading the text from the file again (called "reverting"). For
1802 more information on this option, *Note Reverting: (xemacs)Reverting.
1804 When you save a file in Emacs, it destroys its old contents. However,
1805 if you set the variable `make-backup-files' to non-`nil' i.e. `t',
1806 Emacs will create a "backup" file. Select the Describe variable option
1807 from the Help menu and look at the documentation for this variable. Its
1808 default value should be `t'. However, if its not then use `M-x
1809 set-variable' to set it to `t' (*note Setting Variables::). The backup
1810 file will contain the contents from the last time you visited the file.
1811 Emacs also provides options for creating numbered backups. For more
1812 information on backups, *Note Backup: (xemacs)Backup.
1814 Emacs also saves all the files from time to time so that in case of a
1815 system crash you don't lose lot of your work. You will see the message
1816 `Auto-saving...' displayed in the echo area when the buffer is being
1817 saved automatically. The auto saved files are named by putting the
1818 character `#' in front and back. For example a file called
1819 "myfile.texinfo" would be named as `#myfile.texinfo#'. For information
1820 on controlling auto-saving and recovering data from auto-saving, *Note
1821 Auto Save Files: (xemacs)Auto Save Files.
1823 Emacs provides protection from simultaneous editing which occurs if
1824 two users are visiting the same file and trying to save their changes.
1825 It will put a lock on a file which is being visited and modified. If
1826 any other user tries to modify that file, it will inform the user about
1827 the lock and provide some options. For more information on protection
1828 against simultaneous editing, *Note Interlocking: (xemacs)Interlocking.
1831 File: new-users-guide.info, Node: Other Customizations, Next: Select and Move, Prev: Files, Up: Top
1833 Other Customizations
1834 ********************
1836 You can modify the behavior of Emacs in minor ways permanently by
1837 putting your changes in your `init.el' file. This file contains Lisp
1838 function call expressions. Each of these expressions will consist of a
1839 function name followed by arguments, all surrounded by parentheses. For
1840 example, to turn on the auto-fill-mode (i.e. break lines automatically
1841 when they become too long) , put the following line in your `init.el'
1844 (add-hook 'text-mode-hook
1845 '(lambda() (auto-fill-mode 1)))
1847 Emacs has a function named "turn-on-auto-fill" which is defined as
1848 "(lambda() (auto-fill-mode 1))". Therefore you can also write the above
1851 (add-hook 'text-mode-hook 'turn-on-auto-fill)
1853 Emacs provides a number of hooks for the sake of customization. The hook
1854 variables contain list of functions to be called with no arguments. To
1855 turn on the auto-fill-mode, add the appropriate hook as shown in the
1858 Similarly, to enable the "font-lock mode" which displays your
1859 program in different fonts and colors(*note Modes::), put the following
1860 in your `init.el' file. The comments above the statement explain what
1863 ;;; enables the font-lock-mode in Lisp Mode
1864 (add-hook 'lisp-mode-hook 'turn-on-font-lock)
1866 ;;; enables the font-lock-mode in Texinfo Mode
1867 (add-hook 'texinfo-mode-hook 'turn-on-font-lock)
1869 ;;; enables the font-lock mode in C Mode
1870 (add-hook 'c-mode-hook 'turn-on-font-lock)
1872 To turn on the font-lock mode in other Major Modes like emacs-lisp,
1873 just put the name of the mode with "-hook" appended to it as the middle
1874 parameter in the above examples. You can also select the color that the
1875 functions, comments or other keywords should be displayed in :
1877 ;;; the function names will now be displayed in blue color
1878 (set-face-foreground 'font-lock-function-name-face "blue")
1880 ;;; the comments will be displayed in forest green
1881 (set-face-foreground 'font-lock-comment-face "forest green")
1883 For other customizations regarding the font-lock face, look at the file
1884 `/usr/local/lib/xemacs-VERSION/etc/sample.init.el'.
1888 * Setting Variables:: Customizing Emacs variables
1889 * Init File:: Some examples of Lisp expressions in
1893 File: new-users-guide.info, Node: Setting Variables, Next: Init File, Prev: Other Customizations, Up: Other Customizations
1895 Other Customizations
1896 ====================
1898 In XEmacs, "variables" are used for internal record-keeping and
1899 customizations. There are some variables called "options" which you can
1900 use for customizations. To examine a variable use:
1902 ;;; print the value and documentation of the variable, use either of the
1903 ;;; following commands
1905 M-x describe variable
1907 After you type any of the above commands, you will be prompted for a
1908 variable name in the "echo area". Type in the name of the variable, for
1909 example, type `case-fold-search' <RET> Your window will split into two
1910 and you will see the following message in that window:
1912 case-fold-search's value is t
1913 This value is specific to the current buffer.
1916 *Non-nil if searches should ignore case.
1917 Automatically becomes buffer-local when set in any fashion.
1919 Since this variable's value is 't' searches will ignore case. If you
1920 want case-sensitive-search (i.e. if you are searching for "Foo" and you
1921 do not want "foo" to be included in the search, you need to set this
1922 variable to "nil". In order to do that, use:
1926 Emacs will prompt you for the variable which you wish to set. Type in
1927 "case-fold-search" and hit <RET>. You will see the following message:
1929 Set case-fold-search to value:
1931 Type "nil" and hit <RET>. Now if you again use `M-x describe variable'
1932 , you will see that the new value of case-fold-search will be "nil" and
1933 your searches will be case-sensitive. This will be effective only for
1934 that Emacs session. If you want to change the value of a variable
1935 permanently put the following statement in your `init.el' file :
1937 (setq case-fold-search nil)
1939 This statement will make searches case-sensitive only in the current
1940 buffer which is the `init.el' file. This will not be very useful. To
1941 make searches case-sensitive globally in all buffers, use:
1943 (setq-default case-fold-search nil)
1945 If you want to change the value of any other variable, use :
1947 (setq <variable-name> <new value>)
1949 "setq" will assign the "new value" to the "variable-name" .
1951 If you want a list of the "options" i.e. the variables available for
1955 ;;; displays a buffer listing names, values and documentation of options
1958 ;;; displays options and allows you to edit those list of options
1961 Try these options. If you are using edit-options to edit a variable,
1962 just point at the variable you wish to edit and use one of the following
1966 Set the value of the variable to t (non-nil).
1969 Set the value of the variable to nil.
1972 Move to the next variable.
1975 Move to the previous variable.
1977 There are some other options available to make the value of a
1978 variable local to a buffer and then to switch to its global value. You
1979 can also have a "local variables list" in a file which specifies the
1980 values to use for certain Emacs variables when you edit that file.
1981 *Note Variables: (xemacs)Variables, for information on these options.
1984 File: new-users-guide.info, Node: Init File, Prev: Setting Variables, Up: Other Customizations
1989 For customizing Emacs, you need to put Lisp expressions in your
1990 `init.el' file. The following are some useful Lisp expressions. If you
1991 find any of them useful, just type them in your `init.el' file:
1993 * The following expression will make <TAB> in C mode insert a real
1994 tab character if the cursor or point is in the middle of the line.
1995 Now hitting the <TAB> key will indent a line only if the cursor is
1996 at the left margin or in the line's indentation:
1998 (setq c-tab-always-indent nil)
2000 The value of the variable `c-tab-always-indent' is usually `t' for
2001 `true'. When this variable is true, then hitting the <TAB> key
2002 always indents the current line.
2004 * This expression will turn on the AUTO-FILL-MODE when you are in
2007 (setq text-mode-hook 'turn-on-auto-fill)
2009 This mode will automatically break lines when you type a space so
2010 that the lines don't become too long. The length of the lines is
2011 controlled by the variable `fill-column'. You can set this
2012 variable to a value you wish. Look at the documentation for this
2013 variable to see its default value. To change the value to 75 for
2016 (setq-default fill-column 75)
2018 This will change the value of this variable globally.
2020 * The following expression will enable the use of EVAL-EXPRESSION
2021 without confirmation:
2023 (put 'eval-expression 'disabled nil)
2025 Now when you use EVAL-EXPRESSION, it will print the value of the
2026 expression you specify in the "echo area" without confirming with
2029 * This expression will remove the binding of `C-x C-c', because its
2030 easy to hit this key by mistake and you will exit Emacs
2031 unintentionally. You can use the Exit Emacs option from the File
2034 (global-set-key "\C-x\C-c" nil)
2036 Now if you type `C-x C-c', you won't exit Emacs.
2038 * The following expression will make the <BACKSPACE> and the <DEL>
2039 key work in the same manner:
2041 (global-set-key 'backspace [delete])
2043 * This expression will make searches case sensitive:
2045 (setq-default case-fold-search nil)
2047 If we use "setq" instead of "setq-default" then searches will be
2048 case-sensitive only in the current buffer's local value. In this
2049 case the buffer would be the `init.el' file. Since this would not
2050 be too helpful and we want to have case-sensitive searches in all
2051 buffers, we have to use "setq-default".
2053 * This expression will enable the font-lock mode when you are using
2056 (add-hook 'texinfo-mode-hook 'turn-on-font-lock)
2058 *Note Minor Modes::, for information on font-lock mode.
2060 * Rebinds the key `C-x l' to run the function `make-symbolic-link':
2062 (global-set-key "\C-xl" 'make-symbolic-link)
2064 We use the single quote before "make-symbolic-link" because its a
2065 function name. You can also use the following expression which
2066 does the same thing:
2068 (define-key global-map "C-xl" 'make-symbolic-link)
2070 * The following expression will bind `C-x l' to run the function
2071 `make-symbolic-link' in C mode only:
2073 (define-key c-mode-map "C-xl" 'make-symbolic-link)
2075 Instead of binding `C-xl' to run `make-symbolic-link', you can
2076 bind the <F1> key to run this function:
2078 (define-key c-mode-map 'f1 'make-symbolic-link)
2080 Here, you have to use lower case for naming function keys like
2083 * You can bind the function `undo' i.e. `C-x u' to any key, for
2086 (global-set-key 'f2 'undo)
2088 * The following statement will display the current time in the
2089 modeline of the buffer:
2093 * This displays the current line number on which the cursor is
2094 present in the modeline:
2096 (setq line-number-mode t)
2098 * If you don't want the text to be highlighted when you use commands
2099 for marking regions so as to use the "kill" and "yank" commands
2100 later, you can use the following expression in your `init.el' file:
2102 (setq zmacs-regions nil)
2104 Now if you use a command like `C-x C-p' (`mark-page'), the text
2105 will not be highlighted.
2107 * To control the number of buffers listed when you select the Buffers
2108 menu, you need to set the variable `buffers-menu-max-size' to
2109 whatever value you wish. For example, if you want 20 buffers to be
2110 listed when you select Buffers use:
2112 (setq buffers-menu-max-size 20)
2114 * If you want the window title area to display the full
2115 directory/name of the current buffer's file, and not just the
2118 (setq frame-title-format "%S: %f")
2120 * To get rid of the menu, use :
2124 * If you want an extensive menu-bar use the following expression in
2125 your `init.el' file.
2127 (load "big-menubar")
2129 If you want to write your own menus, you can look at some of the
2131 `/usr/local/lib/xemacs/xemacs-packages/lisp/edit-utils/big-menubar.el'
2135 For more information on initializing your `init.el' file, *Note Init
2136 File: (xemacs)Init File. You should also look at
2137 `/usr/local/lib/xemacs-VERSION/etc/sample.init.el', which is a sample
2138 `init.el' file. It contains some of the commonly desired customizations
2142 File: new-users-guide.info, Node: Select and Move, Next: Search and Replace, Prev: Other Customizations, Up: Top
2144 Selecting and Moving Text
2145 *************************
2147 Many Emacs commands operate on an arbitrary contiguous part of the
2148 current buffer. You can select some part of the buffer and edit only
2149 that part of the buffer. This selected buffer is called a "region". You
2150 can select text in two ways:
2152 * You use special keys to select text by defining a region between
2153 the cursor and "the mark" (which you set).
2155 * If you are running XEmacs under X, you can also select text with
2160 * Selecting Text:: Select a region of text by setting the Mark
2161 * Mouse:: Selecting Text with Mouse
2162 * Region Operation:: Various ways to operate on a selected text
2163 * Moving Text:: Moving Text
2164 * Accumulating text:: Accumulating Text from several buffers
2167 File: new-users-guide.info, Node: Selecting Text, Next: Mouse, Prev: Select and Move, Up: Select and Move
2172 To define a region you need to set "the mark" at one end of it and move
2173 the cursor to the other end. Once you set the mark, it remains there
2174 until you set it again to some other place. Each buffer has its own
2175 "mark ring" (a place where Emacs remembers 16 previous locations of the
2176 mark). To set "the mark", you can use the following commands:
2179 This command will set "the mark" at the position of your cursor
2180 (`set-mark-command'). You can move your cursor around and "the
2181 mark" will stay there.
2184 Interchange mark and point (`exchange-point-and-mark'). Since Emacs
2185 will have only one cursor, after you move the cursor it will be
2186 unable to show you where you set the "the mark". In order to see
2187 "the mark" you can type the command `C-x C-x' which will put your
2188 cursor on the position of your mark and your mark on the position
2189 of your cursor. Use the command again to reset the positions of
2190 your cursor and mark.
2193 This command will push the mark at the beginning of the buffer
2194 without changing the position of your cursor.
2197 This command will push the mark at the end of the buffer without
2198 changing the position of your cursor.
2200 You can also give arguments to `C-<' or `C->'. *Note The Mark and the
2201 Region: (xemacs)The Mark and the Region, for more information.
2204 File: new-users-guide.info, Node: Mouse, Next: Region Operation, Prev: Selecting Text, Up: Select and Move
2206 Selecting Text with Mouse
2207 =========================
2209 If you are using XEmacs under X, you can use the mouse to select text.
2210 The selected text will always be highlighted, so just by looking at the
2211 text you know what you have selected so far. To select a word just
2212 double-click with the left-mouse-button on the word. To select a whole
2213 line triple-click anywhere on the line with the left-mouse-button. You
2214 can also use the Copy item from the Edit menu on the menu-bar to select
2215 text. This kind of selection is called Clipboard selection, *Note X
2216 Clipboard Selection: (xemacs)X Clipboard Selection, for more
2217 information. To select an arbitrary region, follow these steps:
2219 1. Move the mouse cursor over the character at the beginning of the
2220 region of text you want to select.
2222 2. Press and hold the left mouse button.
2224 3. While holding the left mouse button down, drag the cursor to the
2225 character at the end of the region of text you want to select.
2227 4. Release the left mouse button.
2228 The selected region of text is highlighted.
2230 *Note Selecting Text with the Mouse: (xemacs)Selecting Text with the
2231 Mouse, for more information regarding the Mouse and additional mouse
2235 File: new-users-guide.info, Node: Region Operation, Next: Moving Text, Prev: Mouse, Up: Select and Move
2237 Operating on the Region
2238 =======================
2240 Once you have selected a region you can do a lot of things to the text
2242 * Kill the text with `C-w'. For example if you want to kill a
2243 paragraph, position the cursor to the beginning of the paragraph
2244 and type `C-SPC'. Then go to the end of the paragraph and type
2245 `C-w'. The entire paragraph will be deleted. You can also select
2246 the text with a mouse and type `C-w' to kill the entire region.
2247 *Note Killing: (xemacs)Killing, for more information.
2249 * Save the text in a buffer or a file (*note Accumulating Text:
2250 (xemacs)Accumulating Text.).
2252 * You can convert the case of the text with `C-x C-l' or `C-x C-u'
2253 If you type `C-x C-u' the selected text will become all
2254 upper-case. If you type `C-x C-l' the selected text will become all
2257 * Print hardcopy with `M-x print-region'. *Note Hardcopy:
2258 (xemacs)Hardcopy, for more information. This command will print a
2259 hardcopy of only the selected text.
2261 * Indent it with `C-x <TAB>' or `C-M-\' *Note Indentation:
2262 (xemacs)Indentation, for more information.
2265 File: new-users-guide.info, Node: Moving Text, Next: Accumulating text, Prev: Region Operation, Up: Select and Move
2270 The most common way to move or copy text in Emacs is through "killing"
2271 or `cutting' it and then "yanking" or `pasting' it. You can also use
2272 the Cut or Copy option from the Edit menu for killing and copying
2273 respectively. *Note Edit menu::, for reviewing the commands for killing
2274 text. All the killed text in Emacs is recorded in the "kill ring".
2275 Since there is only one kill ring in Emacs, you can kill text in one
2276 buffer and yank it in another buffer. To `paste' or `yank' the killed
2277 text you can use the following commands:
2279 This command will yank or paste the last killed text (`yank').
2282 Save region as last killed text without actually killing it
2283 (`copy-region-as-kill'). You can use this command to copy a
2284 selected region and then yank (or paste) it without actually
2285 removing it from the buffer.
2288 Append next kill to last batch of killed text
2289 (`append-next-kill'). This command will append whatever you killed
2290 last to what you kill now. Then later you will be able to yank the
2291 entire appended text from the "kill ring".
2294 File: new-users-guide.info, Node: Accumulating text, Prev: Moving Text, Up: Select and Move
2299 The following commands can be used for accumulating text from different
2300 buffers into one place or for copying one region of text into many
2303 `M-x append-to-buffer'
2304 Append region to contents of specified buffer
2305 (`append-to-buffer'). After you type in this command and press
2306 <RET>, Emacs will prompt you for a buffer name. You will see a
2307 message in the echo area:
2308 Append to buffer: (default <buffer name>)
2310 After you type in a buffer name, a copy of the region will be
2311 inserted at the location of the cursor into that buffer. If there
2312 is no buffer with the name given by you, Emacs will create a new
2313 buffer with that name. By default the cursor's position in the
2314 <buffer name> is at the end.
2316 `M-x prepend-to-buffer'
2317 Prepend region to contents of specified buffer. This command is
2318 similar to the above command except that the cursor in the buffer
2319 (by default) is at the beginning rather than at the end.
2321 `M-x copy-to-buffer'
2322 Copy region into specified buffer, deleting that buffer's old
2323 contents. This command will also prompt you for a buffer name.
2326 Insert contents of specified buffer into current buffer at point.
2327 This command will prompt you for a buffer name which you want to
2328 be copied into the current buffer at the location of the cursor.
2330 `M-x append-to-file'
2331 This command will prompt you for a filename and append the region
2332 to the end of the contents of the specified file.
2334 *Note Accumulating Text: (xemacs)Accumulating Text, for more
2335 information regarding this topic.
2337 You can also use "rectangle commands" for operating on rectangular
2338 areas of text. *Note Rectangles: (xemacs)Rectangles, for more
2339 information regarding rectangle commands.
2341 Emacs also provides "registers" which serve as temporary storage for
2342 text or positions. Each register has a one character name and they can
2343 store "regions", a "rectangle", or a "mark" i.e. a cursor position.
2344 Whatever you store in register stays there until you store something
2345 else in that register. To find out about commands which manipulate
2346 registers *Note Registers: (xemacs)Registers.
2349 File: new-users-guide.info, Node: Search and Replace, Prev: Select and Move, Up: Top
2351 Searching and Replacing
2352 ***********************
2354 Emacs provides commands for searching for occurrences of a particular
2355 string. The search is incremental i.e. it begins even before you
2356 complete typing the whole string. All searches in Emacs ignore the case
2357 of the text they are searching, i.e. if you are searching for "String",
2358 then "string" will also be one of the selections. If you want a case
2359 sensitive search select the Case Sensitive Search from the Option menu.
2360 You can also set the variable `case-fold-search' to `nil' for making
2361 searches case-sensitive. For information on setting variables, *Note
2362 Setting Variables::. The two commands for searching for strings in
2366 This command will prompt you for a string to search :
2370 If you type "myname" as the string to be searched, then Emacs will
2371 start searching for "m", "my", "myn", etc as you go on typing the
2372 whole string in the forward direction. The cursor will be on the
2373 matching string which has been found so far. If you find the
2374 correct match just hit <RET> or type `C-f' or `C-b' to set the
2375 cursor's position. If you find a matching string "myname" but you
2376 were looking for a different occurrence of it, use `C-s' again. If
2377 the search is unable to find the string, it will give you an error
2381 This command will perform an incremental search in the backward
2382 direction. It will prompt you for a string name:
2386 After you start typing the string name, it will search for the
2387 string in the same fashion as it does for `C-s' except that it
2388 will search in the backward direction. If it cannot find the
2389 string name, it will give you an error message.
2391 If you make a mistake while typing the string names when you use the
2392 above commands, you can use the <DEL> key to erase characters. Each
2393 <DEL> will erase the last character. At any time if you want to quit
2394 the search, just type `C-g'.
2396 To do a non-incremental search i.e. to start the search only after
2397 you have typed the whole string you can use the following commands:
2399 `C-s RET "string" RET'
2400 This command will search for the specified string in the forward
2401 direction and will give an error message if the string is not
2404 `C-r RET "string" RET'
2405 This command will search for the specified string in the backward
2408 For information on how Emacs searches for words and regular
2409 expressions, *Note Search: (xemacs)Search.
2411 To replace all occurrences of a string in Emacs, you can use the
2415 After you type `M-x replace-string', you will be prompted for a string
2420 After you type in a string name, for example "FOO" and press <RET>, you
2421 will see another prompt:
2423 Replace string FOO with:
2425 Now type the string which you want to replace "FOO" with and press
2426 <RET>. After all the occurrences are replaced you will see the message
2427 "Done" in the echo area. If you want only some occurrences of the
2428 string to be replaced, use `M-x query-replace RET <string> RET
2429 <newstring> RET'. For more information, *Note Query Replace:
2430 (xemacs)Query Replace.
2432 XEmacs also provides a utility for checking spellings. Use `M-x
2433 ispell-buffer' to check for spellings in the whole buffer. You can also
2434 check the spelling of a word or a region. You can use menus to check
2437 Evaluate the expression `(load "big-menubar")'. To evaluate this
2438 expression you need to hit the <META> or the <ESC> key twice and type
2439 in the expression in the echo area before hitting <RET>. You will get
2440 an extensive menubar. Select the Spell Check menu item from the
2441 Utilities menu for checking spellings.
2444 File: new-users-guide.info, Node: Key Index, Next: Command Index, Prev: Intro, Up: Top
2446 Key (Character) Index
2447 *********************
2451 * C-<: Selecting Text.
2452 * C->: Selecting Text.
2453 * C-a: Cursor Position.
2454 * C-b: Cursor Position.
2456 * C-e: Cursor Position.
2457 * C-fx: Cursor Position.
2458 * C-g: The Help Menu.
2459 * C-h d: The Help Menu.
2460 * C-h k: The Help Menu.
2463 * C-M-\: Region Operation.
2464 * C-n: Cursor Position.
2465 * C-p: Cursor Position.
2466 * C-r: Search and Replace.
2467 * C-s: Search and Replace.
2468 * C-SPC <1>: Region Operation.
2469 * C-SPC: Selecting Text.
2470 * C-t: Cursor Position.
2471 * C-u: Numeric Argument.
2472 * C-v: Cursor Position.
2473 * C-w: Region Operation.
2474 * C-x 0: XEmacs Window.
2475 * C-x 1: XEmacs Window.
2476 * C-x 2: XEmacs Window.
2477 * C-x 3: XEmacs Window.
2478 * C-x 4: XEmacs Window.
2479 * C-x 4 b: XEmacs Window.
2480 * C-x 4 d: XEmacs Window.
2481 * C-x 4 f: XEmacs Window.
2482 * C-x 4 m: XEmacs Window.
2483 * C-x 5 C-f: Visiting.
2485 * C-x C-f: Visiting.
2486 * C-x C-l: Region Operation.
2487 * C-x C-s: Saving Files.
2488 * C-x C-u: Region Operation.
2489 * C-x C-v: Visiting.
2490 * C-x C-w: Saving Files.
2491 * C-x C-x: Selecting Text.
2492 * C-x s: Saving Files.
2493 * C-x TAB: Region Operation.
2498 * M--: Numeric Argument.
2499 * M-<: Cursor Position.
2500 * M->: Cursor Position.
2501 * M-C-v: XEmacs Window.
2505 * M-v: Cursor Position.
2510 File: new-users-guide.info, Node: Command Index, Next: Variable Index, Prev: Key Index, Up: Top
2512 Command and Function Index
2513 **************************
2517 * add-menu-item: Customizing Menus.
2518 * append-to-buffer: Accumulating text.
2519 * append-to-file: Accumulating text.
2520 * auto-fill-mode <1>: Minor Modes.
2521 * auto-fill-mode: Insert.
2522 * backward-char: Cursor Position.
2523 * backward-kill-word: Erase.
2524 * backward-word: Cursor Position.
2525 * beginning-of-buffer: Cursor Position.
2526 * beginning-of-line: Cursor Position.
2527 * copy-to-buffer: Accumulating text.
2528 * delete-backward-char: Erase.
2529 * delete-char: Erase.
2530 * delete-menu-item: Customizing Menus.
2531 * delete-other-windows <1>: XEmacs Window.
2532 * delete-other-windows: Windows and Menus.
2533 * delete-window <1>: XEmacs Window.
2534 * delete-window: Windows and Menus.
2535 * describe-variable: Setting Variables.
2536 * dired-other-window: XEmacs Window.
2537 * disable-menu-item: Customizing Menus.
2538 * edit-options: Setting Variables.
2539 * enable-menu-item: Customizing Menus.
2540 * end-of-buffer: Cursor Position.
2541 * end-of-line: Cursor Position.
2542 * eval-expression: Init File.
2543 * eval-region: Customization Basics.
2544 * exchange-point-and-mark: Selecting Text.
2545 * find-alternate-file: Visiting.
2546 * find-file: Visiting.
2547 * find-file-other-frame: Visiting.
2548 * find-file-other-window: XEmacs Window.
2549 * forward-char: Cursor Position.
2550 * forward-word: Cursor Position.
2551 * goto-char: Cursor Position.
2552 * goto-line: Cursor Position.
2553 * help-with-tutorial: Edit.
2554 * isearch-backward: Search and Replace.
2555 * isearch-forward: Search and Replace.
2557 * kill-sentence: Erase.
2559 * list-options: Setting Variables.
2560 * mail-other-window: XEmacs Window.
2561 * make-directory: File Names.
2562 * make-symbolic-link: Customizing key Bindings.
2563 * mark-beginning-of-buffer: Selecting Text.
2564 * mark-end-of-buffer: Selecting Text.
2565 * next-line: Cursor Position.
2566 * prepend-to-buffer: Accumulating text.
2567 * previous-line: Cursor Position.
2568 * print-region: Region Operation.
2569 * relabel-menu-items: Customizing Menus.
2570 * remove-directory: File Names.
2571 * replace-string: Search and Replace.
2572 * save-buffer: Saving Files.
2573 * save-buffers-kill-emacs: Exiting.
2574 * save-some-buffers: Saving Files.
2575 * scroll-other-window <1>: XEmacs Window.
2576 * scroll-other-window: Windows and Menus.
2577 * set-mark-command: Selecting Text.
2578 * set-variable: Setting Variables.
2579 * split-window-horizontally: XEmacs Window.
2580 * split-window-vertically: XEmacs Window.
2581 * suspend-emacs: Exiting.
2582 * switch-to-buffer-other-window: XEmacs Window.
2583 * transpose-chars: Cursor Position.
2584 * write file: Saving Files.
2585 * yank: Moving Text.
2586 * zap-to-char: Erase.
2589 File: new-users-guide.info, Node: Variable Index, Next: Concept Index, Prev: Command Index, Up: Top
2596 * buffers-menu-max-size: Init File.
2597 * case-fold-search: Search and Replace.
2598 * default-directory: File Names.
2599 * display-time: Init File.
2600 * fill-column: Init File.
2601 * frame-title-format: Init File.
2602 * make-backup-files: Saving Files.
2603 * zmacs-regions: Init File.
2606 File: new-users-guide.info, Node: Concept Index, Next: Entering, Prev: Variable Index, Up: Top
2613 * abbrev-mode: Minor Modes.
2614 * accumulating text: Accumulating text.
2615 * add menus: Customizing Menus.
2616 * asm-mode: Major Modes.
2617 * Auto Delete Selection menu item: Options Menu.
2618 * auto saving: Saving Files.
2619 * auto-save-mode: Minor Modes.
2620 * binding keys: Customizing key Bindings.
2621 * blink-paren: Minor Modes.
2623 * Buffers menu: Buffers Menu.
2624 * Buffers Menu Length... menu item: Options Menu.
2625 * Buffers Sub-Menus menu item: Options Menu.
2626 * c-mode: Major Modes.
2627 * Case Sensitive Search menu item: Options Menu.
2628 * Clear menu item: Edit menu.
2629 * clipboard selection: Mouse.
2630 * Copy menu item: Edit menu.
2631 * copying text: Accumulating text.
2632 * creating-directories: File Names.
2633 * cursor control: Cursor Position.
2634 * cursor position: Cursor Position.
2635 * cursor shapes: Mouse.
2636 * customize <1>: Other Customizations.
2637 * customize: Customization Basics.
2638 * customize menus: Customizing Menus.
2639 * Cut menu item: Edit menu.
2640 * Delete Frame menu item: File menu.
2641 * delete menus: Customizing Menus.
2643 * deleting menu items: Customizing Menus.
2645 * digit argument: Numeric Argument.
2646 * disable menus: Customizing Menus.
2647 * disabling menu items: Customizing Menus.
2648 * displaying time: Init File.
2649 * echo area: Echo Area.
2650 * edit-picture: Major Modes.
2651 * enabling menu items: Customizing Menus.
2652 * End Macro Recording menu item: Edit menu.
2653 * entering Emacs: Enter.
2654 * entering XEmacs: Enter.
2656 * Execute Last Macro menu item: Edit menu.
2657 * Exit Emacs menu item: File menu.
2660 * File menu: File menu.
2661 * file names: File Names.
2663 * Font menu item: Options Menu.
2664 * font-lock-mode <1>: Other Customizations.
2665 * font-lock-mode: Minor Modes.
2666 * fortran-mode: Major Modes.
2667 * fundamental-mode: Major Modes.
2668 * goto-line: Cursor Position.
2669 * help <1>: The Help Menu.
2671 * Help menu: Help menu.
2672 * hook: Other Customizations.
2673 * init file examples: Init File.
2674 * init.el: Customization Basics.
2675 * Insert File... menu item: File menu.
2676 * insertion: Insert.
2677 * key bindings: Customizing key Bindings.
2678 * keystrokes: Customizing key Bindings.
2679 * Kill Buffer menu item: File menu.
2680 * kill ring: Moving Text.
2681 * killing: Moving Text.
2682 * killing Emacs: Exiting.
2683 * line-number-mode: Minor Modes.
2684 * lisp-mode: Major Modes.
2685 * major modes: Major Modes.
2686 * mark: Select and Move.
2687 * menus: XEmacs Window.
2688 * minor modes: Minor Modes.
2689 * mistakes, correcting: Undo.
2690 * mode line: Mode Line.
2692 * mouse selection: Mouse.
2693 * moving text: Moving Text.
2694 * negative argument: Numeric Argument.
2695 * New Frame menu item: File menu.
2697 * nroff-mode: Major Modes.
2698 * numeric argument: Numeric Argument.
2699 * Open ... menu item: File menu.
2700 * open another file: Frame.
2701 * Open in New Frame... menu item: File menu.
2702 * Options menu: Options Menu.
2703 * outline-mode: Major Modes.
2704 * overstrike: Insert.
2705 * Overstrike menu item: Options Menu.
2706 * overwrite-mode: Minor Modes.
2707 * Paren Highlighting menu item: Options Menu.
2708 * Paste menu item: Edit menu.
2709 * pasting: Moving Text.
2710 * primary selection: Mouse.
2711 * Print Buffer menu item: File menu.
2712 * pull-down-menus: XEmacs Window.
2713 * Read Only menu item: Options Menu.
2714 * rectangle commands: Accumulating text.
2715 * region: Select and Move.
2716 * registers: Accumulating text.
2717 * relabelling menu items: Customizing Menus.
2718 * removing-directories: File Names.
2719 * replace: Search and Replace.
2720 * Revert Buffer menu item: File menu.
2721 * Save Buffer As ... menu item: File menu.
2722 * Save Buffer menu item: File menu.
2723 * Save Options: Options Menu.
2724 * saving files: Saving Files.
2725 * searching: Search and Replace.
2726 * selected window: Windows and Menus.
2727 * setting variables: Setting Variables.
2728 * shrinking XEmacs frame: Exiting.
2729 * simultaneous editing: Saving Files.
2730 * Size menu item: Options Menu.
2731 * Split Frame: File menu.
2732 * Start Macro Recording menu item: Edit menu.
2733 * suspending: Exiting.
2734 * Syntax Highlighting menu item: Options Menu.
2735 * Teach Extended Commands menu item: Options Menu.
2736 * temporary storage: Accumulating text.
2737 * tex-mode: Major Modes.
2738 * texinfo-mode: Major Modes.
2739 * top level: Mode Line.
2740 * Un-split (Keep Others): File menu.
2741 * Un-split (Keep This): File menu.
2743 * Undo menu item: Edit menu.
2744 * visiting files: Visiting.
2745 * Weight menu item: Options Menu.
2746 * windows <1>: XEmacs Window.
2747 * windows <2>: Windows and Menus.
2748 * windows: Entering.
2749 * yanking: Moving Text.
2756 Node: Entering
\7f7190
2759 Node: Exiting
\7f11046
2760 Node: Mode Line
\7f12243
2761 Node: Echo Area
\7f14387
2762 Node: Windows and Menus
\7f15739
2763 Node: XEmacs Window
\7f16189
2764 Node: Pull-down Menus
\7f19807
2765 Node: File menu
\7f20683
2766 Node: Edit menu
\7f23940
2767 Node: Options Menu
\7f26463
2768 Node: Buffers Menu
\7f31245
2769 Node: Help menu
\7f31628
2771 Node: Insert
\7f33714
2772 Node: Cursor Position
\7f35039
2774 Node: Numeric Argument
\7f38262
2776 Node: Customization Basics
\7f40203
2777 Node: Customizing key Bindings
\7f41472
2778 Node: Customizing Menus
\7f44964
2780 Node: The Help Menu
\7f51136
2782 Node: Major Modes
\7f57013
2783 Node: Minor Modes
\7f60962
2785 Node: File Names
\7f65775
2786 Node: Visiting
\7f67577
2787 Node: Saving Files
\7f69698
2788 Node: Other Customizations
\7f73076
2789 Node: Setting Variables
\7f75557
2790 Node: Init File
\7f78767
2791 Node: Select and Move
\7f84270
2792 Node: Selecting Text
\7f85221
2794 Node: Region Operation
\7f88053
2795 Node: Moving Text
\7f89310
2796 Node: Accumulating text
\7f90547
2797 Node: Search and Replace
\7f92865
2798 Node: Key Index
\7f96730
2799 Node: Command Index
\7f100019
2800 Node: Variable Index
\7f104121
2801 Node: Concept Index
\7f104698