1 This is ../info/xemacs.info, produced by makeinfo version 4.0 from
4 INFO-DIR-SECTION XEmacs Editor
6 * XEmacs: (xemacs). XEmacs Editor.
9 This file documents the XEmacs editor.
11 Copyright (C) 1985, 1986, 1988 Richard M. Stallman. Copyright (C)
12 1991, 1992, 1993, 1994 Lucid, Inc. Copyright (C) 1993, 1994 Sun
13 Microsystems, Inc. Copyright (C) 1995 Amdahl Corporation.
15 Permission is granted to make and distribute verbatim copies of this
16 manual provided the copyright notice and this permission notice are
17 preserved on all copies.
19 Permission is granted to copy and distribute modified versions of
20 this manual under the conditions for verbatim copying, provided also
21 that the sections entitled "The GNU Manifesto", "Distribution" and "GNU
22 General Public License" are included exactly as in the original, and
23 provided that the entire resulting derived work is distributed under the
24 terms of a permission notice identical to this one.
26 Permission is granted to copy and distribute translations of this
27 manual into another language, under the above conditions for modified
28 versions, except that the sections entitled "The GNU Manifesto",
29 "Distribution" and "GNU General Public License" may be included in a
30 translation approved by the author instead of in the original English.
33 File: xemacs.info, Node: Variables for Check-in/out, Next: Log Entries, Prev: Editing with VC, Up: Version Control
35 Variables Affecting Check-in and Check-out
36 ------------------------------------------
38 If `vc-suppress-confirm' is non-`nil', then `C-x C-q' and `C-x v i'
39 can save the current buffer without asking, and `C-x v u' also operates
40 without asking for confirmation. (This variable does not affect `C-x v
41 c'; that is so drastic that it should always ask for confirmation.)
43 VC mode does much of its work by running the shell commands for RCS
44 and SCCS. If `vc-command-messages' is non-`nil', VC displays messages
45 to indicate which shell commands it runs, and additional messages when
48 Normally, VC assumes that it can deduce the locked/unlocked state of
49 files by looking at the file permissions of the work file; this is
50 fast. However, if the `RCS' or `SCCS' subdirectory is actually a
51 symbolic link, then VC does not trust the file permissions to reflect
54 You can specify the criterion for whether to trust the file
55 permissions by setting the variable `vc-mistrust-permissions'. Its
56 value may be `t' (always mistrust the file permissions and check the
57 master file), `nil' (always trust the file permissions), or a function
58 of one argument which makes the decision. The argument is the directory
59 name of the `RCS' or `SCCS' subdirectory. A non-`nil' value from the
60 function says to mistrust the file permissions.
62 If you find that the file permissions of work files are changed
63 erroneously, set `vc-mistrust-permissions' to `t'. Then VC always
64 checks the master file to determine the file's status.
66 You can specify additional directories to search for version control
67 programs by setting the variable `vc-path'. These directories are
68 searched before the usual search path. The proper result usually
69 happens automatically.
72 File: xemacs.info, Node: Log Entries, Next: Change Logs and VC, Prev: Variables for Check-in/out, Up: Version Control
77 When you're editing an initial comment or log entry for inclusion in
78 a master file, finish your entry by typing `C-c C-c'.
81 Finish the comment edit normally (`vc-finish-logentry'). This
84 To abort check-in, just don't type `C-c C-c' in that buffer. You
85 can switch buffers and do other editing. As long as you don't try to
86 check in another file, the entry you were editing remains in its
87 buffer, and you can go back to that buffer at any time to complete the
90 If you change several source files for the same reason, it is often
91 convenient to specify the same log entry for many of the files. To do
92 this, use the history of previous log entries. The commands `M-n',
93 `M-p', `M-s' and `M-r' for doing this work just like the minibuffer
94 history commands (except that these versions are used outside the
97 Each time you check in a file, the log entry buffer is put into VC
98 Log mode, which involves running two hooks: `text-mode-hook' and
102 File: xemacs.info, Node: Change Logs and VC, Next: Old Versions, Prev: Log Entries, Up: Version Control
107 If you use RCS for a program and also maintain a change log file for
108 it (*note Change Log::), you can generate change log entries
109 automatically from the version control log entries:
112 Visit the current directory's change log file and create new
113 entries for versions checked in since the most recent entry in the
114 change log file (`vc-update-change-log').
116 This command works with RCS only; it does not work with SCCS.
118 For example, suppose the first line of `ChangeLog' is dated 10 April
119 1992, and that the only check-in since then was by Nathaniel Bowditch
120 to `rcs2log' on 8 May 1992 with log text `Ignore log messages that
121 start with `#'.'. Then `C-x v a' visits `ChangeLog' and inserts text
124 Fri May 8 21:45:00 1992 Nathaniel Bowditch (nat@apn.org)
126 * rcs2log: Ignore log messages that start with `#'.
128 You can then edit the new change log entry further as you wish.
130 Normally, the log entry for file `foo' is displayed as `* foo: TEXT
131 OF LOG ENTRY'. The `:' after `foo' is omitted if the text of the log
132 entry starts with `(FUNCTIONNAME): '. For example, if the log entry
133 for `vc.el' is `(vc-do-command): Check call-process status.', then the
134 text in `ChangeLog' looks like this:
136 Wed May 6 10:53:00 1992 Nathaniel Bowditch (nat@apn.org)
138 * vc.el (vc-do-command): Check call-process status.
140 When `C-x v a' adds several change log entries at once, it groups
141 related log entries together if they all are checked in by the same
142 author at nearly the same time. If the log entries for several such
143 files all have the same text, it coalesces them into a single entry.
144 For example, suppose the most recent checkins have the following log
150 Don't call expand-file-name.
152 Don't call expand-file-name.
154 They appear like this in `ChangeLog':
156 Wed Apr 1 08:57:59 1992 Nathaniel Bowditch (nat@apn.org)
158 * vc.texinfo: Fix expansion typos.
160 * vc.el, vc-hooks.el: Don't call expand-file-name.
162 Normally, `C-x v a' separates log entries by a blank line, but you
163 can mark several related log entries to be clumped together (without an
164 intervening blank line) by starting the text of each related log entry
165 with a label of the form `{CLUMPNAME} '. The label itself is not
166 copied to `ChangeLog'. For example, suppose the log entries are:
169 {expand} Fix expansion typos.
171 {expand} Don't call expand-file-name.
173 {expand} Don't call expand-file-name.
175 Then the text in `ChangeLog' looks like this:
177 Wed Apr 1 08:57:59 1992 Nathaniel Bowditch (nat@apn.org)
179 * vc.texinfo: Fix expansion typos.
180 * vc.el, vc-hooks.el: Don't call expand-file-name.
182 A log entry whose text begins with `#' is not copied to `ChangeLog'.
183 For example, if you merely fix some misspellings in comments, you can
184 log the change with an entry beginning with `#' to avoid putting such
185 trivia into `ChangeLog'.
188 File: xemacs.info, Node: Old Versions, Next: VC Status, Prev: Change Logs and VC, Up: Version Control
190 Examining And Comparing Old Versions
191 ------------------------------------
193 `C-x v ~ VERSION <RET>'
194 Examine version VERSION of the visited file, in a buffer of its
195 own (`vc-version-other-window').
198 Compare the current buffer contents with the latest checked-in
201 `C-u C-x v = FILE <RET> OLDVERS <RET> NEWVERS <RET>'
202 Compare the specified two versions of FILE.
204 You can examine any version of a file by first visiting it, and then
205 using `C-x v ~ VERSION <RET>' (`vc-version-other-window'). This puts
206 the text of version VERSION in a file named `FILENAME.~VERSION~', then
207 visits it in a separate window.
209 To compare two versions of a file, use the command `C-x v ='
212 Plain `C-x v =' compares the current buffer contents (saving them in
213 the file if necessary) with the last checked-in version of the file.
214 With a prefix argument, `C-x v =' reads a file name and two version
215 numbers, then compares those versions of the specified file.
217 If you supply a directory name instead of the name of a work file,
218 this command compares the two specified versions of all registered files
219 in that directory and its subdirectories. You can also specify a
220 snapshot name (*note Snapshots::) instead of one or both version
223 You can specify a checked-in version by its number; you can specify
224 the most recent checked-in version with an empty version number.
226 This command works by running the `vcdiff' utility, getting the
227 options from the variable `diff-switches'. It displays the output in a
228 special buffer in another window. Unlike the `M-x diff' command, `C-x
229 v =' does not try to find the changes in the old and new versions.
230 This is because one or both versions normally do not exist as files.
231 They exist only in the records of the master file. *Note Comparing
232 Files::, for more information about `M-x diff'.
235 File: xemacs.info, Node: VC Status, Next: Renaming and VC, Prev: Old Versions, Up: Version Control
240 To view the detailed version control status and history of a file,
241 type `C-x v l' (`vc-print-log'). It displays the history of changes to
242 the current file, including the text of the log entries. The output
243 appears in a separate window.
245 When you are working on a large program, it's often useful to find
246 all the files that are currently locked, or all the files maintained in
247 version control at all. You can use `C-x v d' (`vc-directory') to show
248 all the locked files in or beneath the current directory. This
249 includes all files that are locked by any user. `C-u C-x v d' lists
250 all files in or beneath the current directory that are maintained with
253 The list of files is displayed as a buffer that uses an augmented
254 Dired mode. The names of the users locking various files are shown (in
255 parentheses) in place of the owner and group. All the normal Dired
256 commands work in this buffer. Most interactive VC commands work also,
257 and apply to the file name on the current line.
259 The `C-x v v' command (`vc-next-action'), when used in the augmented
260 Dired buffer, operates on all the marked files (or the file on the
261 current line). If it operates on more than one file, it handles each
262 file according to its current state; thus, it may check out one file
263 and check in another (because it is already checked out). If it has to
264 check in any files, it reads a single log entry, then uses that text
265 for all the files being checked in. This can be convenient for
266 registering or checking in several files at once, as part of the same
270 File: xemacs.info, Node: Renaming and VC, Next: Snapshots, Prev: VC Status, Up: Version Control
272 Renaming VC Work Files and Master Files
273 ---------------------------------------
275 When you rename a registered file, you must also rename its master
276 file correspondingly to get proper results. Use `vc-rename-file' to
277 rename the source file as you specify, and rename its master file
278 accordingly. It also updates any snapshots (*note Snapshots::) that
279 mention the file, so that they use the new name; despite this, the
280 snapshot thus modified may not completely work (*note Snapshot
283 You cannot use `vc-rename-file' on a file that is locked by someone
287 File: xemacs.info, Node: Snapshots, Next: Version Headers, Prev: Renaming and VC, Up: Version Control
292 A "snapshot" is a named set of file versions (one for each
293 registered file) that you can treat as a unit. One important kind of
294 snapshot is a "release", a (theoretically) stable version of the system
295 that is ready for distribution to users.
299 * Making Snapshots:: The snapshot facilities.
300 * Snapshot Caveats:: Things to be careful of when using snapshots.
303 File: xemacs.info, Node: Making Snapshots, Next: Snapshot Caveats, Prev: Snapshots, Up: Snapshots
305 Making and Using Snapshots
306 ..........................
308 There are two basic commands for snapshots; one makes a snapshot
309 with a given name, the other retrieves a named snapshot.
312 Define the last saved versions of every registered file in or
313 under the current directory as a snapshot named NAME
314 (`vc-create-snapshot').
317 Check out all registered files at or below the current directory
318 level using whatever versions correspond to the snapshot NAME
319 (`vc-retrieve-snapshot').
321 This command reports an error if any files are locked at or below
322 the current directory, without changing anything; this is to avoid
323 overwriting work in progress.
325 A snapshot uses a very small amount of resources--just enough to
326 record the list of file names and which version belongs to the
327 snapshot. Thus, you need not hesitate to create snapshots whenever
330 You can give a snapshot name as an argument to `C-x v =' or `C-x v
331 ~' (*note Old Versions::). Thus, you can use it to compare a snapshot
332 against the current files, or two snapshots against each other, or a
333 snapshot against a named version.
336 File: xemacs.info, Node: Snapshot Caveats, Prev: Making Snapshots, Up: Snapshots
341 VC's snapshot facilities are modeled on RCS's named-configuration
342 support. They use RCS's native facilities for this, so under VC
343 snapshots made using RCS are visible even when you bypass VC.
345 For SCCS, VC implements snapshots itself. The files it uses contain
346 name/file/version-number triples. These snapshots are visible only
349 A snapshot is a set of checked-in versions. So make sure that all
350 the files are checked in and not locked when you make a snapshot.
352 File renaming and deletion can create some difficulties with
353 snapshots. This is not a VC-specific problem, but a general design
354 issue in version control systems that no one has solved very well yet.
356 If you rename a registered file, you need to rename its master along
357 with it (the command `vc-rename-file' does this automatically). If you
358 are using SCCS, you must also update the records of the snapshot, to
359 mention the file by its new name (`vc-rename-file' does this, too). An
360 old snapshot that refers to a master file that no longer exists under
361 the recorded name is invalid; VC can no longer retrieve it. It would
362 be beyond the scope of this manual to explain enough about RCS and SCCS
363 to explain how to update the snapshots by hand.
365 Using `vc-rename-file' makes the snapshot remain valid for
366 retrieval, but it does not solve all problems. For example, some of the
367 files in the program probably refer to others by name. At the very
368 least, the makefile probably mentions the file that you renamed. If you
369 retrieve an old snapshot, the renamed file is retrieved under its new
370 name, which is not the name that the makefile expects. So the program
371 won't really work as retrieved.
374 File: xemacs.info, Node: Version Headers, Prev: Snapshots, Up: Version Control
376 Inserting Version Control Headers
377 ---------------------------------
379 Sometimes it is convenient to put version identification strings
380 directly into working files. Certain special strings called "version
381 headers" are replaced in each successive version by the number of that
384 You can use the `C-x v h' command (`vc-insert-headers') to insert a
385 suitable header string.
388 Insert headers in a file for use with your version-control system.
390 The default header string is `\$Id\$' for RCS and `\%W\%' for SCCS.
391 (The actual strings inserted do not have the backslashes in them. They
392 were placed in the Info source file so that the strings don't get
393 interpreted as version-control headers when the Info source files are
394 maintained under version control.) You can specify other headers to
395 insert by setting the variable `vc-header-alist'. Its value is a list
396 of elements of the form `(PROGRAM . STRING)' where PROGRAM is `RCS' or
397 `SCCS' and STRING is the string to use.
399 Instead of a single string, you can specify a list of strings; then
400 each string in the list is inserted as a separate header on a line of
403 It is often necessary to use "superfluous" backslashes when writing
404 the strings that you put in this variable. This is to prevent the
405 string in the constant from being interpreted as a header itself if the
406 Emacs Lisp file containing it is maintained with version control.
408 Each header is inserted surrounded by tabs, inside comment
409 delimiters, on a new line at the start of the buffer. Normally the
410 ordinary comment start and comment end strings of the current mode are
411 used, but for certain modes, there are special comment delimiters for
412 this purpose; the variable `vc-comment-alist' specifies them. Each
413 element of this list has the form `(MODE STARTER ENDER)'.
415 The variable `vc-static-header-alist' specifies further strings to
416 add based on the name of the buffer. Its value should be a list of
417 elements of the form `(REGEXP . FORMAT)'. Whenever REGEXP matches the
418 buffer name, FORMAT is inserted as part of the header. A header line
419 is inserted for each element that matches the buffer name, and for each
420 string specified by `vc-header-alist'. The header line is made by
421 processing the string from `vc-header-alist' with the format taken from
422 the element. The default value for `vc-static-header-alist' is:
425 "\n#ifndef lint\nstatic char vcid[] = \"\%s\";\n\
426 #endif /* lint */\n"))
428 which specifies insertion of a string of this form:
432 static char vcid[] = "STRING";
436 File: xemacs.info, Node: ListDir, Next: Comparing Files, Prev: Version Control, Up: Files
438 Listing a File Directory
439 ========================
441 Files are organized by Unix into "directories". A "directory
442 listing" is a list of all the files in a directory. Emacs provides
443 directory listings in brief format (file names only) and verbose format
444 (sizes, dates, and authors included).
446 `C-x C-d DIR-OR-PATTERN'
447 Print a brief directory listing (`list-directory').
449 `C-u C-x C-d DIR-OR-PATTERN'
450 Print a verbose directory listing.
452 To print a directory listing, use `C-x C-d' (`list-directory').
453 This command prompts in the minibuffer for a file name which is either
454 a directory to be listed or pattern containing wildcards for the files
455 to be listed. For example,
457 C-x C-d /u2/emacs/etc <RET>
459 lists all the files in directory `/u2/emacs/etc'. An example of
460 specifying a file name pattern is:
462 C-x C-d /u2/emacs/src/*.c <RET>
464 Normally, `C-x C-d' prints a brief directory listing containing just
465 file names. A numeric argument (regardless of value) tells it to print
466 a verbose listing (like `ls -l').
468 Emacs obtains the text of a directory listing by running `ls' in an
469 inferior process. Two Emacs variables control the switches passed to
470 `ls': `list-directory-brief-switches' is a string giving the switches
471 to use in brief listings (`"-CF"' by default).
472 `list-directory-verbose-switches' is a string giving the switches to
473 use in a verbose listing (`"-l"' by default).
475 The variable `directory-abbrev-alist' is an alist of abbreviations
476 for file directories. The list consists of elements of the form `(FROM
477 . TO)', each meaning to replace `FROM' with `TO' when it appears in a
478 directory name. This replacement is done when setting up the default
479 directory of a newly visited file. Every `FROM' string should start
482 Use this feature when you have directories which you normally refer
483 to via absolute symbolic links. Make `TO' the name of the link, and
484 `FROM' the name it is linked to.
487 File: xemacs.info, Node: Comparing Files, Next: Dired, Prev: ListDir, Up: Files
492 The command `M-x diff' compares two files, displaying the
493 differences in an Emacs buffer named `*Diff*'. It works by running the
494 `diff' program, using options taken from the variable `diff-switches',
495 whose value should be a string.
497 The buffer `*Diff*' has Compilation mode as its major mode, so you
498 can use `C-x `' to visit successive changed locations in the two source
499 files. You can also move to a particular hunk of changes and type `C-c
500 C-c' to find the corresponding source location. You can also use the
501 other special commands of Compilation mode: <SPC> and <DEL> for
502 scrolling, and `M-p' and `M-n' for cursor motion. *Note Compilation::.
504 The command `M-x diff-backup' compares a specified file with its most
505 recent backup. If you specify the name of a backup file, `diff-backup'
506 compares it with the source file that it is a backup of.
508 The command `M-x compare-windows' compares the text in the current
509 window with that in the next window. Comparison starts at point in each
510 window. Point moves forward in each window, a character at a time in
511 each window, until the next characters in the two windows are
512 different. Then the command is finished. For more information about
513 windows in Emacs, *Note Windows::.
515 With a numeric argument, `compare-windows' ignores changes in
516 whitespace. If the variable `compare-ignore-case' is non-`nil', it
517 ignores differences in case as well.
520 File: xemacs.info, Node: Dired, Next: Misc File Ops, Prev: Comparing Files, Up: Files
522 Dired, the Directory Editor
523 ===========================
525 Dired makes it easy to delete or visit many of the files in a single
526 directory at once. It creates an Emacs buffer containing a listing of
527 the directory. You can use the normal Emacs commands to move around in
528 this buffer and special Dired commands to operate on the files.
532 * Enter: Dired Enter. How to invoke Dired.
533 * Edit: Dired Edit. Editing the Dired buffer.
534 * Deletion: Dired Deletion. Deleting files with Dired.
535 * Immed: Dired Immed. Other file operations through Dired.
538 File: xemacs.info, Node: Dired Enter, Next: Dired Edit, Prev: Dired, Up: Dired
543 To invoke dired, type `C-x d' or `M-x dired'. The command reads a
544 directory name or wildcard file name pattern as a minibuffer argument
545 just like the `list-directory' command, `C-x C-d'. Where `dired'
546 differs from `list-directory' is in naming the buffer after the
547 directory name or the wildcard pattern used for the listing, and putting
548 the buffer into Dired mode so that the special commands of Dired are
549 available in it. The variable `dired-listing-switches' is a string
550 used as an argument to `ls' in making the directory; this string must
553 To display the Dired buffer in another window rather than in the
554 selected window, use `C-x 4 d' (`dired-other-window)' instead of `C-x
558 File: xemacs.info, Node: Dired Edit, Next: Dired Deletion, Prev: Dired Enter, Up: Dired
563 Once the Dired buffer exists, you can switch freely between it and
564 other Emacs buffers. Whenever the Dired buffer is selected, certain
565 special commands are provided that operate on files that are listed.
566 The Dired buffer is "read-only", and inserting text in it is not
567 useful, so ordinary printing characters such as `d' and `x' are used
568 for Dired commands. Most Dired commands operate on the file described
569 by the line that point is on. Some commands perform operations
570 immediately; others "flag" a file to be operated on later.
572 Most Dired commands that operate on the current line's file also
573 treat a numeric argument as a repeat count, meaning to act on the files
574 of the next few lines. A negative argument means to operate on the
575 files of the preceding lines, and leave point on the first of those
578 All the usual Emacs cursor motion commands are available in Dired
579 buffers. Some special purpose commands are also provided. The keys
580 `C-n' and `C-p' are redefined so that they try to position the cursor
581 at the beginning of the filename on the line, rather than at the
582 beginning of the line.
584 For extra convenience, <SPC> and `n' in Dired are equivalent to
585 `C-n'. `p' is equivalent to `C-p'. Moving by lines is done so often
586 in Dired that it deserves to be easy to type. <DEL> (move up and
587 unflag) is often useful simply for moving up.
589 The `g' command in Dired runs `revert-buffer' to reinitialize the
590 buffer from the actual disk directory and show any changes made in the
591 directory by programs other than Dired. All deletion flags in the Dired
592 buffer are lost when this is done.
595 File: xemacs.info, Node: Dired Deletion, Next: Dired Immed, Prev: Dired Edit, Up: Dired
597 Deleting Files With Dired
598 -------------------------
600 The primary use of Dired is to flag files for deletion and then
604 Flag this file for deletion.
607 Remove deletion-flag on this line.
610 Remove deletion-flag on previous line, moving point to that line.
613 Delete the files that are flagged for deletion.
616 Flag all auto-save files (files whose names start and end with `#')
617 for deletion (*note Auto Save::).
620 Flag all backup files (files whose names end with `~') for deletion
624 Flag excess numeric backup files for deletion. The oldest and
625 newest few backup files of any one file are exempt; the middle
628 You can flag a file for deletion by moving to the line describing the
629 file and typing `d' or `C-d'. The deletion flag is visible as a `D' at
630 the beginning of the line. Point is moved to the beginning of the next
631 line, so that repeated `d' commands flag successive files.
633 The files are flagged for deletion rather than deleted immediately to
634 avoid the danger of deleting a file accidentally. Until you direct
635 Dired to delete the flagged files, you can remove deletion flags using
636 the commands `u' and <DEL>. `u' works just like `d', but removes flags
637 rather than making flags. <DEL> moves upward, removing flags; it is
638 like `u' with numeric argument automatically negated.
640 To delete the flagged files, type `x'. This command first displays a
641 list of all the file names flagged for deletion, and requests
642 confirmation with `yes'. Once you confirm, all the flagged files are
643 deleted, and their lines are deleted from the text of the Dired buffer.
644 The shortened Dired buffer remains selected. If you answer `no' or
645 quit with `C-g', you return immediately to Dired, with the deletion
646 flags still present and no files actually deleted.
648 The `#', `~', and `.' commands flag many files for deletion, based
649 on their names. These commands are useful precisely because they do
650 not actually delete any files; you can remove the deletion flags from
651 any flagged files that you really wish to keep.
653 `#' flags for deletion all files that appear to have been made by
654 auto-saving (that is, files whose names begin and end with `#'). `~'
655 flags for deletion all files that appear to have been made as backups
656 for files that were edited (that is, files whose names end with `~').
658 `.' (Period) flags just some of the backup files for deletion: only
659 numeric backups that are not among the oldest few nor the newest few
660 backups of any one file. Normally `dired-kept-versions' (not
661 `kept-new-versions'; that applies only when saving) specifies the
662 number of newest versions of each file to keep, and `kept-old-versions'
663 specifies the number of oldest versions to keep. Period with a
664 positive numeric argument, as in `C-u 3 .', specifies the number of
665 newest versions to keep, overriding `dired-kept-versions'. A negative
666 numeric argument overrides `kept-old-versions', using minus the value
667 of the argument to specify the number of oldest versions of each file
671 File: xemacs.info, Node: Dired Immed, Prev: Dired Deletion, Up: Dired
673 Immediate File Operations in Dired
674 ----------------------------------
676 Some file operations in Dired take place immediately when they are
680 Copies the file described on the current line. You must supply a
681 file name to copy to, using the minibuffer.
684 Visits the file described on the current line. It is just like
685 typing `C-x C-f' and supplying that file name. If the file on
686 this line is a subdirectory, `f' actually causes Dired to be
687 invoked on that subdirectory. *Note Visiting::.
690 Like `f', but uses another window to display the file's buffer.
691 The Dired buffer remains visible in the first window. This is
692 like using `C-x 4 C-f' to visit the file. *Note Windows::.
695 Renames the file described on the current line. You must supply a
696 file name to rename to, using the minibuffer.
699 Views the file described on this line using `M-x view-file'.
700 Viewing a file is like visiting it, but is slanted toward moving
701 around in the file conveniently and does not allow changing the
702 file. *Note View File: Misc File Ops. Viewing a file that is a
703 directory runs Dired on that directory.
706 File: xemacs.info, Node: Misc File Ops, Prev: Dired, Up: Files
708 Miscellaneous File Operations
709 =============================
711 Emacs has commands for performing many other operations on files.
712 All operate on one file; they do not accept wildcard file names.
714 You can use the command `M-x add-name-to-file' to add a name to an
715 existing file without removing the old name. The new name must belong
716 on the file system that the file is on.
718 `M-x append-to-file' adds the text of the region to the end of the
721 `M-x copy-file' reads the file OLD and writes a new file named NEW
722 with the same contents. Confirmation is required if a file named NEW
723 already exists, because copying overwrites the old contents of the file
726 `M-x delete-file' deletes a specified file, like the `rm' command in
727 the shell. If you are deleting many files in one directory, it may be
728 more convenient to use Dired (*note Dired::).
730 `M-x insert-file' inserts a copy of the contents of a specified file
731 into the current buffer at point, leaving point unchanged before the
732 contents and the mark after them. *Note Mark::.
734 `M-x make-symbolic-link' reads two file names OLD and LINKNAME, and
735 then creates a symbolic link named LINKNAME and pointing at OLD.
736 Future attempts to open file LINKNAME will then refer to the file named
737 OLD at the time the opening is done, or will result in an error if the
738 name OLD is not in use at that time. Confirmation is required if you
739 create the link while LINKNAME is in use. Note that not all systems
740 support symbolic links.
742 `M-x rename-file' reads two file names OLD and NEW using the
743 minibuffer, then renames file OLD as NEW. If a file named NEW already
744 exists, you must confirm with `yes' or renaming is not done; this is
745 because renaming causes the previous meaning of the name NEW to be
746 lost. If OLD and NEW are on different file systems, the file OLD is
749 `M-x view-file' allows you to scan or read a file by sequential
750 screenfuls. It reads a file name argument using the minibuffer. After
751 reading the file into an Emacs buffer, `view-file' reads and displays
752 one windowful. You can then type <SPC> to scroll forward one window,
753 or <DEL> to scroll backward. Various other commands are provided for
754 moving around in the file, but none for changing it; type `C-h' while
755 viewing a file for a list of them. Most commands are the default Emacs
756 cursor motion commands. To exit from viewing, type `C-c'.
759 File: xemacs.info, Node: Buffers, Next: Windows, Prev: Files, Up: Top
761 Using Multiple Buffers
762 **********************
764 Text you are editing in Emacs resides in an object called a
765 "buffer". Each time you visit a file, Emacs creates a buffer to hold
766 the file's text. Each time you invoke Dired, Emacs creates a buffer to
767 hold the directory listing. If you send a message with `C-x m', a
768 buffer named `*mail*' is used to hold the text of the message. When
769 you ask for a command's documentation, it appears in a buffer called
772 At any time, one and only one buffer is "selected". It is also
773 called the "current buffer". Saying a command operates on "the buffer"
774 really means that the command operates on the selected buffer, as most
777 When Emacs creates multiple windows, each window has a chosen buffer
778 which is displayed there, but at any time only one of the windows is
779 selected and its chosen buffer is the selected buffer. Each window's
780 mode line displays the name of the buffer the window is displaying
783 Each buffer has a name which can be of any length but is
784 case-sensitive. You can select a buffer using its name. Most buffers
785 are created when you visit files; their names are derived from the
786 files' names. You can also create an empty buffer with any name you
787 want. A newly started Emacs has a buffer named `*scratch*' which you
788 can use for evaluating Lisp expressions in Emacs.
790 Each buffer records what file it is visiting, whether it is
791 modified, and what major mode and minor modes are in effect in it
792 (*note Major Modes::). Any Emacs variable can be made "local to" a
793 particular buffer, meaning its value in that buffer can be different
794 from the value in other buffers. *Note Locals::.
798 * Select Buffer:: Creating a new buffer or reselecting an old one.
799 * List Buffers:: Getting a list of buffers that exist.
800 * Misc Buffer:: Renaming; changing read-onliness; copying text.
801 * Kill Buffer:: Killing buffers you no longer need.
802 * Several Buffers:: How to go through the list of all buffers
803 and operate variously on several of them.
806 File: xemacs.info, Node: Select Buffer, Next: List Buffers, Prev: Buffers, Up: Buffers
808 Creating and Selecting Buffers
809 ==============================
812 Select or create a buffer named BUFFER (`switch-to-buffer').
814 `C-x 4 b BUFFER <RET>'
815 Similar, but select a buffer named BUFFER in another window
816 (`switch-to-buffer-other-window').
818 `M-x switch-to-other-buffer N'
819 Switch to the previous buffer.
821 To select a buffer named BUFNAME, type `C-x b BUFNAME <RET>'. This
822 is the command `switch-to-buffer' with argument BUFNAME. You can use
823 completion on an abbreviation for the buffer name you want (*note
824 Completion::). An empty argument to `C-x b' specifies the most
825 recently selected buffer that is not displayed in any window.
827 Most buffers are created when you visit files, or use Emacs commands
828 that display text. You can also create a buffer explicitly by typing
829 `C-x b BUFNAME <RET>', which creates a new, empty buffer that is not
830 visiting any file, and selects it for editing. The new buffer's major
831 mode is determined by the value of `default-major-mode' (*note Major
832 Modes::). Buffers not visiting files are usually used for making notes
833 to yourself. If you try to save one, you are asked for the file name
836 The function `switch-to-buffer-other-frame' is similar to
837 `switch-to-buffer' except that it creates a new frame in which to
838 display the selected buffer.
840 Use `M-x switch-to-other-buffer' to visit the previous buffer. If
841 you supply a positive integer N, the Nth most recent buffer is
842 displayed. If you supply an argument of 0, the current buffer is moved
843 to the bottom of the buffer stack.
845 Note that you can also use `C-x C-f' and any other command for
846 visiting a file to switch buffers. *Note Visiting::.
849 File: xemacs.info, Node: List Buffers, Next: Misc Buffer, Prev: Select Buffer, Up: Buffers
851 Listing Existing Buffers
852 ========================
855 List the existing buffers (`list-buffers').
857 To print a list of all existing buffers, type `C-x C-b'. Each line
858 in the list shows one buffer's name, major mode, and visited file. A
859 `*' at the beginning of a line indicates the buffer has been
860 "modified". If several buffers are modified, it may be time to save
861 some with `C-x s' (*note Saving::). A `%' indicates a read-only
862 buffer. A `.' marks the selected buffer. Here is an example of a
865 MR Buffer Size Mode File
866 -- ------ ---- ---- ----
867 .* emacs.tex 383402 Texinfo /u2/emacs/man/emacs.tex
868 *Help* 1287 Fundamental
869 files.el 23076 Emacs-Lisp /u2/emacs/lisp/files.el
870 % RMAIL 64042 RMAIL /u/rms/RMAIL
871 *% man 747 Dired /u2/emacs/man/
872 net.emacs 343885 Fundamental /u/rms/net.emacs
873 fileio.c 27691 C /u2/emacs/src/fileio.c
874 NEWS 67340 Text /u2/emacs/etc/NEWS
875 *scratch* 0 Lisp Interaction
877 Note that the buffer `*Help*' was made by a help request; it is not
878 visiting any file. The buffer `man' was made by Dired on the directory
881 As you move the mouse over the `*Buffer List*' buffer, the lines are
882 highlighted. This visual cue indicates that clicking the right mouse
883 button (`button3') will pop up a menu of commands on the buffer
884 represented by this line. This menu duplicates most of those commands
885 which are bound to keys in the `*Buffer List*' buffer.
888 File: xemacs.info, Node: Misc Buffer, Next: Kill Buffer, Prev: List Buffers, Up: Buffers
890 Miscellaneous Buffer Operations
891 ===============================
894 Toggle read-only status of buffer (`toggle-read-only').
897 Change the name of the current buffer.
900 Scroll through a buffer.
902 A buffer can be "read-only", which means that commands to change its
903 text are not allowed. Normally, read-only buffers are created by
904 subsystems such as Dired and Rmail that have special commands to operate
905 on the text. Emacs also creates a read-only buffer if you visit a file
906 that is protected. To make changes in a read-only buffer, use the
907 command `C-x C-q' (`toggle-read-only'). It makes a read-only buffer
908 writable, and makes a writable buffer read-only. This works by setting
909 the variable `buffer-read-only', which has a local value in each buffer
910 and makes a buffer read-only if its value is non-`nil'.
912 `M-x rename-buffer' changes the name of the current buffer,
913 prompting for the new name in the minibuffer. There is no default. If
914 you specify a name that is used by a different buffer, an error is
915 signalled and renaming is not done.
917 `M-x view-buffer' is similar to `M-x view-file' (*note Misc File
918 Ops::), but it examines an already existing Emacs buffer. View mode
919 provides convenient commands for scrolling through the buffer but not
920 for changing it. When you exit View mode, the resulting value of point
923 To copy text from one buffer to another, use the commands `M-x
924 append-to-buffer' and `M-x insert-buffer'. *Note Accumulating Text::.
927 File: xemacs.info, Node: Kill Buffer, Next: Several Buffers, Prev: Misc Buffer, Up: Buffers
932 After using Emacs for a while, you may accumulate a large number of
933 buffers and may want to eliminate the ones you no longer need. There
934 are several commands for doing this.
937 Kill a buffer, specified by name (`kill-buffer').
939 `M-x kill-some-buffers'
940 Offer to kill each buffer, one by one.
942 `C-x k' (`kill-buffer') kills one buffer, whose name you specify in
943 the minibuffer. If you type just <RET> in the minibuffer, the default,
944 killing the current buffer, is used. If the current buffer is killed,
945 the buffer that has been selected recently but does not appear in any
946 window now is selected. If the buffer being killed contains unsaved
947 changes, you are asked to confirm with `yes' before the buffer is
950 The command `M-x kill-some-buffers' asks about each buffer, one by
951 one. An answer of `y' means to kill the buffer. Killing the current
952 buffer or a buffer containing unsaved changes selects a new buffer or
953 asks for confirmation just like `kill-buffer'.
956 File: xemacs.info, Node: Several Buffers, Prev: Kill Buffer, Up: Buffers
958 Operating on Several Buffers
959 ============================
961 The "buffer-menu" facility is like a "Dired for buffers"; it allows
962 you to request operations on various Emacs buffers by editing a buffer
963 containing a list of them. You can save buffers, kill them (here
964 called "deleting" them, for consistency with Dired), or display them.
967 Begin editing a buffer listing all Emacs buffers.
969 The command `buffer-menu' writes a list of all Emacs buffers into
970 the buffer `*Buffer List*', and selects that buffer in Buffer Menu
971 mode. The buffer is read-only. You can only change it using the
972 special commands described in this section. Most of the commands are
973 graphic characters. You can use Emacs cursor motion commands in the
974 `*Buffer List*' buffer. If the cursor is on a line describing a
975 buffer, the following special commands apply to that buffer:
978 Request to delete (kill) the buffer, then move down. A `D' before
979 the buffer name on a line indicates a deletion request. Requested
980 deletions actually take place when you use the `x' command.
986 Like `d' but move up afterwards instead of down.
989 Request to save the buffer. An `S' before the buffer name on a
990 line indicates the request. Requested saves actually take place
991 when you use the `x' command. You can request both saving and
992 deletion for the same buffer.
995 Mark buffer "unmodified". The command `~' does this immediately
999 Perform previously requested deletions and saves.
1002 Remove any request made for the current line, and move down.
1005 Move to previous line and remove any request made for that line.
1007 All commands that add or remove flags to request later operations
1008 also move down a line. They accept a numeric argument as a repeat
1009 count, unless otherwise specified.
1011 There are also special commands to use the buffer list to select
1012 another buffer, and to specify one or more other buffers for display in
1016 Select the buffer in a full-frame window. This command takes
1020 Immediately set up two windows, with this buffer in one and the
1021 buffer selected before `*Buffer List*' in the other.
1024 Immediately select the buffer in place of the `*Buffer List*'
1028 Immediately select the buffer in another window as if by `C-x 4 b',
1029 leaving `*Buffer List*' visible.
1032 Immediately select this buffer, and display any buffers previously
1033 flagged with the `m' command in other windows. If there are no
1034 buffers flagged with `m', this command is equivalent to `1'.
1037 Flag this buffer to be displayed in another window if the `q'
1038 command is used. The request shows as a `>' at the beginning of
1039 the line. The same buffer may not have both a delete request and a
1042 Going back between a `buffer-menu' buffer and other Emacs buffers is
1043 easy. You can, for example, switch from the `*Buffer List*' buffer to
1044 another Emacs buffer, and edit there. You can then reselect the
1045 `buffer-menu' buffer and perform operations already requested, or you
1046 can kill that buffer or pay no further attention to it. All that
1047 `buffer-menu' does directly is create and select a suitable buffer, and
1048 turn on Buffer Menu mode. All the other capabilities of the buffer
1049 menu are implemented by special commands provided in Buffer Menu mode.
1051 The only difference between `buffer-menu' and `list-buffers' is that
1052 `buffer-menu' selects the `*Buffer List*' buffer and `list-buffers'
1053 does not. If you run `list-buffers' (that is, type `C-x C-b') and
1054 select the buffer list manually, you can use all the commands described
1058 File: xemacs.info, Node: Windows, Next: Mule, Prev: Buffers, Up: Top
1063 Emacs can split the frame into two or many windows, which can display
1064 parts of different buffers or different parts of one buffer. If you are
1065 running XEmacs under X, that means you can have the X window that
1066 contains the Emacs frame have multiple subwindows.
1070 * Basic Window:: Introduction to Emacs windows.
1071 * Split Window:: New windows are made by splitting existing windows.
1072 * Other Window:: Moving to another window or doing something to it.
1073 * Pop Up Window:: Finding a file or buffer in another window.
1074 * Change Window:: Deleting windows and changing their sizes.
1077 File: xemacs.info, Node: Basic Window, Next: Split Window, Prev: Windows, Up: Windows
1079 Concepts of Emacs Windows
1080 =========================
1082 When Emacs displays multiple windows, each window has one Emacs
1083 buffer designated for display. The same buffer may appear in more than
1084 one window; if it does, any changes in its text are displayed in all
1085 the windows that display it. Windows showing the same buffer can show
1086 different parts of it, because each window has its own value of point.
1088 At any time, one window is the "selected window"; the buffer
1089 displayed by that window is the current buffer. The cursor shows the
1090 location of point in that window. Each other window has a location of
1091 point as well, but since the terminal has only one cursor, it cannot
1092 show the location of point in the other windows.
1094 Commands to move point affect the value of point for the selected
1095 Emacs window only. They do not change the value of point in any other
1096 Emacs window, including those showing the same buffer. The same is
1097 true for commands such as `C-x b' to change the selected buffer in the
1098 selected window; they do not affect other windows at all. However,
1099 there are other commands such as `C-x 4 b' that select a different
1100 window and switch buffers in it. Also, all commands that display
1101 information in a window, including (for example) `C-h f'
1102 (`describe-function') and `C-x C-b' (`list-buffers'), work by switching
1103 buffers in a non-selected window without affecting the selected window.
1105 Each window has its own mode line, which displays the buffer name,
1106 modification status, and major and minor modes of the buffer that is
1107 displayed in the window. *Note Mode Line::, for details on the mode
1111 File: xemacs.info, Node: Split Window, Next: Other Window, Prev: Basic Window, Up: Windows
1117 Split the selected window into two windows, one above the other
1118 (`split-window-vertically').
1121 Split the selected window into two windows positioned side by side
1122 (`split-window-horizontally').
1125 Save the current window configuration in register REG (a letter).
1128 Restore (make current) the window configuration in register REG (a
1129 letter). Use with a register previously set with `C-x 6'.
1131 The command `C-x 2' (`split-window-vertically') breaks the selected
1132 window into two windows, one above the other. Both windows start out
1133 displaying the same buffer, with the same value of point. By default
1134 each of the two windows gets half the height of the window that was
1135 split. A numeric argument specifies how many lines to give to the top
1138 `C-x 3' (`split-window-horizontally') breaks the selected window
1139 into two side-by-side windows. A numeric argument specifies how many
1140 columns to give the one on the left. A line of vertical bars separates
1141 the two windows. Windows that are not the full width of the frame have
1142 truncated mode lines which do not always appear in inverse video,
1143 because Emacs display routines cannot display a region of inverse video
1144 that is only part of a line on the screen.
1146 When a window is less than the full width, many text lines are too
1147 long to fit. Continuing all those lines might be confusing. Set the
1148 variable `truncate-partial-width-windows' to non-`nil' to force
1149 truncation in all windows less than the full width of the frame,
1150 independent of the buffer and its value for `truncate-lines'. *Note
1151 Continuation Lines::.
1153 Horizontal scrolling is often used in side-by-side windows. *Note
1156 You can resize a window and store that configuration in a register by
1157 supplying a REGISTER argument to `window-configuration-to-register'
1158 (`C-x 6'). To return to the window configuration established with
1159 `window-configuration-to-register', use `jump-to-register' (`C-x j').