1 This is ../info/new-users-guide.info, produced by makeinfo version 4.8
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 1 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 2 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.
443 You can select a buffer in another window by using some other
444 commands. These commands all have a prefix key `C-x 4'
445 `C-x 4 b BUFNAME <RET>'
446 This command will select a buffer BUFNAME in another window. This
447 runs `switch-to-buffer-other-window'. It will prompt you for a
450 `C-x 4 f FILENAME <RET>'
451 Visit file FILENAME and select its buffer in another window. This
452 runs `find-file-other-window'. *Note Visiting: (xemacs)Visiting.
453 It will prompt you for a filename.
455 `C-x 4 d DIRECTORY <RET>'
456 Select a Dired buffer for directory DIRECTORY in another window.
457 This runs `dired-other-window'. *Note Dired: (xemacs)Dired.
460 Start composing a mail message in another window. This runs
461 `mail-other-window', and its same-window version is `C-x m'.
462 *Note Sending Mail: (xemacs)Sending Mail, for information on how
463 to Send Mail using XEmacs. *Note Reading Mail With Rmail:
464 (xemacs)Reading Mail With Rmail, for information on reading mail
467 If you click the right button on the mouse on a mode line, you will
468 get a menu with following options:
470 Choosing this menu will remove the window above this modeline from
474 Delete all windows on the frame except for the one above this
478 Split the window above the mode line in half, creating another
481 Split Window Horizontally
482 Split the window above the mode line in half horizontally, so that
483 there will be two windows side-by-side.
486 Readjust the sizes of all windows on the frame until all windows
487 have roughly the same number of lines.
490 File: new-users-guide.info, Node: Pull-down Menus, Prev: XEmacs Window, Up: Windows and Menus
492 2.2 XEmacs Pull-down Menus
493 ==========================
495 When you run XEmacs under X, each Emacs frame has a menu-bar at the top
496 which provides commands for editing, help and other options. All these
497 options are also available via key commands, the menus just provide
498 convenient short-cuts. The key commands are displayed right besides
499 some of the options. The following is a brief description of the four
500 default menus on the menu bar:
504 * File menu:: Items on the File menu
505 * Edit menu:: Items on the Edit menu
506 * Options Menu:: Items on the Options Menu
507 * Buffers Menu:: Items on the Buffers Menu
508 * Help menu:: The Help Menu at the extreme right on
512 File: new-users-guide.info, Node: File menu, Next: Edit menu, Prev: Pull-down Menus, Up: Pull-down Menus
517 The File menu bar contains the following items. To choose a particular
518 option, press the left mouse button and drag it to the item you wish to
519 select. Then release the button.
522 This option will prompt you for a file name. You will get a
523 message in the echo area:
526 After Find File, there might be a directory path also. After you
527 type the file name and press <RET> the file will be loaded into a
531 It prompts you for a file name and loads that file in a new buffer
532 in a new frame. You can open many frames for the same Emacs
533 session. You can delete the frame by selecting Delete Frame.
536 Prompts you for a filename and inserts the contents of this
537 filename in your current buffer. Position your cursor at the place
538 you wish to insert the file and select this option. You will get
539 the following message in the echo area:
542 Insert the file name and press <RET>.
545 It saves the changes you have made to the buffer. If you have made
546 changes which are not saved yet, the option will appear dark,
547 otherwise it will be light and unselectable. If you do not wish to
548 save the changes, select Revert Buffer.
551 Prompts you for a filename and saves the current buffer in that
552 file. It loads the new file if the filename you specify is
553 different from the one you were working with.
555 Print Buffer <buffername>
556 Prints a hardcopy of the current or "selected" buffer.
559 Opens a new frame with *scratch* as the default buffer. It doesn't
560 prompt you for a filename. To open a file you need to go to that
561 frame and select Open...
564 Splits the current window into two equal-sized windows with the
565 same buffer. To get back a single frame, select Un-Split (Keep
566 This). *Note XEmacs Window::, for more information about windows.
569 If the frame contains multiple windows, it will remove all windows
570 except the selected one.
572 Un-Split (Keep Others)
573 If the frame contains multiple windows, it will remove the selected
574 window and keep the other one.
576 Revert Buffer <buffername>
577 If you do not wish to save the changes you made to the file since
578 you opened it, select this option. It will restore the last saved
579 version of the file to the current buffer.
581 Kill Buffer <buffername>
582 It will kill the current buffer. If will prompt you if there are
586 It will kill the Emacs "process" as opposed to simply killing the
587 "buffer". Before it kills the process, it will prompt you as to
588 which unsaved buffers you wish to save by going through the list
594 * Edit menu:: Items on the Edit Menu
595 * Options Menu:: Items on the Options Menu
596 * Buffers Menu:: Items on the Buffers Menu
597 * Help menu:: The Help Menu at the extreme right on
601 File: new-users-guide.info, Node: Edit menu, Next: Options Menu, Prev: File menu, Up: Pull-down Menus
606 Most of the commands in this menu work on a block of text or a selected
607 region. The text will be highlighted as you select it.
609 Undoes the previous command. If you type something by mistake you
610 can use this command. For example, if you select Insert File...
611 from the File menu and insert a wrong file by mistake, you can
612 select this item and it will remove the inserted file. It undoes a
613 batch of text which is worth an emacs command.
616 Removes the selected text block from the current buffer, makes it
617 the X clipboard selection, and places it in the kill ring (*note
618 Moving Text::). Before executing this command, you have to select
619 a region using Emacs region selection commands or with the mouse.
620 *Note Selecting Text::.
623 Makes a selected text block the X clipboard selection, and places
624 it in the kill ring. You can select text using one of the Emacs
625 region selection commands or by selecting a text region with the
626 mouse. *Note Selecting Text::, for more information.
629 Inserts the current value of the X clipboard selection in the
630 current buffer. Note that this is not necessarily the same as the
631 Emacs `yank' command, because the Emacs kill ring and the X
632 clipboard selection are not the same thing. You can paste in text
633 you have placed in the clipboard using Copy or Cut. You can also
634 use Paste to insert text that was pasted into the clipboard from
635 other applications. *Note X Clipboard Selection: (xemacs)X
636 Clipboard Selection, for information on using Clipboard Selection.
639 Removes the selected text block from the current buffer but does
640 not place it in the kill ring or the X clipboard selection. You
641 will not be able to get this text back.
643 Start Macro Recording
644 After selecting this, Emacs will remember every keystroke you type
645 until End Macro Recording is selected.
648 Selecting this tells emacs to stop remembering your keystrokes.
651 Selecting this item will cause emacs to re-interpret all of the
652 keystrokes which were saved between selections of the Start Macro
653 Recording and End Macro Recording menu items. You can now execute
654 the most recent keyboard macro. *Note Keyboard Macros:
655 (xemacs)Keyboard Macros, for further information.
658 File: new-users-guide.info, Node: Options Menu, Next: Buffers Menu, Prev: Edit menu, Up: Pull-down Menus
660 2.2.3 The Options Menu
661 ----------------------
663 There are sub-menus for some of the menus which you will need to
664 select. If sub-menus exist for an item, they will be displayed
665 automatically when you drag the mouse on that item. The items in this
666 menu provide some fancy editing operations.
669 Selecting this item will cause the buffer to visit the file in a
670 read-only mode. Changes to the file will not be allowed.
672 Case Sensitive Search
673 Selecting this item will cause searches to be case-sensitive. If
674 its not selected then searches will ignore case. This option is
675 local to the buffer. For example, if this item is selected and you
676 are searching for `Smile', then an occurrence of `smile' will not
677 be recognized because of the smaller case of `s'.
680 After selecting this item, when you type letters they will replace
681 existing text on a one-to-one basis, rather than pushing it to the
682 right. At the end of a line, such characters extend the line.
683 Before a tab, such characters insert until the tab is filled in.
685 Auto Delete Selection
686 Selecting this item will cause automatic deletion of the selected
687 region. After you select a region and hit the <RET> key, the
688 selected text will be deleted. The typed text will replace the
689 selection if the selection is active (i.e. if its highlighted). If
690 the option is not selected then the typed text is just inserted at
693 Teach Extended Commands
694 After you select this item, any time you execute a command with
695 `M-x' which has a shorter keybinding, you will be shown the
696 alternate binding before the command executes. For example if you
697 type `M-x find-file-other-window' which performs the same function
698 as the Open in Other Window... in File menu you will see the
701 M-x find-file-other-window (bound to keys: C-x 4 f, C-x 4 C-f)
704 You can customize your `init.el' file to include the font-lock mode
705 so that when you select this item, the comments will be displayed
706 in one face, strings in another, reserved words in another, and so
707 on. *Note Customization: (xemacs)Customization, for more
708 information on customizing `init.el' file. After selecting this
709 item, you will find your code a lot easier to read. When Fonts is
710 selected, different parts of the program will appear in different
711 Fonts. When Colors is selected, then the program will be displayed
712 in different colors. Selecting None causes the program to appear in
713 just one Font and Color. Selecting Less resets the Fonts and Colors
714 to a fast, minimal set of decorations. Selecting More resets the
715 Fonts and Colors to a larger set of decorations. For example, if
716 Less is selected (which is the default setting) then you might have
717 all comments in green color. It does not matter what the comments
718 contain. Whereas, if More is selected then a function name in the
719 comments themselves might appear in a different Color or Font. Even
720 though the comments themselves might appear in green color, a
721 function name "within" the comments might appear in red color.
724 After selecting Blink from this item, if you place the cursor on a
725 parenthesis, the matching parenthesis will blink. If you select
726 Highlight and place the cursor on a parenthesis, the whole
727 expression of the parenthesis under the cursor will be highlighted.
728 Selecting None will turn off the options (regarding Paren
729 Highlighting) which you had selected earlier.
732 You can select any Font for your program by choosing from one of
733 the available Fonts. The whole buffer will be converted to the
737 You can select any size for the text in your buffer (ranging from
738 2 to 24) by selecting the appropriate option.
741 You can choose either Bold or Medium for the weight of the text of
744 Buffers Menu Length...
745 Prompts you for the number of buffers to display. Then it will
746 display that number of most recently selected buffers.
749 After selection of this item the Buffers menu will contain several
750 commands, as submenus of each buffer line. If this item is
751 unselected, then there are no submenus for each buffer line, the
752 only command available will be selecting that buffer.
755 Selecting this item will save the current settings of your Options
756 menu to your `init.el' file so that the next time you start XEmacs,
757 you won't need to select the options again.
760 File: new-users-guide.info, Node: Buffers Menu, Next: Help menu, Prev: Options Menu, Up: Pull-down Menus
762 2.2.4 The Buffers Menu
763 ----------------------
765 The Buffers menu provides a selection of up to ten buffers and the item
766 List All Buffers, which provides a Buffer List. If you select Buffers
767 Sub-menus from the Options menu, you will get some sub-menus for each
768 of the buffer listing.
771 File: new-users-guide.info, Node: Help menu, Prev: Buffers Menu, Up: Pull-down Menus
776 The Help Menu gives you access to Emacs Info and provides a menu
777 equivalent for some of the choices you have when using `C-h'. *Note
778 Help::, for more information.
780 The Describe variable and Describe function will provide
781 documentation for the corresponding variable or function. The Help menu
782 also gives access to UNIX online manual pages via the UNIX Manual...
786 File: new-users-guide.info, Node: Edit, Next: Customization Basics, Prev: Windows and Menus, Up: Top
788 3 Basic Editing Commands
789 ************************
791 This chapter will introduce you to some basic editing commands. You can
792 also learn the basic editing commands by typing `Control-h t'
793 (`help-with-tutorial' OR by selecting Emacs Tutorial from the Help menu
794 on the menu bar. Most of the Emacs commands will use the <CONTROL> key
795 or the <META> key. The following abbreviations will be used for the
796 <CONTROL> and <META> key in this manual:
799 This means that you should hold down the <CONTROL> key while typing
800 `<chr>'. For example, if the command is `C-g', you should hold the
801 <CONTROL> key and type <g>.
804 This means that you should hold down the `META' key while typing
805 `<chr>'. If there is no `META' key on your keyboard, use the `ESC'
806 key instead. For example, if the command is `M-x', then type
807 `ESC', release it and type `x'.
809 The following abbreviations will be used for some other keys:
831 * Insert:: Insert text in Emacs by simply typing at
833 * Cursor Position:: Moving Around the cursor in the buffer,
834 * Erase:: Different commands for erasing text
835 * Numeric Argument:: Giving Numeric Arguments to commands
836 * Undo:: Undoing Changes made by mistake
839 File: new-users-guide.info, Node: Insert, Next: Cursor Position, Prev: Edit, Up: Edit
844 To insert printing characters into the text you are editing, just type
845 them. Emacs will automatically insert the characters that you type into
846 the buffer at the cursor. The cursor moves forward, but if you prefer
847 to have text characters replace (overwrite) existing text characters,
848 you can enable the Overstrike option from the Options menu in the menu
851 To "delete" text you have just inserted, use <DEL>. <DEL> deletes
852 the character BEFORE the cursor (not the one that the cursor is on top
853 of or under; that is the character AFTER the cursor). The cursor and
854 all characters after it move backwards. Therefore, if you type a
855 printing character and then type <DEL>, they cancel out.
857 To end a line and start typing a new one, type <RET>. This inserts
858 a newline character in the buffer. If point is in the middle of a
859 line, <RET> splits the line. Typing <DEL> when the cursor is at the
860 beginning of a line rubs out the newline before the line, thus joining
861 the line with the preceding line.
863 Emacs automatically splits lines when they become too long, if you
864 turn on a special mode called "Auto Fill" mode. *Note Filling:
865 (xemacs)Filling, for information on using Auto Fill mode.
868 File: new-users-guide.info, Node: Cursor Position, Next: Erase, Prev: Insert, Up: Edit
873 The following commands will allow you to move the cursor around the
874 screen. The actual function names corresponding to these commands are
875 given in parenthesis. You can also invoke these commands by typing `M-x
876 <function name>'. You can do this for any command in XEmacs.
879 Move the cursor backward one character (`backward-char').
882 Move the cursor forward one character (`forward-char').
885 Move the cursor up one line vertically (`previous-line').
888 Move the cursor down one line vertically (`next-line').
891 Move the cursor to the beginning of the line (`beginning-of-line').
894 Move the cursor to the end of the line (`end-of-line').
897 Move the cursor forward one word (`forward-word').
900 Move the cursor backward one word (`backward-word').
903 Move the cursor to the top of the buffer (`beginning-of-buffer').
906 Move the cursor to the end of the buffer (`end-of-buffer').
908 `M-x goto-char RET <number> RET'
909 To enable this command type `M-x goto-char', and hit <RETURN> key.
910 In the "echo area" you will see:
914 You should then type in a number right after the colon and hit the
915 `RETURN' key again. After reading a number N this command will
916 move the cursor to character number N. Position 1 is the
917 beginning of the buffer. For example, if you type `M-x goto-char
918 RET 200 RET', then the cursor will move to the 200th character
919 starting from the beginning of the buffer.
921 `M-x goto-line RET <number> RET'
922 To enable this command type `M-x goto-line', and hit the <RETURN>
923 key. After you see `Goto line:' in the "echo area", type in a
924 number N and hit <RETURN> key again. This command will position
925 the cursor on the nth line starting from the beginning of the
929 This command will display the current line number in the echo area.
933 File: new-users-guide.info, Node: Erase, Next: Numeric Argument, Prev: Cursor Position, Up: Edit
939 If you press <DEL> i.e. the "delete" key, it will delete the
940 character before the cursor (`delete-backward-char').
943 This will delete the character after the cursor (`delete-char').
946 Kill to the end of the line (`kill-line'). If you kill the line by
947 mistake you can "yank" or `paste' it back by typing `C-y'. *Note
948 Moving Text::, for more information on yanking.
951 Kill forward to the end of the next word (`kill-word').
954 Kill back to the beginning of the previous word
955 (`backward-kill-word').
958 Kill to the end of current sentence (`kill-sentence').
961 Kill up to next occurrence of CHAR (`zap-to-char'). To use this
962 command type `M-z'. You will see the following statement in the
967 Type any char and press the <RET> key. For example, if you type
968 `p' then the entire text starting from the position of the cursor
969 until the first occurrence of `p' is killed.
972 File: new-users-guide.info, Node: Numeric Argument, Next: Undo, Prev: Erase, Up: Edit
974 3.4 Giving Numeric Arguments
975 ============================
977 Any Emacs command can be given a "numeric argument". Some commands
978 interpret the argument as a repetition count. For example, if you want
979 to move forward ten characters, you could type `C-f' ten times.
980 However, a more efficient way to do this would be to give an argument
981 of ten to the key `C-f' (the command `forward-char', move forward one
982 character). Negative arguments are also allowed. Often they tell a
983 command to move or act backwards. For example, if you want to move down
984 ten lines, type the following:
986 After you press <RET> key, the cursor will move ten lines downward.
989 Both `C-u' and `M-' allow you to give numeric arguments. If you want
990 to move ten lines backward, you can also give negative arguments, like:
992 OR you could also type:
994 You can obviously use `C-b' to move backward rather than giving
995 negative arguments to `C-n'. *Note Numeric Arguments: (xemacs)Numeric
996 Arguments, for more information on numeric arguments.
999 File: new-users-guide.info, Node: Undo, Prev: Numeric Argument, Up: Edit
1004 When you are editing a buffer, you might type something by mistake.
1005 Emacs allows you to undo all changes you make to a buffer (but not more
1006 than 8000 characters). Each buffer in Emacs keeps a record of the
1007 changes made to it individually, so the undo command applies to the
1008 current buffer. There are two undo commands:
1011 Undo one batch of changes (usually, one command's worth).
1015 The same as above, but this command might not be obvious to type
1016 on some keyboards so it might be better to use the above command.
1018 *Note Undoing Changes: (xemacs)Undoing Changes, for more information
1022 File: new-users-guide.info, Node: Customization Basics, Next: Help, Prev: Edit, Up: Top
1024 4 Customize key bindings and menus
1025 **********************************
1027 When you start Emacs, it reads the file `~/.xemacs/init.el' in the
1028 `.xemacs/' subdirectory of your home directory. You can use this file
1029 to initialize and customize Emacs to your liking. This file should
1030 contain lisp-code. You can customize your `init.el' file to create new
1031 menus, disable menus, change key bindings, enable a minor mode, etc.
1032 Any kind of customization affects only a particular Emacs job that you
1033 do them in. If you want to save your customizations `permanently' i.e.
1034 for future use also, you have to put it in your `init.el' file. After
1035 you make changes to your `init.el' file and save it, the changes will
1036 be effective only after you start Emacs again i.e. for a new Emacs
1037 process. To try out some of the examples in this section, highlight
1038 that region and evaluate the region by giving the command `M-x
1039 eval-region'. You will be able to see the results of your
1040 customizations in that Emacs session only (*note Lisp Eval:
1041 (xemacs)Lisp Eval.).
1045 * Customizing key Bindings:: Changing Key Bindings
1046 * Customizing Menus:: Adding, Deleting, Enabling and Disabling Menus
1049 File: new-users-guide.info, Node: Customizing key Bindings, Next: Customizing Menus, Prev: Customization Basics, Up: Customization Basics
1051 4.1 Customize key bindings
1052 ==========================
1054 Most of Emacs commands use key sequences. *Note Keystrokes:
1055 (xemacs)Keystrokes, for more information about Keys and Commands. In
1056 Emacs, the keys themselves carry no meaning unless they are bound to a
1057 function. For example, `C-n' moves the cursor to the next line because
1058 its bound to the function next-line. Similarly, `C-p' moves to the
1059 previous line because its bound to the function previous-line. The
1060 functions themselves define a particular behavior. You can customize
1061 the key `C-n' to move to the previous line by binding it to
1062 previous-line and `C-p' to move to the next line by binding it to
1063 next-line. To bind keys to globally run commands you need to use the
1064 following syntax in your init.el file:
1066 `(global-set-key KEYS CMD)'
1067 Here, `global-set-key' is a function which will bind the "keys" to
1068 the specified "cmd". For example, if you type the following in your
1071 (global-set-key "\C-p" 'next-line)
1072 (global-set-key "\C-n" 'previous-line)
1074 then `C-p' will move to the next line and `C-n' to the previous line.
1076 You can also disable a key binding, by using `nil' as the CMD in the
1077 syntax stated above. Here, `nil' stands for `false' which means disable
1078 a command or turn off a feature. If you want to enable a command or
1079 turn on a particular feature use `t' which stands for `true'. For
1080 example, if you do not wish `C-x C-c' to `Exit Emacs' you can type the
1081 following expression in your `init.el' file:
1083 (global-set-key "\C-x\C-c" nil)
1085 You might want to have this statement in your `init.el' file because
1086 its easy to hit this command by mistake and it could be annoying to exit
1087 Emacs unintentionally. There is an Exit Emacs option in the File menu
1088 which you might want to use instead. To make a particular key undefined
1091 (global-unset-key "\C-x\C-c")
1093 Now if you use the command `C-x C-c', you will get an error saying that
1094 the command is undefined.
1096 Some other customizations you could try are:
1097 * (global-set-key 'button3 'beginning-of-buffer)
1099 Now when you press the third button of your mouse, the cursor will
1100 be placed at the `beginning-of-buffer'.
1102 * (global-set-key 'f1 'goto-line)
1104 If you press the <F1> key, you will be prompted for a line number.
1105 After you type the line number and hit <RET>, the cursor will be
1106 placed on that line number.
1108 * (global-set-key 'f2 'undo)
1110 Pressing <F2> will undo the last command. If you have a <undo> key
1111 on your keyboard, try binding that key to the undo command.
1113 Another syntax for customizing key bindings is: `(define-key KEYMAP
1114 KEYS DEF)' It defines KEYS to run DEF in the keymap KEYMAP.
1116 KEYMAP is a keymap object which records the bindings of keys to the
1117 commands that they run.
1119 KEYS is the sequence of keystrokes to bind.
1121 DEF is anything that can be a key's definition:
1123 Look at the following two examples:
1125 (define-key global-map "\C-xl" 'make-symbolic-link)
1126 (define-key c-mode-map "\C-xl" 'make-symbolic-link)
1128 Both the examples bind the key `C-xl' to run the function
1129 `make-symbolic-link' (*note Misc File Ops: (xemacs)Misc File Ops.).
1130 However, the second example will bind the key only for C mode. *Note
1131 Major Modes: (xemacs)Major Modes, for more information on Major Modes
1135 File: new-users-guide.info, Node: Customizing Menus, Prev: Customizing key Bindings, Up: Customization Basics
1137 4.2 Customizing Menus
1138 =====================
1140 You can customize any of the XEmacs Pull-down-Menus. You can create
1141 your own menu, delete an existing one, enable a menu or disable a menu.
1142 For more information on the default menus available to you, *Note
1145 Some of the functions which are available to you for customization
1147 1. add-menu-item: (MENU-NAME ITEM-NAME FUNCTION ENABLED-P &optional
1150 This function will add a menu item to a menu, creating the menu
1151 first if necessary. If the named item already exists, the menu
1152 will remain unchanged. For example, if you add the following
1153 example to your `init.el' file or evaluate it (*note Customization
1156 (add-menu-item '("Edit") "Replace String" replace-string t "Clear")
1158 a sub-menu Replace String will be created under Edit menu before
1159 the sub-menu Clear. The Edit menu will now look like:
1167 Start Macro Recording C-x(
1168 End Macro Recording C-x)
1169 Execute Last Macro C-xe
1171 Replace String will now execute the function `replace-string'.
1172 Select this menu item. Emacs will prompt you for a string name to
1173 be replaced. Type a string and hit <RET>. Now type a new string to
1174 replace the old string and hit <RET>. All occurrences of the old
1175 string will be replaced by the new string. In this example,
1177 `Edit' is the MENU-NAME which identifies the menu into which the
1178 new menu item should be inserted.
1180 `Replace String' is the ITEM-NAME which names the menu item to be
1183 `replace-string' is the FUNCTION i.e. the command to be invoked
1184 when the menu item "Replace String" is selected.
1186 `t' is the ENABLED-P parameter which controls whether the menu
1187 item is selectable or not. This parameter can be either `t'
1188 (selectable), `nil' (not selectable), or a form to evaluate. This
1189 form is evaluated just before the menu is displayed, and the menu
1190 item will be selectable if the form returns non-`nil'.
1192 `Clear' is the &OPTIONAL BEFORE parameter which is the name of the
1193 menu before which the new menu or sub-menu should be added. The
1194 &OPTIONAL string means that this parameter is optional. You do not
1195 need to specify this parameter. If you do not specify this
1196 parameter in the example above, the Replace String menu item will
1197 be added at the end of the list of sub-menus in the Edit menu i.e.
1198 after Execute Last Macro.
1200 If you wish to add a new menu to the menubar, try:
1202 (add-menu-item nil "Bot" 'end-of-buffer t)
1204 This will create a new menu Bot on the menu bar. Selecting this
1205 menu will take you to the end of the buffer. Using `nil' for the
1206 parameter MENU-NAME will create a new menu. Your menu-bar will now
1209 File Edit Options Buffers Bot Help
1211 The following example will illustrate how you can add sub-menus to
1212 the submenus themselves:
1214 (add-menu-item '("File" "Management") "Copy File" 'copy-file t)
1215 (add-menu-item '("File" "Management") "Delete File" 'delete-file t)
1216 (add-menu-item '("File" "Management") "Rename File" 'rename-file t)
1217 This will create a sub-menu Management under the File menu. When
1218 you select the submenu Management, it will contain three submenus:
1219 Copy File, Delete File and Rename File.
1221 2. delete-menu-item: (MENU-PATH) This function will remove the menu
1222 item defined by MENU-NAME from the menu hierarchy. Look at the
1223 following examples and the comments just above them which specify
1224 what the examples do.
1226 ;; deletes the "Replace String" menu item created earlier
1227 (delete-menu-item '("Edit" "Replace String"))
1229 ;; deletes the "Bot" menu created earlier
1230 (delete-menu-item '("Bot"))
1232 ;; deletes the sub-menu "Copy File" created earlier
1233 (delete-menu-item '("File" "File Management" "Copy File"))
1235 ;; deletes the sub-menu "Delete File" created earlier
1236 (delete-menu-item '("File" "Management" "Delete File"))
1238 ;; deletes the sub-menu "Rename File" created earlier
1239 (delete-menu-item '("File" "Management" "Rename File"))
1241 3. disable-menu-item: (MENU-NAME) Disables the specified menu item.
1242 The following example
1244 (disable-menu-item '("File" "Management" "Copy File"))
1246 will make the Copy File item unselectable. This menu-item would
1247 still be there but it will appear faded which would mean that it
1250 4. enable-menu-item: (MENU-NAME) Enables the specified previously
1253 (enable-menu-item '("File" "Management" "Copy File"))
1255 This will enable the sub-menu Copy File, which was disabled by the
1258 5. relabel-menu-item: (MENU-NAME NEW-NAME) Change the string of the
1259 menu item specified by MENU-NAME to NEW-NAME.
1261 (relabel-menu-item '("File" "Open...") "Open File")
1263 This example will rename the Open... menu item from the File menu
1268 File: new-users-guide.info, Node: Help, Next: Modes, Prev: Customization Basics, Up: Top
1273 XEmacs provides a comprehensive Help facility. On the extreme right of
1274 the menu-bar there is a Help menu. There are several help commands
1275 provided by this menu. You can also use `C-h' for invoking the Help
1276 facility. Type "?" for a list of keys you can type after typing `C-h'.
1277 If you want more information on what your options are and what kind of
1278 help you can get type "?" again. You will get a listing of all the keys
1279 you can type and what they will do. Initially if you want help, type
1284 * The Help Menu:: Items on the Help menu
1287 File: new-users-guide.info, Node: The Help Menu, Prev: Help, Up: Help
1292 When you click on the Help menu with any of the mouse buttons you will
1293 get the following menu items:
1296 Selecting this item will take you to the Info page which is the
1297 online documentation browsing system. You can simply click on the
1298 highlighted items and "Info" will take you to the document
1299 providing information about that topic.
1302 After you select this item, you will get a documentation on the
1303 major and minor modes which are enabled in the buffer you are
1304 working with. *Note Modes::, for information on Modes.
1307 After you select this item, you will see the following message in
1310 List symbols matching regexp:
1312 If you type "mode" and hit <RET>, you will get a list of all the
1313 symbols (like functions and commands). You can now get
1314 documentation on any of the given symbols by "clicking" on any of
1315 the symbols (i.e. drag your mouse on the appropriate symbol and
1316 release the button). For example, if you "click" on the
1317 'auto-fill-mode' you will get the following message in the window
1324 Toggle auto-fill mode.
1325 With arg, turn auto-fill mode on if and only if arg is positive.
1326 In auto-fill mode, inserting a space at a column beyond `fill-column'
1327 automatically breaks the line at a previous space.
1333 variable not documented
1336 Selecting this item will prompt you for a string just like when you
1337 select Hyper Apropos.... After you give a string name, you will get
1338 a listing of all the functions and commands containing that string
1339 name with a very short description about what that command does.
1342 After you select this item, you will be prompted for a string name
1347 Now you can give any string name, for example "mode" and hit
1348 <RET>. You will get a listing of all the variables and commands
1349 containing that string i.e "mode" with a short description of its
1353 Select this item and you will get a listing of all the keys and the
1354 commands that they execute. Depending on which Major mode your
1355 buffer is in, you will get a listing of the special keybindings
1356 for that particular buffer also. For example, if you are in
1357 "Texinfo" mode, part of your list will contain:
1359 C-c C-c n texinfo-insert-@node
1360 C-c C-c o texinfo-insert-@noindent
1361 C-c C-c s texinfo-insert-@samp
1362 C-c C-c t texinfo-insert-@table
1363 C-c C-c v texinfo-insert-@var
1364 C-c C-c x texinfo-insert-@example
1365 C-c C-c { texinfo-insert-braces
1366 These keybindings apply only to "Texinfo" mode. *Note Modes::, for
1367 more information on various modes.
1370 After you select this item, you will be see the following message
1374 After you type a command key sequence, full documentation of that
1375 command will be displayed. For example if you type `C-g', you will
1376 see the following documentation for `C-g':
1379 Signal a `quit' condition.
1380 This means that `C-g' will quit whatever command you gave earlier.
1382 Describe Function...
1383 This menu item provides documentation for a function. After you
1384 select this item, it will prompt you for a function name in the
1387 Describe function (default <some function name>):
1388 If you hit <RET> without giving a function name, you will get
1389 documentation for that default function name, otherwise if you
1390 type a function name and hit <RET>, you will get documentation for
1393 Describe Variable...
1394 You can get documentation on any variable by selecting this menu
1395 item. It is similar to Describe Function and will prompt you for a
1399 After you select this item you will be prompted for a Unix command
1400 for which you wish to see the man page. You will see the following
1401 message in the echo area:
1403 Manual entry: (default <some name>)
1404 Now you can type any command, for example type `who' and press
1405 <RET>. You will get the man page for the Unix command `who' which
1406 lists who is on the system.
1409 Select this item and you will get a tutorial on Emacs. It is good
1413 Select this item and you will get a lot of historical and current
1417 For more information on the Help facility, *Note Help: (xemacs)Help.
1420 File: new-users-guide.info, Node: Modes, Next: Files, Prev: Help, Up: Top
1422 6 Major and Minor Modes
1423 ***********************
1425 XEmacs is "language sensitive". It has several "major" and "minor"
1426 modes. The major modes customize Emacs to edit text of a particular
1427 sort. There are major modes for C, Lisp, Emacs Lisp, LaTeX, English
1428 etc. Within each major mode, certain functions and keys are redefined
1429 to "suit" that particular sort of text. The minor modes provide certain
1430 features which can be turned off or on at any time. Emacs can only be
1431 in one major mode at any time, but it can turn on several minor modes
1432 at the same time. After you have selected any major or minor mode, you
1433 can select Describe Mode from the Help menu and you will get
1434 documentation about those modes.
1438 * Major Modes:: Choosing Major Modes
1439 * Minor Modes:: Auto-Fill, Abbrev and other minor modes
1442 File: new-users-guide.info, Node: Major Modes, Next: Minor Modes, Prev: Modes, Up: Modes
1447 Emacs has several major modes which customize Emacs to edit text of
1448 various sorts. You can have only one major mode at any time. Within each
1449 major mode, Emacs redefines certain functions (like cursor movement,
1450 indentation and text killing) to suit the needs of the text being
1451 edited. When you are editing a specific type of text you should switch
1452 to the appropriate mode. If you are working with C code, you should
1453 switch to C mode; if you are working with Lisp code, then switch to lisp
1454 mode and if you are working with English text switch to Text mode.
1456 When you open a file to work on, Emacs usually selects the
1457 appropriate mode. For example, if you open a file called `guide.c' then
1458 Emacs will select the C mode because of the ".c" extension of the file.
1459 To explicitly select a mode type the following command:
1461 ;;; selects lisp mode
1467 To select any other mode, just add the major mode name before the
1468 '-mode'. The current mode in which you are in will be displayed in
1469 parenthesis in the mode-line at the bottom of the frame. All major
1470 modes have some special keybindings and you can get a listing of those
1471 keybindings by selecting List Keybindings from the Help menu on the
1474 Some of the available modes in XEmacs are :
1477 When you start XEmacs, usually you start with the default
1478 "Fundamental" mode. This mode has no special definitions or
1482 Use this mode when you have to format a text with nroff before it
1483 can be available in readable form. It redefines some indentation
1484 commands. *Note Nroff Mode: (xemacs)Nroff Mode, for information on
1488 Use this mode if you are using the LaTeX text-formatter. It
1489 provides commands for insertion of quotes, braces and other
1490 characters. It also allows you to format the buffer for printing.
1491 *Note TeX Mode: (xemacs)TeX Mode, for information on this mode.
1494 Texinfo is a documentation system that uses a single source file to
1495 produce both printed output and on-line documentation. When you
1496 use this mode, there will be some special keybindings for
1497 inserting some characters and executing some commands.
1499 This info file which you are reading right now is produced by
1503 Use this mode for editing outlines. When you enable this mode, you
1504 can make part of the text temporarily invisible so that you can
1505 see the overall structure of the outline. *Note Outline Mode:
1506 (xemacs)Outline Mode, for information on this mode.
1509 Use this mode for C programs. It will redefine some indentation
1510 commands. *Note C Indent: (xemacs)C Indent.
1513 Use this mode for Lisp programs. Look at the XEmacs User's Manual
1514 for more information.
1517 Use this mode for Fortran programs. This mode provides special
1518 commands to move around and some other indentation commands. For
1519 more information on this mode, *Note Fortran: (xemacs)Fortran.
1522 This is the picture mode which you can use to create a picture out
1523 of text characters. *Note Picture: (xemacs)Picture, for more
1527 Use asm-mode for editing files of assembler code. Look at the file
1528 ` /usr/local/lib/xemacs-VERSION/lisp/modes/asm.el' for more
1532 There are some other modes and commands for working with other kinds
1533 of text or programs. Emacs also provides commands for reading and
1534 sending Mail. For more information on these features look at the XEmacs
1535 Manual. Emacs also provides the functions of a desk calendar, with a
1536 diary of past or planned events. For more information on the calendar
1537 mode look at the manual for Calendar Mode and Diary.
1540 File: new-users-guide.info, Node: Minor Modes, Prev: Major Modes, Up: Modes
1545 The minor modes in Emacs provide some optional features which you can
1546 turn on or off. Any number of minor modes can be active at the same time
1547 with any major mode. You can enable a minor mode in one buffer and
1548 disable it in other mode. To enable a minor mode, for example the
1549 font-lock mode type the following command:
1552 To enable the other minor modes, replace the "font-lock" with the
1553 name of the minor mode. To disable the mode type the command again. A
1554 positive argument will always turn the mode on. Whenever you type this
1555 command, it will turn the mode on if it was off, OR it will turn it off
1556 if it was on i.e. it toggles. Look at the mode-line at the bottom of the
1557 frame. If it says FLock in parentheses, then it means that this mode is
1558 on, otherwise it is off.
1560 The following are some of the minor modes available in XEmacs. To
1561 enable any one of them type "M-x" in front of them.
1564 You can also choose this mode by selecting the Syntax Highlighting
1565 menu item from the Options menu on the menu-bar at the top. If you
1566 wish to have this mode enabled permanently, choose Save Options
1567 from the Options menu. *Note Options Menu::, for more information
1568 on the Options menu. You can also add statements in your
1569 `init.el' file. For each major mode in which you wish to enable
1570 this minor mode, you need a statement in your `init.el' file. The
1571 following example shows how to enable the font-lock mode when the
1572 major mode is c-mode.
1574 (add-hook 'c-mode-hook 'turn-on-font-lock)
1576 *Note Other Customizations::.
1578 When you enable this mode, the text will be displayed in different
1579 colors and fonts depending on the type of the text. This makes the
1580 text very easy to read and understand. For example, comments might
1581 be displayed in red, variables in black, functions in blue and
1582 other keywords in different colors and fonts. When you select More
1583 from the Syntax Highlighting option, you get very detailed display
1584 of colors and fonts; function names within comments themselves
1585 might appear in a different font and color.
1588 Enabling this mode will provide automatic word-wrapping. The <SPC>
1589 key will break lines i.e. insert newlines as you type to prevent
1590 lines from becoming too long.
1593 When you enable this mode, the text that you type will replace the
1594 existing text rather than moving it to the right (the default
1595 case). You can enable this mode by selecting Overstrike menu-item
1596 from the Options menu from the menu-bar.
1599 After you enable this mode, you can define words which will expand
1600 into some different text i.e. you can define abbreviations. For
1601 example, you might define "expand" to "expand will eventually
1602 expand to this text". After this definition you will be able to
1603 get "expand will eventually expand to this text" simply by typing
1607 *Note Abbrevs: (xemacs)Abbrevs, for more information on this mode
1608 and on defining abbreviations.
1611 After you enable this mode in a buffer, the contents of that
1612 buffer will be saved periodically. This will reduce the amount you
1613 might lose in case of a system crash.
1616 After you enable this mode, the line number at which your cursor is
1617 present will be displayed continuously in the mode line.
1620 To enable this command, just type
1623 Do not add the "-mode" to it. You can also select the Paren
1624 Highlighting option from the Options menu. After you enable this
1625 command, put your cursor on one of the left parenthesis. The other
1626 matching parenthesis will start blinking. *Note Options Menu::,
1627 for more information on the Paren Highlighting option.
1629 For information on some other modes, look at the XEmacs User's Manual
1630 and the associated files.
1633 File: new-users-guide.info, Node: Files, Next: Other Customizations, Prev: Modes, Up: Top
1638 The basic unit of stored data in Unix is the "file". To edit a file,
1639 you must tell Emacs to read the file into a buffer. This is called
1640 "visiting" the file. You can now edit the buffer and to save the
1641 changes you must write the buffer back to the file.
1643 In addition to visiting and saving files, Emacs can delete, copy,
1644 rename, and append to files, and operate on file directories.
1648 * File Names:: How to type and edit file name arguments.
1649 * Visiting:: Visiting a file prepares Emacs to edit the file.
1650 * Saving Files:: How to save Emacs files.
1653 File: new-users-guide.info, Node: File Names, Next: Visiting, Prev: Files, Up: Files
1658 Most of the Emacs commands that operate on a file require you to
1659 specify a file name. For example, you might specify the file name
1660 initially when you enter Emacs :
1664 After you hit <RET>, you will enter XEmacs with "myfile" read into the
1665 current buffer. If you do not specify the filename when entering Emacs,
1666 you can use the Open... option from the File menu. You will be prompted
1667 for a filename in the echo area:
1669 Find file: /usr/workspace/
1671 Type in a file name which you want to open after the "/" and hit <RET>.
1672 The specified file will be read into the current buffer. The
1673 "/usr/workspace" might be the "default directory". When Emacs prompts
1674 you for a file, it uses the default-directory unless you specify a
1675 directory. You can see what the default directory of the current buffer
1676 is by using the Describe Variable option from the Help menu. When Emacs
1677 prompts you for the variable name to describe, type
1678 `default-directory'. If you wish to open a file in some other
1679 directory, use <DEL> or the <BackSpace> key to go back and type the
1680 path name of the new directory.
1682 You can create a new directory by typing `M-x make-directory'. This
1683 command will prompt you for a directory name:
1685 Create directory: /usr/workspace/
1687 After you type a directory name and press <RET>, a new directory with
1688 the specified name will be created. If you do not wish to create a new
1689 directory, then simply press `C-g' to quit the command. Similarly, you
1690 can also remove a directory by using the command `remove-directory'.
1691 The command `M-x pwd' will print the current buffer's default
1692 directory. For more information on file names, *Note File Names:
1696 File: new-users-guide.info, Node: Visiting, Next: Saving Files, Prev: File Names, Up: Files
1701 To edit a file in Emacs you need to "visit" it. "Visiting" a file means
1702 copying its contents (or reading them) into the current buffer. Emacs
1703 will create a new buffer for each file that you visit. The buffer will
1704 be named after the file that you open. If you open a file
1705 `/usr/workspace/myfile.texinfo', the buffer will be called
1706 "myfile.texinfo". If a buffer with this name already exists, a unique
1707 name will be constructed by appending `<2>', `<3>', etc. If this is the
1708 second buffer with the same name, a "<2>" will be appended, "<3>" for a
1709 third buffer and so on. The name of the buffer which is being displayed
1710 in the window will be shown both at the top and bottom of the frame.
1711 Once you are in XEmacs, you can use the following commands:
1714 This command will visit a file (`find-file'). It will prompt you
1715 for a file name to visit. The Open... option from the File menu
1716 does the same thing:
1718 Find file: /usr/workspace/
1720 Type in a filename and press <RET>. You will see a new buffer on
1721 the screen with its name in the mode-line. If the filename you
1722 specify already exists in Emacs, the buffer containing that file
1723 will be selected. You will get an error message if the filename
1724 does not exist. If you still press <RET>, a new buffer with the
1725 given filename will be displayed on the screen.
1728 This command (`find-alternate-file'), will visit a different file
1729 instead of the one visited last. It is similar to `C-c C-f' except
1730 that it kills the current buffer (after offering to save it).
1733 This command will visit a file in another frame
1734 (`find-file-other-frame') without changing the current window or
1735 frame. The Open in New Frame... from the File menu will do the
1736 same thing. It will prompt you for a file name in the echo area.
1737 After you type the file name and press <RET>, the specified file
1738 will be read into a new buffer and displayed on a new frame.
1741 File: new-users-guide.info, Node: Saving Files, Prev: Visiting, Up: Files
1746 The changes that you make after visiting a file will not be saved
1747 unless you save the buffer. When you save the buffer, Emacs writes the
1748 current contents of the buffer into the visited file. Some commands to
1752 This command will permanently save the current buffer in its
1753 visited file (`save-buffer'). You will see the following message
1754 in the echo area if you save a file called "myfile.texinfo" :
1756 Wrote /usr/workspace/myfile.texinfo
1758 Try using this command twice. You will get the above message the
1759 first time you use this command, the second time you will get the
1762 (No changes need to be saved)
1764 This message indicates that you haven't made any changes since the
1765 last time you saved the file.
1768 This command will save all the buffers in their visited files
1769 (`save-some-buffers'). It will prompt you for typing yes or no:
1771 Save file /usr/workspace/myfile.texinfo? (y or n)
1773 You will get the above message for all the buffers. Type "y" if
1774 you want to save the buffer.
1777 This command will prompt you for a file name and save the current
1778 buffer in that file. (`write-file'). You will see the following
1779 message in the echo area:
1781 Write file: /usr/workspace/
1783 After you type in a file name, press <RET>. The buffer will be
1784 saved in a new file. You can make copies of a particular file
1787 You can also undo all the changes made since the file was visited or
1788 saved by reading the text from the file again (called "reverting"). For
1789 more information on this option, *Note Reverting: (xemacs)Reverting.
1791 When you save a file in Emacs, it destroys its old contents. However,
1792 if you set the variable `make-backup-files' to non-`nil' i.e. `t',
1793 Emacs will create a "backup" file. Select the Describe variable option
1794 from the Help menu and look at the documentation for this variable. Its
1795 default value should be `t'. However, if its not then use `M-x
1796 set-variable' to set it to `t' (*note Setting Variables::). The backup
1797 file will contain the contents from the last time you visited the file.
1798 Emacs also provides options for creating numbered backups. For more
1799 information on backups, *Note Backup: (xemacs)Backup.
1801 Emacs also saves all the files from time to time so that in case of a
1802 system crash you don't lose lot of your work. You will see the message
1803 `Auto-saving...' displayed in the echo area when the buffer is being
1804 saved automatically. The auto saved files are named by putting the
1805 character `#' in front and back. For example a file called
1806 "myfile.texinfo" would be named as `#myfile.texinfo#'. For information
1807 on controlling auto-saving and recovering data from auto-saving, *Note
1808 Auto Save Files: (xemacs)Auto Save Files.
1810 Emacs provides protection from simultaneous editing which occurs if
1811 two users are visiting the same file and trying to save their changes.
1812 It will put a lock on a file which is being visited and modified. If
1813 any other user tries to modify that file, it will inform the user about
1814 the lock and provide some options. For more information on protection
1815 against simultaneous editing, *Note Interlocking: (xemacs)Interlocking.
1818 File: new-users-guide.info, Node: Other Customizations, Next: Select and Move, Prev: Files, Up: Top
1820 8 Other Customizations
1821 **********************
1823 You can modify the behavior of Emacs in minor ways permanently by
1824 putting your changes in your `init.el' file. This file contains Lisp
1825 function call expressions. Each of these expressions will consist of a
1826 function name followed by arguments, all surrounded by parentheses. For
1827 example, to turn on the auto-fill-mode (i.e. break lines automatically
1828 when they become too long) , put the following line in your `init.el'
1831 (add-hook 'text-mode-hook
1832 '(lambda() (auto-fill-mode 1)))
1834 Emacs has a function named "turn-on-auto-fill" which is defined as
1835 "(lambda() (auto-fill-mode 1))". Therefore you can also write the above
1838 (add-hook 'text-mode-hook 'turn-on-auto-fill)
1840 Emacs provides a number of hooks for the sake of customization. The hook
1841 variables contain list of functions to be called with no arguments. To
1842 turn on the auto-fill-mode, add the appropriate hook as shown in the
1845 Similarly, to enable the "font-lock mode" which displays your
1846 program in different fonts and colors(*note Modes::), put the following
1847 in your `init.el' file. The comments above the statement explain what
1850 ;;; enables the font-lock-mode in Lisp Mode
1851 (add-hook 'lisp-mode-hook 'turn-on-font-lock)
1853 ;;; enables the font-lock-mode in Texinfo Mode
1854 (add-hook 'texinfo-mode-hook 'turn-on-font-lock)
1856 ;;; enables the font-lock mode in C Mode
1857 (add-hook 'c-mode-hook 'turn-on-font-lock)
1859 To turn on the font-lock mode in other Major Modes like emacs-lisp,
1860 just put the name of the mode with "-hook" appended to it as the middle
1861 parameter in the above examples. You can also select the color that the
1862 functions, comments or other keywords should be displayed in :
1864 ;;; the function names will now be displayed in blue color
1865 (set-face-foreground 'font-lock-function-name-face "blue")
1867 ;;; the comments will be displayed in forest green
1868 (set-face-foreground 'font-lock-comment-face "forest green")
1870 For other customizations regarding the font-lock face, look at the file
1871 `/usr/local/lib/xemacs-VERSION/etc/sample.init.el'.
1875 * Setting Variables:: Customizing Emacs variables
1876 * Init File:: Some examples of Lisp expressions in
1880 File: new-users-guide.info, Node: Setting Variables, Next: Init File, Prev: Other Customizations, Up: Other Customizations
1882 8.1 Other Customizations
1883 ========================
1885 In XEmacs, "variables" are used for internal record-keeping and
1886 customizations. There are some variables called "options" which you can
1887 use for customizations. To examine a variable use:
1889 ;;; print the value and documentation of the variable, use either of the
1890 ;;; following commands
1892 M-x describe variable
1894 After you type any of the above commands, you will be prompted for a
1895 variable name in the "echo area". Type in the name of the variable, for
1896 example, type `case-fold-search' <RET> Your window will split into two
1897 and you will see the following message in that window:
1899 case-fold-search's value is t
1900 This value is specific to the current buffer.
1903 *Non-nil if searches should ignore case.
1904 Automatically becomes buffer-local when set in any fashion.
1906 Since this variable's value is 't' searches will ignore case. If you
1907 want case-sensitive-search (i.e. if you are searching for "Foo" and you
1908 do not want "foo" to be included in the search, you need to set this
1909 variable to "nil". In order to do that, use:
1913 Emacs will prompt you for the variable which you wish to set. Type in
1914 "case-fold-search" and hit <RET>. You will see the following message:
1916 Set case-fold-search to value:
1918 Type "nil" and hit <RET>. Now if you again use `M-x describe variable'
1919 , you will see that the new value of case-fold-search will be "nil" and
1920 your searches will be case-sensitive. This will be effective only for
1921 that Emacs session. If you want to change the value of a variable
1922 permanently put the following statement in your `init.el' file :
1924 (setq case-fold-search nil)
1926 This statement will make searches case-sensitive only in the current
1927 buffer which is the `init.el' file. This will not be very useful. To
1928 make searches case-sensitive globally in all buffers, use:
1930 (setq-default case-fold-search nil)
1932 If you want to change the value of any other variable, use :
1934 (setq <variable-name> <new value>)
1936 "setq" will assign the "new value" to the "variable-name" .
1938 If you want a list of the "options" i.e. the variables available for
1942 ;;; displays a buffer listing names, values and documentation of options
1945 ;;; displays options and allows you to edit those list of options
1948 Try these options. If you are using edit-options to edit a variable,
1949 just point at the variable you wish to edit and use one of the following
1953 Set the value of the variable to t (non-nil).
1956 Set the value of the variable to nil.
1959 Move to the next variable.
1962 Move to the previous variable.
1964 There are some other options available to make the value of a
1965 variable local to a buffer and then to switch to its global value. You
1966 can also have a "local variables list" in a file which specifies the
1967 values to use for certain Emacs variables when you edit that file.
1968 *Note Variables: (xemacs)Variables, for information on these options.
1971 File: new-users-guide.info, Node: Init File, Prev: Setting Variables, Up: Other Customizations
1973 8.2 Init File Examples
1974 ======================
1976 For customizing Emacs, you need to put Lisp expressions in your
1977 `init.el' file. The following are some useful Lisp expressions. If you
1978 find any of them useful, just type them in your `init.el' file:
1980 * The following expression will make <TAB> in C mode insert a real
1981 tab character if the cursor or point is in the middle of the line.
1982 Now hitting the <TAB> key will indent a line only if the cursor is
1983 at the left margin or in the line's indentation:
1985 (setq c-tab-always-indent nil)
1987 The value of the variable `c-tab-always-indent' is usually `t' for
1988 `true'. When this variable is true, then hitting the <TAB> key
1989 always indents the current line.
1991 * This expression will turn on the AUTO-FILL-MODE when you are in
1994 (setq text-mode-hook 'turn-on-auto-fill)
1996 This mode will automatically break lines when you type a space so
1997 that the lines don't become too long. The length of the lines is
1998 controlled by the variable `fill-column'. You can set this
1999 variable to a value you wish. Look at the documentation for this
2000 variable to see its default value. To change the value to 75 for
2003 (setq-default fill-column 75)
2005 This will change the value of this variable globally.
2007 * The following expression will enable the use of EVAL-EXPRESSION
2008 without confirmation:
2010 (put 'eval-expression 'disabled nil)
2012 Now when you use EVAL-EXPRESSION, it will print the value of the
2013 expression you specify in the "echo area" without confirming with
2016 * This expression will remove the binding of `C-x C-c', because its
2017 easy to hit this key by mistake and you will exit Emacs
2018 unintentionally. You can use the Exit Emacs option from the File
2021 (global-set-key "\C-x\C-c" nil)
2023 Now if you type `C-x C-c', you won't exit Emacs.
2025 * The following expression will make the <BACKSPACE> and the <DEL>
2026 key work in the same manner:
2028 (global-set-key 'backspace [delete])
2030 * This expression will make searches case sensitive:
2032 (setq-default case-fold-search nil)
2034 If we use "setq" instead of "setq-default" then searches will be
2035 case-sensitive only in the current buffer's local value. In this
2036 case the buffer would be the `init.el' file. Since this would not
2037 be too helpful and we want to have case-sensitive searches in all
2038 buffers, we have to use "setq-default".
2040 * This expression will enable the font-lock mode when you are using
2043 (add-hook 'texinfo-mode-hook 'turn-on-font-lock)
2045 *Note Minor Modes::, for information on font-lock mode.
2047 * Rebinds the key `C-x l' to run the function `make-symbolic-link':
2049 (global-set-key "\C-xl" 'make-symbolic-link)
2051 We use the single quote before "make-symbolic-link" because its a
2052 function name. You can also use the following expression which
2053 does the same thing:
2055 (define-key global-map "C-xl" 'make-symbolic-link)
2057 * The following expression will bind `C-x l' to run the function
2058 `make-symbolic-link' in C mode only:
2060 (define-key c-mode-map "C-xl" 'make-symbolic-link)
2062 Instead of binding `C-xl' to run `make-symbolic-link', you can
2063 bind the <F1> key to run this function:
2065 (define-key c-mode-map 'f1 'make-symbolic-link)
2067 Here, you have to use lower case for naming function keys like
2070 * You can bind the function `undo' i.e. `C-x u' to any key, for
2073 (global-set-key 'f2 'undo)
2075 * The following statement will display the current time in the
2076 modeline of the buffer:
2080 * This displays the current line number on which the cursor is
2081 present in the modeline:
2083 (setq line-number-mode t)
2085 * If you don't want the text to be highlighted when you use commands
2086 for marking regions so as to use the "kill" and "yank" commands
2087 later, you can use the following expression in your `init.el' file:
2089 (setq zmacs-regions nil)
2091 Now if you use a command like `C-x C-p' (`mark-page'), the text
2092 will not be highlighted.
2094 * To control the number of buffers listed when you select the Buffers
2095 menu, you need to set the variable `buffers-menu-max-size' to
2096 whatever value you wish. For example, if you want 20 buffers to be
2097 listed when you select Buffers use:
2099 (setq buffers-menu-max-size 20)
2101 * If you want the window title area to display the full
2102 directory/name of the current buffer's file, and not just the
2105 (setq frame-title-format "%S: %f")
2107 * To get rid of the menu, use :
2111 * If you want an extensive menu-bar use the following expression in
2112 your `init.el' file.
2114 (load "big-menubar")
2116 If you want to write your own menus, you can look at some of the
2118 `/usr/local/lib/xemacs/xemacs-packages/lisp/edit-utils/big-menubar.el'
2122 For more information on initializing your `init.el' file, *Note Init
2123 File: (xemacs)Init File. You should also look at
2124 `/usr/local/lib/xemacs-VERSION/etc/sample.init.el', which is a sample
2125 `init.el' file. It contains some of the commonly desired customizations
2129 File: new-users-guide.info, Node: Select and Move, Next: Search and Replace, Prev: Other Customizations, Up: Top
2131 9 Selecting and Moving Text
2132 ***************************
2134 Many Emacs commands operate on an arbitrary contiguous part of the
2135 current buffer. You can select some part of the buffer and edit only
2136 that part of the buffer. This selected buffer is called a "region". You
2137 can select text in two ways:
2139 * You use special keys to select text by defining a region between
2140 the cursor and "the mark" (which you set).
2142 * If you are running XEmacs under X, you can also select text with
2147 * Selecting Text:: Select a region of text by setting the Mark
2148 * Mouse:: Selecting Text with Mouse
2149 * Region Operation:: Various ways to operate on a selected text
2150 * Moving Text:: Moving Text
2151 * Accumulating text:: Accumulating Text from several buffers
2154 File: new-users-guide.info, Node: Selecting Text, Next: Mouse, Prev: Select and Move, Up: Select and Move
2156 9.1 Setting the Mark
2157 ====================
2159 To define a region you need to set "the mark" at one end of it and move
2160 the cursor to the other end. Once you set the mark, it remains there
2161 until you set it again to some other place. Each buffer has its own
2162 "mark ring" (a place where Emacs remembers 16 previous locations of the
2163 mark). To set "the mark", you can use the following commands:
2166 This command will set "the mark" at the position of your cursor
2167 (`set-mark-command'). You can move your cursor around and "the
2168 mark" will stay there.
2171 Interchange mark and point (`exchange-point-and-mark'). Since Emacs
2172 will have only one cursor, after you move the cursor it will be
2173 unable to show you where you set the "the mark". In order to see
2174 "the mark" you can type the command `C-x C-x' which will put your
2175 cursor on the position of your mark and your mark on the position
2176 of your cursor. Use the command again to reset the positions of
2177 your cursor and mark.
2180 This command will push the mark at the beginning of the buffer
2181 without changing the position of your cursor.
2184 This command will push the mark at the end of the buffer without
2185 changing the position of your cursor.
2186 You can also give arguments to `C-<' or `C->'. *Note The Mark and
2187 the Region: (xemacs)The Mark and the Region, for more information.
2190 File: new-users-guide.info, Node: Mouse, Next: Region Operation, Prev: Selecting Text, Up: Select and Move
2192 9.2 Selecting Text with Mouse
2193 =============================
2195 If you are using XEmacs under X, you can use the mouse to select text.
2196 The selected text will always be highlighted, so just by looking at the
2197 text you know what you have selected so far. To select a word just
2198 double-click with the left-mouse-button on the word. To select a whole
2199 line triple-click anywhere on the line with the left-mouse-button. You
2200 can also use the Copy item from the Edit menu on the menu-bar to select
2201 text. This kind of selection is called Clipboard selection, *Note X
2202 Clipboard Selection: (xemacs)X Clipboard Selection, for more
2203 information. To select an arbitrary region, follow these steps:
2205 1. Move the mouse cursor over the character at the beginning of the
2206 region of text you want to select.
2208 2. Press and hold the left mouse button.
2210 3. While holding the left mouse button down, drag the cursor to the
2211 character at the end of the region of text you want to select.
2213 4. Release the left mouse button.
2214 The selected region of text is highlighted.
2216 *Note Selecting Text with the Mouse: (xemacs)Selecting Text with the
2217 Mouse, for more information regarding the Mouse and additional mouse
2221 File: new-users-guide.info, Node: Region Operation, Next: Moving Text, Prev: Mouse, Up: Select and Move
2223 9.3 Operating on the Region
2224 ===========================
2226 Once you have selected a region you can do a lot of things to the text
2228 * Kill the text with `C-w'. For example if you want to kill a
2229 paragraph, position the cursor to the beginning of the paragraph
2230 and type `C-SPC'. Then go to the end of the paragraph and type
2231 `C-w'. The entire paragraph will be deleted. You can also select
2232 the text with a mouse and type `C-w' to kill the entire region.
2233 *Note Killing: (xemacs)Killing, for more information.
2235 * Save the text in a buffer or a file (*note Accumulating Text:
2236 (xemacs)Accumulating Text.).
2238 * You can convert the case of the text with `C-x C-l' or `C-x C-u'
2239 If you type `C-x C-u' the selected text will become all
2240 upper-case. If you type `C-x C-l' the selected text will become all
2243 * Print hardcopy with `M-x print-region'. *Note Hardcopy:
2244 (xemacs)Hardcopy, for more information. This command will print a
2245 hardcopy of only the selected text.
2247 * Indent it with `C-x <TAB>' or `C-M-\' *Note Indentation:
2248 (xemacs)Indentation, for more information.
2251 File: new-users-guide.info, Node: Moving Text, Next: Accumulating text, Prev: Region Operation, Up: Select and Move
2256 The most common way to move or copy text in Emacs is through "killing"
2257 or `cutting' it and then "yanking" or `pasting' it. You can also use
2258 the Cut or Copy option from the Edit menu for killing and copying
2259 respectively. *Note Edit menu::, for reviewing the commands for killing
2260 text. All the killed text in Emacs is recorded in the "kill ring".
2261 Since there is only one kill ring in Emacs, you can kill text in one
2262 buffer and yank it in another buffer. To `paste' or `yank' the killed
2263 text you can use the following commands:
2265 This command will yank or paste the last killed text (`yank').
2268 Save region as last killed text without actually killing it
2269 (`copy-region-as-kill'). You can use this command to copy a
2270 selected region and then yank (or paste) it without actually
2271 removing it from the buffer.
2274 Append next kill to last batch of killed text
2275 (`append-next-kill'). This command will append whatever you killed
2276 last to what you kill now. Then later you will be able to yank the
2277 entire appended text from the "kill ring".
2280 File: new-users-guide.info, Node: Accumulating text, Prev: Moving Text, Up: Select and Move
2282 9.5 Accumulating Text
2283 =====================
2285 The following commands can be used for accumulating text from different
2286 buffers into one place or for copying one region of text into many
2289 `M-x append-to-buffer'
2290 Append region to contents of specified buffer
2291 (`append-to-buffer'). After you type in this command and press
2292 <RET>, Emacs will prompt you for a buffer name. You will see a
2293 message in the echo area:
2294 Append to buffer: (default <buffer name>)
2295 After you type in a buffer name, a copy of the region will be
2296 inserted at the location of the cursor into that buffer. If there
2297 is no buffer with the name given by you, Emacs will create a new
2298 buffer with that name. By default the cursor's position in the
2299 <buffer name> is at the end.
2301 `M-x prepend-to-buffer'
2302 Prepend region to contents of specified buffer. This command is
2303 similar to the above command except that the cursor in the buffer
2304 (by default) is at the beginning rather than at the end.
2306 `M-x copy-to-buffer'
2307 Copy region into specified buffer, deleting that buffer's old
2308 contents. This command will also prompt you for a buffer name.
2311 Insert contents of specified buffer into current buffer at point.
2312 This command will prompt you for a buffer name which you want to
2313 be copied into the current buffer at the location of the cursor.
2315 `M-x append-to-file'
2316 This command will prompt you for a filename and append the region
2317 to the end of the contents of the specified file.
2319 *Note Accumulating Text: (xemacs)Accumulating Text, for more
2320 information regarding this topic.
2322 You can also use "rectangle commands" for operating on rectangular
2323 areas of text. *Note Rectangles: (xemacs)Rectangles, for more
2324 information regarding rectangle commands.
2326 Emacs also provides "registers" which serve as temporary storage for
2327 text or positions. Each register has a one character name and they can
2328 store "regions", a "rectangle", or a "mark" i.e. a cursor position.
2329 Whatever you store in register stays there until you store something
2330 else in that register. To find out about commands which manipulate
2331 registers *Note Registers: (xemacs)Registers.
2334 File: new-users-guide.info, Node: Search and Replace, Prev: Select and Move, Up: Top
2336 10 Searching and Replacing
2337 **************************
2339 Emacs provides commands for searching for occurrences of a particular
2340 string. The search is incremental i.e. it begins even before you
2341 complete typing the whole string. All searches in Emacs ignore the case
2342 of the text they are searching, i.e. if you are searching for "String",
2343 then "string" will also be one of the selections. If you want a case
2344 sensitive search select the Case Sensitive Search from the Option menu.
2345 You can also set the variable `case-fold-search' to `nil' for making
2346 searches case-sensitive. For information on setting variables, *Note
2347 Setting Variables::. The two commands for searching for strings in
2351 This command will prompt you for a string to search :
2355 If you type "myname" as the string to be searched, then Emacs will
2356 start searching for "m", "my", "myn", etc as you go on typing the
2357 whole string in the forward direction. The cursor will be on the
2358 matching string which has been found so far. If you find the
2359 correct match just hit <RET> or type `C-f' or `C-b' to set the
2360 cursor's position. If you find a matching string "myname" but you
2361 were looking for a different occurrence of it, use `C-s' again. If
2362 the search is unable to find the string, it will give you an error
2366 This command will perform an incremental search in the backward
2367 direction. It will prompt you for a string name:
2371 After you start typing the string name, it will search for the
2372 string in the same fashion as it does for `C-s' except that it
2373 will search in the backward direction. If it cannot find the
2374 string name, it will give you an error message.
2376 If you make a mistake while typing the string names when you use the
2377 above commands, you can use the <DEL> key to erase characters. Each
2378 <DEL> will erase the last character. At any time if you want to quit
2379 the search, just type `C-g'.
2381 To do a non-incremental search i.e. to start the search only after
2382 you have typed the whole string you can use the following commands:
2384 `C-s RET "string" RET'
2385 This command will search for the specified string in the forward
2386 direction and will give an error message if the string is not
2389 `C-r RET "string" RET'
2390 This command will search for the specified string in the backward
2393 For information on how Emacs searches for words and regular
2394 expressions, *Note Search: (xemacs)Search.
2396 To replace all occurrences of a string in Emacs, you can use the
2400 After you type `M-x replace-string', you will be prompted for a string
2405 After you type in a string name, for example "FOO" and press <RET>, you
2406 will see another prompt:
2408 Replace string FOO with:
2410 Now type the string which you want to replace "FOO" with and press
2411 <RET>. After all the occurrences are replaced you will see the message
2412 "Done" in the echo area. If you want only some occurrences of the
2413 string to be replaced, use `M-x query-replace RET <string> RET
2414 <newstring> RET'. For more information, *Note Query Replace:
2415 (xemacs)Query Replace.
2417 XEmacs also provides a utility for checking spellings. Use `M-x
2418 ispell-buffer' to check for spellings in the whole buffer. You can also
2419 check the spelling of a word or a region. You can use menus to check
2422 Evaluate the expression `(load "big-menubar")'. To evaluate this
2423 expression you need to hit the <META> or the <ESC> key twice and type
2424 in the expression in the echo area before hitting <RET>. You will get
2425 an extensive menubar. Select the Spell Check menu item from the
2426 Utilities menu for checking spellings.
2429 File: new-users-guide.info, Node: Key Index, Next: Command Index, Prev: Intro, Up: Top
2431 Key (Character) Index
2432 *********************
2437 * C-<: Selecting Text. (line 6)
2438 * C->: Selecting Text. (line 6)
2439 * C-a: Cursor Position. (line 11)
2440 * C-b: Cursor Position. (line 11)
2441 * C-d: Erase. (line 6)
2442 * C-e: Cursor Position. (line 11)
2443 * C-fx: Cursor Position. (line 11)
2444 * C-g: The Help Menu. (line 92)
2445 * C-h d: The Help Menu. (line 96)
2446 * C-h k: The Help Menu. (line 107)
2447 * C-h t: Edit. (line 6)
2448 * C-k: Erase. (line 6)
2449 * C-M-\: Region Operation. (line 7)
2450 * C-n: Cursor Position. (line 11)
2451 * C-p: Cursor Position. (line 11)
2452 * C-r: Search and Replace. (line 33)
2453 * C-s: Search and Replace. (line 18)
2454 * C-SPC <1>: Region Operation. (line 7)
2455 * C-SPC: Selecting Text. (line 6)
2456 * C-t: Cursor Position. (line 11)
2457 * C-u: Numeric Argument. (line 6)
2458 * C-v: Cursor Position. (line 11)
2459 * C-w: Region Operation. (line 7)
2460 * C-x 0: XEmacs Window. (line 12)
2461 * C-x 1: XEmacs Window. (line 12)
2462 * C-x 2: XEmacs Window. (line 12)
2463 * C-x 3: XEmacs Window. (line 12)
2464 * C-x 4: XEmacs Window. (line 12)
2465 * C-x 4 b: XEmacs Window. (line 44)
2466 * C-x 4 d: XEmacs Window. (line 44)
2467 * C-x 4 f: XEmacs Window. (line 44)
2468 * C-x 4 m: XEmacs Window. (line 44)
2469 * C-x 5 C-f: Visiting. (line 38)
2470 * C-x C-c: Exiting. (line 15)
2471 * C-x C-f: Visiting. (line 19)
2472 * C-x C-l: Region Operation. (line 7)
2473 * C-x C-s: Saving Files. (line 12)
2474 * C-x C-u: Region Operation. (line 7)
2475 * C-x C-v: Visiting. (line 33)
2476 * C-x C-w: Saving Files. (line 37)
2477 * C-x C-x: Selecting Text. (line 6)
2478 * C-x s: Saving Files. (line 28)
2479 * C-x TAB: Region Operation. (line 7)
2480 * C-x u: Undo. (line 12)
2481 * C-y: Moving Text. (line 6)
2482 * C-z: Exiting. (line 15)
2483 * DEL: Insert. (line 13)
2484 * M--: Numeric Argument. (line 6)
2485 * M-<: Cursor Position. (line 11)
2486 * M->: Cursor Position. (line 11)
2487 * M-C-v: XEmacs Window. (line 12)
2488 * M-d: Erase. (line 6)
2489 * M-DEL: Erase. (line 6)
2490 * M-k: Erase. (line 6)
2491 * M-v: Cursor Position. (line 11)
2492 * M-z: Erase. (line 6)
2493 * RET: Insert. (line 19)
2496 File: new-users-guide.info, Node: Command Index, Next: Variable Index, Prev: Key Index, Up: Top
2498 Command and Function Index
2499 **************************
2504 * add-menu-item: Customizing Menus. (line 6)
2505 * append-to-buffer: Accumulating text. (line 6)
2506 * append-to-file: Accumulating text. (line 6)
2507 * auto-fill-mode <1>: Minor Modes. (line 49)
2508 * auto-fill-mode: Insert. (line 19)
2509 * backward-char: Cursor Position. (line 11)
2510 * backward-kill-word: Erase. (line 6)
2511 * backward-word: Cursor Position. (line 33)
2512 * beginning-of-buffer: Cursor Position. (line 11)
2513 * beginning-of-line: Cursor Position. (line 11)
2514 * copy-to-buffer: Accumulating text. (line 6)
2515 * delete-backward-char: Erase. (line 6)
2516 * delete-char: Erase. (line 6)
2517 * delete-menu-item: Customizing Menus. (line 87)
2518 * delete-other-windows <1>: XEmacs Window. (line 22)
2519 * delete-other-windows: Windows and Menus. (line 6)
2520 * delete-window <1>: XEmacs Window. (line 16)
2521 * delete-window: Windows and Menus. (line 6)
2522 * describe-variable: Setting Variables. (line 6)
2523 * dired-other-window: XEmacs Window. (line 44)
2524 * disable-menu-item: Customizing Menus. (line 107)
2525 * edit-options: Setting Variables. (line 62)
2526 * enable-menu-item: Customizing Menus. (line 116)
2527 * end-of-buffer: Cursor Position. (line 11)
2528 * end-of-line: Cursor Position. (line 11)
2529 * eval-expression: Init File. (line 37)
2530 * eval-region: Customization Basics.
2532 * exchange-point-and-mark: Selecting Text. (line 6)
2533 * find-alternate-file: Visiting. (line 33)
2534 * find-file: Visiting. (line 19)
2535 * find-file-other-frame: Visiting. (line 38)
2536 * find-file-other-window: XEmacs Window. (line 44)
2537 * forward-char: Cursor Position. (line 11)
2538 * forward-word: Cursor Position. (line 30)
2539 * goto-char: Cursor Position. (line 11)
2540 * goto-line: Cursor Position. (line 11)
2541 * help-with-tutorial: Edit. (line 6)
2542 * isearch-backward: Search and Replace. (line 33)
2543 * isearch-forward: Search and Replace. (line 18)
2544 * kill-line: Erase. (line 6)
2545 * kill-sentence: Erase. (line 6)
2546 * kill-word: Erase. (line 6)
2547 * list-options: Setting Variables. (line 62)
2548 * mail-other-window: XEmacs Window. (line 44)
2549 * make-directory: File Names. (line 35)
2550 * make-symbolic-link: Customizing key Bindings.
2552 * mark-beginning-of-buffer: Selecting Text. (line 6)
2553 * mark-end-of-buffer: Selecting Text. (line 6)
2554 * next-line: Cursor Position. (line 11)
2555 * prepend-to-buffer: Accumulating text. (line 6)
2556 * previous-line: Cursor Position. (line 11)
2557 * print-region: Region Operation. (line 7)
2558 * relabel-menu-items: Customizing Menus. (line 124)
2559 * remove-directory: File Names. (line 35)
2560 * replace-string: Search and Replace. (line 64)
2561 * save-buffer: Saving Files. (line 12)
2562 * save-buffers-kill-emacs: Exiting. (line 15)
2563 * save-some-buffers: Saving Files. (line 28)
2564 * scroll-other-window <1>: XEmacs Window. (line 13)
2565 * scroll-other-window: Windows and Menus. (line 6)
2566 * set-mark-command: Selecting Text. (line 6)
2567 * set-variable: Setting Variables. (line 32)
2568 * split-window-horizontally: XEmacs Window. (line 38)
2569 * split-window-vertically: XEmacs Window. (line 32)
2570 * suspend-emacs: Exiting. (line 15)
2571 * switch-to-buffer-other-window: XEmacs Window. (line 44)
2572 * transpose-chars: Cursor Position. (line 11)
2573 * write file: Saving Files. (line 37)
2574 * yank: Moving Text. (line 6)
2575 * zap-to-char: Erase. (line 6)
2578 File: new-users-guide.info, Node: Variable Index, Next: Concept Index, Prev: Command Index, Up: Top
2586 * buffers-menu-max-size: Init File. (line 129)
2587 * case-fold-search: Search and Replace. (line 6)
2588 * default-directory: File Names. (line 19)
2589 * display-time: Init File. (line 108)
2590 * fill-column: Init File. (line 33)
2591 * frame-title-format: Init File. (line 135)
2592 * make-backup-files: Saving Files. (line 51)
2593 * zmacs-regions: Init File. (line 119)
2596 File: new-users-guide.info, Node: Concept Index, Next: Entering, Prev: Variable Index, Up: Top
2604 * abbrev-mode: Minor Modes. (line 60)
2605 * accumulating text: Accumulating text. (line 6)
2606 * add menus: Customizing Menus. (line 6)
2607 * asm-mode: Major Modes. (line 86)
2608 * Auto Delete Selection menu item: Options Menu. (line 6)
2609 * auto saving: Saving Files. (line 61)
2610 * auto-save-mode: Minor Modes. (line 72)
2611 * binding keys: Customizing key Bindings.
2613 * blink-paren: Minor Modes. (line 81)
2614 * buffer: Entering. (line 6)
2615 * Buffers menu: Buffers Menu. (line 6)
2616 * Buffers Menu Length... menu item: Options Menu. (line 6)
2617 * Buffers Sub-Menus menu item: Options Menu. (line 6)
2618 * c-mode: Major Modes. (line 68)
2619 * Case Sensitive Search menu item: Options Menu. (line 6)
2620 * Clear menu item: Edit menu. (line 6)
2621 * clipboard selection: Mouse. (line 6)
2622 * Copy menu item: Edit menu. (line 6)
2623 * copying text: Accumulating text. (line 6)
2624 * creating-directories: File Names. (line 35)
2625 * cursor control: Cursor Position. (line 6)
2626 * cursor position: Cursor Position. (line 6)
2627 * cursor shapes: Mouse. (line 6)
2628 * customize <1>: Other Customizations.
2630 * customize: Customization Basics.
2632 * customize menus: Customizing Menus. (line 6)
2633 * Cut menu item: Edit menu. (line 6)
2634 * Delete Frame menu item: File menu. (line 6)
2635 * delete menus: Customizing Menus. (line 6)
2636 * deleting: Erase. (line 6)
2637 * deleting menu items: Customizing Menus. (line 87)
2638 * deletion: Insert. (line 13)
2639 * digit argument: Numeric Argument. (line 6)
2640 * disable menus: Customizing Menus. (line 6)
2641 * disabling menu items: Customizing Menus. (line 107)
2642 * displaying time: Init File. (line 108)
2643 * echo area: Echo Area. (line 6)
2644 * edit-picture: Major Modes. (line 81)
2645 * enabling menu items: Customizing Menus. (line 116)
2646 * End Macro Recording menu item: Edit menu. (line 6)
2647 * entering Emacs: Enter. (line 6)
2648 * entering XEmacs: Enter. (line 6)
2649 * erasing: Erase. (line 6)
2650 * Execute Last Macro menu item: Edit menu. (line 6)
2651 * Exit Emacs menu item: File menu. (line 6)
2652 * exiting: Exiting. (line 6)
2653 * file: Entering. (line 6)
2654 * File menu: File menu. (line 6)
2655 * file names: File Names. (line 6)
2656 * files: Files. (line 6)
2657 * Font menu item: Options Menu. (line 6)
2658 * font-lock-mode <1>: Other Customizations.
2660 * font-lock-mode: Minor Modes. (line 25)
2661 * fortran-mode: Major Modes. (line 76)
2662 * fundamental-mode: Major Modes. (line 36)
2663 * goto-line: Cursor Position. (line 55)
2664 * help <1>: The Help Menu. (line 6)
2665 * help: Help. (line 6)
2666 * Help menu: Help menu. (line 6)
2667 * hook: Other Customizations.
2669 * init file examples: Init File. (line 6)
2670 * init.el: Customization Basics.
2672 * Insert File... menu item: File menu. (line 6)
2673 * insertion: Insert. (line 6)
2674 * key bindings: Customizing key Bindings.
2676 * keystrokes: Customizing key Bindings.
2678 * Kill Buffer menu item: File menu. (line 6)
2679 * kill ring: Moving Text. (line 6)
2680 * killing: Moving Text. (line 6)
2681 * killing Emacs: Exiting. (line 6)
2682 * line-number-mode: Minor Modes. (line 77)
2683 * lisp-mode: Major Modes. (line 72)
2684 * major modes: Major Modes. (line 6)
2685 * mark: Select and Move. (line 6)
2686 * menus: XEmacs Window. (line 67)
2687 * minor modes: Minor Modes. (line 6)
2688 * mistakes, correcting: Undo. (line 6)
2689 * mode line: Mode Line. (line 6)
2690 * modes: Modes. (line 6)
2691 * mouse selection: Mouse. (line 6)
2692 * moving text: Moving Text. (line 6)
2693 * negative argument: Numeric Argument. (line 6)
2694 * New Frame menu item: File menu. (line 6)
2695 * newline: Insert. (line 19)
2696 * nroff-mode: Major Modes. (line 41)
2697 * numeric argument: Numeric Argument. (line 6)
2698 * Open ... menu item: File menu. (line 6)
2699 * open another file: Frame. (line 6)
2700 * Open in New Frame... menu item: File menu. (line 6)
2701 * Options menu: Options Menu. (line 6)
2702 * outline-mode: Major Modes. (line 62)
2703 * overstrike: Insert. (line 6)
2704 * Overstrike menu item: Options Menu. (line 6)
2705 * overwrite-mode: Minor Modes. (line 54)
2706 * Paren Highlighting menu item: Options Menu. (line 6)
2707 * Paste menu item: Edit menu. (line 6)
2708 * pasting: Moving Text. (line 6)
2709 * primary selection: Mouse. (line 6)
2710 * Print Buffer menu item: File menu. (line 6)
2711 * pull-down-menus: XEmacs Window. (line 67)
2712 * Read Only menu item: Options Menu. (line 6)
2713 * rectangle commands: Accumulating text. (line 6)
2714 * region: Select and Move. (line 6)
2715 * registers: Accumulating text. (line 6)
2716 * relabelling menu items: Customizing Menus. (line 124)
2717 * removing-directories: File Names. (line 35)
2718 * replace: Search and Replace. (line 6)
2719 * Revert Buffer menu item: File menu. (line 6)
2720 * Save Buffer As ... menu item: File menu. (line 6)
2721 * Save Buffer menu item: File menu. (line 6)
2722 * Save Options: Options Menu. (line 6)
2723 * saving files: Saving Files. (line 6)
2724 * searching: Search and Replace. (line 6)
2725 * selected window: Windows and Menus. (line 6)
2726 * setting variables: Setting Variables. (line 6)
2727 * shrinking XEmacs frame: Exiting. (line 6)
2728 * simultaneous editing: Saving Files. (line 70)
2729 * Size menu item: Options Menu. (line 6)
2730 * Split Frame: File menu. (line 6)
2731 * Start Macro Recording menu item: Edit menu. (line 6)
2732 * suspending: Exiting. (line 6)
2733 * Syntax Highlighting menu item: Options Menu. (line 6)
2734 * Teach Extended Commands menu item: Options Menu. (line 6)
2735 * temporary storage: Accumulating text. (line 6)
2736 * tex-mode: Major Modes. (line 47)
2737 * texinfo-mode: Major Modes. (line 53)
2738 * top level: Mode Line. (line 6)
2739 * Un-split (Keep Others): File menu. (line 6)
2740 * Un-split (Keep This): File menu. (line 6)
2741 * undo: Undo. (line 6)
2742 * Undo menu item: Edit menu. (line 6)
2743 * visiting files: Visiting. (line 6)
2744 * Weight menu item: Options Menu. (line 6)
2745 * windows <1>: XEmacs Window. (line 67)
2746 * windows <2>: Windows and Menus. (line 6)
2747 * windows: Entering. (line 6)
2748 * yanking: Moving Text. (line 6)
2755 Node: Entering
\7f7190
2758 Node: Exiting
\7f11066
2759 Node: Mode Line
\7f12271
2760 Node: Echo Area
\7f14423
2761 Node: Windows and Menus
\7f15783
2762 Node: XEmacs Window
\7f16237
2763 Node: Pull-down Menus
\7f19866
2764 Node: File menu
\7f20750
2765 Node: Edit menu
\7f24017
2766 Node: Options Menu
\7f26552
2767 Node: Buffers Menu
\7f31346
2768 Node: Help menu
\7f31741
2770 Node: Insert
\7f33843
2771 Node: Cursor Position
\7f35176
2773 Node: Numeric Argument
\7f38415
2775 Node: Customization Basics
\7f40380
2776 Node: Customizing key Bindings
\7f41653
2777 Node: Customizing Menus
\7f45155
2779 Node: The Help Menu
\7f51298
2781 Node: Major Modes
\7f57134
2782 Node: Minor Modes
\7f61086
2784 Node: File Names
\7f65913
2785 Node: Visiting
\7f67723
2786 Node: Saving Files
\7f69852
2787 Node: Other Customizations
\7f73238
2788 Node: Setting Variables
\7f75708
2789 Node: Init File
\7f78916
2790 Node: Select and Move
\7f84427
2791 Node: Selecting Text
\7f85382
2793 Node: Region Operation
\7f88232
2794 Node: Moving Text
\7f89498
2795 Node: Accumulating text
\7f90743
2796 Node: Search and Replace
\7f93068
2797 Node: Key Index
\7f96940
2798 Node: Command Index
\7f101262
2799 Node: Variable Index
\7f106682
2800 Node: Concept Index
\7f107426