Sync up with r21-2-27.
[chise/xemacs-chise.git-] / info / xemacs.info-5
1 This is Info file ../info/xemacs.info, produced by Makeinfo version
2 1.68 from the input file xemacs/xemacs.texi.
3
4 INFO-DIR-SECTION XEmacs Editor
5 START-INFO-DIR-ENTRY
6 * XEmacs: (xemacs).             XEmacs Editor.
7 END-INFO-DIR-ENTRY
8
9    This file documents the XEmacs editor.
10
11    Copyright (C) 1985, 1986, 1988 Richard M. Stallman.  Copyright (C)
12 1991, 1992, 1993, 1994 Lucid, Inc.  Copyright (C) 1993, 1994 Sun
13 Microsystems, Inc.  Copyright (C) 1995 Amdahl Corporation.
14
15    Permission is granted to make and distribute verbatim copies of this
16 manual provided the copyright notice and this permission notice are
17 preserved on all copies.
18
19    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.
25
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.
31
32 \1f
33 File: xemacs.info,  Node: Killing,  Next: Yanking,  Prev: Additional Mouse Operations,  Up: Top
34
35 Deletion and Killing
36 ====================
37
38    Most commands that erase text from the buffer save it. You can get
39 the text back if you change your mind, or you can move or copy it to
40 other parts of the buffer.  Commands which erase text and save it in the
41 kill ring are known as "kill" commands.  Some other commands erase text
42 but do not save it; they are known as "delete" commands.  (This
43 distinction is made only for erasing text in the buffer.)
44
45    The commands' names and individual descriptions use the words `kill'
46 and `delete' to indicate what they do.  If you perform a kill or delete
47 command by mistake, use the `C-x u' (`undo') command to undo it (*note
48 Undo::.). The delete commands include `C-d' (`delete-char') and <DEL>
49 (`delete-backward-char'), which delete only one character at a time,
50 and those commands that delete only spaces or newlines.  Commands that
51 can destroy significant amounts of nontrivial data usually kill.
52
53 Deletion
54 --------
55
56 `C-d'
57      Delete next character (`delete-char').
58
59 `<DEL>'
60      Delete previous character (`delete-backward-char').
61
62 `M-\'
63      Delete spaces and tabs around point (`delete-horizontal-space').
64
65 `M-<SPC>'
66      Delete spaces and tabs around point, leaving one space
67      (`just-one-space').
68
69 `C-x C-o'
70      Delete blank lines around the current line (`delete-blank-lines').
71
72 `M-^'
73      Join two lines by deleting the intervening newline, and any
74      indentation following it (`delete-indentation').
75
76    The most basic delete commands are `C-d' (`delete-char') and <DEL>
77 (`delete-backward-char').  `C-d' deletes the character after point, the
78 one the cursor is "on top of".  Point doesn't move.  <DEL> deletes the
79 character before the cursor, and moves point back.  You can delete
80 newlines like any other characters in the buffer; deleting a newline
81 joins two lines.  Actually, `C-d' and <DEL> aren't always delete
82 commands; if you give them an argument, they kill instead, since they
83 can erase more than one character this way.
84
85    The other delete commands delete only formatting characters: spaces,
86 tabs and newlines.  `M-\' (`delete-horizontal-space') deletes all
87 spaces and tab characters before and after point.  `M-<SPC>'
88 (`just-one-space') does the same but leaves a single space after point,
89 regardless of the number of spaces that existed previously (even zero).
90
91    `C-x C-o' (`delete-blank-lines') deletes all blank lines after the
92 current line. If the current line is blank, it deletes all blank lines
93 preceding the current line as well as leaving one blank line, the
94 current line.  `M-^' (`delete-indentation') joins the current line and
95 the previous line, or, if given an argument, joins the current line and
96 the next line by deleting a newline and all surrounding spaces, possibly
97 leaving a single space.  *Note M-^: Indentation.
98
99 Killing by Lines
100 ----------------
101
102 `C-k'
103      Kill rest of line or one or more lines (`kill-line').
104
105    The simplest kill command is `C-k'.  If given at the beginning of a
106 line, it kills all the text on the line, leaving the line blank.  If
107 given on a blank line, the blank line disappears.  As a consequence, a
108 line disappears completely if you go to the front of a non-blank line
109 and type `C-k' twice.
110
111    More generally, `C-k' kills from point up to the end of the line,
112 unless it is at the end of a line.  In that case, it kills the newline
113 following the line, thus merging the next line into the current one.
114 Emacs ignores invisible spaces and tabs at the end of the line when
115 deciding which case applies: if point appears to be at the end of the
116 line, you can be sure the newline will be killed.
117
118    If you give `C-k' a positive argument, it kills that many lines and
119 the newlines that follow them (however, text on the current line before
120 point is not killed).  With a negative argument, `C-k' kills back to a
121 number of line beginnings.  An argument of -2 means kill back to the
122 second line beginning.  If point is at the beginning of a line, that
123 line beginning doesn't count, so `C-u - 2 C-k' with point at the front
124 of a line kills the two previous lines.
125
126    `C-k' with an argument of zero kills all the text before point on the
127 current line.
128
129 Other Kill Commands
130 -------------------
131
132 `C-w'
133      Kill region (from point to the mark) (`kill-region').  *Note
134      Words::.
135
136 `M-d'
137      Kill word (`kill-word').
138
139 `M-<DEL>'
140      Kill word backwards (`backward-kill-word').
141
142 `C-x <DEL>'
143      Kill back to beginning of sentence (`backward-kill-sentence').
144      *Note Sentences::.
145
146 `M-k'
147      Kill to end of sentence (`kill-sentence').
148
149 `C-M-k'
150      Kill sexp (`kill-sexp').  *Note Lists::.
151
152 `M-z CHAR'
153      Kill up to next occurrence of CHAR (`zap-to-char').
154
155    `C-w' (`kill-region') is a very general kill command; it kills
156 everything between point and the mark. You can use this command to kill
157 any contiguous sequence of characters by first setting the mark at one
158 end of a sequence of characters, then going to the other end and typing
159 `C-w'.
160
161    A convenient way of killing is combined with searching: `M-z'
162 (`zap-to-char') reads a character and kills from point up to (but not
163 including) the next occurrence of that character in the buffer.  If
164 there is no next occurrence, killing goes to the end of the buffer.  A
165 numeric argument acts as a repeat count.  A negative argument means to
166 search backward and kill text before point.
167
168    Other syntactic units can be killed: words, with `M-<DEL>' and `M-d'
169 (*note Words::.); sexps, with `C-M-k' (*note Lists::.); and sentences,
170 with `C-x <DEL>' and `M-k' (*note Sentences::.).
171
172 \1f
173 File: xemacs.info,  Node: Yanking,  Next: Using X Selections,  Prev: Killing,  Up: Top
174
175 Yanking
176 =======
177
178    "Yanking" means getting back text which was killed. Some systems
179 call this "pasting".  The usual way to move or copy text is to kill it
180 and then yank it one or more times.
181
182 `C-y'
183      Yank last killed text (`yank').
184
185 `M-y'
186      Replace re-inserted killed text with the previously killed text
187      (`yank-pop').
188
189 `M-w'
190      Save region as last killed text without actually killing it
191      (`copy-region-as-kill').
192
193 `C-M-w'
194      Append next kill to last batch of killed text (`append-next-kill').
195
196 * Menu:
197
198 * Kill Ring::       Where killed text is stored.  Basic yanking.
199 * Appending Kills:: Several kills in a row all yank together.
200 * Earlier Kills::   Yanking something killed some time ago.
201
202 \1f
203 File: xemacs.info,  Node: Kill Ring,  Next: Appending Kills,  Prev: Yanking,  Up: Yanking
204
205 The Kill Ring
206 -------------
207
208    All killed text is recorded in the "kill ring", a list of blocks of
209 text that have been killed.  There is only one kill ring, used in all
210 buffers, so you can kill text in one buffer and yank it in another
211 buffer.  This is the usual way to move text from one file to another.
212 (*Note Accumulating Text::, for some other ways.)
213
214    If you have two separate Emacs processes, you cannot use the kill
215 ring to move text. If you are using XEmacs under X, however, you can
216 use the X selection mechanism to move text from one to another.
217
218    If you are using XEmacs under X and have one Emacs process with
219 multiple frames, they do share the same kill ring.  You can kill or
220 copy text in one Emacs frame, then yank it in the other frame belonging
221 to the same process.
222
223    The command `C-y' (`yank') reinserts the text of the most recent
224 kill.  It leaves the cursor at the end of the text and sets the mark at
225 the beginning of the text.  *Note Mark::.
226
227    `C-u C-y' yanks the text, leaves the cursor in front of the text,
228 and sets the mark after it, if the argument is with just a `C-u'.  Any
229 other argument, including `C-u' and digits, has different results,
230 described below, under "Yanking Earlier Kills".
231
232    To copy a block of text, you can also use `M-w'
233 (`copy-region-as-kill'), which copies the region into the kill ring
234 without removing it from the buffer. `M-w' is similar to `C-w' followed
235 by `C-y' but does not mark the buffer as "modified" and does not
236 actually cut anything.
237
238 \1f
239 File: xemacs.info,  Node: Appending Kills,  Next: Earlier Kills,  Prev: Kill Ring,  Up: Yanking
240
241 Appending Kills
242 ---------------
243
244    Normally, each kill command pushes a new block onto the kill ring.
245 However, two or more kill commands in a row combine their text into a
246 single entry, so that a single `C-y' yanks it all back. This means you
247 don't have to kill all the text you want to yank in one command; you
248 can kill line after line, or word after word, until you have killed what
249 you want, then get it all back at once using `C-y'. (Thus we join
250 television in leading people to kill thoughtlessly.)
251
252    Commands that kill forward from point add onto the end of the
253 previous killed text.  Commands that kill backward from point add onto
254 the beginning.  This way, any sequence of mixed forward and backward
255 kill commands puts all the killed text into one entry without
256 rearrangement.  Numeric arguments do not break the sequence of
257 appending kills.  For example, suppose the buffer contains:
258
259      This is the first
260      line of sample text
261      and here is the third.
262
263 with point at the beginning of the second line.  If you type `C-k C-u 2
264 M-<DEL> C-k', the first `C-k' kills the text `line of sample text',
265 `C-u 2 M-<DEL>' kills `the first' with the newline that followed it,
266 and the second `C-k' kills the newline after the second line.  The
267 result is that the buffer contains `This is and here is the third.' and
268 a single kill entry contains `the first<RET>line of sample
269 text<RET>'--all the killed text, in its original order.
270
271    If a kill command is separated from the last kill command by other
272 commands (not just numeric arguments), it starts a new entry on the kill
273 ring.  To force a kill command to append, first type the command `C-M-w'
274 (`append-next-kill'). `C-M-w' tells the following command, if it is a
275 kill command, to append the text it kills to the last killed text,
276 instead of starting a new entry.  With `C-M-w', you can kill several
277 separated pieces of text and accumulate them to be yanked back in one
278 place.
279
280 \1f
281 File: xemacs.info,  Node: Earlier Kills,  Prev: Appending Kills,  Up: Yanking
282
283 Yanking Earlier Kills
284 ---------------------
285
286    To recover killed text that is no longer the most recent kill, you
287 need the `Meta-y' (`yank-pop') command.  You can use `M-y' only after a
288 `C-y' or another `M-y'.  It takes the text previously yanked and
289 replaces it with the text from an earlier kill.  To recover the text of
290 the next-to-the-last kill, first use `C-y' to recover the last kill,
291 then `M-y' to replace it with the previous kill.
292
293    You can think in terms of a "last yank" pointer which points at an
294 item in the kill ring.  Each time you kill, the "last yank" pointer
295 moves to the new item at the front of the ring.  `C-y' yanks the item
296 which the "last yank" pointer points to.  `M-y' moves the "last yank"
297 pointer to a different item, and the text in the buffer changes to
298 match.  Enough `M-y' commands can move the pointer to any item in the
299 ring, so you can get any item into the buffer.  Eventually the pointer
300 reaches the end of the ring; the next `M-y' moves it to the first item
301 again.
302
303    Yanking moves the "last yank" pointer around the ring, but does not
304 change the order of the entries in the ring, which always runs from the
305 most recent kill at the front to the oldest one still remembered.
306
307    Use `M-y' with a numeric argument to advance the "last yank" pointer
308 by the specified number of items.  A negative argument moves the
309 pointer toward the front of the ring; from the front of the ring, it
310 moves to the last entry and starts moving forward from there.
311
312    Once the text you are looking for is brought into the buffer, you can
313 stop doing `M-y' commands and the text will stay there. Since the text
314 is just a copy of the kill ring item, editing it in the buffer does not
315 change what's in the ring.  As long you don't kill additional text, the
316 "last yank" pointer remains at the same place in the kill ring:
317 repeating `C-y' will yank another copy of the same old kill.
318
319    If you know how many `M-y' commands it would take to find the text
320 you want, you can yank that text in one step using `C-y' with a numeric
321 argument.  `C-y' with an argument greater than one restores the text
322 the specified number of entries back in the kill ring.  Thus, `C-u 2
323 C-y' gets the next to the last block of killed text.  It is equivalent
324 to `C-y M-y'.  `C-y' with a numeric argument starts counting from the
325 "last yank" pointer, and sets the "last yank" pointer to the entry that
326 it yanks.
327
328    The variable `kill-ring-max' controls the length of the kill ring;
329 no more than that many blocks of killed text are saved.
330
331 \1f
332 File: xemacs.info,  Node: Using X Selections,  Next: Accumulating Text,  Prev: Yanking,  Up: Top
333
334 Using X Selections
335 ==================
336
337    In the X window system, mouse selections provide a simple mechanism
338 for text transfer between different applications.  In a typical X
339 application, you can select text by pressing the left mouse button and
340 dragging the cursor over the text you want to copy.  The text becomes
341 the primary X selection and is highlighted.  The highlighted region is
342 also the Emacs selected region.
343
344    * Since the region is the primary X selection, you can go to a
345      different X application and click the middle mouse button: the
346      text that you selected in the previous application is pasted into
347      the current application.
348
349    * Since the region is the Emacs selected region, you can use all
350      region commands (`C-w, M-w' etc.) as well as the options of the
351      Edit menu to manipulate the selected text.
352
353 * Menu:
354
355 * X Clipboard Selection::       Pasting to the X clipboard.
356 * X Selection Commands::        Other operations on the selection.
357 * X Cut Buffers::               X cut buffers are available for compatibility.
358 * Active Regions::              Using zmacs-style highlighting of the
359                                  selected region.
360
361 \1f
362 File: xemacs.info,  Node: X Clipboard Selection,  Next: X Selection Commands,  Prev: Using X Selections,  Up: Using X Selections
363
364 The Clipboard Selection
365 -----------------------
366
367    There are other kinds of X selections besides the Primary selection;
368 one common one is the Clipboard selection.  Some applications prefer to
369 transfer data using this selection in preference to the Primary.  One
370 can transfer text from the Primary selection to the  Clipboard
371 selection with the Copy command under the Edit menu in the menubar.
372
373    Usually, the clipboard selection is not visible.  However, if you
374 run the `xclipboard' application, the text most recently copied to the
375 clipboard (with the Copy command) is displayed in a window.  Any time
376 new text is thus copied, the `xclipboard' application makes a copy of
377 it and displays it in its window.  The value of the clipboard can
378 survive the lifetime of the running Emacs process.  The `xclipboard'
379 man page provides more details.
380
381    Warning: If you use the `xclipboard' application, remember that it
382 maintains a list of all things that have been pasted to the clipboard
383 (that is, copied with the Copy command).  If you don't manually delete
384 elements from this list by clicking on the Delete button in the
385 `xclipboard' window, the clipboard will eventually consume a lot of
386 memory.
387
388    In summary, some X applications (such as `xterm') allow one to paste
389 text in them from XEmacs in the following way:
390
391    * Drag out a region of text in Emacs with the left mouse button,
392      making that text be the Primary selection.
393
394    * Click the middle button in the other application, pasting the
395      Primary selection.
396
397    With some other applications (notably, the OpenWindows and Motif
398 tools) you must use this method instead:
399
400    * Drag out a region of text in Emacs with the left mouse button,
401      making that text be the Primary selection.
402
403    * Copy the selected text to the Clipboard selection by selecting the
404      Copy menu item from the Edit menu, or by hitting the Copy key on
405      your keyboard.
406
407    * Paste the text in the other application by selecting Paste from its
408      menu, or by hitting the Paste key on your keyboard.
409
410 \1f
411 File: xemacs.info,  Node: X Selection Commands,  Next: X Cut Buffers,  Prev: X Clipboard Selection,  Up: Using X Selections
412
413 Miscellaneous X Selection Commands
414 ----------------------------------
415
416 `M-x x-copy-primary-selection'
417      Copy the primary selection to both the kill ring and the Clipboard.
418
419 `M-x x-insert-selection'
420      Insert the current selection into the buffer at point.
421
422 `M-x x-delete-primary-selection'
423      Deletes the text in the primary selection without copying it to
424      the kill ring or the Clipboard.
425
426 `M-x x-kill-primary-selection'
427      Deletes the text in the primary selection and copies it to both
428      the kill ring and the Clipboard.
429
430 `M-x x-mouse-kill'
431      Kill the text between point and the mouse and copy it to the
432      clipboard and to the cut buffer.
433
434 `M-x x-own-secondary-selection'
435      Make a secondary X selection of the given argument.
436
437 `M-x x-own-selection'
438      Make a primary X selection of the given argument.
439
440 `M-x x-set-point-and-insert-selection'
441      Set point where clicked and insert the primary selection or the
442      cut buffer.
443
444 \1f
445 File: xemacs.info,  Node: X Cut Buffers,  Next: Active Regions,  Prev: X Selection Commands,  Up: Using X Selections
446
447 X Cut Buffers
448 -------------
449
450    X cut buffers are a different, older way of transferring text between
451 applications.  XEmacs supports cut buffers for compatibility with older
452 programs, even though selections are now the preferred way of
453 transferring text.
454
455    X has a concept of applications "owning" selections.  When you select
456 text by clicking and dragging inside an application, the application
457 tells the X server that it owns the selection.  When another
458 application asks the X server for the value of the selection, the X
459 server requests the information from the owner. When you use
460 selections, the selection data is not actually transferred unless
461 someone wants it; the act of making a selection doesn't transfer data.
462 Cut buffers are different: when you "own" a cut buffer, the data is
463 actually transferred to the X server immediately, and survives the
464 lifetime of the application.
465
466    Any time a region of text becomes the primary selection in Emacs,
467 Emacs also copies that text to the cut buffer.  This makes it possible
468 to copy text from an XEmacs buffer and paste it into an older,
469 non-selection-based application (such as Emacs 18).
470
471    Note: Older versions of Emacs could not access the X selections, only
472 the X cut buffers.
473
474 \1f
475 File: xemacs.info,  Node: Active Regions,  Prev: X Cut Buffers,  Up: Using X Selections
476
477 Active Regions
478 --------------
479
480    By default, both the text you select in an Emacs buffer using the
481 click-and-drag mechanism and text you select by setting point and the
482 mark is highlighted. You can use Emacs region commands as well as the
483 Cut and Copy commands on the highlighted region you selected with the
484 mouse.
485
486    If you prefer, you can make a distinction between text selected with
487 the mouse and text selected with point and the mark by setting the
488 variable `zmacs-regions' to `nil'.  In that case:
489
490    * The text selected with the mouse becomes both the X selection and
491      the Emacs selected region. You can use menu-bar commands as well
492      as Emacs region commands on it.
493
494    * The text selected with point and the mark is not highlighted. You
495      can only use Emacs region commands on it, not the menu-bar items.
496
497    Active regions originally come from Zmacs, the Lisp Machine editor.
498 The idea behind them is that commands can only operate on a region when
499 the region is in an "active" state.  Put simply, you can only operate on
500 a region that is highlighted.
501
502    The variable `zmacs-regions' checks whether LISPM-style active
503 regions should be used.  This means that commands that operate on the
504 region (the area between point and the mark) only work while the region
505 is in the active state, which is indicated by highlighting.  Most
506 commands causes the region to not be in the active state; for example,
507 `C-w' only works immediately after activating the region.
508
509    More specifically:
510    * Commands that operate on the region only work if the region is
511      active.
512
513    * Only a very small set of commands causes the region to become
514      active-- those commands whose semantics are to mark an area, such
515      as `mark-defun'.
516
517    * The region is deactivated after each command that is executed,
518      except that motion commands do not change whether the region is
519      active or not.
520
521    `set-mark-command' (`C-SPC') pushes a mark and activates the region.
522 Moving the cursor with normal motion commands (`C-n', `C-p', etc.)
523 will cause the region between point and the recently-pushed mark to be
524 highlighted.  It will remain highlighted until some non-motion command
525 is executed.
526
527    `exchange-point-and-mark' (`C-x C-x') activates the region.  So if
528 you mark a region and execute a command that operates on it, you can
529 reactivate the same region with `C-x C-x' (or perhaps `C-x C-x C-x
530 C-x') to operate on it again.
531
532    Generally, commands that push marks as a means of navigation, such as
533 `beginning-of-buffer' (`M-<') and `end-of-buffer' (`M->'), do not
534 activate the region.  However, commands that push marks as a means of
535 marking an area of text, such as `mark-defun' (`M-C-h'), `mark-word'
536 (`M-@'), and `mark-whole-buffer' (`C-x h'), do activate the region.
537
538    When `zmacs-regions' is `t', there is no distinction between the
539 primary X selection and the active region selected by point and the
540 mark.  To see this, set the mark (<C-SPC>) and move the cursor with any
541 cursor-motion command: the region between point and mark is
542 highlighted, and you can watch it grow and shrink as you move the
543 cursor.
544
545    Any other commands besides cursor-motion commands (such as inserting
546 or deleting text) will cause the region to no longer be active; it will
547 no longer be highlighted, and will no longer be the primary selection.
548 Region can be explicitly deactivated with `C-g'.
549
550    Commands that require a region (such as `C-w') signal an error if
551 the region is not active.  Certain commands cause the region to be in
552 its active state.  The most common ones are `push-mark' (<C-SPC>) and
553 `exchange-point-and-mark' (`C-x C-x').
554
555    When `zmacs-regions' is `t', programs can be non-intrusive on the
556 state of the region by setting the variable `zmacs-region-stays' to a
557 non-`nil' value.  If you are writing a new Emacs command that is
558 conceptually a "motion" command and should not interfere with the
559 current highlightedness of the region, then you may set this variable.
560 It is reset to `nil' after each user command is executed.
561
562    When `zmacs-regions' is `t', programs can make the region between
563 point and mark go into the active (highlighted) state by using the
564 function `zmacs-activate-region'. Only a small number of commands
565 should ever do this.
566
567    When `zmacs-regions' is `t', programs can deactivate the region
568 between point and the mark by using `zmacs-deactivate-region'.  Note:
569 you should not have to call this function; the command loop calls it
570 when appropriate.
571
572 \1f
573 File: xemacs.info,  Node: Accumulating Text,  Next: Rectangles,  Prev: Using X Selections,  Up: Top
574
575 Accumulating Text
576 =================
577
578    Usually you copy or move text by killing it and yanking it, but
579 there are other ways that are useful for copying one block of text in
580 many places, or for copying many scattered blocks of text into one
581 place.
582
583    If you like, you can accumulate blocks of text from scattered
584 locations either into a buffer or into a file.  The relevant commands
585 are described here.  You can also use Emacs registers for storing and
586 accumulating text.  *Note Registers::.
587
588 `M-x append-to-buffer'
589      Append region to contents of specified buffer (`append-to-buffer').
590
591 `M-x prepend-to-buffer'
592      Prepend region to contents of specified buffer.
593
594 `M-x copy-to-buffer'
595      Copy region into specified buffer, deleting that buffer's old
596      contents.
597
598 `M-x insert-buffer'
599      Insert contents of specified buffer into current buffer at point.
600
601 `M-x append-to-file'
602      Append region to the end of the contents of specified file.
603
604    To accumulate text into a buffer, use the command `M-x
605 append-to-buffer', which inserts a copy of the region into the buffer
606 BUFFERNAME, at the location of point in that buffer.  If there is no
607 buffer with the given name, one is created.
608
609    If you append text to a buffer that has been used for editing, the
610 copied text goes to the place where point is.  Point in that buffer is
611 left at the end of the copied text, so successive uses of
612 `append-to-buffer' accumulate the text in the specified buffer in the
613 same order as they were copied.  Strictly speaking, this command does
614 not always append to the text already in the buffer; but if this command
615 is the only command used to alter a buffer, it does always append to the
616 existing text because point is always at the end.
617
618    `M-x prepend-to-buffer' is similar to `append-to-buffer', but point
619 in the other buffer is left before the copied text, so successive
620 prependings add text in reverse order.  `M-x copy-to-buffer' is
621 similar, except that any existing text in the other buffer is deleted,
622 so the buffer is left containing just the text newly copied into it.
623
624    You can retrieve the accumulated text from that buffer with `M-x
625 insert-buffer', which takes BUFFERNAME as an argument.  It inserts a
626 copy of the text in buffer BUFFERNAME into the selected buffer.  You
627 could alternatively select the other buffer for editing, perhaps moving
628 text from it by killing or with `append-to-buffer'.  *Note Buffers::,
629 for background information on buffers.
630
631    Instead of accumulating text within Emacs in a buffer, you can append
632 text directly into a file with `M-x append-to-file', which takes
633 FILE-NAME as an argument.  It adds the text of the region to the end of
634 the specified file.  The file is changed immediately on disk.  This
635 command is normally used with files that are not being visited in
636 Emacs.  Using it on a file that Emacs is visiting can produce confusing
637 results, because the file's text inside Emacs does not change while the
638 file itself changes.
639
640 \1f
641 File: xemacs.info,  Node: Rectangles,  Next: Registers,  Prev: Accumulating Text,  Up: Top
642
643 Rectangles
644 ==========
645
646    The rectangle commands affect rectangular areas of text: all
647 characters between a certain pair of columns, in a certain range of
648 lines.  Commands are provided to kill rectangles, yank killed
649 rectangles, clear them out, or delete them.  Rectangle commands are
650 useful with text in multicolumnar formats, like code with comments at
651 the right, or for changing text into or out of such formats.
652
653    To specify the rectangle a command should work on, put the mark at
654 one corner and point at the opposite corner.  The specified rectangle is
655 called the "region-rectangle" because it is controlled about the same
656 way the region is controlled.  Remember that a given combination of
657 point and mark values can be interpreted either as specifying a region
658 or as specifying a rectangle; it is up to the command that uses them to
659 choose the interpretation.
660
661 `M-x delete-rectangle'
662      Delete the text of the region-rectangle, moving any following text
663      on each line leftward to the left edge of the region-rectangle.
664
665 `M-x kill-rectangle'
666      Similar, but also save the contents of the region-rectangle as the
667      "last killed rectangle".
668
669 `M-x yank-rectangle'
670      Yank the last killed rectangle with its upper left corner at point.
671
672 `M-x open-rectangle'
673      Insert blank space to fill the space of the region-rectangle.  The
674      previous contents of the region-rectangle are pushed rightward.
675
676 `M-x clear-rectangle'
677      Clear the region-rectangle by replacing its contents with spaces.
678
679    The rectangle operations fall into two classes: commands deleting and
680 moving rectangles, and commands for blank rectangles.
681
682    There are two ways to get rid of the text in a rectangle: you can
683 discard the text (delete it) or save it as the "last killed" rectangle.
684 The commands for these two ways are `M-x delete-rectangle' and `M-x
685 kill-rectangle'.  In either case, the portion of each line that falls
686 inside the rectangle's boundaries is deleted, causing following text
687 (if any) on the line to move left.
688
689    Note that "killing" a rectangle is not killing in the usual sense;
690 the rectangle is not stored in the kill ring, but in a special place
691 that only records the most recently killed rectangle (that is, does not
692 append to a killed rectangle).  Different yank commands have to be used
693 and only one rectangle is stored, because yanking a rectangle is quite
694 different from yanking linear text and yank-popping commands are
695 difficult to make sense of.
696
697    Inserting a rectangle is the opposite of deleting one.  You specify
698 where to put the upper left corner by putting point there.  The
699 rectangle's first line is inserted at point, the rectangle's second line
700 is inserted at a point one line vertically down, and so on.  The number
701 of lines affected is determined by the height of the saved rectangle.
702
703    To insert the last killed rectangle, type `M-x yank-rectangle'.
704 This can be used to convert single-column lists into double-column
705 lists; kill the second half of the list as a rectangle and then yank it
706 beside the first line of the list.
707
708    There are two commands for working with blank rectangles: `M-x
709 clear-rectangle' erases existing text, and `M-x open-rectangle' inserts
710 a blank rectangle.  Clearing a rectangle is equivalent to deleting it
711 and then inserting a blank rectangle of the same size.
712
713    Rectangles can also be copied into and out of registers.  *Note
714 Rectangle Registers: RegRect.
715
716 \1f
717 File: xemacs.info,  Node: Registers,  Next: Display,  Prev: Rectangles,  Up: Top
718
719 Registers
720 *********
721
722    XEmacs "registers" are places in which you can save text or
723 positions for later use.  Once you save text or a rectangle in a
724 register, you can copy it into the buffer once or many times; a position
725 saved in a register is used by moving point to that position.
726 Rectangles can also be copied into and out of registers (*note
727 Rectangles::.).
728
729    Each register has a name which is a single character.  A register can
730 store a piece of text, a rectangle, a position, a window configuration,
731 or a file name, but only one thing at any given time.  Whatever you
732 store in a register remains there until you store something else in that
733 register.  To see what a register R contains, use `M-x view-register'.
734
735 `M-x view-register <RET> R'
736      Display a description of what register R contains.
737
738    `M-x view-register' reads a register name as an argument and then
739 displays the contents of the specified register.
740
741 * Menu:
742
743 * Position: RegPos.           Saving positions in registers.
744 * Text: RegText.              Saving text in registers.
745 * Rectangle: RegRect.         Saving rectangles in registers.
746 * Configurations: RegConfig.  Saving window configurations in registers.
747 * Files: RegFiles.            File names in registers.
748 * Numbers: RegNumbers.        Numbers in registers.
749 * Bookmarks::                 Bookmarks are like registers, but persistent.
750
751 \1f
752 File: xemacs.info,  Node: RegPos,  Next: RegText,  Prev: Registers,  Up: Registers
753
754 Saving Positions in Registers
755 =============================
756
757    Saving a position records a place in a buffer so that you can move
758 back there later.  Moving to a saved position switches to that buffer
759 and moves point to that place in it.
760
761 `C-x r <SPC> R'
762      Save position of point in register R (`point-to-register').
763
764 `C-x r j R'
765      Jump to the position saved in register R (`jump-to-register').
766
767    To save the current position of point in a register, choose a name R
768 and type `C-x r <SPC> R'.  The register R retains the position thus
769 saved until you store something else in that register.
770
771    The command `C-x r j R' moves point to the position recorded in
772 register R.  The register is not affected; it continues to record the
773 same location.  You can jump to the same position using the same
774 register as often as you want.
775
776    If you use `C-x r j' to go to a saved position, but the buffer it
777 was saved from has been killed, `C-x r j' tries to create the buffer
778 again by visiting the same file.  Of course, this works only for buffers
779 that were visiting files.
780
781 \1f
782 File: xemacs.info,  Node: RegText,  Next: RegRect,  Prev: RegPos,  Up: Registers
783
784 Saving Text in Registers
785 ========================
786
787    When you want to insert a copy of the same piece of text many times,
788 it can be impractical to use the kill ring, since each subsequent kill
789 moves the piece of text further down on the ring.  It becomes hard to
790 keep track of the argument needed to retrieve the same text with `C-y'.
791 An alternative is to store the text in a register with `C-x r s'
792 (`copy-to-register') and then retrieve it with `C-x r i'
793 (`insert-register').
794
795 `C-x r s R'
796      Copy region into register R (`copy-to-register').
797
798 `C-x r g R'
799 `C-x r i R'
800      Insert text contents of register R (`insert-register').
801
802    `C-x r s R' stores a copy of the text of the region into the
803 register named R.  Given a numeric argument, `C-x r s R' deletes the
804 text from the buffer as well.
805
806    `C-x r i R' inserts the text from register R in the buffer.  By
807 default it leaves point before the text and places the mark after it.
808 With a numeric argument (`C-u'), it puts point after the text and the
809 mark before it.
810
811 \1f
812 File: xemacs.info,  Node: RegRect,  Next: RegConfig,  Prev: RegText,  Up: Registers
813
814 Saving Rectangles in Registers
815 ==============================
816
817    A register can contain a rectangle instead of lines of text.  The
818 rectangle is represented as a list of strings.  *Note Rectangles::, for
819 basic information on rectangles and how to specify rectangles in a
820 buffer.
821
822 `C-x r r R'
823      Copy the region-rectangle into register R
824      (`copy-rectangle-to-register').  With a numeric argument, delete it
825      as well.
826
827 `C-x r g R'
828 `C-x r i R'
829      Insert the rectangle stored in register R (if it contains a
830      rectangle) (`insert-register').
831
832    The `C-x r i R' command inserts linear text if the register
833 contains that, or inserts a rectangle if the register contains one.
834
835    See also the command `sort-columns', which you can think of as
836 sorting a rectangle.  *Note Sorting::.
837
838 \1f
839 File: xemacs.info,  Node: RegConfig,  Next: RegNumbers,  Prev: RegRect,  Up: Registers
840
841 Saving Window Configurations in Registers
842 =========================================
843
844    You can save the window configuration of the selected frame in a
845 register, or even the configuration of all windows in all frames, and
846 restore the configuration later.
847
848 `C-x r w R'
849      Save the state of the selected frame's windows in register R
850      (`window-configuration-to-register').
851
852 `M-x frame-configuration-to-register <RET> R'
853      Save the state of all frames, including all their windows, in
854      register R (`frame-configuration-to-register').
855
856    Use `C-x r j R' to restore a window or frame configuration.  This is
857 the same command used to restore a cursor position.  When you restore a
858 frame configuration, any existing frames not included in the
859 configuration become invisible.  If you wish to delete these frames
860 instead, use `C-u C-x r j R'.
861
862 \1f
863 File: xemacs.info,  Node: RegNumbers,  Next: RegFiles,  Prev: RegConfig,  Up: Registers
864
865 Keeping Numbers in Registers
866 ============================
867
868    There are commands to store a number in a register, to insert the
869 number in the buffer in decimal, and to increment it.  These commands
870 can be useful in keyboard macros (*note Keyboard Macros::.).
871
872 `C-u NUMBER C-x r n REG'
873      Store NUMBER into register REG (`number-to-register').
874
875 `C-u NUMBER C-x r + REG'
876      Increment the number in register REG by NUMBER
877      (`increment-register').
878
879 `C-x r g REG'
880      Insert the number from register REG into the buffer.
881
882    `C-x r g' is the same command used to insert any other sort of
883 register contents into the buffer.
884
885 \1f
886 File: xemacs.info,  Node: RegFiles,  Next: Bookmarks,  Prev: RegNumbers,  Up: Registers
887
888 Keeping File Names in Registers
889 ===============================
890
891    If you visit certain file names frequently, you can visit them more
892 conveniently if you put their names in registers.  Here's the Lisp code
893 used to put a file name in a register:
894
895      (set-register ?R '(file . NAME))
896
897 For example,
898
899      (set-register ?z '(file . "/usr/src/xemacs/src/ChangeLog"))
900
901 puts the file name shown in register `z'.
902
903    To visit the file whose name is in register R, type `C-x r j R'.
904 (This is the same command used to jump to a position or restore a frame
905 configuration.)
906
907 \1f
908 File: xemacs.info,  Node: Bookmarks,  Prev: RegFiles,  Up: Registers
909
910 Bookmarks
911 =========
912
913    "Bookmarks" are somewhat like registers in that they record
914 positions you can jump to.  Unlike registers, they have long names, and
915 they persist automatically from one Emacs session to the next.  The
916 prototypical use of bookmarks is to record "where you were reading" in
917 various files.
918
919    Note: bookmark.el is distributed in edit-utils package.  You need to
920 install that to use bookmark facility (*note Packages::.).
921
922 `C-x r m <RET>'
923      Set the bookmark for the visited file, at point.
924
925 `C-x r m BOOKMARK <RET>'
926      Set the bookmark named BOOKMARK at point (`bookmark-set').
927
928 `C-x r b BOOKMARK <RET>'
929      Jump to the bookmark named BOOKMARK (`bookmark-jump').
930
931 `C-x r l'
932      List all bookmarks (`list-bookmarks').
933
934 `M-x bookmark-save'
935      Save all the current bookmark values in the default bookmark file.
936
937    The prototypical use for bookmarks is to record one current position
938 in each of several files.  So the command `C-x r m', which sets a
939 bookmark, uses the visited file name as the default for the bookmark
940 name.  If you name each bookmark after the file it points to, then you
941 can conveniently revisit any of those files with `C-x r b', and move to
942 the position of the bookmark at the same time.
943
944    To display a list of all your bookmarks in a separate buffer, type
945 `C-x r l' (`list-bookmarks').  If you switch to that buffer, you can
946 use it to edit your bookmark definitions or annotate the bookmarks.
947 Type `C-h m' in that buffer for more information about its special
948 editing commands.
949
950    When you kill XEmacs, XEmacs offers to save your bookmark values in
951 your default bookmark file, `~/.emacs.bmk', if you have changed any
952 bookmark values.  You can also save the bookmarks at any time with the
953 `M-x bookmark-save' command.  The bookmark commands load your default
954 bookmark file automatically.  This saving and loading is how bookmarks
955 persist from one XEmacs session to the next.
956
957    If you set the variable `bookmark-save-flag' to 1, then each command
958 that sets a bookmark will also save your bookmarks; this way, you don't
959 lose any bookmark values even if XEmacs crashes.  (The value, if a
960 number, says how many bookmark modifications should go by between
961 saving.)
962
963    Bookmark position values are saved with surrounding context, so that
964 `bookmark-jump' can find the proper position even if the file is
965 modified slightly.  The variable `bookmark-search-size' says how many
966 characters of context to record, on each side of the bookmark's
967 position.
968
969    Here are some additional commands for working with bookmarks:
970
971 `M-x bookmark-load <RET> FILENAME <RET>'
972      Load a file named FILENAME that contains a list of bookmark
973      values.  You can use this command, as well as `bookmark-write', to
974      work with other files of bookmark values in addition to your
975      default bookmark file.
976
977 `M-x bookmark-write <RET> FILENAME <RET>'
978      Save all the current bookmark values in the file FILENAME.
979
980 `M-x bookmark-delete <RET> BOOKMARK <RET>'
981      Delete the bookmark named BOOKMARK.
982
983 `M-x bookmark-insert-location <RET> BOOKMARK <RET>'
984      Insert in the buffer the name of the file that bookmark BOOKMARK
985      points to.
986
987 `M-x bookmark-insert <RET> BOOKMARK <RET>'
988      Insert in the buffer the *contents* of the file that bookmark
989      BOOKMARK points to.
990
991 \1f
992 File: xemacs.info,  Node: Display,  Next: Search,  Prev: Registers,  Up: Top
993
994 Controlling the Display
995 ***********************
996
997    Since only part of a large buffer fits in the window, XEmacs tries
998 to show the part that is likely to be interesting.  The display control
999 commands allow you to specify which part of the text you want to see.
1000
1001 `C-l'
1002      Clear frame and redisplay, scrolling the selected window to center
1003      point vertically within it (`recenter').
1004
1005 `C-v'
1006 `pgdn'
1007 `next'
1008      Scroll forward (a windowful or a specified number of lines)
1009      (`scroll-up').  On most X keyboards, you can get this
1010      functionality using the key labelled `Page Down', which generates
1011      either `next' or `pgdn'.
1012
1013 `M-v'
1014 `pgup'
1015 `prior'
1016      Scroll backward (`scroll-down').  On most X keyboards, you can get
1017      this functionality using the key labelled `Page Up', which
1018      generates either `prior' or `pgup'.
1019
1020 `ARG C-l'
1021      Scroll so point is on line ARG (`recenter').
1022
1023 `C-x <'
1024 `C-pgdn'
1025 `C-next'
1026      Scroll text in current window to the left (`scroll-left').
1027
1028 `C-x >'
1029 `C-pgup'
1030 `C-prior'
1031      Scroll to the right (`scroll-right').
1032
1033 `C-x $'
1034      Make deeply indented lines invisible (`set-selective-display').
1035
1036 * Menu:
1037
1038 * Scrolling::              Moving text up and down in a window.
1039 * Horizontal Scrolling::   Moving text left and right in a window.
1040 * Selective Display::      Hiding lines with lots of indentation.
1041 * Display Vars::           Information on variables for customizing display.
1042
1043 \1f
1044 File: xemacs.info,  Node: Scrolling,  Next: Horizontal Scrolling,  Prev: Display,  Up: Display
1045
1046 Scrolling
1047 =========
1048
1049    If a buffer contains text that is too large to fit entirely within
1050 the window that is displaying the buffer, XEmacs shows a contiguous
1051 section of the text.  The section shown always contains point.
1052
1053    "Scrolling" means moving text up or down in the window so that
1054 different parts of the text are visible.  Scrolling forward means that
1055 text moves up, and new text appears at the bottom.  Scrolling backward
1056 moves text down and new text appears at the top.
1057
1058    Scrolling happens automatically if you move point past the bottom or
1059 top of the window.  You can also explicitly request scrolling with the
1060 commands in this section.
1061
1062 `C-l'
1063      Clear frame and redisplay, scrolling the selected window to center
1064      point vertically within it (`recenter').
1065
1066 `C-v'
1067 `pgdn'
1068 `next'
1069      Scroll forward (a windowful or a specified number of lines)
1070      (`scroll-up').
1071
1072 `M-v'
1073 `pgup'
1074 `prior'
1075      Scroll backward (`scroll-down').
1076
1077 `ARG C-l'
1078      Scroll so point is on line ARG (`recenter').
1079
1080    The most basic scrolling command is `C-l' (`recenter') with no
1081 argument.  It clears the entire frame and redisplays all windows.  In
1082 addition, it scrolls the selected window so that point is halfway down
1083 from the top of the window.
1084
1085    The scrolling commands `C-v' and `M-v' let you move all the text in
1086 the window up or down a few lines.  `C-v' (`scroll-up') with an
1087 argument shows you that many more lines at the bottom of the window,
1088 moving the text and point up together as `C-l' might.  `C-v' with a
1089 negative argument shows you more lines at the top of the window.
1090 `Meta-v' (`scroll-down') is like `C-v', but moves in the opposite
1091 direction.
1092
1093    To read the buffer a windowful at a time, use `C-v' with no
1094 argument.  `C-v' takes the last two lines at the bottom of the window
1095 and puts them at the top, followed by nearly a whole windowful of lines
1096 not previously visible.  Point moves to the new top of the window if it
1097 was in the text scrolled off the top.  `M-v' with no argument moves
1098 backward with similar overlap.  The number of lines of overlap across a
1099 `C-v' or `M-v' is controlled by the variable
1100 `next-screen-context-lines'; by default, it is two.
1101
1102    Another way to scroll is using `C-l' with a numeric argument.  `C-l'
1103 does not clear the frame when given an argument; it only scrolls the
1104 selected window.  With a positive argument N, `C-l' repositions text to
1105 put point N lines down from the top.  An argument of zero puts point on
1106 the very top line.  Point does not move with respect to the text;
1107 rather, the text and point move rigidly on the frame.  `C-l' with a
1108 negative argument puts point that many lines from the bottom of the
1109 window.  For example, `C-u - 1 C-l' puts point on the bottom line, and
1110 `C-u - 5 C-l' puts it five lines from the bottom.  Just `C-u' as
1111 argument, as in `C-u C-l', scrolls point to the center of the frame.
1112
1113    Scrolling happens automatically if point has moved out of the visible
1114 portion of the text when it is time to display.  Usually scrolling is
1115 done  to put point vertically centered within the window.  However, if
1116 the variable `scroll-step' has a non-zero value, an attempt is made to
1117 scroll the buffer by that many lines; if that is enough to bring point
1118 back into visibility, that is what happens.
1119
1120    Scrolling happens automatically if point has moved out of the visible
1121 portion of the text when it is time to display.  Usually scrolling is
1122 done  to put point vertically centered within the window.  However, if
1123 the variable `scroll-step' has a non-zero value, an attempt is made to
1124 scroll the buffer by that many lines; if that is enough to bring point
1125 back into visibility, that is what happens.
1126
1127    If you set `scroll-step' to a small value because you want to use
1128 arrow keys to scroll the screen without recentering, the redisplay
1129 preemption will likely make XEmacs keep recentering the screen when
1130 scrolling fast, regardless of `scroll-step'.  To prevent this, set
1131 `scroll-conservatively' to a small value, which will have the result of
1132 overriding the redisplay preemption.
1133
1134 \1f
1135 File: xemacs.info,  Node: Horizontal Scrolling,  Prev: Scrolling,  Up: Display
1136
1137 Horizontal Scrolling
1138 ====================
1139
1140 `C-x <'
1141      Scroll text in current window to the left (`scroll-left').
1142
1143 `C-x >'
1144      Scroll to the right (`scroll-right').
1145
1146    The text in a window can also be scrolled horizontally.  This means
1147 that each line of text is shifted sideways in the window, and one or
1148 more characters at the beginning of each line are not displayed at all.
1149 When a window has been scrolled horizontally in this way, text lines
1150 are truncated rather than continued (*note Continuation Lines::.), with
1151 a `$' appearing in the first column when there is text truncated to the
1152 left, and in the last column when there is text truncated to the right.
1153
1154    The command `C-x <' (`scroll-left') scrolls the selected window to
1155 the left by N columns with argument N.  With no argument, it scrolls by
1156 almost the full width of the window (two columns less, to be precise).
1157 `C-x >' (`scroll-right') scrolls similarly to the right.  The window
1158 cannot be scrolled any farther to the right once it is displaying
1159 normally (with each line starting at the window's left margin);
1160 attempting to do so has no effect.
1161
1162 \1f
1163 File: xemacs.info,  Node: Selective Display,  Next: Display Vars,  Prev: Display,  Up: Display
1164
1165 Selective Display
1166 =================
1167
1168    XEmacs can hide lines indented more than a certain number of columns
1169 (you specify how many columns).  This allows you  to get an overview of
1170 a part of a program.
1171
1172    To hide lines, type `C-x $' (`set-selective-display') with a numeric
1173 argument N.  (*Note Arguments::, for information on giving the
1174 argument.)  Lines with at least N columns of indentation disappear from
1175 the screen.  The only indication of their presence are three dots
1176 (`...'), which appear at the end of each visible line that is followed
1177 by one or more invisible ones.
1178
1179    The invisible lines are still present in the buffer, and most editing
1180 commands see them as usual, so it is very easy to put point in the
1181 middle of invisible text.  When this happens, the cursor appears at the
1182 end of the previous line, after the three dots.  If point is at the end
1183 of the visible line, before the newline that ends it, the cursor
1184 appears before the three dots.
1185
1186    The commands `C-n' and `C-p' move across the invisible lines as if
1187 they were not there.
1188
1189    To make everything visible again, type `C-x $' with no argument.
1190