1 This is ../info/xemacs.info, produced by makeinfo version 4.0 from
4 INFO-DIR-SECTION XEmacs Editor
6 * XEmacs: (xemacs). XEmacs Editor.
9 This file documents 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
13 Microsystems, Inc. Copyright (C) 1995 Amdahl Corporation.
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.
19 Permission is granted to copy and distribute modified versions of
20 this manual under the conditions for verbatim copying, provided also
21 that the sections entitled "The GNU Manifesto", "Distribution" and "GNU
22 General Public License" are included exactly as in the original, and
23 provided that the entire resulting derived work is distributed under the
24 terms of a permission notice identical to this one.
26 Permission is granted to copy and distribute translations of this
27 manual into another language, under the above conditions for modified
28 versions, except that the sections entitled "The GNU Manifesto",
29 "Distribution" and "GNU General Public License" may be included in a
30 translation approved by the author instead of in the original English.
33 File: xemacs.info, Node: Mark Ring, Prev: Marking Objects, Up: Mark
38 Aside from delimiting the region, the mark is also useful for marking
39 a spot that you may want to go back to. To make this feature more
40 useful, Emacs remembers 16 previous locations of the mark in the "mark
41 ring". Most commands that set the mark push the old mark onto this
42 ring. To return to a marked location, use `C-u C-<SPC>' (or `C-u
43 C-@'); this is the command `set-mark-command' given a numeric argument.
44 The command moves point to where the mark was, and restores the mark
45 from the ring of former marks. Repeated use of this command moves point
46 to all the old marks on the ring, one by one. The marks you have seen
47 go to the end of the ring, so no marks are lost.
49 Each buffer has its own mark ring. All editing commands use the
50 current buffer's mark ring. In particular, `C-u C-<SPC>' always stays
53 Many commands that can move long distances, such as `M-<'
54 (`beginning-of-buffer'), start by setting the mark and saving the old
55 mark on the mark ring. This makes it easier for you to move back
56 later. Searches set the mark, unless they do not actually move point.
57 When a command sets the mark, `Mark Set' is printed in the echo area.
59 The variable `mark-ring-max' is the maximum number of entries to
60 keep in the mark ring. If that many entries exist and another entry is
61 added, the last entry in the list is discarded. Repeating `C-u
62 C-<SPC>' circulates through the entries that are currently in the ring.
64 The variable `mark-ring' holds the mark ring itself, as a list of
65 marker objects in the order most recent first. This variable is local
69 File: xemacs.info, Node: Mouse Selection, Next: Additional Mouse Operations, Prev: Mark, Up: Top
71 Selecting Text with the Mouse
72 =============================
74 If you are using XEmacs under X, you can use the mouse pointer to
75 select text. (The normal mouse pointer is an I-beam, the same pointer
78 The glyph variable `text-pointer-glyph' controls the shape of the
79 mouse pointer when over text. You can also control the shape of the
80 mouse pointer when over nontext using `nontext-pointer-glyph', and the
81 shape of the mouse pointer when over the modeline using
82 `modeline-pointer-glyph'. (Remember, you should use `set-glyph-image',
83 not `setq', to set one of these variables.)
85 If you want to get fancy, you can set the foreground and background
86 colors of the mouse pointer by setting the `pointer' face.
88 There are two ways to select a region of text with the mouse:
90 To select a word in text, double-click with the left mouse button
91 while the mouse cursor is over the word. The word is highlighted when
92 selected. On monochrome monitors, a stippled background indicates that a
93 region of text has been highlighted. On color monitors, a color
94 background indicates highlighted text. You can triple-click to select
97 To select an arbitrary region of text:
99 1. Move the mouse cursor over the character at the beginning of the
100 region of text you want to select.
102 2. Press and hold the left mouse button.
104 3. While holding the left mouse button down, drag the cursor to the
105 character at the end of the region of text you want to select.
107 4. Release the left mouse button.
108 The selected region of text is highlighted.
110 Once a region of text is selected, it becomes the primary X selection
111 (*note Using X Selections::) as well as the Emacs selected region. You
112 can paste it into other X applications and use the options from the
113 Edit pull-down menu on it. Since it is also the Emacs region, you can
114 use Emacs region commands on it.
117 File: xemacs.info, Node: Additional Mouse Operations, Next: Killing, Prev: Mouse Selection, Up: Top
119 Additional Mouse Operations
120 ===========================
122 XEmacs also provides the following mouse functions. Most of these
123 are not bound to mouse gestures by default, but they are provided for
124 your customization pleasure. For example, if you wanted `shift-left'
125 (that is, holding down the <Shift> key and clicking the left mouse
126 button) to delete the character at which you are pointing, then you
129 (global-set-key '(shift button1) 'mouse-del-char)
132 Delete the character pointed to by the mouse.
134 `mouse-delete-window'
135 Delete the Emacs window that the mouse is on.
137 `mouse-keep-one-window'
138 Select the Emacs window that the mouse is on, then delete all other
139 windows on this frame.
142 Kill the line pointed to by the mouse.
145 Print the length of the line indicated by the pointer.
148 Scroll point to the mouse position.
151 Select the Emacs window the mouse is on.
153 `mouse-select-and-split'
154 Select the Emacs window mouse is on, then split it vertically in
158 Select the Emacs window the mouse is on and set the mark at the
159 mouse position. Display the cursor at that position for a second.
162 Select the Emacs window that the mouse is on and move point to the
166 Make a selection with the mouse. This is the default binding of
167 the left mouse button (<button1>).
170 Extend the existing selection. This is the default binding of
173 `mouse-track-and-copy-to-cutbuffer'
174 Make a selection like `mouse-track', but also copy it to the cut
177 `mouse-track-delete-and-insert'
178 Make a selection with the mouse and insert it at point. This is
179 the default binding of <control-shift-button1>.
182 Make a selection with the mouse and insert it at point. This is
183 the default binding of <control-button1>.
185 `mouse-window-to-region'
186 Narrow a window to the region between the cursor and the mouse
189 The `M-x mouse-track' command should be bound to a mouse button. If
190 you click-and-drag, the selection is set to the region between the
191 point of the initial click and the point at which you release the
192 button. These positions do not need to be ordered.
194 If you click-and-release without moving the mouse, the point is
195 moved, and the selection is disowned (there will be no selection
196 owner.) The mark will be set to the previous position of point.
198 If you double-click, the selection will extend by symbols instead of
199 by characters. If you triple-click, the selection will extend by lines.
201 If you drag the mouse off the top or bottom of the window, you can
202 select pieces of text that are larger than the visible part of the
203 buffer; the buffer will scroll as necessary.
205 The selected text becomes the current X selection, and is also
206 copied to the top of the kill ring. Point will be left at the position
207 at which you released the button and the mark will be left at the
208 initial click position. Bind a mouse click to
209 `mouse-track-and-copy-to-cutbuffer' to copy selections to the cut
210 buffer. (See also the `mouse-track-adjust' command, on
213 The `M-x mouse-track-adjust' command should be bound to a mouse
214 button. The selection will be enlarged or shrunk so that the point of
215 the mouse click is one of its endpoints. This is only meaningful after
216 the `mouse-track' command (<button1>) has been executed.
218 The `M-x mouse-track-delete-and-insert' command is exactly the same
219 as the `mouse-track' command on <button1>, except that point is not
220 moved; the selected text is immediately inserted after being selected;
221 and the text of the selection is deleted.
223 The `M-x mouse-track-insert' command is exactly the same as the
224 `mouse-track' command on <button1>, except that point is not moved; the
225 selected text is immediately inserted after being selected; and the
226 selection is immediately disowned afterwards.
229 File: xemacs.info, Node: Killing, Next: Yanking, Prev: Additional Mouse Operations, Up: Top
234 Most commands that erase text from the buffer save it. You can get
235 the text back if you change your mind, or you can move or copy it to
236 other parts of the buffer. Commands which erase text and save it in the
237 kill ring are known as "kill" commands. Some other commands erase text
238 but do not save it; they are known as "delete" commands. (This
239 distinction is made only for erasing text in the buffer.)
241 The commands' names and individual descriptions use the words `kill'
242 and `delete' to indicate what they do. If you perform a kill or delete
243 command by mistake, use the `C-x u' (`undo') command to undo it (*note
244 Undo::). The delete commands include `C-d' (`delete-char') and <DEL>
245 (`delete-backward-char'), which delete only one character at a time,
246 and those commands that delete only spaces or newlines. Commands that
247 can destroy significant amounts of nontrivial data usually kill.
253 Delete next character (`delete-char').
256 Delete previous character (`delete-backward-char').
259 Delete spaces and tabs around point (`delete-horizontal-space').
262 Delete spaces and tabs around point, leaving one space
266 Delete blank lines around the current line (`delete-blank-lines').
269 Join two lines by deleting the intervening newline, and any
270 indentation following it (`delete-indentation').
272 The most basic delete commands are `C-d' (`delete-char') and <DEL>
273 (`delete-backward-char'). `C-d' deletes the character after point, the
274 one the cursor is "on top of". Point doesn't move. <DEL> deletes the
275 character before the cursor, and moves point back. You can delete
276 newlines like any other characters in the buffer; deleting a newline
277 joins two lines. Actually, `C-d' and <DEL> aren't always delete
278 commands; if you give them an argument, they kill instead, since they
279 can erase more than one character this way.
281 The other delete commands delete only formatting characters: spaces,
282 tabs and newlines. `M-\' (`delete-horizontal-space') deletes all
283 spaces and tab characters before and after point. `M-<SPC>'
284 (`just-one-space') does the same but leaves a single space after point,
285 regardless of the number of spaces that existed previously (even zero).
287 `C-x C-o' (`delete-blank-lines') deletes all blank lines after the
288 current line. If the current line is blank, it deletes all blank lines
289 preceding the current line as well as leaving one blank line, the
290 current line. `M-^' (`delete-indentation') joins the current line and
291 the previous line, or, if given an argument, joins the current line and
292 the next line by deleting a newline and all surrounding spaces, possibly
293 leaving a single space. *Note M-^: Indentation.
299 Kill rest of line or one or more lines (`kill-line').
301 The simplest kill command is `C-k'. If given at the beginning of a
302 line, it kills all the text on the line, leaving the line blank. If
303 given on a blank line, the blank line disappears. As a consequence, a
304 line disappears completely if you go to the front of a non-blank line
305 and type `C-k' twice.
307 More generally, `C-k' kills from point up to the end of the line,
308 unless it is at the end of a line. In that case, it kills the newline
309 following the line, thus merging the next line into the current one.
310 Emacs ignores invisible spaces and tabs at the end of the line when
311 deciding which case applies: if point appears to be at the end of the
312 line, you can be sure the newline will be killed.
314 If you give `C-k' a positive argument, it kills that many lines and
315 the newlines that follow them (however, text on the current line before
316 point is not killed). With a negative argument, `C-k' kills back to a
317 number of line beginnings. An argument of -2 means kill back to the
318 second line beginning. If point is at the beginning of a line, that
319 line beginning doesn't count, so `C-u - 2 C-k' with point at the front
320 of a line kills the two previous lines.
322 `C-k' with an argument of zero kills all the text before point on the
329 Kill region (from point to the mark) (`kill-region'). *Note
333 Kill word (`kill-word').
336 Kill word backwards (`backward-kill-word').
339 Kill back to beginning of sentence (`backward-kill-sentence').
343 Kill to end of sentence (`kill-sentence').
346 Kill sexp (`kill-sexp'). *Note Lists::.
349 Kill up to next occurrence of CHAR (`zap-to-char').
351 `C-w' (`kill-region') is a very general kill command; it kills
352 everything between point and the mark. You can use this command to kill
353 any contiguous sequence of characters by first setting the mark at one
354 end of a sequence of characters, then going to the other end and typing
357 A convenient way of killing is combined with searching: `M-z'
358 (`zap-to-char') reads a character and kills from point up to (but not
359 including) the next occurrence of that character in the buffer. If
360 there is no next occurrence, killing goes to the end of the buffer. A
361 numeric argument acts as a repeat count. A negative argument means to
362 search backward and kill text before point.
364 Other syntactic units can be killed: words, with `M-<DEL>' and `M-d'
365 (*note Words::); sexps, with `C-M-k' (*note Lists::); and sentences,
366 with `C-x <DEL>' and `M-k' (*note Sentences::).
369 File: xemacs.info, Node: Yanking, Next: Using X Selections, Prev: Killing, Up: Top
374 "Yanking" means getting back text which was killed. Some systems
375 call this "pasting". The usual way to move or copy text is to kill it
376 and then yank it one or more times.
379 Yank last killed text (`yank').
382 Replace re-inserted killed text with the previously killed text
386 Save region as last killed text without actually killing it
387 (`copy-region-as-kill').
390 Append next kill to last batch of killed text (`append-next-kill').
394 * Kill Ring:: Where killed text is stored. Basic yanking.
395 * Appending Kills:: Several kills in a row all yank together.
396 * Earlier Kills:: Yanking something killed some time ago.
399 File: xemacs.info, Node: Kill Ring, Next: Appending Kills, Prev: Yanking, Up: Yanking
404 All killed text is recorded in the "kill ring", a list of blocks of
405 text that have been killed. There is only one kill ring, used in all
406 buffers, so you can kill text in one buffer and yank it in another
407 buffer. This is the usual way to move text from one file to another.
408 (*Note Accumulating Text::, for some other ways.)
410 If you have two separate Emacs processes, you cannot use the kill
411 ring to move text. If you are using XEmacs under X, however, you can
412 use the X selection mechanism to move text from one to another.
414 If you are using XEmacs under X and have one Emacs process with
415 multiple frames, they do share the same kill ring. You can kill or
416 copy text in one Emacs frame, then yank it in the other frame belonging
419 The command `C-y' (`yank') reinserts the text of the most recent
420 kill. It leaves the cursor at the end of the text and sets the mark at
421 the beginning of the text. *Note Mark::.
423 `C-u C-y' yanks the text, leaves the cursor in front of the text,
424 and sets the mark after it, if the argument is with just a `C-u'. Any
425 other argument, including `C-u' and digits, has different results,
426 described below, under "Yanking Earlier Kills".
428 To copy a block of text, you can also use `M-w'
429 (`copy-region-as-kill'), which copies the region into the kill ring
430 without removing it from the buffer. `M-w' is similar to `C-w' followed
431 by `C-y' but does not mark the buffer as "modified" and does not
432 actually cut anything.
435 File: xemacs.info, Node: Appending Kills, Next: Earlier Kills, Prev: Kill Ring, Up: Yanking
440 Normally, each kill command pushes a new block onto the kill ring.
441 However, two or more kill commands in a row combine their text into a
442 single entry, so that a single `C-y' yanks it all back. This means you
443 don't have to kill all the text you want to yank in one command; you
444 can kill line after line, or word after word, until you have killed what
445 you want, then get it all back at once using `C-y'. (Thus we join
446 television in leading people to kill thoughtlessly.)
448 Commands that kill forward from point add onto the end of the
449 previous killed text. Commands that kill backward from point add onto
450 the beginning. This way, any sequence of mixed forward and backward
451 kill commands puts all the killed text into one entry without
452 rearrangement. Numeric arguments do not break the sequence of
453 appending kills. For example, suppose the buffer contains:
457 and here is the third.
459 with point at the beginning of the second line. If you type `C-k C-u 2
460 M-<DEL> C-k', the first `C-k' kills the text `line of sample text',
461 `C-u 2 M-<DEL>' kills `the first' with the newline that followed it,
462 and the second `C-k' kills the newline after the second line. The
463 result is that the buffer contains `This is and here is the third.' and
464 a single kill entry contains `the first<RET>line of sample
465 text<RET>'--all the killed text, in its original order.
467 If a kill command is separated from the last kill command by other
468 commands (not just numeric arguments), it starts a new entry on the kill
469 ring. To force a kill command to append, first type the command `C-M-w'
470 (`append-next-kill'). `C-M-w' tells the following command, if it is a
471 kill command, to append the text it kills to the last killed text,
472 instead of starting a new entry. With `C-M-w', you can kill several
473 separated pieces of text and accumulate them to be yanked back in one
477 File: xemacs.info, Node: Earlier Kills, Prev: Appending Kills, Up: Yanking
479 Yanking Earlier Kills
480 ---------------------
482 To recover killed text that is no longer the most recent kill, you
483 need the `Meta-y' (`yank-pop') command. You can use `M-y' only after a
484 `C-y' or another `M-y'. It takes the text previously yanked and
485 replaces it with the text from an earlier kill. To recover the text of
486 the next-to-the-last kill, first use `C-y' to recover the last kill,
487 then `M-y' to replace it with the previous kill.
489 You can think in terms of a "last yank" pointer which points at an
490 item in the kill ring. Each time you kill, the "last yank" pointer
491 moves to the new item at the front of the ring. `C-y' yanks the item
492 which the "last yank" pointer points to. `M-y' moves the "last yank"
493 pointer to a different item, and the text in the buffer changes to
494 match. Enough `M-y' commands can move the pointer to any item in the
495 ring, so you can get any item into the buffer. Eventually the pointer
496 reaches the end of the ring; the next `M-y' moves it to the first item
499 Yanking moves the "last yank" pointer around the ring, but does not
500 change the order of the entries in the ring, which always runs from the
501 most recent kill at the front to the oldest one still remembered.
503 Use `M-y' with a numeric argument to advance the "last yank" pointer
504 by the specified number of items. A negative argument moves the
505 pointer toward the front of the ring; from the front of the ring, it
506 moves to the last entry and starts moving forward from there.
508 Once the text you are looking for is brought into the buffer, you can
509 stop doing `M-y' commands and the text will stay there. Since the text
510 is just a copy of the kill ring item, editing it in the buffer does not
511 change what's in the ring. As long you don't kill additional text, the
512 "last yank" pointer remains at the same place in the kill ring:
513 repeating `C-y' will yank another copy of the same old kill.
515 If you know how many `M-y' commands it would take to find the text
516 you want, you can yank that text in one step using `C-y' with a numeric
517 argument. `C-y' with an argument greater than one restores the text
518 the specified number of entries back in the kill ring. Thus, `C-u 2
519 C-y' gets the next to the last block of killed text. It is equivalent
520 to `C-y M-y'. `C-y' with a numeric argument starts counting from the
521 "last yank" pointer, and sets the "last yank" pointer to the entry that
524 The variable `kill-ring-max' controls the length of the kill ring;
525 no more than that many blocks of killed text are saved.
528 File: xemacs.info, Node: Using X Selections, Next: Accumulating Text, Prev: Yanking, Up: Top
533 In the X window system, mouse selections provide a simple mechanism
534 for text transfer between different applications. In a typical X
535 application, you can select text by pressing the left mouse button and
536 dragging the cursor over the text you want to copy. The text becomes
537 the primary X selection and is highlighted. The highlighted region is
538 also the Emacs selected region.
540 * Since the region is the primary X selection, you can go to a
541 different X application and click the middle mouse button: the
542 text that you selected in the previous application is pasted into
543 the current application.
545 * Since the region is the Emacs selected region, you can use all
546 region commands (`C-w, M-w' etc.) as well as the options of the
547 Edit menu to manipulate the selected text.
551 * X Clipboard Selection:: Pasting to the X clipboard.
552 * X Selection Commands:: Other operations on the selection.
553 * X Cut Buffers:: X cut buffers are available for compatibility.
554 * Active Regions:: Using zmacs-style highlighting of the
558 File: xemacs.info, Node: X Clipboard Selection, Next: X Selection Commands, Prev: Using X Selections, Up: Using X Selections
560 The Clipboard Selection
561 -----------------------
563 There are other kinds of X selections besides the Primary selection;
564 one common one is the Clipboard selection. Some applications prefer to
565 transfer data using this selection in preference to the Primary. One
566 can transfer text from the Primary selection to the Clipboard
567 selection with the Copy command under the Edit menu in the menubar.
569 Usually, the clipboard selection is not visible. However, if you
570 run the `xclipboard' application, the text most recently copied to the
571 clipboard (with the Copy command) is displayed in a window. Any time
572 new text is thus copied, the `xclipboard' application makes a copy of
573 it and displays it in its window. The value of the clipboard can
574 survive the lifetime of the running Emacs process. The `xclipboard'
575 man page provides more details.
577 Warning: If you use the `xclipboard' application, remember that it
578 maintains a list of all things that have been pasted to the clipboard
579 (that is, copied with the Copy command). If you don't manually delete
580 elements from this list by clicking on the Delete button in the
581 `xclipboard' window, the clipboard will eventually consume a lot of
584 In summary, some X applications (such as `xterm') allow one to paste
585 text in them from XEmacs in the following way:
587 * Drag out a region of text in Emacs with the left mouse button,
588 making that text be the Primary selection.
590 * Click the middle button in the other application, pasting the
593 With some other applications (notably, the OpenWindows and Motif
594 tools) you must use this method instead:
596 * Drag out a region of text in Emacs with the left mouse button,
597 making that text be the Primary selection.
599 * Copy the selected text to the Clipboard selection by selecting the
600 Copy menu item from the Edit menu, or by hitting the Copy key on
603 * Paste the text in the other application by selecting Paste from its
604 menu, or by hitting the Paste key on your keyboard.
607 File: xemacs.info, Node: X Selection Commands, Next: X Cut Buffers, Prev: X Clipboard Selection, Up: Using X Selections
609 Miscellaneous X Selection Commands
610 ----------------------------------
612 `M-x x-copy-primary-selection'
613 Copy the primary selection to both the kill ring and the Clipboard.
615 `M-x x-insert-selection'
616 Insert the current selection into the buffer at point.
618 `M-x x-delete-primary-selection'
619 Deletes the text in the primary selection without copying it to
620 the kill ring or the Clipboard.
622 `M-x x-kill-primary-selection'
623 Deletes the text in the primary selection and copies it to both
624 the kill ring and the Clipboard.
627 Kill the text between point and the mouse and copy it to the
628 clipboard and to the cut buffer.
630 `M-x x-own-secondary-selection'
631 Make a secondary X selection of the given argument.
633 `M-x x-own-selection'
634 Make a primary X selection of the given argument.
636 `M-x x-set-point-and-insert-selection'
637 Set point where clicked and insert the primary selection or the
641 File: xemacs.info, Node: X Cut Buffers, Next: Active Regions, Prev: X Selection Commands, Up: Using X Selections
646 X cut buffers are a different, older way of transferring text between
647 applications. XEmacs supports cut buffers for compatibility with older
648 programs, even though selections are now the preferred way of
651 X has a concept of applications "owning" selections. When you select
652 text by clicking and dragging inside an application, the application
653 tells the X server that it owns the selection. When another
654 application asks the X server for the value of the selection, the X
655 server requests the information from the owner. When you use
656 selections, the selection data is not actually transferred unless
657 someone wants it; the act of making a selection doesn't transfer data.
658 Cut buffers are different: when you "own" a cut buffer, the data is
659 actually transferred to the X server immediately, and survives the
660 lifetime of the application.
662 Any time a region of text becomes the primary selection in Emacs,
663 Emacs also copies that text to the cut buffer. This makes it possible
664 to copy text from an XEmacs buffer and paste it into an older,
665 non-selection-based application (such as Emacs 18).
667 Note: Older versions of Emacs could not access the X selections, only
671 File: xemacs.info, Node: Active Regions, Prev: X Cut Buffers, Up: Using X Selections
676 By default, both the text you select in an Emacs buffer using the
677 click-and-drag mechanism and text you select by setting point and the
678 mark is highlighted. You can use Emacs region commands as well as the
679 Cut and Copy commands on the highlighted region you selected with the
682 If you prefer, you can make a distinction between text selected with
683 the mouse and text selected with point and the mark by setting the
684 variable `zmacs-regions' to `nil'. In that case:
686 * The text selected with the mouse becomes both the X selection and
687 the Emacs selected region. You can use menu-bar commands as well
688 as Emacs region commands on it.
690 * The text selected with point and the mark is not highlighted. You
691 can only use Emacs region commands on it, not the menu-bar items.
693 Active regions originally come from Zmacs, the Lisp Machine editor.
694 The idea behind them is that commands can only operate on a region when
695 the region is in an "active" state. Put simply, you can only operate on
696 a region that is highlighted.
698 The variable `zmacs-regions' checks whether LISPM-style active
699 regions should be used. This means that commands that operate on the
700 region (the area between point and the mark) only work while the region
701 is in the active state, which is indicated by highlighting. Most
702 commands causes the region to not be in the active state; for example,
703 `C-w' only works immediately after activating the region.
706 * Commands that operate on the region only work if the region is
709 * Only a very small set of commands causes the region to become
710 active-- those commands whose semantics are to mark an area, such
713 * The region is deactivated after each command that is executed,
714 except that motion commands do not change whether the region is
717 `set-mark-command' (`C-SPC') pushes a mark and activates the region.
718 Moving the cursor with normal motion commands (`C-n', `C-p', etc.)
719 will cause the region between point and the recently-pushed mark to be
720 highlighted. It will remain highlighted until some non-motion command
723 `exchange-point-and-mark' (`C-x C-x') activates the region. So if
724 you mark a region and execute a command that operates on it, you can
725 reactivate the same region with `C-x C-x' (or perhaps `C-x C-x C-x
726 C-x') to operate on it again.
728 Generally, commands that push marks as a means of navigation, such as
729 `beginning-of-buffer' (`M-<') and `end-of-buffer' (`M->'), do not
730 activate the region. However, commands that push marks as a means of
731 marking an area of text, such as `mark-defun' (`M-C-h'), `mark-word'
732 (`M-@'), and `mark-whole-buffer' (`C-x h'), do activate the region.
734 When `zmacs-regions' is `t', there is no distinction between the
735 primary X selection and the active region selected by point and the
736 mark. To see this, set the mark (<C-SPC>) and move the cursor with any
737 cursor-motion command: the region between point and mark is
738 highlighted, and you can watch it grow and shrink as you move the
741 Any other commands besides cursor-motion commands (such as inserting
742 or deleting text) will cause the region to no longer be active; it will
743 no longer be highlighted, and will no longer be the primary selection.
744 Region can be explicitly deactivated with `C-g'.
746 Commands that require a region (such as `C-w') signal an error if
747 the region is not active. Certain commands cause the region to be in
748 its active state. The most common ones are `push-mark' (<C-SPC>) and
749 `exchange-point-and-mark' (`C-x C-x').
751 When `zmacs-regions' is `t', programs can be non-intrusive on the
752 state of the region by setting the variable `zmacs-region-stays' to a
753 non-`nil' value. If you are writing a new Emacs command that is
754 conceptually a "motion" command and should not interfere with the
755 current highlightedness of the region, then you may set this variable.
756 It is reset to `nil' after each user command is executed.
758 When `zmacs-regions' is `t', programs can make the region between
759 point and mark go into the active (highlighted) state by using the
760 function `zmacs-activate-region'. Only a small number of commands
763 When `zmacs-regions' is `t', programs can deactivate the region
764 between point and the mark by using `zmacs-deactivate-region'. Note:
765 you should not have to call this function; the command loop calls it
769 File: xemacs.info, Node: Accumulating Text, Next: Rectangles, Prev: Using X Selections, Up: Top
774 Usually you copy or move text by killing it and yanking it, but
775 there are other ways that are useful for copying one block of text in
776 many places, or for copying many scattered blocks of text into one
779 If you like, you can accumulate blocks of text from scattered
780 locations either into a buffer or into a file. The relevant commands
781 are described here. You can also use Emacs registers for storing and
782 accumulating text. *Note Registers::.
784 `M-x append-to-buffer'
785 Append region to contents of specified buffer (`append-to-buffer').
787 `M-x prepend-to-buffer'
788 Prepend region to contents of specified buffer.
791 Copy region into specified buffer, deleting that buffer's old
795 Insert contents of specified buffer into current buffer at point.
798 Append region to the end of the contents of specified file.
800 To accumulate text into a buffer, use the command `M-x
801 append-to-buffer', which inserts a copy of the region into the buffer
802 BUFFERNAME, at the location of point in that buffer. If there is no
803 buffer with the given name, one is created.
805 If you append text to a buffer that has been used for editing, the
806 copied text goes to the place where point is. Point in that buffer is
807 left at the end of the copied text, so successive uses of
808 `append-to-buffer' accumulate the text in the specified buffer in the
809 same order as they were copied. Strictly speaking, this command does
810 not always append to the text already in the buffer; but if this command
811 is the only command used to alter a buffer, it does always append to the
812 existing text because point is always at the end.
814 `M-x prepend-to-buffer' is similar to `append-to-buffer', but point
815 in the other buffer is left before the copied text, so successive
816 prependings add text in reverse order. `M-x copy-to-buffer' is
817 similar, except that any existing text in the other buffer is deleted,
818 so the buffer is left containing just the text newly copied into it.
820 You can retrieve the accumulated text from that buffer with `M-x
821 insert-buffer', which takes BUFFERNAME as an argument. It inserts a
822 copy of the text in buffer BUFFERNAME into the selected buffer. You
823 could alternatively select the other buffer for editing, perhaps moving
824 text from it by killing or with `append-to-buffer'. *Note Buffers::,
825 for background information on buffers.
827 Instead of accumulating text within Emacs in a buffer, you can append
828 text directly into a file with `M-x append-to-file', which takes
829 FILE-NAME as an argument. It adds the text of the region to the end of
830 the specified file. The file is changed immediately on disk. This
831 command is normally used with files that are not being visited in
832 Emacs. Using it on a file that Emacs is visiting can produce confusing
833 results, because the file's text inside Emacs does not change while the
837 File: xemacs.info, Node: Rectangles, Next: Registers, Prev: Accumulating Text, Up: Top
842 The rectangle commands affect rectangular areas of text: all
843 characters between a certain pair of columns, in a certain range of
844 lines. Commands are provided to kill rectangles, yank killed
845 rectangles, clear them out, or delete them. Rectangle commands are
846 useful with text in multicolumnar formats, like code with comments at
847 the right, or for changing text into or out of such formats.
849 To specify the rectangle a command should work on, put the mark at
850 one corner and point at the opposite corner. The specified rectangle is
851 called the "region-rectangle" because it is controlled about the same
852 way the region is controlled. Remember that a given combination of
853 point and mark values can be interpreted either as specifying a region
854 or as specifying a rectangle; it is up to the command that uses them to
855 choose the interpretation.
857 `M-x delete-rectangle'
858 Delete the text of the region-rectangle, moving any following text
859 on each line leftward to the left edge of the region-rectangle.
862 Similar, but also save the contents of the region-rectangle as the
863 "last killed rectangle".
866 Yank the last killed rectangle with its upper left corner at point.
869 Insert blank space to fill the space of the region-rectangle. The
870 previous contents of the region-rectangle are pushed rightward.
872 `M-x clear-rectangle'
873 Clear the region-rectangle by replacing its contents with spaces.
875 The rectangle operations fall into two classes: commands deleting and
876 moving rectangles, and commands for blank rectangles.
878 There are two ways to get rid of the text in a rectangle: you can
879 discard the text (delete it) or save it as the "last killed" rectangle.
880 The commands for these two ways are `M-x delete-rectangle' and `M-x
881 kill-rectangle'. In either case, the portion of each line that falls
882 inside the rectangle's boundaries is deleted, causing following text
883 (if any) on the line to move left.
885 Note that "killing" a rectangle is not killing in the usual sense;
886 the rectangle is not stored in the kill ring, but in a special place
887 that only records the most recently killed rectangle (that is, does not
888 append to a killed rectangle). Different yank commands have to be used
889 and only one rectangle is stored, because yanking a rectangle is quite
890 different from yanking linear text and yank-popping commands are
891 difficult to make sense of.
893 Inserting a rectangle is the opposite of deleting one. You specify
894 where to put the upper left corner by putting point there. The
895 rectangle's first line is inserted at point, the rectangle's second line
896 is inserted at a point one line vertically down, and so on. The number
897 of lines affected is determined by the height of the saved rectangle.
899 To insert the last killed rectangle, type `M-x yank-rectangle'.
900 This can be used to convert single-column lists into double-column
901 lists; kill the second half of the list as a rectangle and then yank it
902 beside the first line of the list.
904 There are two commands for working with blank rectangles: `M-x
905 clear-rectangle' erases existing text, and `M-x open-rectangle' inserts
906 a blank rectangle. Clearing a rectangle is equivalent to deleting it
907 and then inserting a blank rectangle of the same size.
909 Rectangles can also be copied into and out of registers. *Note
910 Rectangle Registers: RegRect.
913 File: xemacs.info, Node: Registers, Next: Display, Prev: Rectangles, Up: Top
918 XEmacs "registers" are places in which you can save text or
919 positions for later use. Once you save text or a rectangle in a
920 register, you can copy it into the buffer once or many times; a position
921 saved in a register is used by moving point to that position.
922 Rectangles can also be copied into and out of registers (*note
925 Each register has a name which is a single character. A register can
926 store a piece of text, a rectangle, a position, a window configuration,
927 or a file name, but only one thing at any given time. Whatever you
928 store in a register remains there until you store something else in that
929 register. To see what a register R contains, use `M-x view-register'.
931 `M-x view-register <RET> R'
932 Display a description of what register R contains.
934 `M-x view-register' reads a register name as an argument and then
935 displays the contents of the specified register.
939 * Position: RegPos. Saving positions in registers.
940 * Text: RegText. Saving text in registers.
941 * Rectangle: RegRect. Saving rectangles in registers.
942 * Configurations: RegConfig. Saving window configurations in registers.
943 * Files: RegFiles. File names in registers.
944 * Numbers: RegNumbers. Numbers in registers.
945 * Bookmarks:: Bookmarks are like registers, but persistent.
948 File: xemacs.info, Node: RegPos, Next: RegText, Prev: Registers, Up: Registers
950 Saving Positions in Registers
951 =============================
953 Saving a position records a place in a buffer so that you can move
954 back there later. Moving to a saved position switches to that buffer
955 and moves point to that place in it.
958 Save position of point in register R (`point-to-register').
961 Jump to the position saved in register R (`jump-to-register').
963 To save the current position of point in a register, choose a name R
964 and type `C-x r <SPC> R'. The register R retains the position thus
965 saved until you store something else in that register.
967 The command `C-x r j R' moves point to the position recorded in
968 register R. The register is not affected; it continues to record the
969 same location. You can jump to the same position using the same
970 register as often as you want.
972 If you use `C-x r j' to go to a saved position, but the buffer it
973 was saved from has been killed, `C-x r j' tries to create the buffer
974 again by visiting the same file. Of course, this works only for buffers
975 that were visiting files.
978 File: xemacs.info, Node: RegText, Next: RegRect, Prev: RegPos, Up: Registers
980 Saving Text in Registers
981 ========================
983 When you want to insert a copy of the same piece of text many times,
984 it can be impractical to use the kill ring, since each subsequent kill
985 moves the piece of text further down on the ring. It becomes hard to
986 keep track of the argument needed to retrieve the same text with `C-y'.
987 An alternative is to store the text in a register with `C-x r s'
988 (`copy-to-register') and then retrieve it with `C-x r i'
992 Copy region into register R (`copy-to-register').
996 Insert text contents of register R (`insert-register').
998 `C-x r s R' stores a copy of the text of the region into the
999 register named R. Given a numeric argument, `C-x r s R' deletes the
1000 text from the buffer as well.
1002 `C-x r i R' inserts the text from register R in the buffer. By
1003 default it leaves point before the text and places the mark after it.
1004 With a numeric argument (`C-u'), it puts point after the text and the
1008 File: xemacs.info, Node: RegRect, Next: RegConfig, Prev: RegText, Up: Registers
1010 Saving Rectangles in Registers
1011 ==============================
1013 A register can contain a rectangle instead of lines of text. The
1014 rectangle is represented as a list of strings. *Note Rectangles::, for
1015 basic information on rectangles and how to specify rectangles in a
1019 Copy the region-rectangle into register R
1020 (`copy-rectangle-to-register'). With a numeric argument, delete it
1025 Insert the rectangle stored in register R (if it contains a
1026 rectangle) (`insert-register').
1028 The `C-x r i R' command inserts linear text if the register
1029 contains that, or inserts a rectangle if the register contains one.
1031 See also the command `sort-columns', which you can think of as
1032 sorting a rectangle. *Note Sorting::.
1035 File: xemacs.info, Node: RegConfig, Next: RegNumbers, Prev: RegRect, Up: Registers
1037 Saving Window Configurations in Registers
1038 =========================================
1040 You can save the window configuration of the selected frame in a
1041 register, or even the configuration of all windows in all frames, and
1042 restore the configuration later.
1045 Save the state of the selected frame's windows in register R
1046 (`window-configuration-to-register').
1048 `M-x frame-configuration-to-register <RET> R'
1049 Save the state of all frames, including all their windows, in
1050 register R (`frame-configuration-to-register').
1052 Use `C-x r j R' to restore a window or frame configuration. This is
1053 the same command used to restore a cursor position. When you restore a
1054 frame configuration, any existing frames not included in the
1055 configuration become invisible. If you wish to delete these frames
1056 instead, use `C-u C-x r j R'.
1059 File: xemacs.info, Node: RegNumbers, Next: RegFiles, Prev: RegConfig, Up: Registers
1061 Keeping Numbers in Registers
1062 ============================
1064 There are commands to store a number in a register, to insert the
1065 number in the buffer in decimal, and to increment it. These commands
1066 can be useful in keyboard macros (*note Keyboard Macros::).
1068 `C-u NUMBER C-x r n REG'
1069 Store NUMBER into register REG (`number-to-register').
1071 `C-u NUMBER C-x r + REG'
1072 Increment the number in register REG by NUMBER
1073 (`increment-register').
1076 Insert the number from register REG into the buffer.
1078 `C-x r g' is the same command used to insert any other sort of
1079 register contents into the buffer.
1082 File: xemacs.info, Node: RegFiles, Next: Bookmarks, Prev: RegNumbers, Up: Registers
1084 Keeping File Names in Registers
1085 ===============================
1087 If you visit certain file names frequently, you can visit them more
1088 conveniently if you put their names in registers. Here's the Lisp code
1089 used to put a file name in a register:
1091 (set-register ?R '(file . NAME))
1095 (set-register ?z '(file . "/usr/src/xemacs/src/ChangeLog"))
1097 puts the file name shown in register `z'.
1099 To visit the file whose name is in register R, type `C-x r j R'.
1100 (This is the same command used to jump to a position or restore a frame
1104 File: xemacs.info, Node: Bookmarks, Prev: RegFiles, Up: Registers
1109 "Bookmarks" are somewhat like registers in that they record
1110 positions you can jump to. Unlike registers, they have long names, and
1111 they persist automatically from one Emacs session to the next. The
1112 prototypical use of bookmarks is to record "where you were reading" in
1115 Note: bookmark.el is distributed in edit-utils package. You need to
1116 install that to use bookmark facility (*note Packages::).
1119 Set the bookmark for the visited file, at point.
1121 `C-x r m BOOKMARK <RET>'
1122 Set the bookmark named BOOKMARK at point (`bookmark-set').
1124 `C-x r b BOOKMARK <RET>'
1125 Jump to the bookmark named BOOKMARK (`bookmark-jump').
1128 List all bookmarks (`list-bookmarks').
1131 Save all the current bookmark values in the default bookmark file.
1133 The prototypical use for bookmarks is to record one current position
1134 in each of several files. So the command `C-x r m', which sets a
1135 bookmark, uses the visited file name as the default for the bookmark
1136 name. If you name each bookmark after the file it points to, then you
1137 can conveniently revisit any of those files with `C-x r b', and move to
1138 the position of the bookmark at the same time.
1140 To display a list of all your bookmarks in a separate buffer, type
1141 `C-x r l' (`list-bookmarks'). If you switch to that buffer, you can
1142 use it to edit your bookmark definitions or annotate the bookmarks.
1143 Type `C-h m' in that buffer for more information about its special
1146 When you kill XEmacs, XEmacs offers to save your bookmark values in
1147 your default bookmark file, `~/.emacs.bmk', if you have changed any
1148 bookmark values. You can also save the bookmarks at any time with the
1149 `M-x bookmark-save' command. The bookmark commands load your default
1150 bookmark file automatically. This saving and loading is how bookmarks
1151 persist from one XEmacs session to the next.
1153 If you set the variable `bookmark-save-flag' to 1, then each command
1154 that sets a bookmark will also save your bookmarks; this way, you don't
1155 lose any bookmark values even if XEmacs crashes. (The value, if a
1156 number, says how many bookmark modifications should go by between
1159 Bookmark position values are saved with surrounding context, so that
1160 `bookmark-jump' can find the proper position even if the file is
1161 modified slightly. The variable `bookmark-search-size' says how many
1162 characters of context to record, on each side of the bookmark's
1165 Here are some additional commands for working with bookmarks:
1167 `M-x bookmark-load <RET> FILENAME <RET>'
1168 Load a file named FILENAME that contains a list of bookmark
1169 values. You can use this command, as well as `bookmark-write', to
1170 work with other files of bookmark values in addition to your
1171 default bookmark file.
1173 `M-x bookmark-write <RET> FILENAME <RET>'
1174 Save all the current bookmark values in the file FILENAME.
1176 `M-x bookmark-delete <RET> BOOKMARK <RET>'
1177 Delete the bookmark named BOOKMARK.
1179 `M-x bookmark-insert-location <RET> BOOKMARK <RET>'
1180 Insert in the buffer the name of the file that bookmark BOOKMARK
1183 `M-x bookmark-insert <RET> BOOKMARK <RET>'
1184 Insert in the buffer the _contents_ of the file that bookmark
1188 File: xemacs.info, Node: Display, Next: Search, Prev: Registers, Up: Top
1190 Controlling the Display
1191 ***********************
1193 Since only part of a large buffer fits in the window, XEmacs tries
1194 to show the part that is likely to be interesting. The display control
1195 commands allow you to specify which part of the text you want to see.
1198 Clear frame and redisplay, scrolling the selected window to center
1199 point vertically within it (`recenter').
1204 Scroll forward (a windowful or a specified number of lines)
1205 (`scroll-up'). On most X keyboards, you can get this
1206 functionality using the key labelled `Page Down', which generates
1207 either `next' or `pgdn'.
1212 Scroll backward (`scroll-down'). On most X keyboards, you can get
1213 this functionality using the key labelled `Page Up', which
1214 generates either `prior' or `pgup'.
1217 Scroll so point is on line ARG (`recenter').
1222 Scroll text in current window to the left (`scroll-left').
1227 Scroll to the right (`scroll-right').
1230 Make deeply indented lines invisible (`set-selective-display').
1234 * Scrolling:: Moving text up and down in a window.
1235 * Horizontal Scrolling:: Moving text left and right in a window.
1236 * Selective Display:: Hiding lines with lots of indentation.
1237 * Display Vars:: Information on variables for customizing display.