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