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: Making Snapshots, Next: Snapshot Caveats, Prev: Snapshots, Up: Snapshots
35 Making and Using Snapshots
36 ..........................
38 There are two basic commands for snapshots; one makes a snapshot
39 with a given name, the other retrieves a named snapshot.
42 Define the last saved versions of every registered file in or
43 under the current directory as a snapshot named NAME
44 (`vc-create-snapshot').
47 Check out all registered files at or below the current directory
48 level using whatever versions correspond to the snapshot NAME
49 (`vc-retrieve-snapshot').
51 This command reports an error if any files are locked at or below
52 the current directory, without changing anything; this is to avoid
53 overwriting work in progress.
55 A snapshot uses a very small amount of resources--just enough to
56 record the list of file names and which version belongs to the
57 snapshot. Thus, you need not hesitate to create snapshots whenever
60 You can give a snapshot name as an argument to `C-x v =' or `C-x v
61 ~' (*note Old Versions::). Thus, you can use it to compare a snapshot
62 against the current files, or two snapshots against each other, or a
63 snapshot against a named version.
66 File: xemacs.info, Node: Snapshot Caveats, Prev: Making Snapshots, Up: Snapshots
71 VC's snapshot facilities are modeled on RCS's named-configuration
72 support. They use RCS's native facilities for this, so under VC
73 snapshots made using RCS are visible even when you bypass VC.
75 For SCCS, VC implements snapshots itself. The files it uses contain
76 name/file/version-number triples. These snapshots are visible only
79 A snapshot is a set of checked-in versions. So make sure that all
80 the files are checked in and not locked when you make a snapshot.
82 File renaming and deletion can create some difficulties with
83 snapshots. This is not a VC-specific problem, but a general design
84 issue in version control systems that no one has solved very well yet.
86 If you rename a registered file, you need to rename its master along
87 with it (the command `vc-rename-file' does this automatically). If you
88 are using SCCS, you must also update the records of the snapshot, to
89 mention the file by its new name (`vc-rename-file' does this, too). An
90 old snapshot that refers to a master file that no longer exists under
91 the recorded name is invalid; VC can no longer retrieve it. It would
92 be beyond the scope of this manual to explain enough about RCS and SCCS
93 to explain how to update the snapshots by hand.
95 Using `vc-rename-file' makes the snapshot remain valid for
96 retrieval, but it does not solve all problems. For example, some of the
97 files in the program probably refer to others by name. At the very
98 least, the makefile probably mentions the file that you renamed. If you
99 retrieve an old snapshot, the renamed file is retrieved under its new
100 name, which is not the name that the makefile expects. So the program
101 won't really work as retrieved.
104 File: xemacs.info, Node: Version Headers, Prev: Snapshots, Up: Version Control
106 Inserting Version Control Headers
107 ---------------------------------
109 Sometimes it is convenient to put version identification strings
110 directly into working files. Certain special strings called "version
111 headers" are replaced in each successive version by the number of that
114 You can use the `C-x v h' command (`vc-insert-headers') to insert a
115 suitable header string.
118 Insert headers in a file for use with your version-control system.
120 The default header string is `\$Id\$' for RCS and `\%W\%' for SCCS.
121 (The actual strings inserted do not have the backslashes in them. They
122 were placed in the Info source file so that the strings don't get
123 interpreted as version-control headers when the Info source files are
124 maintained under version control.) You can specify other headers to
125 insert by setting the variable `vc-header-alist'. Its value is a list
126 of elements of the form `(PROGRAM . STRING)' where PROGRAM is `RCS' or
127 `SCCS' and STRING is the string to use.
129 Instead of a single string, you can specify a list of strings; then
130 each string in the list is inserted as a separate header on a line of
133 It is often necessary to use "superfluous" backslashes when writing
134 the strings that you put in this variable. This is to prevent the
135 string in the constant from being interpreted as a header itself if the
136 Emacs Lisp file containing it is maintained with version control.
138 Each header is inserted surrounded by tabs, inside comment
139 delimiters, on a new line at the start of the buffer. Normally the
140 ordinary comment start and comment end strings of the current mode are
141 used, but for certain modes, there are special comment delimiters for
142 this purpose; the variable `vc-comment-alist' specifies them. Each
143 element of this list has the form `(MODE STARTER ENDER)'.
145 The variable `vc-static-header-alist' specifies further strings to
146 add based on the name of the buffer. Its value should be a list of
147 elements of the form `(REGEXP . FORMAT)'. Whenever REGEXP matches the
148 buffer name, FORMAT is inserted as part of the header. A header line
149 is inserted for each element that matches the buffer name, and for each
150 string specified by `vc-header-alist'. The header line is made by
151 processing the string from `vc-header-alist' with the format taken from
152 the element. The default value for `vc-static-header-alist' is:
155 "\n#ifndef lint\nstatic char vcid[] = \"\%s\";\n\
156 #endif /* lint */\n"))
158 which specifies insertion of a string of this form:
162 static char vcid[] = "STRING";
166 File: xemacs.info, Node: ListDir, Next: Comparing Files, Prev: Version Control, Up: Files
168 Listing a File Directory
169 ========================
171 Files are organized by Unix into "directories". A "directory
172 listing" is a list of all the files in a directory. Emacs provides
173 directory listings in brief format (file names only) and verbose format
174 (sizes, dates, and authors included).
176 `C-x C-d DIR-OR-PATTERN'
177 Print a brief directory listing (`list-directory').
179 `C-u C-x C-d DIR-OR-PATTERN'
180 Print a verbose directory listing.
182 To print a directory listing, use `C-x C-d' (`list-directory').
183 This command prompts in the minibuffer for a file name which is either
184 a directory to be listed or pattern containing wildcards for the files
185 to be listed. For example,
187 C-x C-d /u2/emacs/etc <RET>
189 lists all the files in directory `/u2/emacs/etc'. An example of
190 specifying a file name pattern is:
192 C-x C-d /u2/emacs/src/*.c <RET>
194 Normally, `C-x C-d' prints a brief directory listing containing just
195 file names. A numeric argument (regardless of value) tells it to print
196 a verbose listing (like `ls -l').
198 Emacs obtains the text of a directory listing by running `ls' in an
199 inferior process. Two Emacs variables control the switches passed to
200 `ls': `list-directory-brief-switches' is a string giving the switches
201 to use in brief listings (`"-CF"' by default).
202 `list-directory-verbose-switches' is a string giving the switches to
203 use in a verbose listing (`"-l"' by default).
205 The variable `directory-abbrev-alist' is an alist of abbreviations
206 for file directories. The list consists of elements of the form `(FROM
207 . TO)', each meaning to replace `FROM' with `TO' when it appears in a
208 directory name. This replacement is done when setting up the default
209 directory of a newly visited file. Every `FROM' string should start
212 Use this feature when you have directories which you normally refer
213 to via absolute symbolic links. Make `TO' the name of the link, and
214 `FROM' the name it is linked to.
217 File: xemacs.info, Node: Comparing Files, Next: Dired, Prev: ListDir, Up: Files
222 The command `M-x diff' compares two files, displaying the
223 differences in an Emacs buffer named `*Diff*'. It works by running the
224 `diff' program, using options taken from the variable `diff-switches',
225 whose value should be a string.
227 The buffer `*Diff*' has Compilation mode as its major mode, so you
228 can use `C-x `' to visit successive changed locations in the two source
229 files. You can also move to a particular hunk of changes and type `C-c
230 C-c' to find the corresponding source location. You can also use the
231 other special commands of Compilation mode: <SPC> and <DEL> for
232 scrolling, and `M-p' and `M-n' for cursor motion. *Note Compilation::.
234 The command `M-x diff-backup' compares a specified file with its most
235 recent backup. If you specify the name of a backup file, `diff-backup'
236 compares it with the source file that it is a backup of.
238 The command `M-x compare-windows' compares the text in the current
239 window with that in the next window. Comparison starts at point in each
240 window. Point moves forward in each window, a character at a time in
241 each window, until the next characters in the two windows are
242 different. Then the command is finished. For more information about
243 windows in Emacs, *Note Windows::.
245 With a numeric argument, `compare-windows' ignores changes in
246 whitespace. If the variable `compare-ignore-case' is non-`nil', it
247 ignores differences in case as well.
250 File: xemacs.info, Node: Dired, Next: Misc File Ops, Prev: Comparing Files, Up: Files
252 Dired, the Directory Editor
253 ===========================
255 Dired makes it easy to delete or visit many of the files in a single
256 directory at once. It creates an Emacs buffer containing a listing of
257 the directory. You can use the normal Emacs commands to move around in
258 this buffer and special Dired commands to operate on the files.
262 * Enter: Dired Enter. How to invoke Dired.
263 * Edit: Dired Edit. Editing the Dired buffer.
264 * Deletion: Dired Deletion. Deleting files with Dired.
265 * Immed: Dired Immed. Other file operations through Dired.
268 File: xemacs.info, Node: Dired Enter, Next: Dired Edit, Prev: Dired, Up: Dired
273 To invoke dired, type `C-x d' or `M-x dired'. The command reads a
274 directory name or wildcard file name pattern as a minibuffer argument
275 just like the `list-directory' command, `C-x C-d'. Where `dired'
276 differs from `list-directory' is in naming the buffer after the
277 directory name or the wildcard pattern used for the listing, and putting
278 the buffer into Dired mode so that the special commands of Dired are
279 available in it. The variable `dired-listing-switches' is a string
280 used as an argument to `ls' in making the directory; this string must
283 To display the Dired buffer in another window rather than in the
284 selected window, use `C-x 4 d' (`dired-other-window)' instead of `C-x
288 File: xemacs.info, Node: Dired Edit, Next: Dired Deletion, Prev: Dired Enter, Up: Dired
293 Once the Dired buffer exists, you can switch freely between it and
294 other Emacs buffers. Whenever the Dired buffer is selected, certain
295 special commands are provided that operate on files that are listed.
296 The Dired buffer is "read-only", and inserting text in it is not
297 useful, so ordinary printing characters such as `d' and `x' are used
298 for Dired commands. Most Dired commands operate on the file described
299 by the line that point is on. Some commands perform operations
300 immediately; others "flag" a file to be operated on later.
302 Most Dired commands that operate on the current line's file also
303 treat a numeric argument as a repeat count, meaning to act on the files
304 of the next few lines. A negative argument means to operate on the
305 files of the preceding lines, and leave point on the first of those
308 All the usual Emacs cursor motion commands are available in Dired
309 buffers. Some special purpose commands are also provided. The keys
310 `C-n' and `C-p' are redefined so that they try to position the cursor
311 at the beginning of the filename on the line, rather than at the
312 beginning of the line.
314 For extra convenience, <SPC> and `n' in Dired are equivalent to
315 `C-n'. `p' is equivalent to `C-p'. Moving by lines is done so often
316 in Dired that it deserves to be easy to type. <DEL> (move up and
317 unflag) is often useful simply for moving up.
319 The `g' command in Dired runs `revert-buffer' to reinitialize the
320 buffer from the actual disk directory and show any changes made in the
321 directory by programs other than Dired. All deletion flags in the Dired
322 buffer are lost when this is done.
325 File: xemacs.info, Node: Dired Deletion, Next: Dired Immed, Prev: Dired Edit, Up: Dired
327 Deleting Files With Dired
328 -------------------------
330 The primary use of Dired is to flag files for deletion and then
334 Flag this file for deletion.
337 Remove deletion-flag on this line.
340 Remove deletion-flag on previous line, moving point to that line.
343 Delete the files that are flagged for deletion.
346 Flag all auto-save files (files whose names start and end with `#')
347 for deletion (*note Auto Save::).
350 Flag all backup files (files whose names end with `~') for deletion
354 Flag excess numeric backup files for deletion. The oldest and
355 newest few backup files of any one file are exempt; the middle
358 You can flag a file for deletion by moving to the line describing the
359 file and typing `d' or `C-d'. The deletion flag is visible as a `D' at
360 the beginning of the line. Point is moved to the beginning of the next
361 line, so that repeated `d' commands flag successive files.
363 The files are flagged for deletion rather than deleted immediately to
364 avoid the danger of deleting a file accidentally. Until you direct
365 Dired to delete the flagged files, you can remove deletion flags using
366 the commands `u' and <DEL>. `u' works just like `d', but removes flags
367 rather than making flags. <DEL> moves upward, removing flags; it is
368 like `u' with numeric argument automatically negated.
370 To delete the flagged files, type `x'. This command first displays a
371 list of all the file names flagged for deletion, and requests
372 confirmation with `yes'. Once you confirm, all the flagged files are
373 deleted, and their lines are deleted from the text of the Dired buffer.
374 The shortened Dired buffer remains selected. If you answer `no' or
375 quit with `C-g', you return immediately to Dired, with the deletion
376 flags still present and no files actually deleted.
378 The `#', `~', and `.' commands flag many files for deletion, based
379 on their names. These commands are useful precisely because they do
380 not actually delete any files; you can remove the deletion flags from
381 any flagged files that you really wish to keep.
383 `#' flags for deletion all files that appear to have been made by
384 auto-saving (that is, files whose names begin and end with `#'). `~'
385 flags for deletion all files that appear to have been made as backups
386 for files that were edited (that is, files whose names end with `~').
388 `.' (Period) flags just some of the backup files for deletion: only
389 numeric backups that are not among the oldest few nor the newest few
390 backups of any one file. Normally `dired-kept-versions' (not
391 `kept-new-versions'; that applies only when saving) specifies the
392 number of newest versions of each file to keep, and `kept-old-versions'
393 specifies the number of oldest versions to keep. Period with a
394 positive numeric argument, as in `C-u 3 .', specifies the number of
395 newest versions to keep, overriding `dired-kept-versions'. A negative
396 numeric argument overrides `kept-old-versions', using minus the value
397 of the argument to specify the number of oldest versions of each file
401 File: xemacs.info, Node: Dired Immed, Prev: Dired Deletion, Up: Dired
403 Immediate File Operations in Dired
404 ----------------------------------
406 Some file operations in Dired take place immediately when they are
410 Copies the file described on the current line. You must supply a
411 file name to copy to, using the minibuffer.
414 Visits the file described on the current line. It is just like
415 typing `C-x C-f' and supplying that file name. If the file on
416 this line is a subdirectory, `f' actually causes Dired to be
417 invoked on that subdirectory. *Note Visiting::.
420 Like `f', but uses another window to display the file's buffer.
421 The Dired buffer remains visible in the first window. This is
422 like using `C-x 4 C-f' to visit the file. *Note Windows::.
425 Renames the file described on the current line. You must supply a
426 file name to rename to, using the minibuffer.
429 Views the file described on this line using `M-x view-file'.
430 Viewing a file is like visiting it, but is slanted toward moving
431 around in the file conveniently and does not allow changing the
432 file. *Note View File: Misc File Ops. Viewing a file that is a
433 directory runs Dired on that directory.
436 File: xemacs.info, Node: Misc File Ops, Prev: Dired, Up: Files
438 Miscellaneous File Operations
439 =============================
441 Emacs has commands for performing many other operations on files.
442 All operate on one file; they do not accept wildcard file names.
444 You can use the command `M-x add-name-to-file' to add a name to an
445 existing file without removing the old name. The new name must belong
446 on the file system that the file is on.
448 `M-x append-to-file' adds the text of the region to the end of the
451 `M-x copy-file' reads the file OLD and writes a new file named NEW
452 with the same contents. Confirmation is required if a file named NEW
453 already exists, because copying overwrites the old contents of the file
456 `M-x delete-file' deletes a specified file, like the `rm' command in
457 the shell. If you are deleting many files in one directory, it may be
458 more convenient to use Dired (*note Dired::).
460 `M-x insert-file' inserts a copy of the contents of a specified file
461 into the current buffer at point, leaving point unchanged before the
462 contents and the mark after them. *Note Mark::.
464 `M-x make-symbolic-link' reads two file names OLD and LINKNAME, and
465 then creates a symbolic link named LINKNAME and pointing at OLD.
466 Future attempts to open file LINKNAME will then refer to the file named
467 OLD at the time the opening is done, or will result in an error if the
468 name OLD is not in use at that time. Confirmation is required if you
469 create the link while LINKNAME is in use. Note that not all systems
470 support symbolic links.
472 `M-x rename-file' reads two file names OLD and NEW using the
473 minibuffer, then renames file OLD as NEW. If a file named NEW already
474 exists, you must confirm with `yes' or renaming is not done; this is
475 because renaming causes the previous meaning of the name NEW to be
476 lost. If OLD and NEW are on different file systems, the file OLD is
479 `M-x view-file' allows you to scan or read a file by sequential
480 screenfuls. It reads a file name argument using the minibuffer. After
481 reading the file into an Emacs buffer, `view-file' reads and displays
482 one windowful. You can then type <SPC> to scroll forward one window,
483 or <DEL> to scroll backward. Various other commands are provided for
484 moving around in the file, but none for changing it; type `C-h' while
485 viewing a file for a list of them. Most commands are the default Emacs
486 cursor motion commands. To exit from viewing, type `C-c'.
489 File: xemacs.info, Node: Buffers, Next: Windows, Prev: Files, Up: Top
491 Using Multiple Buffers
492 **********************
494 Text you are editing in Emacs resides in an object called a
495 "buffer". Each time you visit a file, Emacs creates a buffer to hold
496 the file's text. Each time you invoke Dired, Emacs creates a buffer to
497 hold the directory listing. If you send a message with `C-x m', a
498 buffer named `*mail*' is used to hold the text of the message. When
499 you ask for a command's documentation, it appears in a buffer called
502 At any time, one and only one buffer is "selected". It is also
503 called the "current buffer". Saying a command operates on "the buffer"
504 really means that the command operates on the selected buffer, as most
507 When Emacs creates multiple windows, each window has a chosen buffer
508 which is displayed there, but at any time only one of the windows is
509 selected and its chosen buffer is the selected buffer. Each window's
510 mode line displays the name of the buffer the window is displaying
513 Each buffer has a name which can be of any length but is
514 case-sensitive. You can select a buffer using its name. Most buffers
515 are created when you visit files; their names are derived from the
516 files' names. You can also create an empty buffer with any name you
517 want. A newly started Emacs has a buffer named `*scratch*' which you
518 can use for evaluating Lisp expressions in Emacs.
520 Each buffer records what file it is visiting, whether it is
521 modified, and what major mode and minor modes are in effect in it
522 (*note Major Modes::). Any Emacs variable can be made "local to" a
523 particular buffer, meaning its value in that buffer can be different
524 from the value in other buffers. *Note Locals::.
528 * Select Buffer:: Creating a new buffer or reselecting an old one.
529 * List Buffers:: Getting a list of buffers that exist.
530 * Misc Buffer:: Renaming; changing read-onliness; copying text.
531 * Kill Buffer:: Killing buffers you no longer need.
532 * Several Buffers:: How to go through the list of all buffers
533 and operate variously on several of them.
536 File: xemacs.info, Node: Select Buffer, Next: List Buffers, Prev: Buffers, Up: Buffers
538 Creating and Selecting Buffers
539 ==============================
542 Select or create a buffer named BUFFER (`switch-to-buffer').
544 `C-x 4 b BUFFER <RET>'
545 Similar, but select a buffer named BUFFER in another window
546 (`switch-to-buffer-other-window').
548 `M-x switch-to-other-buffer N'
549 Switch to the previous buffer.
551 To select a buffer named BUFNAME, type `C-x b BUFNAME <RET>'. This
552 is the command `switch-to-buffer' with argument BUFNAME. You can use
553 completion on an abbreviation for the buffer name you want (*note
554 Completion::). An empty argument to `C-x b' specifies the most
555 recently selected buffer that is not displayed in any window.
557 Most buffers are created when you visit files, or use Emacs commands
558 that display text. You can also create a buffer explicitly by typing
559 `C-x b BUFNAME <RET>', which creates a new, empty buffer that is not
560 visiting any file, and selects it for editing. The new buffer's major
561 mode is determined by the value of `default-major-mode' (*note Major
562 Modes::). Buffers not visiting files are usually used for making notes
563 to yourself. If you try to save one, you are asked for the file name
566 The function `switch-to-buffer-other-frame' is similar to
567 `switch-to-buffer' except that it creates a new frame in which to
568 display the selected buffer.
570 Use `M-x switch-to-other-buffer' to visit the previous buffer. If
571 you supply a positive integer N, the Nth most recent buffer is
572 displayed. If you supply an argument of 0, the current buffer is moved
573 to the bottom of the buffer stack.
575 Note that you can also use `C-x C-f' and any other command for
576 visiting a file to switch buffers. *Note Visiting::.
579 File: xemacs.info, Node: List Buffers, Next: Misc Buffer, Prev: Select Buffer, Up: Buffers
581 Listing Existing Buffers
582 ========================
585 List the existing buffers (`list-buffers').
587 To print a list of all existing buffers, type `C-x C-b'. Each line
588 in the list shows one buffer's name, major mode, and visited file. A
589 `*' at the beginning of a line indicates the buffer has been
590 "modified". If several buffers are modified, it may be time to save
591 some with `C-x s' (*note Saving::). A `%' indicates a read-only
592 buffer. A `.' marks the selected buffer. Here is an example of a
595 MR Buffer Size Mode File
596 -- ------ ---- ---- ----
597 .* emacs.tex 383402 Texinfo /u2/emacs/man/emacs.tex
598 *Help* 1287 Fundamental
599 files.el 23076 Emacs-Lisp /u2/emacs/lisp/files.el
600 % RMAIL 64042 RMAIL /u/rms/RMAIL
601 *% man 747 Dired /u2/emacs/man/
602 net.emacs 343885 Fundamental /u/rms/net.emacs
603 fileio.c 27691 C /u2/emacs/src/fileio.c
604 NEWS 67340 Text /u2/emacs/etc/NEWS
605 *scratch* 0 Lisp Interaction
607 Note that the buffer `*Help*' was made by a help request; it is not
608 visiting any file. The buffer `man' was made by Dired on the directory
611 As you move the mouse over the `*Buffer List*' buffer, the lines are
612 highlighted. This visual cue indicates that clicking the right mouse
613 button (`button3') will pop up a menu of commands on the buffer
614 represented by this line. This menu duplicates most of those commands
615 which are bound to keys in the `*Buffer List*' buffer.
618 File: xemacs.info, Node: Misc Buffer, Next: Kill Buffer, Prev: List Buffers, Up: Buffers
620 Miscellaneous Buffer Operations
621 ===============================
624 Toggle read-only status of buffer (`toggle-read-only').
627 Change the name of the current buffer.
630 Scroll through a buffer.
632 A buffer can be "read-only", which means that commands to change its
633 text are not allowed. Normally, read-only buffers are created by
634 subsystems such as Dired and Rmail that have special commands to operate
635 on the text. Emacs also creates a read-only buffer if you visit a file
636 that is protected. To make changes in a read-only buffer, use the
637 command `C-x C-q' (`toggle-read-only'). It makes a read-only buffer
638 writable, and makes a writable buffer read-only. This works by setting
639 the variable `buffer-read-only', which has a local value in each buffer
640 and makes a buffer read-only if its value is non-`nil'.
642 `M-x rename-buffer' changes the name of the current buffer,
643 prompting for the new name in the minibuffer. There is no default. If
644 you specify a name that is used by a different buffer, an error is
645 signalled and renaming is not done.
647 `M-x view-buffer' is similar to `M-x view-file' (*note Misc File
648 Ops::), but it examines an already existing Emacs buffer. View mode
649 provides convenient commands for scrolling through the buffer but not
650 for changing it. When you exit View mode, the resulting value of point
653 To copy text from one buffer to another, use the commands `M-x
654 append-to-buffer' and `M-x insert-buffer'. *Note Accumulating Text::.
657 File: xemacs.info, Node: Kill Buffer, Next: Several Buffers, Prev: Misc Buffer, Up: Buffers
662 After using Emacs for a while, you may accumulate a large number of
663 buffers and may want to eliminate the ones you no longer need. There
664 are several commands for doing this.
667 Kill a buffer, specified by name (`kill-buffer').
669 `M-x kill-some-buffers'
670 Offer to kill each buffer, one by one.
672 `C-x k' (`kill-buffer') kills one buffer, whose name you specify in
673 the minibuffer. If you type just <RET> in the minibuffer, the default,
674 killing the current buffer, is used. If the current buffer is killed,
675 the buffer that has been selected recently but does not appear in any
676 window now is selected. If the buffer being killed contains unsaved
677 changes, you are asked to confirm with `yes' before the buffer is
680 The command `M-x kill-some-buffers' asks about each buffer, one by
681 one. An answer of `y' means to kill the buffer. Killing the current
682 buffer or a buffer containing unsaved changes selects a new buffer or
683 asks for confirmation just like `kill-buffer'.
686 File: xemacs.info, Node: Several Buffers, Prev: Kill Buffer, Up: Buffers
688 Operating on Several Buffers
689 ============================
691 The "buffer-menu" facility is like a "Dired for buffers"; it allows
692 you to request operations on various Emacs buffers by editing a buffer
693 containing a list of them. You can save buffers, kill them (here
694 called "deleting" them, for consistency with Dired), or display them.
697 Begin editing a buffer listing all Emacs buffers.
699 The command `buffer-menu' writes a list of all Emacs buffers into
700 the buffer `*Buffer List*', and selects that buffer in Buffer Menu
701 mode. The buffer is read-only. You can only change it using the
702 special commands described in this section. Most of the commands are
703 graphic characters. You can use Emacs cursor motion commands in the
704 `*Buffer List*' buffer. If the cursor is on a line describing a
705 buffer, the following special commands apply to that buffer:
708 Request to delete (kill) the buffer, then move down. A `D' before
709 the buffer name on a line indicates a deletion request. Requested
710 deletions actually take place when you use the `x' command.
716 Like `d' but move up afterwards instead of down.
719 Request to save the buffer. An `S' befor the buffer name on a line
720 indicates the request. Requested saves actually take place when
721 you use the `x' command. You can request both saving and deletion
725 Mark buffer "unmodified". The command `~' does this immediately
729 Perform previously requested deletions and saves.
732 Remove any request made for the current line, and move down.
735 Move to previous line and remove any request made for that line.
737 All commands that add or remove flags to request later operations
738 also move down a line. They accept a numeric argument as a repeat
739 count, unless otherwise specified.
741 There are also special commands to use the buffer list to select
742 another buffer, and to specify one or more other buffers for display in
746 Select the buffer in a full-frame window. This command takes
750 Immediately set up two windows, with this buffer in one and the
751 buffer selected before `*Buffer List*' in the other.
754 Immediately select the buffer in place of the `*Buffer List*'
758 Immediately select the buffer in another window as if by `C-x 4 b',
759 leaving `*Buffer List*' visible.
762 Immediately select this buffer, and display any buffers previously
763 flagged with the `m' command in other windows. If there are no
764 buffers flagged with `m', this command is equivalent to `1'.
767 Flag this buffer to be displayed in another window if the `q'
768 command is used. The request shows as a `>' at the beginning of
769 the line. The same buffer may not have both a delete request and a
772 Going back between a `buffer-menu' buffer and other Emacs buffers is
773 easy. You can, for example, switch from the `*Buffer List*' buffer to
774 another Emacs buffer, and edit there. You can then reselect the
775 `buffer-menu' buffer and perform operations already requested, or you
776 can kill that buffer or pay no further attention to it. All that
777 `buffer-menu' does directly is create and select a suitable buffer, and
778 turn on Buffer Menu mode. All the other capabilities of the buffer
779 menu are implemented by special commands provided in Buffer Menu mode.
781 The only difference between `buffer-menu' and `list-buffers' is that
782 `buffer-menu' selects the `*Buffer List*' buffer and `list-buffers'
783 does not. If you run `list-buffers' (that is, type `C-x C-b') and
784 select the buffer list manually, you can use all the commands described
788 File: xemacs.info, Node: Windows, Next: Mule, Prev: Buffers, Up: Top
793 Emacs can split the frame into two or many windows, which can display
794 parts of different buffers or different parts of one buffer. If you are
795 running XEmacs under X, that means you can have the X window that
796 contains the Emacs frame have multiple subwindows.
800 * Basic Window:: Introduction to Emacs windows.
801 * Split Window:: New windows are made by splitting existing windows.
802 * Other Window:: Moving to another window or doing something to it.
803 * Pop Up Window:: Finding a file or buffer in another window.
804 * Change Window:: Deleting windows and changing their sizes.
807 File: xemacs.info, Node: Basic Window, Next: Split Window, Prev: Windows, Up: Windows
809 Concepts of Emacs Windows
810 =========================
812 When Emacs displays multiple windows, each window has one Emacs
813 buffer designated for display. The same buffer may appear in more than
814 one window; if it does, any changes in its text are displayed in all
815 the windows that display it. Windows showing the same buffer can show
816 different parts of it, because each window has its own value of point.
818 At any time, one window is the "selected window"; the buffer
819 displayed by that window is the current buffer. The cursor shows the
820 location of point in that window. Each other window has a location of
821 point as well, but since the terminal has only one cursor, it cannot
822 show the location of point in the other windows.
824 Commands to move point affect the value of point for the selected
825 Emacs window only. They do not change the value of point in any other
826 Emacs window, including those showing the same buffer. The same is
827 true for commands such as `C-x b' to change the selected buffer in the
828 selected window; they do not affect other windows at all. However,
829 there are other commands such as `C-x 4 b' that select a different
830 window and switch buffers in it. Also, all commands that display
831 information in a window, including (for example) `C-h f'
832 (`describe-function') and `C-x C-b' (`list-buffers'), work by switching
833 buffers in a non-selected window without affecting the selected window.
835 Each window has its own mode line, which displays the buffer name,
836 modification status, and major and minor modes of the buffer that is
837 displayed in the window. *Note Mode Line::, for details on the mode
841 File: xemacs.info, Node: Split Window, Next: Other Window, Prev: Basic Window, Up: Windows
847 Split the selected window into two windows, one above the other
848 (`split-window-vertically').
851 Split the selected window into two windows positioned side by side
852 (`split-window-horizontally').
855 Save the current window configuration in register REG (a letter).
858 Restore (make current) the window configuration in register REG (a
859 letter). Use with a register previously set with `C-x 6'.
861 The command `C-x 2' (`split-window-vertically') breaks the selected
862 window into two windows, one above the other. Both windows start out
863 displaying the same buffer, with the same value of point. By default
864 each of the two windows gets half the height of the window that was
865 split. A numeric argument specifies how many lines to give to the top
868 `C-x 3' (`split-window-horizontally') breaks the selected window
869 into two side-by-side windows. A numeric argument specifies how many
870 columns to give the one on the left. A line of vertical bars separates
871 the two windows. Windows that are not the full width of the frame have
872 truncated mode lines which do not always appear in inverse video,
873 because Emacs display routines cannot display a region of inverse video
874 that is only part of a line on the screen.
876 When a window is less than the full width, many text lines are too
877 long to fit. Continuing all those lines might be confusing. Set the
878 variable `truncate-partial-width-windows' to non-`nil' to force
879 truncation in all windows less than the full width of the frame,
880 independent of the buffer and its value for `truncate-lines'. *Note
881 Continuation Lines::.
883 Horizontal scrolling is often used in side-by-side windows. *Note
886 You can resize a window and store that configuration in a register by
887 supplying a REGISTER argument to `window-configuration-to-register'
888 (`C-x 6'). To return to the window configuration established with
889 `window-configuration-to-register', use `jump-to-register' (`C-x j').
892 File: xemacs.info, Node: Other Window, Next: Pop Up Window, Prev: Split Window, Up: Windows
898 Select another window (`other-window'). That is the letter `o',
902 Scroll the next window (`scroll-other-window').
904 `M-x compare-windows'
905 Find the next place where the text in the selected window does not
906 match the text in the next window.
908 `M-x other-window-any-frame N'
909 Select the Nth different window on any frame.
911 To select a different window, use `C-x o' (`other-window'). That is
912 an `o', for `other', not a zero. When there are more than two windows,
913 the command moves through all the windows in a cyclic order, generally
914 top to bottom and left to right. From the rightmost and bottommost
915 window, it goes back to the one at the upper left corner. A numeric
916 argument, N, moves several steps in the cyclic order of windows. A
917 negative numeric argument moves around the cycle in the opposite order.
918 If the optional second argument ALL-FRAMES is non-`nil', the function
919 cycles through all frames. When the minibuffer is active, the
920 minibuffer is the last window in the cycle; you can switch from the
921 minibuffer window to one of the other windows, and later switch back
922 and finish supplying the minibuffer argument that is requested. *Note
925 The command `M-x other-window-any-frame' also selects the window N
926 steps away in the cyclic order. However, unlike `other-window', this
927 command selects a window on the next or previous frame instead of
928 wrapping around to the top or bottom of the current frame, when there
931 The usual scrolling commands (*note Display::) apply to the selected
932 window only. `M-C-v' (`scroll-other-window') scrolls the window that
933 `C-x o' would select. Like `C-v', it takes positive and negative
936 The command `M-x compare-windows' compares the text in the current
937 window with the text in the next window. Comparison starts at point in
938 each window. Point moves forward in each window, a character at a time,
939 until the next set of characters in the two windows are different.
940 Then the command is finished.
942 A prefix argument IGNORE-WHITESPACE means ignore changes in
943 whitespace. The variable `compare-windows-whitespace' controls how
944 whitespace is skipped.
946 If `compare-ignore-case' is non-`nil', changes in case are also
950 File: xemacs.info, Node: Pop Up Window, Next: Change Window, Prev: Other Window, Up: Windows
952 Displaying in Another Window
953 ============================
955 `C-x 4' is a prefix key for commands that select another window
956 (splitting the window if there is only one) and select a buffer in that
957 window. Different `C-x 4' commands have different ways of finding the
960 `C-x 4 b BUFNAME <RET>'
961 Select buffer BUFNAME in another window. This runs
962 `switch-to-buffer-other-window'.
964 `C-x 4 f FILENAME <RET>'
965 Visit file FILENAME and select its buffer in another window. This
966 runs `find-file-other-window'. *Note Visiting::.
968 `C-x 4 d DIRECTORY <RET>'
969 Select a Dired buffer for directory DIRECTORY in another window.
970 This runs `dired-other-window'. *Note Dired::.
973 Start composing a mail message in another window. This runs
974 `mail-other-window', and its same-window version is `C-x m' (*note
978 Find a tag in the current tag table in another window. This runs
979 `find-tag-other-window', the multiple-window variant of `M-.'
982 If the variable `display-buffer-function' is non-`nil', its value is
983 the function to call to handle `display-buffer'. It receives two
984 arguments, the buffer and a flag that if non-`nil' means that the
985 currently selected window is not acceptable. Commands such as
986 `switch-to-buffer-other-window' and `find-file-other-window' work using
990 File: xemacs.info, Node: Change Window, Prev: Pop Up Window, Up: Windows
992 Deleting and Rearranging Windows
993 ================================
996 Get rid of the selected window (`delete-window'). That is a zero.
997 If there is more than one Emacs frame, deleting the sole remaining
998 window on that frame deletes the frame as well. If the current
999 frame is the only frame, it is not deleted.
1002 Get rid of all windows except the selected one
1003 (`delete-other-windows').
1006 Make the selected window taller, at the expense of the other(s)
1010 Make the selected window wider (`enlarge-window-horizontally').
1012 To delete a window, type `C-x 0' (`delete-window'). (That is a
1013 zero.) The space occupied by the deleted window is distributed among
1014 the other active windows (but not the minibuffer window, even if that
1015 is active at the time). Once a window is deleted, its attributes are
1016 forgotten; there is no automatic way to make another window of the same
1017 shape or showing the same buffer. The buffer continues to exist, and
1018 you can select it in any window with `C-x b'.
1020 `C-x 1' (`delete-other-windows') is more powerful than `C-x 0'; it
1021 deletes all the windows except the selected one (and the minibuffer).
1022 The selected window expands to use the whole frame except for the echo
1025 To readjust the division of space among existing windows, use `C-x
1026 ^' (`enlarge-window'). It makes the currently selected window longer
1027 by one line or as many lines as a numeric argument specifies. With a
1028 negative argument, it makes the selected window smaller. `C-x }'
1029 (`enlarge-window-horizontally') makes the selected window wider by the
1030 specified number of columns. The extra screen space given to a window
1031 comes from one of its neighbors, if that is possible; otherwise, all
1032 the competing windows are shrunk in the same proportion. If this makes
1033 some windows too small, those windows are deleted and their space is
1034 divided up. Minimum window size is specified by the variables
1035 `window-min-height' and `window-min-width'.
1037 You can also resize windows within a frame by clicking the left mouse
1038 button on a modeline, and dragging.
1040 Clicking the right button on a mode line pops up a menu of common
1041 window manager operations. This menu contains the following options:
1044 Remove the window above this modeline from the frame.
1046 Delete Other Windows
1047 Delete all windows on the frame except for the one above this
1051 Split the window above the mode line in half, creating another
1054 Split Window Horizontally
1055 Split the window above the mode line in half horizontally, so that
1056 there will be two windows side-by-side.
1059 Readjust the sizes of all windows on the frame until all windows
1060 have roughly the same number of lines.
1063 File: xemacs.info, Node: Mule, Next: Major Modes, Prev: Windows, Up: Top
1065 World Scripts Support
1066 *********************
1068 If you compile XEmacs with mule option, it supports a wide variety of
1069 world scripts, including Latin script, as well as Arabic script,
1070 Simplified Chinese script (for mainland of China), Traditional Chinese
1071 script (for Taiwan and Hong-Kong), Greek script, Hebrew script, IPA
1072 symbols, Japanese scripts (Hiragana, Katakana and Kanji), Korean scripts
1073 (Hangul and Hanja) and Cyrillic script (for Beylorussian, Bulgarian,
1074 Russian, Serbian and Ukrainian). These features have been merged from
1075 the modified version of Emacs known as MULE (for "MULti-lingual
1076 Enhancement to GNU Emacs").
1080 * Mule Intro:: Basic concepts of Mule.
1081 * Language Environments:: Setting things up for the language you use.
1082 * Input Methods:: Entering text characters not on your keyboard.
1083 * Select Input Method:: Specifying your choice of input methods.
1084 * Coding Systems:: Character set conversion when you read and
1085 write files, and so on.
1086 * Recognize Coding:: How XEmacs figures out which conversion to use.
1087 * Specify Coding:: Various ways to choose which conversion to use.
1090 File: xemacs.info, Node: Mule Intro, Next: Language Environments, Prev: Mule, Up: Mule
1092 Introduction to world scripts
1093 =============================
1095 The users of these scripts have established many more-or-less
1096 standard coding systems for storing files. XEmacs translates between
1097 the internal character encoding and various other coding systems when
1098 reading and writing files, when exchanging data with subprocesses, and
1099 (in some cases) in the `C-q' command (see below).
1101 The command `C-h h' (`view-hello-file') displays the file
1102 `etc/HELLO', which shows how to say "hello" in many languages. This
1103 illustrates various scripts.
1105 Keyboards, even in the countries where these character sets are used,
1106 generally don't have keys for all the characters in them. So XEmacs
1107 supports various "input methods", typically one for each script or
1108 language, to make it convenient to type them.
1110 The prefix key `C-x <RET>' is used for commands that pertain to
1111 world scripts, coding systems, and input methods.
1114 File: xemacs.info, Node: Language Environments, Next: Input Methods, Prev: Mule Intro, Up: Mule
1116 Language Environments
1117 =====================
1119 All supported character sets are supported in XEmacs buffers if it is
1120 compile with mule; there is no need to select a particular language in
1121 order to display its characters in an XEmacs buffer. However, it is
1122 important to select a "language environment" in order to set various
1123 defaults. The language environment really represents a choice of
1124 preferred script (more or less) rather that a choice of language.
1126 The language environment controls which coding systems to recognize
1127 when reading text (*note Recognize Coding::). This applies to files,
1128 incoming mail, netnews, and any other text you read into XEmacs. It may
1129 also specify the default coding system to use when you create a file.
1130 Each language environment also specifies a default input method.
1132 The command to select a language environment is `M-x
1133 set-language-environment'. It makes no difference which buffer is
1134 current when you use this command, because the effects apply globally to
1135 the XEmacs session. The supported language environments include:
1137 Chinese-BIG5, Chinese-CNS, Chinese-GB, Cyrillic-ISO, English,
1138 Ethiopic, Greek, Japanese, Korean, Latin-1, Latin-2, Latin-3,
1141 Some operating systems let you specify the language you are using by
1142 setting locale environment variables. XEmacs handles one common special
1143 case of this: if your locale name for character types contains the
1144 string `8859-N', XEmacs automatically selects the corresponding
1145 language environment.
1147 To display information about the effects of a certain language
1148 environment LANG-ENV, use the command `C-h L LANG-ENV <RET>'
1149 (`describe-language-environment'). This tells you which languages this
1150 language environment is useful for, and lists the character sets,
1151 coding systems, and input methods that go with it. It also shows some
1152 sample text to illustrate scripts used in this language environment.
1153 By default, this command describes the chosen language environment.