(M-40132'): Unify GT-53970.
[chise/xemacs-chise.git-] / info / xemacs.info-5
1 This is ../info/xemacs.info, produced by makeinfo version 4.0b from
2 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: Library Keywords,  Next: Help Mode,  Prev: Apropos,  Up: Help
34
35 Keyword Search for Lisp Libraries
36 =================================
37
38    The `C-h p' command lets you search the standard Emacs Lisp
39 libraries by topic keywords.  Here is a partial list of keywords you can
40 use:
41
42      abbrev        abbreviation handling, typing shortcuts, macros
43      bib           code related to the `bib' bibliography processor
44      c             C, C++, and Objective-C language support
45      calendar      calendar and time management support
46      comm          communications, networking, remote access to files
47      data          support for editing files of data
48      docs          support for Emacs documentation
49      dumped        files preloaded into Emacs
50      emulations    emulations of other editors
51      extensions    Emacs Lisp language extensions
52      faces         support for multiple fonts
53      frames        support for Emacs frames and window systems
54      games         games, jokes and amusements
55      hardware      support for interfacing with exotic hardware
56      help          support for on-line help systems
57      hypermedia    support for links between text or other media types
58      i18n          internationalization and alternate character-set support
59      internal      code for Emacs internals, build process, defaults
60      languages     specialized modes for editing programming languages
61      lisp          Lisp support, including Emacs Lisp
62      local         code local to your site
63      maint         maintenance aids for the Emacs development group
64      mail          modes for electronic-mail handling
65      matching      various sorts of searching and matching
66      mouse         mouse support
67      mule          multi-language extensions
68      news          support for netnews reading and posting
69      oop           support for object-oriented programming
70      outlines      support for hierarchical outlining
71      processes     process, subshell, compilation, and job control support
72      terminals     support for terminal types
73      tex           code related to the TeX formatter
74      tools         programming tools
75      unix          front-ends/assistants for, or emulators of, UNIX features
76      vms           support code for vms
77      wp            word processing
78
79 \1f
80 File: xemacs.info,  Node: Help Mode,  Next: Misc Help,  Prev: Library Keywords,  Up: Help
81
82 Help Mode Commands
83 ==================
84
85    Help buffers provide the commands of View mode (*note Misc File
86 Ops::), plus a few special commands of their own.
87
88 `<SPC>'
89      Scroll forward.
90
91 `<DEL>'
92 `<BS>'
93      Scroll backward.
94
95    When a command name (*note Running Commands by Name: M-x.) or
96 variable name (*note Variables::) appears in the documentation, it
97 normally appears inside paired single-quotes.
98
99 \1f
100 File: xemacs.info,  Node: Misc Help,  Prev: Help Mode,  Up: Help
101
102 Other Help Commands
103 ===================
104
105    `C-h i' (`info') runs the Info program, which is used for browsing
106 through structured documentation files.  The entire XEmacs manual is
107 available within Info.  Eventually all the documentation of the GNU
108 system will be available.  Type `h' after entering Info to run a
109 tutorial on using Info.
110
111    If you specify a numeric argument, `C-h i' prompts for the name of a
112 documentation file.  This way, you can browse a file which doesn't have
113 an entry in the top-level Info menu.  It is also handy when you need to
114 get to the documentation quickly, and you know the exact name of the
115 file.
116
117    There are two special help commands for accessing XEmacs
118 documentation through Info.  `C-h C-f FUNCTION <RET>' enters Info and
119 goes straight to the documentation of the XEmacs function FUNCTION.
120 `C-h C-k KEY' enters Info and goes straight to the documentation of the
121 key KEY.  These two keys run the commands `Info-elisp-ref' and
122 `Info-goto-emacs-key-command-node'.
123
124    If something surprising happens, and you are not sure what commands
125 you typed, use `C-h l' (`view-lossage').  `C-h l' prints the last 100
126 command characters you typed in.  If you see commands that you don't
127 know, you can use `C-h c' to find out what they do.
128
129    XEmacs has several major modes.  Each mode redefines a few keys and
130 makes a few other changes in how editing works.  `C-h m'
131 (`describe-mode') prints documentation on the current major mode, which
132 normally describes all the commands that are changed in this mode.
133
134    `C-h b' (`describe-bindings') and `C-h s' (`describe-syntax')
135 present information about the current XEmacs mode that is not covered
136 by `C-h m'.  `C-h b' displays a list of all the key bindings currently
137 in effect, with the local bindings of the current major mode first,
138 followed by the global bindings (*note Key Bindings::).  `C-h s'
139 displays the contents of the syntax table with explanations of each
140 character's syntax (*note Syntax::).
141
142    You can get a similar list for a particular prefix key by typing
143 `C-h' after the prefix key.  (There are a few prefix keys for which
144 this does not work--those that provide their own bindings for `C-h'.
145 One of these is <ESC>, because `<ESC> C-h' is actually `C-M-h', which
146 marks a defun.)
147
148    The other `C-h' options display various files of useful information.
149 `C-h C-w' (`describe-no-warranty') displays the full details on the
150 complete absence of warranty for XEmacs.  `C-h n' (`view-emacs-news')
151 displays the file `xemacs/etc/NEWS', which contains documentation on
152 XEmacs changes arranged chronologically.  `C-h F' (`xemacs-local-faq')
153 displays local version of the XEmacs
154 frequently-answered-questions-list.  `C-h t' (`help-with-tutorial')
155 displays the learn-by-doing XEmacs tutorial. `C-h C-c'
156 (`describe-copying') displays the file `xemacs/etc/COPYING', which
157 tells you the conditions you must obey in distributing copies of
158 XEmacs.  `C-h C-d' (`describe-distribution') displays another file named
159 `xemacs/etc/DISTRIB', which tells you how you can order a copy of the
160 latest version of XEmacs.
161
162 \1f
163 File: xemacs.info,  Node: Mark,  Next: Mouse Selection,  Prev: Help,  Up: Top
164
165 Selecting Text
166 **************
167
168    Many Emacs commands operate on an arbitrary contiguous part of the
169 current buffer. You can select text in two ways:
170
171    * You use special keys to select text by defining a region between
172      point and the mark.
173
174    * If you are running XEmacs under X, you can also select text with
175      the mouse.
176
177 The Mark and the Region
178 =======================
179
180    To specify the text for a command to operate on, set "the mark" at
181 one end of it, and move point to the other end.  The text between point
182 and the mark is called "the region".  You can move point or the mark to
183 adjust the boundaries of the region.  It doesn't matter which one is
184 set first chronologically, or which one comes earlier in the text.
185
186    Once the mark has been set, it remains until it is set again at
187 another place.  The mark remains fixed with respect to the preceding
188 character if text is inserted or deleted in a buffer.  Each Emacs
189 buffer has its own mark; when you return to a buffer that had been
190 selected previously, it has the same mark it had before.
191
192    Many commands that insert text, such as `C-y' (`yank') and `M-x
193 insert-buffer', position the mark at one end of the inserted text--the
194 opposite end from where point is positioned, so that the region
195 contains the text just inserted.
196
197    Aside from delimiting the region, the mark is useful for marking a
198 spot that you may want to go back to.  To make this feature more useful,
199 Emacs remembers 16 previous locations of the mark in the `mark ring'.
200
201 * Menu:
202
203 * Setting Mark::        Commands to set the mark.
204 * Using Region::        Summary of ways to operate on contents of the region.
205 * Marking Objects::     Commands to put region around textual units.
206 * Mark Ring::           Previous mark positions saved so you can go back there.
207
208 \1f
209 File: xemacs.info,  Node: Setting Mark,  Next: Using Region,  Prev: Mark,  Up: Mark
210
211 Setting the Mark
212 ----------------
213
214    Here are some commands for setting the mark:
215
216 `C-<SPC>'
217      Set the mark where point is (`set-mark-command').
218
219 `C-@'
220      The same.
221
222 `C-x C-x'
223      Interchange mark and point (`exchange-point-and-mark').
224
225 `C-<'
226      Pushes a mark at the beginning of the buffer.
227
228 `C->'
229      Pushes a mark at the end of the buffer.
230
231    For example, to convert part of the buffer to all upper-case, you
232 can use the `C-x C-u' (`upcase-region') command, which operates on the
233 text in the region.  First go to the beginning of the text you want to
234 capitalize and type `C-<SPC>' to put the mark there, then move to the
235 end, and then type `C-x C-u' to capitalize the selected region.  You
236 can also set the mark at the end of the text, move to the beginning,
237 and then type `C-x C-u'.  Most commands that operate on the text in the
238 region have the word `region' in their names.
239
240    The most common way to set the mark is with the `C-<SPC>' command
241 (`set-mark-command').  This command sets the mark where point is. You
242 can then move point away, leaving the mark behind.  It is actually
243 incorrect to speak of the character `C-<SPC>'; there is no such
244 character.  When you type <SPC> while holding down <CTRL>, you get the
245 character `C-@' on most terminals. This character is actually bound to
246 `set-mark-command'.  But unless you are unlucky enough to have a
247 terminal where typing `C-<SPC>' does not produce `C-@', you should
248 think of this character as `C-<SPC>'.
249
250    Since terminals have only one cursor, Emacs cannot show you where the
251 mark is located. Most people use the mark soon after they set it, before
252 they forget where it is. But you can see where the mark is with the
253 command `C-x C-x' (`exchange-point-and-mark') which puts the mark where
254 point was and point where the mark was.  The extent of the region is
255 unchanged, but the cursor and point are now at the previous location of
256 the mark.
257
258    Another way to set the mark is to push the mark to the beginning of a
259 buffer while leaving point at its original location. If you supply an
260 argument to `C-<' (`mark-beginning-of-buffer'), the mark is pushed N/10
261 of the way from the true beginning of the buffer. You can also set the
262 mark at the end of a buffer with `C->' (`mark-end-of-buffer'). It
263 pushes the mark to the end of the buffer, leaving point alone.
264 Supplying an argument to the command pushes the mark N/10 of the way
265 from the true end of the buffer.
266
267    If you are using XEmacs under the X window system, you can set the
268 variable `zmacs-regions' to `t'. This makes the current region (defined
269 by point and mark) highlight and makes it available as the X clipboard
270 selection, which means you can use the menu bar items on it.  *Note
271 Active Regions::, for more information.
272
273    `C-x C-x' is also useful when you are satisfied with the location of
274 point but want to move the mark; do `C-x C-x' to put point there and
275 then you can move it.  A second use of `C-x C-x', if necessary, puts
276 the mark at the new location with point back at its original location.
277
278 \1f
279 File: xemacs.info,  Node: Using Region,  Next: Marking Objects,  Prev: Setting Mark,  Up: Mark
280
281 Operating on the Region
282 -----------------------
283
284    Once you have created an active region, you can do many things to
285 the text in it:
286    * Kill it with `C-w' (*note Killing::).
287
288    * Save it in a register with `C-x r s' (*note Registers::).
289
290    * Save it in a buffer or a file (*note Accumulating Text::).
291
292    * Convert case with `C-x C-l' or `C-x C-u'
293      (*note Case::).
294
295    * Evaluate it as Lisp code with `M-x eval-region' (*note Lisp
296      Eval::).
297
298    * Fill it as text with `M-q' (*note Filling::).
299
300    * Print hardcopy with `M-x print-region' (*note Hardcopy::).
301
302    * Indent it with `C-x <TAB>' or `C-M-\' (*note Indentation::).
303
304 \1f
305 File: xemacs.info,  Node: Marking Objects,  Next: Mark Ring,  Prev: Using Region,  Up: Mark
306
307 Commands to Mark Textual Objects
308 --------------------------------
309
310    There are commands for placing point and the mark around a textual
311 object such as a word, list, paragraph or page.
312
313 `M-@'
314      Set mark after end of next word (`mark-word').  This command and
315      the following one do not move point.
316
317 `C-M-@'
318      Set mark after end of next Lisp expression (`mark-sexp').
319
320 `M-h'
321      Put region around current paragraph (`mark-paragraph').
322
323 `C-M-h'
324      Put region around current Lisp defun (`mark-defun').
325
326 `C-x h'
327      Put region around entire buffer (`mark-whole-buffer').
328
329 `C-x C-p'
330      Put region around current page (`mark-page').
331
332    `M-@' (`mark-word') puts the mark at the end of the next word, while
333 `C-M-@' (`mark-sexp') puts it at the end of the next Lisp expression.
334 These characters sometimes save you some typing.
335
336    A number of commands are available that set both point and mark and
337 thus delimit an object in the buffer.  `M-h' (`mark-paragraph') moves
338 point to the beginning of the paragraph that surrounds or follows
339 point, and puts the mark at the end of that paragraph (*note
340 Paragraphs::).  You can then indent, case-convert, or kill the whole
341 paragraph.  In the same fashion, `C-M-h' (`mark-defun') puts point
342 before and the mark after the current or following defun (*note
343 Defuns::).  `C-x C-p' (`mark-page') puts point before the current page
344 (or the next or previous, depending on the argument), and mark at the
345 end (*note Pages::).  The mark goes after the terminating page
346 delimiter (to include it), while point goes after the preceding page
347 delimiter (to exclude it).  Finally, `C-x h' (`mark-whole-buffer') sets
348 up the entire buffer as the region by putting point at the beginning
349 and the mark at the end.
350
351 \1f
352 File: xemacs.info,  Node: Mark Ring,  Prev: Marking Objects,  Up: Mark
353
354 The Mark Ring
355 -------------
356
357    Aside from delimiting the region, the mark is also useful for marking
358 a spot that you may want to go back to.  To make this feature more
359 useful, Emacs remembers 16 previous locations of the mark in the "mark
360 ring".  Most commands that set the mark push the old mark onto this
361 ring.  To return to a marked location, use `C-u C-<SPC>' (or `C-u
362 C-@'); this is the command `set-mark-command' given a numeric argument.
363 The command moves point to where the mark was, and restores the mark
364 from the ring of former marks. Repeated use of this command moves point
365 to all the old marks on the ring, one by one.  The marks you have seen
366 go to the end of the ring, so no marks are lost.
367
368    Each buffer has its own mark ring.  All editing commands use the
369 current buffer's mark ring.  In particular, `C-u C-<SPC>' always stays
370 in the same buffer.
371
372    Many commands that can move long distances, such as `M-<'
373 (`beginning-of-buffer'), start by setting the mark and saving the old
374 mark on the mark ring.  This makes it easier for you to move back
375 later.  Searches set the mark, unless they do not actually move point.
376 When a command sets the mark, `Mark Set' is printed in the echo area.
377
378    The variable `mark-ring-max' is the maximum number of entries to
379 keep in the mark ring.  If that many entries exist and another entry is
380 added, the last entry in the list is discarded.  Repeating `C-u
381 C-<SPC>' circulates through the entries that are currently in the ring.
382
383    The variable `mark-ring' holds the mark ring itself, as a list of
384 marker objects in the order most recent first.  This variable is local
385 in every buffer.
386
387 \1f
388 File: xemacs.info,  Node: Mouse Selection,  Next: Additional Mouse Operations,  Prev: Mark,  Up: Top
389
390 Selecting Text with the Mouse
391 =============================
392
393    If you are using XEmacs under X, you can use the mouse pointer to
394 select text. (The normal mouse pointer is an I-beam, the same pointer
395 that `xterm' uses.)
396
397    The glyph variable `text-pointer-glyph' controls the shape of the
398 mouse pointer when over text.  You can also control the shape of the
399 mouse pointer when over nontext using `nontext-pointer-glyph', and the
400 shape of the mouse pointer when over the modeline using
401 `modeline-pointer-glyph'. (Remember, you should use `set-glyph-image',
402 not `setq', to set one of these variables.)
403
404    If you want to get fancy, you can set the foreground and background
405 colors of the mouse pointer by setting the `pointer' face.
406
407    There are two ways to select a region of text with the mouse:
408
409    To select a word in text, double-click with the left mouse button
410 while the mouse cursor is over the word.  The word is highlighted when
411 selected. On monochrome monitors, a stippled background indicates that a
412 region of text has been highlighted. On color monitors, a color
413 background indicates highlighted text. You can triple-click to select
414 whole lines.
415
416    To select an arbitrary region of text:
417
418   1. Move the mouse cursor over the character at the beginning of the
419      region of text you want to select.
420
421   2. Press and hold the left mouse button.
422
423   3. While holding the left mouse button down, drag the cursor to the
424      character at the end of the region of text you want to select.
425
426   4. Release the left mouse button.
427         The selected region of text is highlighted.
428
429    Once a region of text is selected, it becomes the primary X selection
430 (*note Using X Selections::) as well as the Emacs selected region. You
431 can paste it into other X applications and use the options from the
432 Edit pull-down menu on it.  Since it is also the Emacs region, you can
433 use Emacs region commands on it.
434
435 \1f
436 File: xemacs.info,  Node: Additional Mouse Operations,  Next: Killing,  Prev: Mouse Selection,  Up: Top
437
438 Additional Mouse Operations
439 ===========================
440
441    XEmacs also provides the following mouse functions.  Most of these
442 are not bound to mouse gestures by default, but they are provided for
443 your customization pleasure.  For example, if you wanted `shift-left'
444 (that is, holding down the <Shift> key and clicking the left mouse
445 button) to delete the character at which you are pointing, then you
446 could do this:
447
448      (global-set-key '(shift button1) 'mouse-del-char)
449
450 `mouse-del-char'
451      Delete the character pointed to by the mouse.
452
453 `mouse-delete-window'
454      Delete the Emacs window that the mouse is on.
455
456 `mouse-keep-one-window'
457      Select the Emacs window that the mouse is on, then delete all other
458      windows on this frame.
459
460 `mouse-kill-line'
461      Kill the line pointed to by the mouse.
462
463 `mouse-line-length'
464      Print the length of the line indicated by the pointer.
465
466 `mouse-scroll'
467      Scroll point to the mouse position.
468
469 `mouse-select'
470      Select the Emacs window the mouse is on.
471
472 `mouse-select-and-split'
473      Select the Emacs window mouse is on, then split it vertically in
474      half.
475
476 `mouse-set-mark'
477      Select the Emacs window the mouse is on and set the mark at the
478      mouse position.  Display the cursor at that position for a second.
479
480 `mouse-set-point'
481      Select the Emacs window that the mouse is on and move point to the
482      mouse position.
483
484 `mouse-track'
485      Make a selection with the mouse.   This is the default binding of
486      the left mouse button (<button1>).
487
488 `mouse-track-adjust'
489      Extend the existing selection.  This is the default binding of
490      <Shift-button1>.
491
492 `mouse-track-and-copy-to-cutbuffer'
493      Make a selection like `mouse-track', but also copy it to the cut
494      buffer.
495
496 `mouse-track-delete-and-insert'
497      Make a selection with the mouse and insert it at point.  This is
498      the default binding of <control-shift-button1>.
499
500 `mouse-track-insert'
501      Make a selection with the mouse and insert it at point.  This is
502      the default binding of <control-button1>.
503
504 `mouse-window-to-region'
505      Narrow a window to the region between the cursor and the mouse
506      pointer.
507
508    The `M-x mouse-track' command should be bound to a mouse button.  If
509 you click-and-drag, the selection is set to the region between the
510 point of the initial click and the point at which you release the
511 button.  These positions do not need to be ordered.
512
513    If you click-and-release without moving the mouse, the point is
514 moved, and the selection is disowned (there will be no selection
515 owner.)  The mark will be set to the previous position of point.
516
517    If you double-click, the selection will extend by symbols instead of
518 by characters.  If you triple-click, the selection will extend by lines.
519
520    If you drag the mouse off the top or bottom of the window, you can
521 select pieces of text that are larger than the visible part of the
522 buffer; the buffer will scroll as necessary.
523
524    The selected text becomes the current X selection, and is also
525 copied to the top of the kill ring.  Point will be left at the position
526 at which you released the button and the mark will be left at the
527 initial click position.  Bind a mouse click to
528 `mouse-track-and-copy-to-cutbuffer' to copy selections to the cut
529 buffer.  (See also the `mouse-track-adjust' command, on
530 `Shift-button1'.)
531
532    The `M-x mouse-track-adjust' command should be bound to a mouse
533 button.  The selection will be enlarged or shrunk so that the point of
534 the mouse click is one of its endpoints.  This is only meaningful after
535 the `mouse-track' command (<button1>) has been executed.
536
537    The `M-x mouse-track-delete-and-insert' command is exactly the same
538 as the `mouse-track' command on <button1>, except that point is not
539 moved; the selected text is immediately inserted after being selected;
540 and the text of the selection is deleted.
541
542    The `M-x mouse-track-insert' command is exactly the same as the
543 `mouse-track' command on <button1>, except that point is not moved; the
544 selected text is immediately inserted after being selected; and the
545 selection is immediately disowned afterwards.
546
547 \1f
548 File: xemacs.info,  Node: Killing,  Next: Yanking,  Prev: Additional Mouse Operations,  Up: Top
549
550 Deletion and Killing
551 ====================
552
553    Most commands that erase text from the buffer save it. You can get
554 the text back if you change your mind, or you can move or copy it to
555 other parts of the buffer.  Commands which erase text and save it in the
556 kill ring are known as "kill" commands.  Some other commands erase text
557 but do not save it; they are known as "delete" commands.  (This
558 distinction is made only for erasing text in the buffer.)
559
560    The commands' names and individual descriptions use the words `kill'
561 and `delete' to indicate what they do.  If you perform a kill or delete
562 command by mistake, use the `C-x u' (`undo') command to undo it (*note
563 Undo::). The delete commands include `C-d' (`delete-char') and <DEL>
564 (`delete-backward-char'), which delete only one character at a time,
565 and those commands that delete only spaces or newlines.  Commands that
566 can destroy significant amounts of nontrivial data usually kill.
567
568 Deletion
569 --------
570
571 `C-d'
572      Delete next character (`delete-char').
573
574 `<DEL>'
575      Delete previous character (`delete-backward-char').
576
577 `M-\'
578      Delete spaces and tabs around point (`delete-horizontal-space').
579
580 `M-<SPC>'
581      Delete spaces and tabs around point, leaving one space
582      (`just-one-space').
583
584 `C-x C-o'
585      Delete blank lines around the current line (`delete-blank-lines').
586
587 `M-^'
588      Join two lines by deleting the intervening newline, and any
589      indentation following it (`delete-indentation').
590
591    The most basic delete commands are `C-d' (`delete-char') and <DEL>
592 (`delete-backward-char').  `C-d' deletes the character after point, the
593 one the cursor is "on top of".  Point doesn't move.  <DEL> deletes the
594 character before the cursor, and moves point back.  You can delete
595 newlines like any other characters in the buffer; deleting a newline
596 joins two lines.  Actually, `C-d' and <DEL> aren't always delete
597 commands; if you give them an argument, they kill instead, since they
598 can erase more than one character this way.
599
600    The other delete commands delete only formatting characters: spaces,
601 tabs and newlines.  `M-\' (`delete-horizontal-space') deletes all
602 spaces and tab characters before and after point.  `M-<SPC>'
603 (`just-one-space') does the same but leaves a single space after point,
604 regardless of the number of spaces that existed previously (even zero).
605
606    `C-x C-o' (`delete-blank-lines') deletes all blank lines after the
607 current line. If the current line is blank, it deletes all blank lines
608 preceding the current line as well as leaving one blank line, the
609 current line.  `M-^' (`delete-indentation') joins the current line and
610 the previous line, or, if given an argument, joins the current line and
611 the next line by deleting a newline and all surrounding spaces, possibly
612 leaving a single space.  *Note M-^: Indentation.
613
614 Killing by Lines
615 ----------------
616
617 `C-k'
618      Kill rest of line or one or more lines (`kill-line').
619
620    The simplest kill command is `C-k'.  If given at the beginning of a
621 line, it kills all the text on the line, leaving the line blank.  If
622 given on a blank line, the blank line disappears.  As a consequence, a
623 line disappears completely if you go to the front of a non-blank line
624 and type `C-k' twice.
625
626    More generally, `C-k' kills from point up to the end of the line,
627 unless it is at the end of a line.  In that case, it kills the newline
628 following the line, thus merging the next line into the current one.
629 Emacs ignores invisible spaces and tabs at the end of the line when
630 deciding which case applies: if point appears to be at the end of the
631 line, you can be sure the newline will be killed.
632
633    If you give `C-k' a positive argument, it kills that many lines and
634 the newlines that follow them (however, text on the current line before
635 point is not killed).  With a negative argument, `C-k' kills back to a
636 number of line beginnings.  An argument of -2 means kill back to the
637 second line beginning.  If point is at the beginning of a line, that
638 line beginning doesn't count, so `C-u - 2 C-k' with point at the front
639 of a line kills the two previous lines.
640
641    `C-k' with an argument of zero kills all the text before point on the
642 current line.
643
644 Other Kill Commands
645 -------------------
646
647 `C-w'
648      Kill region (from point to the mark) (`kill-region').  *Note
649      Words::.
650
651 `M-d'
652      Kill word (`kill-word').
653
654 `M-<DEL>'
655      Kill word backwards (`backward-kill-word').
656
657 `C-x <DEL>'
658      Kill back to beginning of sentence (`backward-kill-sentence').
659      *Note Sentences::.
660
661 `M-k'
662      Kill to end of sentence (`kill-sentence').
663
664 `C-M-k'
665      Kill sexp (`kill-sexp').  *Note Lists::.
666
667 `M-z CHAR'
668      Kill up to next occurrence of CHAR (`zap-to-char').
669
670    `C-w' (`kill-region') is a very general kill command; it kills
671 everything between point and the mark. You can use this command to kill
672 any contiguous sequence of characters by first setting the mark at one
673 end of a sequence of characters, then going to the other end and typing
674 `C-w'.
675
676    A convenient way of killing is combined with searching: `M-z'
677 (`zap-to-char') reads a character and kills from point up to (but not
678 including) the next occurrence of that character in the buffer.  If
679 there is no next occurrence, killing goes to the end of the buffer.  A
680 numeric argument acts as a repeat count.  A negative argument means to
681 search backward and kill text before point.
682
683    Other syntactic units can be killed: words, with `M-<DEL>' and `M-d'
684 (*note Words::); sexps, with `C-M-k' (*note Lists::); and sentences,
685 with `C-x <DEL>' and `M-k' (*note Sentences::).
686
687 \1f
688 File: xemacs.info,  Node: Yanking,  Next: Using X Selections,  Prev: Killing,  Up: Top
689
690 Yanking
691 =======
692
693    "Yanking" means getting back text which was killed. Some systems
694 call this "pasting".  The usual way to move or copy text is to kill it
695 and then yank it one or more times.
696
697 `C-y'
698      Yank last killed text (`yank').
699
700 `M-y'
701      Replace re-inserted killed text with the previously killed text
702      (`yank-pop').
703
704 `M-w'
705      Save region as last killed text without actually killing it
706      (`copy-region-as-kill').
707
708 `C-M-w'
709      Append next kill to last batch of killed text (`append-next-kill').
710
711 * Menu:
712
713 * Kill Ring::       Where killed text is stored.  Basic yanking.
714 * Appending Kills:: Several kills in a row all yank together.
715 * Earlier Kills::   Yanking something killed some time ago.
716
717 \1f
718 File: xemacs.info,  Node: Kill Ring,  Next: Appending Kills,  Prev: Yanking,  Up: Yanking
719
720 The Kill Ring
721 -------------
722
723    All killed text is recorded in the "kill ring", a list of blocks of
724 text that have been killed.  There is only one kill ring, used in all
725 buffers, so you can kill text in one buffer and yank it in another
726 buffer.  This is the usual way to move text from one file to another.
727 (*Note Accumulating Text::, for some other ways.)
728
729    If you have two separate Emacs processes, you cannot use the kill
730 ring to move text. If you are using XEmacs under X, however, you can
731 use the X selection mechanism to move text from one to another.
732
733    If you are using XEmacs under X and have one Emacs process with
734 multiple frames, they do share the same kill ring.  You can kill or
735 copy text in one Emacs frame, then yank it in the other frame belonging
736 to the same process.
737
738    The command `C-y' (`yank') reinserts the text of the most recent
739 kill.  It leaves the cursor at the end of the text and sets the mark at
740 the beginning of the text.  *Note Mark::.
741
742    `C-u C-y' yanks the text, leaves the cursor in front of the text,
743 and sets the mark after it, if the argument is with just a `C-u'.  Any
744 other argument, including `C-u' and digits, has different results,
745 described below, under "Yanking Earlier Kills".
746
747    To copy a block of text, you can also use `M-w'
748 (`copy-region-as-kill'), which copies the region into the kill ring
749 without removing it from the buffer. `M-w' is similar to `C-w' followed
750 by `C-y' but does not mark the buffer as "modified" and does not
751 actually cut anything.
752
753 \1f
754 File: xemacs.info,  Node: Appending Kills,  Next: Earlier Kills,  Prev: Kill Ring,  Up: Yanking
755
756 Appending Kills
757 ---------------
758
759    Normally, each kill command pushes a new block onto the kill ring.
760 However, two or more kill commands in a row combine their text into a
761 single entry, so that a single `C-y' yanks it all back. This means you
762 don't have to kill all the text you want to yank in one command; you
763 can kill line after line, or word after word, until you have killed what
764 you want, then get it all back at once using `C-y'. (Thus we join
765 television in leading people to kill thoughtlessly.)
766
767    Commands that kill forward from point add onto the end of the
768 previous killed text.  Commands that kill backward from point add onto
769 the beginning.  This way, any sequence of mixed forward and backward
770 kill commands puts all the killed text into one entry without
771 rearrangement.  Numeric arguments do not break the sequence of
772 appending kills.  For example, suppose the buffer contains:
773
774      This is the first
775      line of sample text
776      and here is the third.
777
778 with point at the beginning of the second line.  If you type `C-k C-u 2
779 M-<DEL> C-k', the first `C-k' kills the text `line of sample text',
780 `C-u 2 M-<DEL>' kills `the first' with the newline that followed it,
781 and the second `C-k' kills the newline after the second line.  The
782 result is that the buffer contains `This is and here is the third.' and
783 a single kill entry contains `the first<RET>line of sample
784 text<RET>'--all the killed text, in its original order.
785
786    If a kill command is separated from the last kill command by other
787 commands (not just numeric arguments), it starts a new entry on the kill
788 ring.  To force a kill command to append, first type the command `C-M-w'
789 (`append-next-kill'). `C-M-w' tells the following command, if it is a
790 kill command, to append the text it kills to the last killed text,
791 instead of starting a new entry.  With `C-M-w', you can kill several
792 separated pieces of text and accumulate them to be yanked back in one
793 place.
794
795 \1f
796 File: xemacs.info,  Node: Earlier Kills,  Prev: Appending Kills,  Up: Yanking
797
798 Yanking Earlier Kills
799 ---------------------
800
801    To recover killed text that is no longer the most recent kill, you
802 need the `Meta-y' (`yank-pop') command.  You can use `M-y' only after a
803 `C-y' or another `M-y'.  It takes the text previously yanked and
804 replaces it with the text from an earlier kill.  To recover the text of
805 the next-to-the-last kill, first use `C-y' to recover the last kill,
806 then `M-y' to replace it with the previous kill.
807
808    You can think in terms of a "last yank" pointer which points at an
809 item in the kill ring.  Each time you kill, the "last yank" pointer
810 moves to the new item at the front of the ring.  `C-y' yanks the item
811 which the "last yank" pointer points to.  `M-y' moves the "last yank"
812 pointer to a different item, and the text in the buffer changes to
813 match.  Enough `M-y' commands can move the pointer to any item in the
814 ring, so you can get any item into the buffer.  Eventually the pointer
815 reaches the end of the ring; the next `M-y' moves it to the first item
816 again.
817
818    Yanking moves the "last yank" pointer around the ring, but does not
819 change the order of the entries in the ring, which always runs from the
820 most recent kill at the front to the oldest one still remembered.
821
822    Use `M-y' with a numeric argument to advance the "last yank" pointer
823 by the specified number of items.  A negative argument moves the
824 pointer toward the front of the ring; from the front of the ring, it
825 moves to the last entry and starts moving forward from there.
826
827    Once the text you are looking for is brought into the buffer, you can
828 stop doing `M-y' commands and the text will stay there. Since the text
829 is just a copy of the kill ring item, editing it in the buffer does not
830 change what's in the ring.  As long you don't kill additional text, the
831 "last yank" pointer remains at the same place in the kill ring:
832 repeating `C-y' will yank another copy of the same old kill.
833
834    If you know how many `M-y' commands it would take to find the text
835 you want, you can yank that text in one step using `C-y' with a numeric
836 argument.  `C-y' with an argument greater than one restores the text
837 the specified number of entries back in the kill ring.  Thus, `C-u 2
838 C-y' gets the next to the last block of killed text.  It is equivalent
839 to `C-y M-y'.  `C-y' with a numeric argument starts counting from the
840 "last yank" pointer, and sets the "last yank" pointer to the entry that
841 it yanks.
842
843    The variable `kill-ring-max' controls the length of the kill ring;
844 no more than that many blocks of killed text are saved.
845
846 \1f
847 File: xemacs.info,  Node: Using X Selections,  Next: Accumulating Text,  Prev: Yanking,  Up: Top
848
849 Using X Selections
850 ==================
851
852    In the X window system, mouse selections provide a simple mechanism
853 for text transfer between different applications.  In a typical X
854 application, you can select text by pressing the left mouse button and
855 dragging the cursor over the text you want to copy.  The text becomes
856 the primary X selection and is highlighted.  The highlighted region is
857 also the Emacs selected region.
858
859    * Since the region is the primary X selection, you can go to a
860      different X application and click the middle mouse button: the
861      text that you selected in the previous application is pasted into
862      the current application.
863
864    * Since the region is the Emacs selected region, you can use all
865      region commands (`C-w, M-w' etc.) as well as the options of the
866      Edit menu to manipulate the selected text.
867
868 * Menu:
869
870 * X Clipboard Selection::       Pasting to the X clipboard.
871 * X Selection Commands::        Other operations on the selection.
872 * X Cut Buffers::               X cut buffers are available for compatibility.
873 * Active Regions::              Using zmacs-style highlighting of the
874                                  selected region.
875
876 \1f
877 File: xemacs.info,  Node: X Clipboard Selection,  Next: X Selection Commands,  Prev: Using X Selections,  Up: Using X Selections
878
879 The Clipboard Selection
880 -----------------------
881
882    There are other kinds of X selections besides the Primary selection;
883 one common one is the Clipboard selection.  Some applications prefer to
884 transfer data using this selection in preference to the Primary.  One
885 can transfer text from the Primary selection to the  Clipboard
886 selection with the Copy command under the Edit menu in the menubar.
887
888    Usually, the clipboard selection is not visible.  However, if you
889 run the `xclipboard' application, the text most recently copied to the
890 clipboard (with the Copy command) is displayed in a window.  Any time
891 new text is thus copied, the `xclipboard' application makes a copy of
892 it and displays it in its window.  The value of the clipboard can
893 survive the lifetime of the running Emacs process.  The `xclipboard'
894 man page provides more details.
895
896    Warning: If you use the `xclipboard' application, remember that it
897 maintains a list of all things that have been pasted to the clipboard
898 (that is, copied with the Copy command).  If you don't manually delete
899 elements from this list by clicking on the Delete button in the
900 `xclipboard' window, the clipboard will eventually consume a lot of
901 memory.
902
903    In summary, some X applications (such as `xterm') allow one to paste
904 text in them from XEmacs in the following way:
905
906    * Drag out a region of text in Emacs with the left mouse button,
907      making that text be the Primary selection.
908
909    * Click the middle button in the other application, pasting the
910      Primary selection.
911
912    With some other applications (notably, the OpenWindows and Motif
913 tools) you must use this method instead:
914
915    * Drag out a region of text in Emacs with the left mouse button,
916      making that text be the Primary selection.
917
918    * Copy the selected text to the Clipboard selection by selecting the
919      Copy menu item from the Edit menu, or by hitting the Copy key on
920      your keyboard.
921
922    * Paste the text in the other application by selecting Paste from its
923      menu, or by hitting the Paste key on your keyboard.
924
925 \1f
926 File: xemacs.info,  Node: X Selection Commands,  Next: X Cut Buffers,  Prev: X Clipboard Selection,  Up: Using X Selections
927
928 Miscellaneous X Selection Commands
929 ----------------------------------
930
931 `M-x x-copy-primary-selection'
932      Copy the primary selection to both the kill ring and the Clipboard.
933
934 `M-x x-insert-selection'
935      Insert the current selection into the buffer at point.
936
937 `M-x x-delete-primary-selection'
938      Deletes the text in the primary selection without copying it to
939      the kill ring or the Clipboard.
940
941 `M-x x-kill-primary-selection'
942      Deletes the text in the primary selection and copies it to both
943      the kill ring and the Clipboard.
944
945 `M-x x-mouse-kill'
946      Kill the text between point and the mouse and copy it to the
947      clipboard and to the cut buffer.
948
949 `M-x x-own-secondary-selection'
950      Make a secondary X selection of the given argument.
951
952 `M-x x-own-selection'
953      Make a primary X selection of the given argument.
954
955 `M-x x-set-point-and-insert-selection'
956      Set point where clicked and insert the primary selection or the
957      cut buffer.
958
959 \1f
960 File: xemacs.info,  Node: X Cut Buffers,  Next: Active Regions,  Prev: X Selection Commands,  Up: Using X Selections
961
962 X Cut Buffers
963 -------------
964
965    X cut buffers are a different, older way of transferring text between
966 applications.  XEmacs supports cut buffers for compatibility with older
967 programs, even though selections are now the preferred way of
968 transferring text.
969
970    X has a concept of applications "owning" selections.  When you select
971 text by clicking and dragging inside an application, the application
972 tells the X server that it owns the selection.  When another
973 application asks the X server for the value of the selection, the X
974 server requests the information from the owner. When you use
975 selections, the selection data is not actually transferred unless
976 someone wants it; the act of making a selection doesn't transfer data.
977 Cut buffers are different: when you "own" a cut buffer, the data is
978 actually transferred to the X server immediately, and survives the
979 lifetime of the application.
980
981    Any time a region of text becomes the primary selection in Emacs,
982 Emacs also copies that text to the cut buffer.  This makes it possible
983 to copy text from an XEmacs buffer and paste it into an older,
984 non-selection-based application (such as Emacs 18).
985
986    Note: Older versions of Emacs could not access the X selections, only
987 the X cut buffers.
988
989 \1f
990 File: xemacs.info,  Node: Active Regions,  Prev: X Cut Buffers,  Up: Using X Selections
991
992 Active Regions
993 --------------
994
995    By default, both the text you select in an Emacs buffer using the
996 click-and-drag mechanism and text you select by setting point and the
997 mark is highlighted. You can use Emacs region commands as well as the
998 Cut and Copy commands on the highlighted region you selected with the
999 mouse.
1000
1001    If you prefer, you can make a distinction between text selected with
1002 the mouse and text selected with point and the mark by setting the
1003 variable `zmacs-regions' to `nil'.  In that case:
1004
1005    * The text selected with the mouse becomes both the X selection and
1006      the Emacs selected region. You can use menu-bar commands as well
1007      as Emacs region commands on it.
1008
1009    * The text selected with point and the mark is not highlighted. You
1010      can only use Emacs region commands on it, not the menu-bar items.
1011
1012    Active regions originally come from Zmacs, the Lisp Machine editor.
1013 The idea behind them is that commands can only operate on a region when
1014 the region is in an "active" state.  Put simply, you can only operate on
1015 a region that is highlighted.
1016
1017    The variable `zmacs-regions' checks whether LISPM-style active
1018 regions should be used.  This means that commands that operate on the
1019 region (the area between point and the mark) only work while the region
1020 is in the active state, which is indicated by highlighting.  Most
1021 commands causes the region to not be in the active state; for example,
1022 `C-w' only works immediately after activating the region.
1023
1024    More specifically:
1025    * Commands that operate on the region only work if the region is
1026      active.
1027
1028    * Only a very small set of commands causes the region to become
1029      active-- those commands whose semantics are to mark an area, such
1030      as `mark-defun'.
1031
1032    * The region is deactivated after each command that is executed,
1033      except that motion commands do not change whether the region is
1034      active or not.
1035
1036    `set-mark-command' (`C-SPC') pushes a mark and activates the region.
1037 Moving the cursor with normal motion commands (`C-n', `C-p', etc.)
1038 will cause the region between point and the recently-pushed mark to be
1039 highlighted.  It will remain highlighted until some non-motion command
1040 is executed.
1041
1042    `exchange-point-and-mark' (`C-x C-x') activates the region.  So if
1043 you mark a region and execute a command that operates on it, you can
1044 reactivate the same region with `C-x C-x' (or perhaps `C-x C-x C-x
1045 C-x') to operate on it again.
1046
1047    Generally, commands that push marks as a means of navigation, such as
1048 `beginning-of-buffer' (`M-<') and `end-of-buffer' (`M->'), do not
1049 activate the region.  However, commands that push marks as a means of
1050 marking an area of text, such as `mark-defun' (`M-C-h'), `mark-word'
1051 (`M-@'), and `mark-whole-buffer' (`C-x h'), do activate the region.
1052
1053    When `zmacs-regions' is `t', there is no distinction between the
1054 primary X selection and the active region selected by point and the
1055 mark.  To see this, set the mark (<C-SPC>) and move the cursor with any
1056 cursor-motion command: the region between point and mark is
1057 highlighted, and you can watch it grow and shrink as you move the
1058 cursor.
1059
1060    Any other commands besides cursor-motion commands (such as inserting
1061 or deleting text) will cause the region to no longer be active; it will
1062 no longer be highlighted, and will no longer be the primary selection.
1063 Region can be explicitly deactivated with `C-g'.
1064
1065    Commands that require a region (such as `C-w') signal an error if
1066 the region is not active.  Certain commands cause the region to be in
1067 its active state.  The most common ones are `push-mark' (<C-SPC>) and
1068 `exchange-point-and-mark' (`C-x C-x').
1069
1070    When `zmacs-regions' is `t', programs can be non-intrusive on the
1071 state of the region by setting the variable `zmacs-region-stays' to a
1072 non-`nil' value.  If you are writing a new Emacs command that is
1073 conceptually a "motion" command and should not interfere with the
1074 current highlightedness of the region, then you may set this variable.
1075 It is reset to `nil' after each user command is executed.
1076
1077    When `zmacs-regions' is `t', programs can make the region between
1078 point and mark go into the active (highlighted) state by using the
1079 function `zmacs-activate-region'. Only a small number of commands
1080 should ever do this.
1081
1082    When `zmacs-regions' is `t', programs can deactivate the region
1083 between point and the mark by using `zmacs-deactivate-region'.  Note:
1084 you should not have to call this function; the command loop calls it
1085 when appropriate.
1086
1087 \1f
1088 File: xemacs.info,  Node: Accumulating Text,  Next: Rectangles,  Prev: Using X Selections,  Up: Top
1089
1090 Accumulating Text
1091 =================
1092
1093    Usually you copy or move text by killing it and yanking it, but
1094 there are other ways that are useful for copying one block of text in
1095 many places, or for copying many scattered blocks of text into one
1096 place.
1097
1098    If you like, you can accumulate blocks of text from scattered
1099 locations either into a buffer or into a file.  The relevant commands
1100 are described here.  You can also use Emacs registers for storing and
1101 accumulating text.  *Note Registers::.
1102
1103 `M-x append-to-buffer'
1104      Append region to contents of specified buffer (`append-to-buffer').
1105
1106 `M-x prepend-to-buffer'
1107      Prepend region to contents of specified buffer.
1108
1109 `M-x copy-to-buffer'
1110      Copy region into specified buffer, deleting that buffer's old
1111      contents.
1112
1113 `M-x insert-buffer'
1114      Insert contents of specified buffer into current buffer at point.
1115
1116 `M-x append-to-file'
1117      Append region to the end of the contents of specified file.
1118
1119    To accumulate text into a buffer, use the command `M-x
1120 append-to-buffer', which inserts a copy of the region into the buffer
1121 BUFFERNAME, at the location of point in that buffer.  If there is no
1122 buffer with the given name, one is created.
1123
1124    If you append text to a buffer that has been used for editing, the
1125 copied text goes to the place where point is.  Point in that buffer is
1126 left at the end of the copied text, so successive uses of
1127 `append-to-buffer' accumulate the text in the specified buffer in the
1128 same order as they were copied.  Strictly speaking, this command does
1129 not always append to the text already in the buffer; but if this command
1130 is the only command used to alter a buffer, it does always append to the
1131 existing text because point is always at the end.
1132
1133    `M-x prepend-to-buffer' is similar to `append-to-buffer', but point
1134 in the other buffer is left before the copied text, so successive
1135 prependings add text in reverse order.  `M-x copy-to-buffer' is
1136 similar, except that any existing text in the other buffer is deleted,
1137 so the buffer is left containing just the text newly copied into it.
1138
1139    You can retrieve the accumulated text from that buffer with `M-x
1140 insert-buffer', which takes BUFFERNAME as an argument.  It inserts a
1141 copy of the text in buffer BUFFERNAME into the selected buffer.  You
1142 could alternatively select the other buffer for editing, perhaps moving
1143 text from it by killing or with `append-to-buffer'.  *Note Buffers::,
1144 for background information on buffers.
1145
1146    Instead of accumulating text within Emacs in a buffer, you can append
1147 text directly into a file with `M-x append-to-file', which takes
1148 FILE-NAME as an argument.  It adds the text of the region to the end of
1149 the specified file.  The file is changed immediately on disk.  This
1150 command is normally used with files that are not being visited in
1151 Emacs.  Using it on a file that Emacs is visiting can produce confusing
1152 results, because the file's text inside Emacs does not change while the
1153 file itself changes.
1154