Sync with r21-2-35.
[chise/xemacs-chise.git-] / info / xemacs.info-8
1 This is ../info/xemacs.info, produced by makeinfo version 4.0 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: Change Logs and VC,  Next: Old Versions,  Prev: Log Entries,  Up: Version Control
34
35 Change Logs and VC
36 ------------------
37
38    If you use RCS for a program and also maintain a change log file for
39 it (*note Change Log::), you can generate change log entries
40 automatically from the version control log entries:
41
42 `C-x v a'
43      Visit the current directory's change log file and create new
44      entries for versions checked in since the most recent entry in the
45      change log file (`vc-update-change-log').
46
47      This command works with RCS only; it does not work with SCCS.
48
49    For example, suppose the first line of `ChangeLog' is dated 10 April
50 1992, and that the only check-in since then was by Nathaniel Bowditch
51 to `rcs2log' on 8 May 1992 with log text `Ignore log messages that
52 start with `#'.'.  Then `C-x v a' visits `ChangeLog' and inserts text
53 like this:
54
55      Fri May  8 21:45:00 1992  Nathaniel Bowditch  (nat@apn.org)
56      
57              * rcs2log: Ignore log messages that start with `#'.
58
59 You can then edit the new change log entry further as you wish.
60
61    Normally, the log entry for file `foo' is displayed as `* foo: TEXT
62 OF LOG ENTRY'.  The `:' after `foo' is omitted if the text of the log
63 entry starts with `(FUNCTIONNAME): '.  For example, if the log entry
64 for `vc.el' is `(vc-do-command): Check call-process status.', then the
65 text in `ChangeLog' looks like this:
66
67      Wed May  6 10:53:00 1992  Nathaniel Bowditch  (nat@apn.org)
68      
69              * vc.el (vc-do-command): Check call-process status.
70
71    When `C-x v a' adds several change log entries at once, it groups
72 related log entries together if they all are checked in by the same
73 author at nearly the same time.  If the log entries for several such
74 files all have the same text, it coalesces them into a single entry.
75 For example, suppose the most recent checkins have the following log
76 entries:
77
78 For `vc.texinfo':
79      Fix expansion typos.
80 For `vc.el':
81      Don't call expand-file-name.
82 For `vc-hooks.el':
83      Don't call expand-file-name.
84
85    They appear like this in `ChangeLog':
86
87      Wed Apr  1 08:57:59 1992  Nathaniel Bowditch  (nat@apn.org)
88      
89              * vc.texinfo: Fix expansion typos.
90      
91              * vc.el, vc-hooks.el: Don't call expand-file-name.
92
93    Normally, `C-x v a' separates log entries by a blank line, but you
94 can mark several related log entries to be clumped together (without an
95 intervening blank line) by starting the text of each related log entry
96 with a label of the form `{CLUMPNAME} '.  The label itself is not
97 copied to `ChangeLog'.  For example, suppose the log entries are:
98
99 For `vc.texinfo':
100      {expand} Fix expansion typos.
101 For `vc.el':
102      {expand} Don't call expand-file-name.
103 For `vc-hooks.el':
104      {expand} Don't call expand-file-name.
105
106 Then the text in `ChangeLog' looks like this:
107
108      Wed Apr  1 08:57:59 1992  Nathaniel Bowditch  (nat@apn.org)
109      
110              * vc.texinfo: Fix expansion typos.
111              * vc.el, vc-hooks.el: Don't call expand-file-name.
112
113    A log entry whose text begins with `#' is not copied to `ChangeLog'.
114 For example, if you merely fix some misspellings in comments, you can
115 log the change with an entry beginning with `#' to avoid putting such
116 trivia into `ChangeLog'.
117
118 \1f
119 File: xemacs.info,  Node: Old Versions,  Next: VC Status,  Prev: Change Logs and VC,  Up: Version Control
120
121 Examining And Comparing Old Versions
122 ------------------------------------
123
124 `C-x v ~ VERSION <RET>'
125      Examine version VERSION of the visited file, in a buffer of its
126      own (`vc-version-other-window').
127
128 `C-x v ='
129      Compare the current buffer contents with the latest checked-in
130      version of the file.
131
132 `C-u C-x v = FILE <RET> OLDVERS <RET> NEWVERS <RET>'
133      Compare the specified two versions of FILE.
134
135    You can examine any version of a file by first visiting it, and then
136 using `C-x v ~ VERSION <RET>' (`vc-version-other-window').  This puts
137 the text of version VERSION in a file named `FILENAME.~VERSION~', then
138 visits it in a separate window.
139
140    To compare two versions of a file, use the command `C-x v ='
141 (`vc-diff').
142
143    Plain `C-x v =' compares the current buffer contents (saving them in
144 the file if necessary) with the last checked-in version of the file.
145 With a prefix argument, `C-x v =' reads a file name and two version
146 numbers, then compares those versions of the specified file.
147
148    If you supply a directory name instead of the name of a work file,
149 this command compares the two specified versions of all registered files
150 in that directory and its subdirectories.  You can also specify a
151 snapshot name (*note Snapshots::) instead of one or both version
152 numbers.
153
154    You can specify a checked-in version by its number; you can specify
155 the most recent checked-in version with an empty version number.
156
157    This command works by running the `vcdiff' utility, getting the
158 options from the variable `diff-switches'.  It displays the output in a
159 special buffer in another window.  Unlike the `M-x diff' command, `C-x
160 v =' does not try to find the changes in the old and new versions.
161 This is because one or both versions normally do not exist as files.
162 They exist only in the records of the master file.  *Note Comparing
163 Files::, for more information about `M-x diff'.
164
165 \1f
166 File: xemacs.info,  Node: VC Status,  Next: Renaming and VC,  Prev: Old Versions,  Up: Version Control
167
168 VC Status Commands
169 ------------------
170
171    To view the detailed version control status and history of a file,
172 type `C-x v l' (`vc-print-log').  It displays the history of changes to
173 the current file, including the text of the log entries.  The output
174 appears in a separate window.
175
176    When you are working on a large program, it's often useful to find
177 all the files that are currently locked, or all the files maintained in
178 version control at all.  You can use `C-x v d' (`vc-directory') to show
179 all the locked files in or beneath the current directory.  This
180 includes all files that are locked by any user.  `C-u C-x v d' lists
181 all files in or beneath the current directory that are maintained with
182 version control.
183
184    The list of files is displayed as a buffer that uses an augmented
185 Dired mode.  The names of the users locking various files are shown (in
186 parentheses) in place of the owner and group.  All the normal Dired
187 commands work in this buffer.  Most interactive VC commands work also,
188 and apply to the file name on the current line.
189
190    The `C-x v v' command (`vc-next-action'), when used in the augmented
191 Dired buffer, operates on all the marked files (or the file on the
192 current line).  If it operates on more than one file, it handles each
193 file according to its current state; thus, it may check out one file
194 and check in another (because it is already checked out).  If it has to
195 check in any files, it reads a single log entry, then uses that text
196 for all the files being checked in.  This can be convenient for
197 registering or checking in several files at once, as part of the same
198 change.
199
200 \1f
201 File: xemacs.info,  Node: Renaming and VC,  Next: Snapshots,  Prev: VC Status,  Up: Version Control
202
203 Renaming VC Work Files and Master Files
204 ---------------------------------------
205
206    When you rename a registered file, you must also rename its master
207 file correspondingly to get proper results.  Use `vc-rename-file' to
208 rename the source file as you specify, and rename its master file
209 accordingly.  It also updates any snapshots (*note Snapshots::) that
210 mention the file, so that they use the new name; despite this, the
211 snapshot thus modified may not completely work (*note Snapshot
212 Caveats::).
213
214    You cannot use `vc-rename-file' on a file that is locked by someone
215 else.
216
217 \1f
218 File: xemacs.info,  Node: Snapshots,  Next: Version Headers,  Prev: Renaming and VC,  Up: Version Control
219
220 Snapshots
221 ---------
222
223    A "snapshot" is a named set of file versions (one for each
224 registered file) that you can treat as a unit.  One important kind of
225 snapshot is a "release", a (theoretically) stable version of the system
226 that is ready for distribution to users.
227
228 * Menu:
229
230 * Making Snapshots::            The snapshot facilities.
231 * Snapshot Caveats::            Things to be careful of when using snapshots.
232
233 \1f
234 File: xemacs.info,  Node: Making Snapshots,  Next: Snapshot Caveats,  Prev: Snapshots,  Up: Snapshots
235
236 Making and Using Snapshots
237 ..........................
238
239    There are two basic commands for snapshots; one makes a snapshot
240 with a given name, the other retrieves a named snapshot.
241
242 `C-x v s NAME <RET>'
243      Define the last saved versions of every registered file in or
244      under the current directory as a snapshot named NAME
245      (`vc-create-snapshot').
246
247 `C-x v r NAME <RET>'
248      Check out all registered files at or below the current directory
249      level using whatever versions correspond to the snapshot NAME
250      (`vc-retrieve-snapshot').
251
252      This command reports an error if any files are locked at or below
253      the current directory, without changing anything; this is to avoid
254      overwriting work in progress.
255
256    A snapshot uses a very small amount of resources--just enough to
257 record the list of file names and which version belongs to the
258 snapshot.  Thus, you need not hesitate to create snapshots whenever
259 they are useful.
260
261    You can give a snapshot name as an argument to `C-x v =' or `C-x v
262 ~' (*note Old Versions::).  Thus, you can use it to compare a snapshot
263 against the current files, or two snapshots against each other, or a
264 snapshot against a named version.
265
266 \1f
267 File: xemacs.info,  Node: Snapshot Caveats,  Prev: Making Snapshots,  Up: Snapshots
268
269 Snapshot Caveats
270 ................
271
272    VC's snapshot facilities are modeled on RCS's named-configuration
273 support.  They use RCS's native facilities for this, so under VC
274 snapshots made using RCS are visible even when you bypass VC.
275
276    For SCCS, VC implements snapshots itself.  The files it uses contain
277 name/file/version-number triples.  These snapshots are visible only
278 through VC.
279
280    A snapshot is a set of checked-in versions.  So make sure that all
281 the files are checked in and not locked when you make a snapshot.
282
283    File renaming and deletion can create some difficulties with
284 snapshots.  This is not a VC-specific problem, but a general design
285 issue in version control systems that no one has solved very well yet.
286
287    If you rename a registered file, you need to rename its master along
288 with it (the command `vc-rename-file' does this automatically).  If you
289 are using SCCS, you must also update the records of the snapshot, to
290 mention the file by its new name (`vc-rename-file' does this, too).  An
291 old snapshot that refers to a master file that no longer exists under
292 the recorded name is invalid; VC can no longer retrieve it.  It would
293 be beyond the scope of this manual to explain enough about RCS and SCCS
294 to explain how to update the snapshots by hand.
295
296    Using `vc-rename-file' makes the snapshot remain valid for
297 retrieval, but it does not solve all problems.  For example, some of the
298 files in the program probably refer to others by name.  At the very
299 least, the makefile probably mentions the file that you renamed.  If you
300 retrieve an old snapshot, the renamed file is retrieved under its new
301 name, which is not the name that the makefile expects.  So the program
302 won't really work as retrieved.
303
304 \1f
305 File: xemacs.info,  Node: Version Headers,  Prev: Snapshots,  Up: Version Control
306
307 Inserting Version Control Headers
308 ---------------------------------
309
310    Sometimes it is convenient to put version identification strings
311 directly into working files.  Certain special strings called "version
312 headers" are replaced in each successive version by the number of that
313 version.
314
315    You can use the `C-x v h' command (`vc-insert-headers') to insert a
316 suitable header string.
317
318 `C-x v h'
319      Insert headers in a file for use with your version-control system.
320
321    The default header string is `\$Id\$' for RCS and `\%W\%' for SCCS.
322 (The actual strings inserted do not have the backslashes in them.  They
323 were placed in the Info source file so that the strings don't get
324 interpreted as version-control headers when the Info source files are
325 maintained under version control.) You can specify other headers to
326 insert by setting the variable `vc-header-alist'.  Its value is a list
327 of elements of the form `(PROGRAM . STRING)' where PROGRAM is `RCS' or
328 `SCCS' and STRING is the string to use.
329
330    Instead of a single string, you can specify a list of strings; then
331 each string in the list is inserted as a separate header on a line of
332 its own.
333
334    It is often necessary to use "superfluous" backslashes when writing
335 the strings that you put in this variable.  This is to prevent the
336 string in the constant from being interpreted as a header itself if the
337 Emacs Lisp file containing it is maintained with version control.
338
339    Each header is inserted surrounded by tabs, inside comment
340 delimiters, on a new line at the start of the buffer.  Normally the
341 ordinary comment start and comment end strings of the current mode are
342 used, but for certain modes, there are special comment delimiters for
343 this purpose; the variable `vc-comment-alist' specifies them.  Each
344 element of this list has the form `(MODE STARTER ENDER)'.
345
346    The variable `vc-static-header-alist' specifies further strings to
347 add based on the name of the buffer.  Its value should be a list of
348 elements of the form `(REGEXP . FORMAT)'.  Whenever REGEXP matches the
349 buffer name, FORMAT is inserted as part of the header.  A header line
350 is inserted for each element that matches the buffer name, and for each
351 string specified by `vc-header-alist'.  The header line is made by
352 processing the string from `vc-header-alist' with the format taken from
353 the element.  The default value for `vc-static-header-alist' is:
354
355      (("\\.c$" .
356        "\n#ifndef lint\nstatic char vcid[] = \"\%s\";\n\
357      #endif /* lint */\n"))
358
359 which specifies insertion of a string of this form:
360
361
362      #ifndef lint
363      static char vcid[] = "STRING";
364      #endif /* lint */
365
366 \1f
367 File: xemacs.info,  Node: ListDir,  Next: Comparing Files,  Prev: Version Control,  Up: Files
368
369 Listing a File Directory
370 ========================
371
372    Files are organized by Unix into "directories".  A "directory
373 listing" is a list of all the files in a directory.  Emacs provides
374 directory listings in brief format (file names only) and verbose format
375 (sizes, dates, and authors included).
376
377 `C-x C-d DIR-OR-PATTERN'
378      Print a brief directory listing (`list-directory').
379
380 `C-u C-x C-d DIR-OR-PATTERN'
381      Print a verbose directory listing.
382
383    To print a directory listing, use `C-x C-d' (`list-directory').
384 This command prompts in the minibuffer for a file name which is either
385 a  directory to be listed or pattern containing wildcards for the files
386 to be listed.  For example,
387
388      C-x C-d /u2/emacs/etc <RET>
389
390 lists all the files in directory `/u2/emacs/etc'.  An example of
391 specifying a file name pattern is:
392
393      C-x C-d /u2/emacs/src/*.c <RET>
394
395    Normally, `C-x C-d' prints a brief directory listing containing just
396 file names.  A numeric argument (regardless of value) tells it to print
397 a verbose listing (like `ls -l').
398
399    Emacs obtains the text of a directory listing by running `ls' in an
400 inferior process.  Two Emacs variables control the switches passed to
401 `ls': `list-directory-brief-switches' is a string giving the switches
402 to use in brief listings (`"-CF"' by default).
403 `list-directory-verbose-switches' is a string giving the switches to
404 use in a verbose listing (`"-l"' by default).
405
406    The variable `directory-abbrev-alist' is an alist of abbreviations
407 for file directories.  The list consists of elements of the form `(FROM
408 .  TO)', each meaning to replace `FROM' with `TO' when it appears in a
409 directory name.  This replacement is done when setting up the default
410 directory of a newly visited file.  Every `FROM' string should start
411 with ``^''.
412
413    Use this feature when you have directories which you normally refer
414 to via absolute symbolic links.  Make `TO' the name of the link, and
415 `FROM' the name it is linked to.
416
417 \1f
418 File: xemacs.info,  Node: Comparing Files,  Next: Dired,  Prev: ListDir,  Up: Files
419
420 Comparing Files
421 ===============
422
423    The command `M-x diff' compares two files, displaying the
424 differences in an Emacs buffer named `*Diff*'.  It works by running the
425 `diff' program, using options taken from the variable `diff-switches',
426 whose value should be a string.
427
428    The buffer `*Diff*' has Compilation mode as its major mode, so you
429 can use `C-x `' to visit successive changed locations in the two source
430 files.  You can also move to a particular hunk of changes and type `C-c
431 C-c' to find the corresponding source location.  You can also use the
432 other special commands of Compilation mode: <SPC> and <DEL> for
433 scrolling, and `M-p' and `M-n' for cursor motion.  *Note Compilation::.
434
435    The command `M-x diff-backup' compares a specified file with its most
436 recent backup.  If you specify the name of a backup file, `diff-backup'
437 compares it with the source file that it is a backup of.
438
439    The command `M-x compare-windows' compares the text in the current
440 window with that in the next window.  Comparison starts at point in each
441 window.  Point moves forward in each window, a character at a time in
442 each window, until the next characters in the two windows are
443 different.  Then the command is finished.  For more information about
444 windows in Emacs, *Note Windows::.
445
446    With a numeric argument, `compare-windows' ignores changes in
447 whitespace.  If the variable `compare-ignore-case' is non-`nil', it
448 ignores differences in case as well.
449
450 \1f
451 File: xemacs.info,  Node: Dired,  Next: Misc File Ops,  Prev: Comparing Files,  Up: Files
452
453 Dired, the Directory Editor
454 ===========================
455
456    Dired makes it easy to delete or visit many of the files in a single
457 directory at once.  It creates an Emacs buffer containing a listing of
458 the directory.  You can use the normal Emacs commands to move around in
459 this buffer and special Dired commands to operate on the files.
460
461 * Menu:
462
463 * Enter: Dired Enter.         How to invoke Dired.
464 * Edit: Dired Edit.           Editing the Dired buffer.
465 * Deletion: Dired Deletion.   Deleting files with Dired.
466 * Immed: Dired Immed.         Other file operations through Dired.
467
468 \1f
469 File: xemacs.info,  Node: Dired Enter,  Next: Dired Edit,  Prev: Dired,  Up: Dired
470
471 Entering Dired
472 --------------
473
474    To invoke dired, type `C-x d' or `M-x dired'.  The command reads a
475 directory name or wildcard file name pattern as a minibuffer argument
476 just like the `list-directory' command, `C-x C-d'.  Where `dired'
477 differs from `list-directory' is in naming the buffer after the
478 directory name or the wildcard pattern used for the listing, and putting
479 the buffer into Dired mode so that the special commands of Dired are
480 available in it.  The variable `dired-listing-switches' is a string
481 used as an argument to `ls' in making the directory; this string must
482 contain `-l'.
483
484    To display the Dired buffer in another window rather than in the
485 selected window, use `C-x 4 d' (`dired-other-window)' instead of `C-x
486 d'.
487
488 \1f
489 File: xemacs.info,  Node: Dired Edit,  Next: Dired Deletion,  Prev: Dired Enter,  Up: Dired
490
491 Editing in Dired
492 ----------------
493
494    Once the Dired buffer exists, you can switch freely between it and
495 other Emacs buffers.  Whenever the Dired buffer is selected, certain
496 special commands are provided that operate on files that are listed.
497 The Dired buffer is "read-only", and inserting text in it is not
498 useful, so ordinary printing characters such as `d' and `x' are used
499 for Dired commands.  Most Dired commands operate on the file described
500 by the line that point is on.  Some commands perform operations
501 immediately; others "flag" a file to be operated on later.
502
503    Most Dired commands that operate on the current line's file also
504 treat a numeric argument as a repeat count, meaning to act on the files
505 of the next few lines.  A negative argument means to operate on the
506 files of the preceding lines, and leave point on the first of those
507 lines.
508
509    All the usual Emacs cursor motion commands are available in Dired
510 buffers.  Some special purpose commands are also provided.  The keys
511 `C-n' and `C-p' are redefined so that they try to position the cursor
512 at the beginning of the filename on the line, rather than at the
513 beginning of the line.
514
515    For extra convenience, <SPC> and `n' in Dired are equivalent to
516 `C-n'.  `p' is equivalent to `C-p'.  Moving by lines is done so often
517 in Dired that it deserves to be easy to type.  <DEL> (move up and
518 unflag) is often useful simply for moving up.
519
520    The `g' command in Dired runs `revert-buffer' to reinitialize the
521 buffer from the actual disk directory and show any changes made in the
522 directory by programs other than Dired.  All deletion flags in the Dired
523 buffer are lost when this is done.
524
525 \1f
526 File: xemacs.info,  Node: Dired Deletion,  Next: Dired Immed,  Prev: Dired Edit,  Up: Dired
527
528 Deleting Files With Dired
529 -------------------------
530
531    The primary use of Dired is to flag files for deletion and then
532 delete them.
533
534 `d'
535      Flag this file for deletion.
536
537 `u'
538      Remove deletion-flag on this line.
539
540 `<DEL>'
541      Remove deletion-flag on previous line, moving point to that line.
542
543 `x'
544      Delete the files that are flagged for deletion.
545
546 `#'
547      Flag all auto-save files (files whose names start and end with `#')
548      for deletion (*note Auto Save::).
549
550 `~'
551      Flag all backup files (files whose names end with `~') for deletion
552      (*note Backup::).
553
554 `. (Period)'
555      Flag excess numeric backup files for deletion.  The oldest and
556      newest few backup files of any one file are exempt; the middle
557      ones are flagged.
558
559    You can flag a file for deletion by moving to the line describing the
560 file and typing `d' or `C-d'.  The deletion flag is visible as a `D' at
561 the beginning of the line.  Point is moved to the beginning of the next
562 line, so that repeated `d' commands flag successive files.
563
564    The files are flagged for deletion rather than deleted immediately to
565 avoid the danger of deleting a file accidentally.  Until you direct
566 Dired to delete the flagged files, you can remove deletion flags using
567 the commands `u' and <DEL>.  `u' works just like `d', but removes flags
568 rather than making flags.  <DEL> moves upward, removing flags; it is
569 like `u' with numeric argument automatically negated.
570
571    To delete the flagged files, type `x'.  This command first displays a
572 list of all the file names flagged for deletion, and requests
573 confirmation with `yes'.  Once you confirm, all the flagged files are
574 deleted, and their lines are deleted from the text of the Dired buffer.
575 The shortened Dired buffer remains selected.  If you answer `no' or
576 quit with `C-g', you return immediately to Dired, with the deletion
577 flags still present and no files actually deleted.
578
579    The `#', `~', and `.' commands flag many files for deletion, based
580 on their names.  These commands are useful precisely because they do
581 not actually delete any files; you can remove the deletion flags from
582 any flagged files that you really wish to keep.
583
584    `#' flags for deletion all files that appear to have been made by
585 auto-saving (that is, files whose names begin and end with `#').  `~'
586 flags for deletion all files that appear to have been made as backups
587 for files that were edited (that is, files whose names end with `~').
588
589    `.' (Period) flags just some of the backup files for deletion: only
590 numeric backups that are not among the oldest few nor the newest few
591 backups of any one file.  Normally `dired-kept-versions' (not
592 `kept-new-versions'; that applies only when saving) specifies the
593 number of newest versions of each file to keep, and `kept-old-versions'
594 specifies the number of oldest versions to keep.  Period with a
595 positive numeric argument, as in `C-u 3 .', specifies the number of
596 newest versions to keep, overriding `dired-kept-versions'.  A negative
597 numeric argument overrides `kept-old-versions', using minus the value
598 of the argument to specify the number of oldest versions of each file
599 to keep.
600
601 \1f
602 File: xemacs.info,  Node: Dired Immed,  Prev: Dired Deletion,  Up: Dired
603
604 Immediate File Operations in Dired
605 ----------------------------------
606
607    Some file operations in Dired take place immediately when they are
608 requested.
609
610 `C'
611      Copies the file described on the current line.  You must supply a
612      file name to copy to, using the minibuffer.
613
614 `f'
615      Visits the file described on the current line.  It is just like
616      typing `C-x C-f' and supplying that file name.  If the file on
617      this line is a subdirectory, `f' actually causes Dired to be
618      invoked on that subdirectory.  *Note Visiting::.
619
620 `o'
621      Like `f', but uses another window to display the file's buffer.
622      The Dired buffer remains visible in the first window.  This is
623      like using `C-x 4 C-f' to visit the file.  *Note Windows::.
624
625 `R'
626      Renames the file described on the current line.  You must supply a
627      file name to rename to, using the minibuffer.
628
629 `v'
630      Views the file described on this line using `M-x view-file'.
631      Viewing a file is like visiting it, but is slanted toward moving
632      around in the file conveniently and does not allow changing the
633      file.  *Note View File: Misc File Ops.  Viewing a file that is a
634      directory runs Dired on that directory.
635
636 \1f
637 File: xemacs.info,  Node: Misc File Ops,  Prev: Dired,  Up: Files
638
639 Miscellaneous File Operations
640 =============================
641
642    Emacs has commands for performing many other operations on files.
643 All operate on one file; they do not accept wildcard file names.
644
645    You can use the command `M-x add-name-to-file' to add a name to an
646 existing file without removing the old name.  The new name must belong
647 on the file system that the file is on.
648
649    `M-x append-to-file' adds the text of the region to the end of the
650 specified file.
651
652    `M-x copy-file' reads the file OLD and writes a new file named NEW
653 with the same contents.  Confirmation is required if a file named NEW
654 already exists, because copying overwrites the old contents of the file
655 NEW.
656
657    `M-x delete-file' deletes a specified file, like the `rm' command in
658 the shell.  If you are deleting many files in one directory, it may be
659 more convenient to use Dired (*note Dired::).
660
661    `M-x insert-file' inserts a copy of the contents of a specified file
662 into the current buffer at point, leaving point unchanged before the
663 contents and the mark after them.  *Note Mark::.
664
665    `M-x make-symbolic-link' reads two file names OLD and LINKNAME, and
666 then creates a symbolic link named LINKNAME and pointing at OLD.
667 Future attempts to open file LINKNAME will then refer to the file named
668 OLD at the time the opening is done, or will result in an error if the
669 name OLD is not in use at that time.  Confirmation is required if you
670 create the link while LINKNAME is in use.  Note that not all systems
671 support symbolic links.
672
673    `M-x rename-file' reads two file names OLD and NEW using the
674 minibuffer, then renames file OLD as NEW.  If a file named NEW already
675 exists, you must confirm with `yes' or renaming is not done; this is
676 because renaming causes the previous meaning of the name NEW to be
677 lost.  If OLD and NEW are on different file systems, the file OLD is
678 copied and deleted.
679
680    `M-x view-file' allows you to scan or read a file by sequential
681 screenfuls.  It reads a file name argument using the minibuffer.  After
682 reading the file into an Emacs buffer, `view-file' reads and displays
683 one windowful.  You can then type <SPC> to scroll forward one window,
684 or <DEL> to scroll backward.  Various other commands are provided for
685 moving around in the file, but none for changing it; type `C-h' while
686 viewing a file for a list of them.  Most commands are the default Emacs
687 cursor motion commands.  To exit from viewing, type `C-c'.
688
689 \1f
690 File: xemacs.info,  Node: Buffers,  Next: Windows,  Prev: Files,  Up: Top
691
692 Using Multiple Buffers
693 **********************
694
695    Text you are editing in Emacs resides in an object called a
696 "buffer".  Each time you visit a file, Emacs creates a buffer to hold
697 the file's text.  Each time you invoke Dired, Emacs creates a buffer to
698 hold the directory listing.  If you send a message with `C-x m', a
699 buffer named `*mail*' is used to hold the text of the message.  When
700 you ask for a command's documentation, it appears in a buffer called
701 `*Help*'.
702
703    At any time, one and only one buffer is "selected".  It is also
704 called the "current buffer".  Saying a command operates on "the buffer"
705 really means that the command operates on the selected buffer, as most
706 commands do.
707
708    When Emacs creates multiple windows, each window has a chosen buffer
709 which is displayed there, but at any time only one of the windows is
710 selected and its chosen buffer is the selected buffer.  Each window's
711 mode line displays the name of the buffer the window is displaying
712 (*note Windows::).
713
714    Each buffer has a name which can be of any length but is
715 case-sensitive.  You can select a buffer using its name.  Most buffers
716 are created when you visit files; their names are derived from the
717 files' names.  You can also create an empty buffer with any name you
718 want.  A newly started Emacs has a buffer named `*scratch*' which you
719 can use for evaluating Lisp expressions in Emacs.
720
721    Each buffer records what file it is visiting, whether it is
722 modified, and what major mode and minor modes are in effect in it
723 (*note Major Modes::).  Any Emacs variable can be made "local to" a
724 particular buffer, meaning its value in that buffer can be different
725 from the value in other buffers.  *Note Locals::.
726
727 * Menu:
728
729 * Select Buffer::   Creating a new buffer or reselecting an old one.
730 * List Buffers::    Getting a list of buffers that exist.
731 * Misc Buffer::     Renaming; changing read-onliness; copying text.
732 * Kill Buffer::     Killing buffers you no longer need.
733 * Several Buffers:: How to go through the list of all buffers
734                      and operate variously on several of them.
735
736 \1f
737 File: xemacs.info,  Node: Select Buffer,  Next: List Buffers,  Prev: Buffers,  Up: Buffers
738
739 Creating and Selecting Buffers
740 ==============================
741
742 `C-x b BUFFER <RET>'
743      Select or create a buffer named BUFFER (`switch-to-buffer').
744
745 `C-x 4 b BUFFER <RET>'
746      Similar, but select a buffer named BUFFER in another window
747      (`switch-to-buffer-other-window').
748
749 `M-x switch-to-other-buffer N'
750      Switch to the previous buffer.
751
752    To select a buffer named BUFNAME, type `C-x b BUFNAME <RET>'.  This
753 is the command `switch-to-buffer' with argument BUFNAME.  You can use
754 completion on an abbreviation for the buffer name you want (*note
755 Completion::).  An empty argument to `C-x b' specifies the most
756 recently selected buffer that is not displayed in any window.
757
758    Most buffers are created when you visit files, or use Emacs commands
759 that display text.  You can also create a buffer explicitly by typing
760 `C-x b BUFNAME <RET>', which creates a new, empty buffer that is not
761 visiting any file, and selects it for editing.  The new buffer's major
762 mode is determined by the value of `default-major-mode' (*note Major
763 Modes::).  Buffers not visiting files are usually used for making notes
764 to yourself.  If you try to save one, you are asked for the file name
765 to use.
766
767    The function `switch-to-buffer-other-frame' is similar to
768 `switch-to-buffer' except that it creates a new frame in which to
769 display the selected buffer.
770
771    Use `M-x switch-to-other-buffer' to visit the previous buffer. If
772 you supply a positive integer N, the Nth most recent buffer is
773 displayed. If you supply an argument of 0, the current buffer is moved
774 to the bottom of the buffer stack.
775
776    Note that you can also use `C-x C-f' and any other command for
777 visiting a file to switch buffers.  *Note Visiting::.
778
779 \1f
780 File: xemacs.info,  Node: List Buffers,  Next: Misc Buffer,  Prev: Select Buffer,  Up: Buffers
781
782 Listing Existing Buffers
783 ========================
784
785 `C-x C-b'
786      List the existing buffers (`list-buffers').
787
788    To print a list of all existing buffers, type `C-x C-b'.  Each line
789 in the list shows one buffer's name, major mode, and visited file.  A
790 `*' at the beginning of a line indicates the buffer has been
791 "modified".  If several buffers are modified, it may be time to save
792 some with `C-x s' (*note Saving::).  A `%' indicates a read-only
793 buffer.  A `.' marks the selected buffer.  Here is an example of a
794 buffer list:
795
796       MR Buffer         Size  Mode           File
797       -- ------         ----  ----           ----
798      .*  emacs.tex      383402 Texinfo       /u2/emacs/man/emacs.tex
799          *Help*         1287  Fundamental
800          files.el       23076 Emacs-Lisp     /u2/emacs/lisp/files.el
801        % RMAIL          64042 RMAIL          /u/rms/RMAIL
802       *% man            747   Dired          /u2/emacs/man/
803          net.emacs      343885 Fundamental   /u/rms/net.emacs
804          fileio.c       27691 C              /u2/emacs/src/fileio.c
805          NEWS           67340 Text           /u2/emacs/etc/NEWS
806          *scratch*      0     Lisp Interaction
807
808 Note that the buffer `*Help*' was made by a help request; it is not
809 visiting any file.  The buffer `man' was made by Dired on the directory
810 `/u2/emacs/man/'.
811
812    As you move the mouse over the `*Buffer List*' buffer, the lines are
813 highlighted.  This visual cue indicates that clicking the right mouse
814 button (`button3') will pop up a menu of commands on the buffer
815 represented by this line.  This menu duplicates most of those commands
816 which are bound to keys in the `*Buffer List*' buffer.
817
818 \1f
819 File: xemacs.info,  Node: Misc Buffer,  Next: Kill Buffer,  Prev: List Buffers,  Up: Buffers
820
821 Miscellaneous Buffer Operations
822 ===============================
823
824 `C-x C-q'
825      Toggle read-only status of buffer (`toggle-read-only').
826
827 `M-x rename-buffer'
828      Change the name of the current buffer.
829
830 `M-x view-buffer'
831      Scroll through a buffer.
832
833    A buffer can be "read-only", which means that commands to change its
834 text are not allowed.  Normally, read-only buffers are created by
835 subsystems such as Dired and Rmail that have special commands to operate
836 on the text.  Emacs also creates a read-only buffer if you visit a file
837 that is protected.  To make changes in a read-only buffer, use the
838 command `C-x C-q' (`toggle-read-only').  It makes a read-only buffer
839 writable, and makes a writable buffer read-only.  This works by setting
840 the variable `buffer-read-only', which has a local value in each buffer
841 and makes a buffer read-only if its value is non-`nil'.
842
843    `M-x rename-buffer' changes the name of the current buffer,
844 prompting for the new name in the minibuffer.  There is no default.  If
845 you specify a name that is used by a different buffer, an error is
846 signalled and renaming is not done.
847
848    `M-x view-buffer' is similar to `M-x view-file' (*note Misc File
849 Ops::), but it examines an already existing Emacs buffer.  View mode
850 provides convenient commands for scrolling through the buffer but not
851 for changing it.  When you exit View mode, the resulting value of point
852 remains in effect.
853
854    To copy text from one buffer to another, use the commands `M-x
855 append-to-buffer' and `M-x insert-buffer'.  *Note Accumulating Text::.
856
857 \1f
858 File: xemacs.info,  Node: Kill Buffer,  Next: Several Buffers,  Prev: Misc Buffer,  Up: Buffers
859
860 Killing Buffers
861 ===============
862
863    After using Emacs for a while, you may accumulate a large number of
864 buffers and may want to eliminate the ones you no longer need.  There
865 are several commands for doing this.
866
867 `C-x k'
868      Kill a buffer, specified by name (`kill-buffer').
869
870 `M-x kill-some-buffers'
871      Offer to kill each buffer, one by one.
872
873    `C-x k' (`kill-buffer') kills one buffer, whose name you specify in
874 the minibuffer.  If you type just <RET> in the minibuffer, the default,
875 killing the current buffer, is used.  If the current buffer is killed,
876 the buffer that has been selected recently but does not appear in any
877 window now is selected.  If the buffer being killed contains unsaved
878 changes, you are asked to confirm with `yes' before the buffer is
879 killed.
880
881    The command `M-x kill-some-buffers' asks about each buffer, one by
882 one.  An answer of `y' means to kill the buffer.  Killing the current
883 buffer or a buffer containing unsaved changes selects a new buffer or
884 asks for confirmation just like `kill-buffer'.
885
886 \1f
887 File: xemacs.info,  Node: Several Buffers,  Prev: Kill Buffer,  Up: Buffers
888
889 Operating on Several Buffers
890 ============================
891
892    The "buffer-menu" facility is like a "Dired for buffers"; it allows
893 you to request operations on various Emacs buffers by editing a buffer
894 containing a list of them.  You can save buffers, kill them (here
895 called "deleting" them, for consistency with Dired), or display them.
896
897 `M-x buffer-menu'
898      Begin editing a buffer listing all Emacs buffers.
899
900    The command `buffer-menu' writes a list of all Emacs buffers into
901 the buffer `*Buffer List*', and selects that buffer in Buffer Menu
902 mode.  The buffer is read-only.  You can only change it using the
903 special commands described in this section.  Most of the commands are
904 graphic characters.  You can use  Emacs cursor motion commands in the
905 `*Buffer List*' buffer.  If the cursor is on a line describing a
906 buffer, the following  special commands apply to that buffer:
907
908 `d'
909      Request to delete (kill) the buffer, then move down.  A `D' before
910      the buffer name on a line indicates a deletion request.  Requested
911      deletions actually take place when you use the `x' command.
912
913 `k'
914      Synonym for `d'.
915
916 `C-d'
917      Like `d' but move up afterwards instead of down.
918
919 `s'
920      Request to save the buffer.  An `S' before the buffer name on a
921      line indicates the request.  Requested saves actually take place
922      when you use the `x' command.  You can request both saving and
923      deletion for the same buffer.
924
925 `~'
926      Mark buffer "unmodified".  The command `~' does this immediately
927      when typed.
928
929 `x'
930      Perform previously requested deletions and saves.
931
932 `u'
933      Remove any request made for the current line, and move down.
934
935 `<DEL>'
936      Move to previous line and remove any request made for that line.
937
938    All commands that add or remove flags to request later operations
939 also move down a line.  They accept a numeric argument as a repeat
940 count, unless otherwise specified.
941
942    There are also special commands to use the buffer list to select
943 another buffer, and to specify one or more other buffers for display in
944 additional windows.
945
946 `1'
947      Select the buffer in a full-frame window.  This command takes
948      effect immediately.
949
950 `2'
951      Immediately set up two windows, with this buffer in one and the
952      buffer selected before `*Buffer List*' in the other.
953
954 `f'
955      Immediately select the buffer in place of the `*Buffer List*'
956      buffer.
957
958 `o'
959      Immediately select the buffer in another window as if by `C-x 4 b',
960      leaving `*Buffer List*' visible.
961
962 `q'
963      Immediately select this buffer, and display any buffers previously
964      flagged with the `m' command in other windows.  If there are no
965      buffers flagged with `m', this command is equivalent to `1'.
966
967 `m'
968      Flag this buffer to be displayed in another window if the `q'
969      command is used.  The request shows as a `>' at the beginning of
970      the line.  The same buffer may not have both a delete request and a
971      display request.
972
973    Going back between a `buffer-menu' buffer and other Emacs buffers is
974 easy.  You can, for example, switch from the `*Buffer List*' buffer to
975 another Emacs buffer, and edit there.  You can then reselect the
976 `buffer-menu' buffer and perform operations already requested, or you
977 can kill that buffer or pay no further attention to it.   All that
978 `buffer-menu' does directly is create and select a suitable buffer, and
979 turn on Buffer Menu mode.  All the other capabilities of the buffer
980 menu are implemented by special commands provided in Buffer Menu mode.
981
982    The only difference between `buffer-menu' and `list-buffers' is that
983 `buffer-menu' selects the `*Buffer List*' buffer and `list-buffers'
984 does not.  If you run `list-buffers' (that is, type `C-x C-b') and
985 select the buffer list manually, you can use all the commands described
986 here.
987
988 \1f
989 File: xemacs.info,  Node: Windows,  Next: Mule,  Prev: Buffers,  Up: Top
990
991 Multiple Windows
992 ****************
993
994    Emacs can split the frame into two or many windows, which can display
995 parts of different buffers or different parts of one buffer.  If you are
996 running XEmacs under X, that means you can have the X window that
997 contains the Emacs frame have multiple subwindows.
998
999 * Menu:
1000
1001 * Basic Window::     Introduction to Emacs windows.
1002 * Split Window::     New windows are made by splitting existing windows.
1003 * Other Window::     Moving to another window or doing something to it.
1004 * Pop Up Window::    Finding a file or buffer in another window.
1005 * Change Window::    Deleting windows and changing their sizes.
1006
1007 \1f
1008 File: xemacs.info,  Node: Basic Window,  Next: Split Window,  Prev: Windows,  Up: Windows
1009
1010 Concepts of Emacs Windows
1011 =========================
1012
1013    When Emacs displays multiple windows, each window has one Emacs
1014 buffer designated for display.  The same buffer may appear in more than
1015 one window; if it does, any changes in its text are displayed in all
1016 the windows that display it.  Windows showing the same buffer can show
1017 different parts of it, because each window has its own value of point.
1018
1019    At any time, one  window is the "selected window"; the buffer
1020 displayed by that window is the current buffer.  The cursor shows the
1021 location of point in that window.  Each other window has a location of
1022 point as well, but since the terminal has only one cursor, it cannot
1023 show the location of point in the other windows.
1024
1025    Commands to move point affect the value of point for the selected
1026 Emacs window only.  They do not change the value of point in any other
1027 Emacs window, including those showing the same buffer.  The same is
1028 true for commands such as `C-x b' to change the selected buffer in the
1029 selected window; they do not affect other windows at all.  However,
1030 there are other commands such as `C-x 4 b' that select a different
1031 window and switch buffers in it.  Also, all commands that display
1032 information in a window, including (for example) `C-h f'
1033 (`describe-function') and `C-x C-b' (`list-buffers'), work by switching
1034 buffers in a non-selected window without affecting the selected window.
1035
1036    Each window has its own mode line, which displays the buffer name,
1037 modification status, and major and minor modes of the buffer that is
1038 displayed in the window.  *Note Mode Line::, for details on the mode
1039 line.
1040
1041 \1f
1042 File: xemacs.info,  Node: Split Window,  Next: Other Window,  Prev: Basic Window,  Up: Windows
1043
1044 Splitting Windows
1045 =================
1046
1047 `C-x 2'
1048      Split the selected window into two windows, one above the other
1049      (`split-window-vertically').
1050
1051 `C-x 3'
1052      Split the selected window into two windows positioned side by side
1053      (`split-window-horizontally').
1054
1055 `C-x 6'
1056      Save the current window configuration in register REG (a letter).
1057
1058 `C-x 7'
1059      Restore (make current) the window configuration in register REG (a
1060      letter).  Use with a register previously set with `C-x 6'.
1061
1062    The command `C-x 2' (`split-window-vertically') breaks the selected
1063 window into two windows, one above the other.  Both windows start out
1064 displaying the same buffer, with the same value of point.  By default
1065 each of the two windows gets half the height of the window that was
1066 split.  A numeric argument specifies how many lines to give to the top
1067 window.
1068
1069    `C-x 3' (`split-window-horizontally') breaks the selected window
1070 into two side-by-side windows.  A numeric argument specifies how many
1071 columns to give the one on the left.  A line of vertical bars separates
1072 the two windows.  Windows that are not the full width of the frame have
1073 truncated mode lines which do not always appear in inverse video,
1074 because Emacs display routines cannot display a region of inverse video
1075 that is only part of a line on the screen.
1076
1077    When a window is less than the full width, many text lines are too
1078 long to fit.  Continuing all those lines might be confusing.  Set the
1079 variable `truncate-partial-width-windows' to non-`nil' to force
1080 truncation in all windows less than the full width of the frame,
1081 independent of the buffer and its value for `truncate-lines'.  *Note
1082 Continuation Lines::.
1083
1084    Horizontal scrolling is often used in side-by-side windows.  *Note
1085 Display::.
1086
1087    You can resize a window and store that configuration in a register by
1088 supplying a REGISTER argument to `window-configuration-to-register'
1089 (`C-x 6'). To return to the window configuration established with
1090 `window-configuration-to-register', use `jump-to-register' (`C-x j').
1091
1092 \1f
1093 File: xemacs.info,  Node: Other Window,  Next: Pop Up Window,  Prev: Split Window,  Up: Windows
1094
1095 Using Other Windows
1096 ===================
1097
1098 `C-x o'
1099      Select another window (`other-window').  That is the letter `o',
1100      not zero.
1101
1102 `M-C-v'
1103      Scroll the next window (`scroll-other-window').
1104
1105 `M-x compare-windows'
1106      Find the next place where the text in the selected window does not
1107      match the text in the next window.
1108
1109 `M-x other-window-any-frame N'
1110      Select the Nth different window on any frame.
1111
1112    To select a different window, use `C-x o' (`other-window').  That is
1113 an `o', for `other', not a zero.  When there are more than two windows,
1114 the command moves through all the windows in a cyclic order, generally
1115 top to bottom and left to right.  From the rightmost and bottommost
1116 window, it goes back to the one at the upper left corner.  A numeric
1117 argument, N, moves several steps in the cyclic order of windows. A
1118 negative numeric argument moves around the cycle in the opposite order.
1119 If the optional second argument ALL-FRAMES is non-`nil', the function
1120 cycles through all frames.  When the minibuffer is active, the
1121 minibuffer is the last window in the cycle; you can switch from the
1122 minibuffer window to one of the other windows, and later switch back
1123 and finish supplying the minibuffer argument that is requested.  *Note
1124 Minibuffer Edit::.
1125
1126    The command `M-x other-window-any-frame' also selects the window N
1127 steps away in the cyclic order.  However, unlike `other-window', this
1128 command selects a window on the next or previous frame instead of
1129 wrapping around to the top or bottom of the current frame, when there
1130 are no more windows.
1131
1132    The usual scrolling commands (*note Display::) apply to the selected
1133 window only.  `M-C-v' (`scroll-other-window') scrolls the window that
1134 `C-x o' would select.  Like `C-v', it takes positive and negative
1135 arguments.
1136
1137    The command `M-x compare-windows' compares the text in the current
1138 window with the text in the next window.  Comparison starts at point in
1139 each window.  Point moves forward in each window, a character at a time,
1140 until the next set of characters in the two windows are different.
1141 Then the command is finished.
1142
1143    A prefix argument IGNORE-WHITESPACE means ignore changes in
1144 whitespace.  The variable `compare-windows-whitespace' controls how
1145 whitespace is skipped.
1146
1147    If `compare-ignore-case' is non-`nil', changes in case are also
1148 ignored.
1149
1150 \1f
1151 File: xemacs.info,  Node: Pop Up Window,  Next: Change Window,  Prev: Other Window,  Up: Windows
1152
1153 Displaying in Another Window
1154 ============================
1155
1156    `C-x 4' is a prefix key for commands that select another window
1157 (splitting the window if there is only one) and select a buffer in that
1158 window.  Different `C-x 4' commands have different ways of finding the
1159 buffer to select.
1160
1161 `C-x 4 b BUFNAME <RET>'
1162      Select buffer BUFNAME in another window.  This runs
1163      `switch-to-buffer-other-window'.
1164
1165 `C-x 4 f FILENAME <RET>'
1166      Visit file FILENAME and select its buffer in another window.  This
1167      runs `find-file-other-window'.  *Note Visiting::.
1168
1169 `C-x 4 d DIRECTORY <RET>'
1170      Select a Dired buffer for directory DIRECTORY in another window.
1171      This runs `dired-other-window'.  *Note Dired::.
1172
1173 `C-x 4 m'
1174      Start composing a mail message in another window.  This runs
1175      `mail-other-window', and its same-window version is `C-x m' (*note
1176      Sending Mail::).
1177
1178 `C-x 4 .'
1179      Find a tag in the current tag table in another window.  This runs
1180      `find-tag-other-window', the multiple-window variant of `M-.'
1181      (*note Tags::).
1182
1183    If the variable `display-buffer-function' is non-`nil', its value is
1184 the function to call to handle `display-buffer'. It receives two
1185 arguments, the buffer and a flag that if non-`nil' means that the
1186 currently selected window is not acceptable. Commands such as
1187 `switch-to-buffer-other-window' and `find-file-other-window' work using
1188 this function.
1189