1 This is Info file ../info/xemacs.info, produced by Makeinfo version
2 1.68 from the input file xemacs/xemacs.texi.
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: Dired Immed, Prev: Dired Deletion, Up: Dired
35 Immediate File Operations in Dired
36 ----------------------------------
38 Some file operations in Dired take place immediately when they are
42 Copies the file described on the current line. You must supply a
43 file name to copy to, using the minibuffer.
46 Visits the file described on the current line. It is just like
47 typing `C-x C-f' and supplying that file name. If the file on
48 this line is a subdirectory, `f' actually causes Dired to be
49 invoked on that subdirectory. *Note Visiting::.
52 Like `f', but uses another window to display the file's buffer.
53 The Dired buffer remains visible in the first window. This is
54 like using `C-x 4 C-f' to visit the file. *Note Windows::.
57 Renames the file described on the current line. You must supply a
58 file name to rename to, using the minibuffer.
61 Views the file described on this line using `M-x view-file'.
62 Viewing a file is like visiting it, but is slanted toward moving
63 around in the file conveniently and does not allow changing the
64 file. *Note View File: Misc File Ops. Viewing a file that is a
65 directory runs Dired on that directory.
68 File: xemacs.info, Node: Misc File Ops, Prev: Dired, Up: Files
70 Miscellaneous File Operations
71 =============================
73 Emacs has commands for performing many other operations on files.
74 All operate on one file; they do not accept wildcard file names.
76 You can use the command `M-x add-name-to-file' to add a name to an
77 existing file without removing the old name. The new name must belong
78 on the file system that the file is on.
80 `M-x append-to-file' adds the text of the region to the end of the
83 `M-x copy-file' reads the file OLD and writes a new file named NEW
84 with the same contents. Confirmation is required if a file named NEW
85 already exists, because copying overwrites the old contents of the file
88 `M-x delete-file' deletes a specified file, like the `rm' command in
89 the shell. If you are deleting many files in one directory, it may be
90 more convenient to use Dired (*note Dired::.).
92 `M-x insert-file' inserts a copy of the contents of a specified file
93 into the current buffer at point, leaving point unchanged before the
94 contents and the mark after them. *Note Mark::.
96 `M-x make-symbolic-link' reads two file names OLD and LINKNAME, and
97 then creates a symbolic link named LINKNAME and pointing at OLD.
98 Future attempts to open file LINKNAME will then refer to the file named
99 OLD at the time the opening is done, or will result in an error if the
100 name OLD is not in use at that time. Confirmation is required if you
101 create the link while LINKNAME is in use. Note that not all systems
102 support symbolic links.
104 `M-x rename-file' reads two file names OLD and NEW using the
105 minibuffer, then renames file OLD as NEW. If a file named NEW already
106 exists, you must confirm with `yes' or renaming is not done; this is
107 because renaming causes the previous meaning of the name NEW to be
108 lost. If OLD and NEW are on different file systems, the file OLD is
111 `M-x view-file' allows you to scan or read a file by sequential
112 screenfuls. It reads a file name argument using the minibuffer. After
113 reading the file into an Emacs buffer, `view-file' reads and displays
114 one windowful. You can then type <SPC> to scroll forward one window,
115 or <DEL> to scroll backward. Various other commands are provided for
116 moving around in the file, but none for changing it; type `C-h' while
117 viewing a file for a list of them. Most commands are the default Emacs
118 cursor motion commands. To exit from viewing, type `C-c'.
121 File: xemacs.info, Node: Buffers, Next: Windows, Prev: Files, Up: Top
123 Using Multiple Buffers
124 **********************
126 Text you are editing in Emacs resides in an object called a
127 "buffer". Each time you visit a file, Emacs creates a buffer to hold
128 the file's text. Each time you invoke Dired, Emacs creates a buffer to
129 hold the directory listing. If you send a message with `C-x m', a
130 buffer named `*mail*' is used to hold the text of the message. When
131 you ask for a command's documentation, it appears in a buffer called
134 At any time, one and only one buffer is "selected". It is also
135 called the "current buffer". Saying a command operates on "the buffer"
136 really means that the command operates on the selected buffer, as most
139 When Emacs creates multiple windows, each window has a chosen buffer
140 which is displayed there, but at any time only one of the windows is
141 selected and its chosen buffer is the selected buffer. Each window's
142 mode line displays the name of the buffer the window is displaying
145 Each buffer has a name which can be of any length but is
146 case-sensitive. You can select a buffer using its name. Most buffers
147 are created when you visit files; their names are derived from the
148 files' names. You can also create an empty buffer with any name you
149 want. A newly started Emacs has a buffer named `*scratch*' which you
150 can use for evaluating Lisp expressions in Emacs.
152 Each buffer records what file it is visiting, whether it is
153 modified, and what major mode and minor modes are in effect in it
154 (*note Major Modes::.). Any Emacs variable can be made "local to" a
155 particular buffer, meaning its value in that buffer can be different
156 from the value in other buffers. *Note Locals::.
160 * Select Buffer:: Creating a new buffer or reselecting an old one.
161 * List Buffers:: Getting a list of buffers that exist.
162 * Misc Buffer:: Renaming; changing read-onliness; copying text.
163 * Kill Buffer:: Killing buffers you no longer need.
164 * Several Buffers:: How to go through the list of all buffers
165 and operate variously on several of them.
168 File: xemacs.info, Node: Select Buffer, Next: List Buffers, Prev: Buffers, Up: Buffers
170 Creating and Selecting Buffers
171 ==============================
174 Select or create a buffer named BUFFER (`switch-to-buffer').
176 `C-x 4 b BUFFER <RET>'
177 Similar, but select a buffer named BUFFER in another window
178 (`switch-to-buffer-other-window').
180 `M-x switch-to-other-buffer N'
181 Switch to the previous buffer.
183 To select a buffer named BUFNAME, type `C-x b BUFNAME <RET>'. This
184 is the command `switch-to-buffer' with argument BUFNAME. You can use
185 completion on an abbreviation for the buffer name you want (*note
186 Completion::.). An empty argument to `C-x b' specifies the most
187 recently selected buffer that is not displayed in any window.
189 Most buffers are created when you visit files, or use Emacs commands
190 that display text. You can also create a buffer explicitly by typing
191 `C-x b BUFNAME <RET>', which creates a new, empty buffer that is not
192 visiting any file, and selects it for editing. The new buffer's major
193 mode is determined by the value of `default-major-mode' (*note Major
194 Modes::.). Buffers not visiting files are usually used for making
195 notes to yourself. If you try to save one, you are asked for the file
198 The function `switch-to-buffer-other-frame' is similar to
199 `switch-to-buffer' except that it creates a new frame in which to
200 display the selected buffer.
202 Use `M-x switch-to-other-buffer' to visit the previous buffer. If
203 you supply a positive integer N, the Nth most recent buffer is
204 displayed. If you supply an argument of 0, the current buffer is moved
205 to the bottom of the buffer stack.
207 Note that you can also use `C-x C-f' and any other command for
208 visiting a file to switch buffers. *Note Visiting::.
211 File: xemacs.info, Node: List Buffers, Next: Misc Buffer, Prev: Select Buffer, Up: Buffers
213 Listing Existing Buffers
214 ========================
217 List the existing buffers (`list-buffers').
219 To print a list of all existing buffers, type `C-x C-b'. Each line
220 in the list shows one buffer's name, major mode, and visited file. A
221 `*' at the beginning of a line indicates the buffer has been
222 "modified". If several buffers are modified, it may be time to save
223 some with `C-x s' (*note Saving::.). A `%' indicates a read-only
224 buffer. A `.' marks the selected buffer. Here is an example of a
227 MR Buffer Size Mode File
228 -- ------ ---- ---- ----
229 .* emacs.tex 383402 Texinfo /u2/emacs/man/emacs.tex
230 *Help* 1287 Fundamental
231 files.el 23076 Emacs-Lisp /u2/emacs/lisp/files.el
232 % RMAIL 64042 RMAIL /u/rms/RMAIL
233 *% man 747 Dired /u2/emacs/man/
234 net.emacs 343885 Fundamental /u/rms/net.emacs
235 fileio.c 27691 C /u2/emacs/src/fileio.c
236 NEWS 67340 Text /u2/emacs/etc/NEWS
237 *scratch* 0 Lisp Interaction
239 Note that the buffer `*Help*' was made by a help request; it is not
240 visiting any file. The buffer `man' was made by Dired on the directory
243 As you move the mouse over the `*Buffer List*' buffer, the lines are
244 highlighted. This visual cue indicates that clicking the right mouse
245 button (`button3') will pop up a menu of commands on the buffer
246 represented by this line. This menu duplicates most of those commands
247 which are bound to keys in the `*Buffer List*' buffer.
250 File: xemacs.info, Node: Misc Buffer, Next: Kill Buffer, Prev: List Buffers, Up: Buffers
252 Miscellaneous Buffer Operations
253 ===============================
256 Toggle read-only status of buffer (`toggle-read-only').
259 Change the name of the current buffer.
262 Scroll through a buffer.
264 A buffer can be "read-only", which means that commands to change its
265 text are not allowed. Normally, read-only buffers are created by
266 subsystems such as Dired and Rmail that have special commands to operate
267 on the text. Emacs also creates a read-only buffer if you visit a file
268 that is protected. To make changes in a read-only buffer, use the
269 command `C-x C-q' (`toggle-read-only'). It makes a read-only buffer
270 writable, and makes a writable buffer read-only. This works by setting
271 the variable `buffer-read-only', which has a local value in each buffer
272 and makes a buffer read-only if its value is non-`nil'.
274 `M-x rename-buffer' changes the name of the current buffer,
275 prompting for the new name in the minibuffer. There is no default. If
276 you specify a name that is used by a different buffer, an error is
277 signalled and renaming is not done.
279 `M-x view-buffer' is similar to `M-x view-file' (*note Misc File
280 Ops::.), but it examines an already existing Emacs buffer. View mode
281 provides convenient commands for scrolling through the buffer but not
282 for changing it. When you exit View mode, the resulting value of point
285 To copy text from one buffer to another, use the commands `M-x
286 append-to-buffer' and `M-x insert-buffer'. *Note Accumulating Text::.
289 File: xemacs.info, Node: Kill Buffer, Next: Several Buffers, Prev: Misc Buffer, Up: Buffers
294 After using Emacs for a while, you may accumulate a large number of
295 buffers and may want to eliminate the ones you no longer need. There
296 are several commands for doing this.
299 Kill a buffer, specified by name (`kill-buffer').
301 `M-x kill-some-buffers'
302 Offer to kill each buffer, one by one.
304 `C-x k' (`kill-buffer') kills one buffer, whose name you specify in
305 the minibuffer. If you type just <RET> in the minibuffer, the default,
306 killing the current buffer, is used. If the current buffer is killed,
307 the buffer that has been selected recently but does not appear in any
308 window now is selected. If the buffer being killed contains unsaved
309 changes, you are asked to confirm with `yes' before the buffer is
312 The command `M-x kill-some-buffers' asks about each buffer, one by
313 one. An answer of `y' means to kill the buffer. Killing the current
314 buffer or a buffer containing unsaved changes selects a new buffer or
315 asks for confirmation just like `kill-buffer'.
318 File: xemacs.info, Node: Several Buffers, Prev: Kill Buffer, Up: Buffers
320 Operating on Several Buffers
321 ============================
323 The "buffer-menu" facility is like a "Dired for buffers"; it allows
324 you to request operations on various Emacs buffers by editing a buffer
325 containing a list of them. You can save buffers, kill them (here
326 called "deleting" them, for consistency with Dired), or display them.
329 Begin editing a buffer listing all Emacs buffers.
331 The command `buffer-menu' writes a list of all Emacs buffers into
332 the buffer `*Buffer List*', and selects that buffer in Buffer Menu
333 mode. The buffer is read-only. You can only change it using the
334 special commands described in this section. Most of the commands are
335 graphic characters. You can use Emacs cursor motion commands in the
336 `*Buffer List*' buffer. If the cursor is on a line describing a
337 buffer, the following special commands apply to that buffer:
340 Request to delete (kill) the buffer, then move down. A `D' before
341 the buffer name on a line indicates a deletion request. Requested
342 deletions actually take place when you use the `x' command.
348 Like `d' but move up afterwards instead of down.
351 Request to save the buffer. An `S' befor the buffer name on a line
352 indicates the request. Requested saves actually take place when
353 you use the `x' command. You can request both saving and deletion
357 Mark buffer "unmodified". The command `~' does this immediately
361 Perform previously requested deletions and saves.
364 Remove any request made for the current line, and move down.
367 Move to previous line and remove any request made for that line.
369 All commands that add or remove flags to request later operations
370 also move down a line. They accept a numeric argument as a repeat
371 count, unless otherwise specified.
373 There are also special commands to use the buffer list to select
374 another buffer, and to specify one or more other buffers for display in
378 Select the buffer in a full-frame window. This command takes
382 Immediately set up two windows, with this buffer in one and the
383 buffer selected before `*Buffer List*' in the other.
386 Immediately select the buffer in place of the `*Buffer List*'
390 Immediately select the buffer in another window as if by `C-x 4 b',
391 leaving `*Buffer List*' visible.
394 Immediately select this buffer, and display any buffers previously
395 flagged with the `m' command in other windows. If there are no
396 buffers flagged with `m', this command is equivalent to `1'.
399 Flag this buffer to be displayed in another window if the `q'
400 command is used. The request shows as a `>' at the beginning of
401 the line. The same buffer may not have both a delete request and a
404 Going back between a `buffer-menu' buffer and other Emacs buffers is
405 easy. You can, for example, switch from the `*Buffer List*' buffer to
406 another Emacs buffer, and edit there. You can then reselect the
407 `buffer-menu' buffer and perform operations already requested, or you
408 can kill that buffer or pay no further attention to it. All that
409 `buffer-menu' does directly is create and select a suitable buffer, and
410 turn on Buffer Menu mode. All the other capabilities of the buffer
411 menu are implemented by special commands provided in Buffer Menu mode.
413 The only difference between `buffer-menu' and `list-buffers' is that
414 `buffer-menu' selects the `*Buffer List*' buffer and `list-buffers'
415 does not. If you run `list-buffers' (that is, type `C-x C-b') and
416 select the buffer list manually, you can use all the commands described
420 File: xemacs.info, Node: Windows, Next: Mule, Prev: Buffers, Up: Top
425 Emacs can split the frame into two or many windows, which can display
426 parts of different buffers or different parts of one buffer. If you are
427 running XEmacs under X, that means you can have the X window that
428 contains the Emacs frame have multiple subwindows.
432 * Basic Window:: Introduction to Emacs windows.
433 * Split Window:: New windows are made by splitting existing windows.
434 * Other Window:: Moving to another window or doing something to it.
435 * Pop Up Window:: Finding a file or buffer in another window.
436 * Change Window:: Deleting windows and changing their sizes.
439 File: xemacs.info, Node: Basic Window, Next: Split Window, Prev: Windows, Up: Windows
441 Concepts of Emacs Windows
442 =========================
444 When Emacs displays multiple windows, each window has one Emacs
445 buffer designated for display. The same buffer may appear in more than
446 one window; if it does, any changes in its text are displayed in all
447 the windows that display it. Windows showing the same buffer can show
448 different parts of it, because each window has its own value of point.
450 At any time, one window is the "selected window"; the buffer
451 displayed by that window is the current buffer. The cursor shows the
452 location of point in that window. Each other window has a location of
453 point as well, but since the terminal has only one cursor, it cannot
454 show the location of point in the other windows.
456 Commands to move point affect the value of point for the selected
457 Emacs window only. They do not change the value of point in any other
458 Emacs window, including those showing the same buffer. The same is
459 true for commands such as `C-x b' to change the selected buffer in the
460 selected window; they do not affect other windows at all. However,
461 there are other commands such as `C-x 4 b' that select a different
462 window and switch buffers in it. Also, all commands that display
463 information in a window, including (for example) `C-h f'
464 (`describe-function') and `C-x C-b' (`list-buffers'), work by switching
465 buffers in a non-selected window without affecting the selected window.
467 Each window has its own mode line, which displays the buffer name,
468 modification status, and major and minor modes of the buffer that is
469 displayed in the window. *Note Mode Line::, for details on the mode
473 File: xemacs.info, Node: Split Window, Next: Other Window, Prev: Basic Window, Up: Windows
479 Split the selected window into two windows, one above the other
480 (`split-window-vertically').
483 Split the selected window into two windows positioned side by side
484 (`split-window-horizontally').
487 Save the current window configuration in register REG (a letter).
490 Restore (make current) the window configuration in register REG (a
491 letter). Use with a register previously set with `C-x 6'.
493 The command `C-x 2' (`split-window-vertically') breaks the selected
494 window into two windows, one above the other. Both windows start out
495 displaying the same buffer, with the same value of point. By default
496 each of the two windows gets half the height of the window that was
497 split. A numeric argument specifies how many lines to give to the top
500 `C-x 3' (`split-window-horizontally') breaks the selected window
501 into two side-by-side windows. A numeric argument specifies how many
502 columns to give the one on the left. A line of vertical bars separates
503 the two windows. Windows that are not the full width of the frame have
504 truncated mode lines which do not always appear in inverse video,
505 because Emacs display routines cannot display a region of inverse video
506 that is only part of a line on the screen.
508 When a window is less than the full width, many text lines are too
509 long to fit. Continuing all those lines might be confusing. Set the
510 variable `truncate-partial-width-windows' to non-`nil' to force
511 truncation in all windows less than the full width of the frame,
512 independent of the buffer and its value for `truncate-lines'. *Note
513 Continuation Lines::.
515 Horizontal scrolling is often used in side-by-side windows. *Note
518 You can resize a window and store that configuration in a register by
519 supplying a REGISTER argument to `window-configuration-to-register'
520 (`C-x 6'). To return to the window configuration established with
521 `window-configuration-to-register', use `jump-to-register' (`C-x j').
524 File: xemacs.info, Node: Other Window, Next: Pop Up Window, Prev: Split Window, Up: Windows
530 Select another window (`other-window'). That is the letter `o',
534 Scroll the next window (`scroll-other-window').
536 `M-x compare-windows'
537 Find the next place where the text in the selected window does not
538 match the text in the next window.
540 `M-x other-window-any-frame N'
541 Select the Nth different window on any frame.
543 To select a different window, use `C-x o' (`other-window'). That is
544 an `o', for `other', not a zero. When there are more than two windows,
545 the command moves through all the windows in a cyclic order, generally
546 top to bottom and left to right. From the rightmost and bottommost
547 window, it goes back to the one at the upper left corner. A numeric
548 argument, N, moves several steps in the cyclic order of windows. A
549 negative numeric argument moves around the cycle in the opposite order.
550 If the optional second argument ALL-FRAMES is non-`nil', the function
551 cycles through all frames. When the minibuffer is active, the
552 minibuffer is the last window in the cycle; you can switch from the
553 minibuffer window to one of the other windows, and later switch back
554 and finish supplying the minibuffer argument that is requested. *Note
557 The command `M-x other-window-any-frame' also selects the window N
558 steps away in the cyclic order. However, unlike `other-window', this
559 command selects a window on the next or previous frame instead of
560 wrapping around to the top or bottom of the current frame, when there
563 The usual scrolling commands (*note Display::.) apply to the selected
564 window only. `M-C-v' (`scroll-other-window') scrolls the window that
565 `C-x o' would select. Like `C-v', it takes positive and negative
568 The command `M-x compare-windows' compares the text in the current
569 window with the text in the next window. Comparison starts at point in
570 each window. Point moves forward in each window, a character at a time,
571 until the next set of characters in the two windows are different.
572 Then the command is finished.
574 A prefix argument IGNORE-WHITESPACE means ignore changes in
575 whitespace. The variable `compare-windows-whitespace' controls how
576 whitespace is skipped.
578 If `compare-ignore-case' is non-`nil', changes in case are also
582 File: xemacs.info, Node: Pop Up Window, Next: Change Window, Prev: Other Window, Up: Windows
584 Displaying in Another Window
585 ============================
587 `C-x 4' is a prefix key for commands that select another window
588 (splitting the window if there is only one) and select a buffer in that
589 window. Different `C-x 4' commands have different ways of finding the
592 `C-x 4 b BUFNAME <RET>'
593 Select buffer BUFNAME in another window. This runs
594 `switch-to-buffer-other-window'.
596 `C-x 4 f FILENAME <RET>'
597 Visit file FILENAME and select its buffer in another window. This
598 runs `find-file-other-window'. *Note Visiting::.
600 `C-x 4 d DIRECTORY <RET>'
601 Select a Dired buffer for directory DIRECTORY in another window.
602 This runs `dired-other-window'. *Note Dired::.
605 Start composing a mail message in another window. This runs
606 `mail-other-window', and its same-window version is `C-x m' (*note
610 Find a tag in the current tag table in another window. This runs
611 `find-tag-other-window', the multiple-window variant of `M-.'
614 If the variable `display-buffer-function' is non-`nil', its value is
615 the function to call to handle `display-buffer'. It receives two
616 arguments, the buffer and a flag that if non-`nil' means that the
617 currently selected window is not acceptable. Commands such as
618 `switch-to-buffer-other-window' and `find-file-other-window' work using
622 File: xemacs.info, Node: Change Window, Prev: Pop Up Window, Up: Windows
624 Deleting and Rearranging Windows
625 ================================
628 Get rid of the selected window (`delete-window'). That is a zero.
629 If there is more than one Emacs frame, deleting the sole remaining
630 window on that frame deletes the frame as well. If the current
631 frame is the only frame, it is not deleted.
634 Get rid of all windows except the selected one
635 (`delete-other-windows').
638 Make the selected window taller, at the expense of the other(s)
642 Make the selected window wider (`enlarge-window-horizontally').
644 To delete a window, type `C-x 0' (`delete-window'). (That is a
645 zero.) The space occupied by the deleted window is distributed among
646 the other active windows (but not the minibuffer window, even if that
647 is active at the time). Once a window is deleted, its attributes are
648 forgotten; there is no automatic way to make another window of the same
649 shape or showing the same buffer. The buffer continues to exist, and
650 you can select it in any window with `C-x b'.
652 `C-x 1' (`delete-other-windows') is more powerful than `C-x 0'; it
653 deletes all the windows except the selected one (and the minibuffer).
654 The selected window expands to use the whole frame except for the echo
657 To readjust the division of space among existing windows, use `C-x
658 ^' (`enlarge-window'). It makes the currently selected window longer
659 by one line or as many lines as a numeric argument specifies. With a
660 negative argument, it makes the selected window smaller. `C-x }'
661 (`enlarge-window-horizontally') makes the selected window wider by the
662 specified number of columns. The extra screen space given to a window
663 comes from one of its neighbors, if that is possible; otherwise, all
664 the competing windows are shrunk in the same proportion. If this makes
665 some windows too small, those windows are deleted and their space is
666 divided up. Minimum window size is specified by the variables
667 `window-min-height' and `window-min-width'.
669 You can also resize windows within a frame by clicking the left mouse
670 button on a modeline, and dragging.
672 Clicking the right button on a mode line pops up a menu of common
673 window manager operations. This menu contains the following options:
676 Remove the window above this modeline from the frame.
679 Delete all windows on the frame except for the one above this
683 Split the window above the mode line in half, creating another
686 Split Window Horizontally
687 Split the window above the mode line in half horizontally, so that
688 there will be two windows side-by-side.
691 Readjust the sizes of all windows on the frame until all windows
692 have roughly the same number of lines.
695 File: xemacs.info, Node: Mule, Next: Major Modes, Prev: Windows, Up: Top
697 World Scripts Support
698 *********************
700 If you compile XEmacs with mule option, it supports a wide variety of
701 world scripts, including Latin script, as well as Arabic script,
702 Simplified Chinese script (for mainland of China), Traditional Chinese
703 script (for Taiwan and Hong-Kong), Greek script, Hebrew script, IPA
704 symbols, Japanese scripts (Hiragana, Katakana and Kanji), Korean scripts
705 (Hangul and Hanja) and Cyrillic script (for Beylorussian, Bulgarian,
706 Russian, Serbian and Ukrainian). These features have been merged from
707 the modified version of Emacs known as MULE (for "MULti-lingual
708 Enhancement to GNU Emacs").
712 * Mule Intro:: Basic concepts of Mule.
713 * Language Environments:: Setting things up for the language you use.
714 * Input Methods:: Entering text characters not on your keyboard.
715 * Select Input Method:: Specifying your choice of input methods.
716 * Coding Systems:: Character set conversion when you read and
717 write files, and so on.
718 * Recognize Coding:: How XEmacs figures out which conversion to use.
719 * Specify Coding:: Various ways to choose which conversion to use.
722 File: xemacs.info, Node: Mule Intro, Next: Language Environments, Prev: Mule, Up: Mule
724 Introduction to world scripts
725 =============================
727 The users of these scripts have established many more-or-less
728 standard coding systems for storing files. XEmacs translates between
729 the internal character encoding and various other coding systems when
730 reading and writing files, when exchanging data with subprocesses, and
731 (in some cases) in the `C-q' command (see below).
733 The command `C-h h' (`view-hello-file') displays the file
734 `etc/HELLO', which shows how to say "hello" in many languages. This
735 illustrates various scripts.
737 Keyboards, even in the countries where these character sets are used,
738 generally don't have keys for all the characters in them. So XEmacs
739 supports various "input methods", typically one for each script or
740 language, to make it convenient to type them.
742 The prefix key `C-x <RET>' is used for commands that pertain to
743 world scripts, coding systems, and input methods.
746 File: xemacs.info, Node: Language Environments, Next: Input Methods, Prev: Mule Intro, Up: Mule
748 Language Environments
749 =====================
751 All supported character sets are supported in XEmacs buffers if it is
752 compile with mule; there is no need to select a particular language in
753 order to display its characters in an XEmacs buffer. However, it is
754 important to select a "language environment" in order to set various
755 defaults. The language environment really represents a choice of
756 preferred script (more or less) rather that a choice of language.
758 The language environment controls which coding systems to recognize
759 when reading text (*note Recognize Coding::.). This applies to files,
760 incoming mail, netnews, and any other text you read into XEmacs. It may
761 also specify the default coding system to use when you create a file.
762 Each language environment also specifies a default input method.
764 The command to select a language environment is `M-x
765 set-language-environment'. It makes no difference which buffer is
766 current when you use this command, because the effects apply globally to
767 the XEmacs session. The supported language environments include:
769 Chinese-BIG5, Chinese-CNS, Chinese-GB, Cyrillic-ISO, English,
770 Ethiopic, Greek, Japanese, Korean, Latin-1, Latin-2, Latin-3,
773 Some operating systems let you specify the language you are using by
774 setting locale environment variables. XEmacs handles one common special
775 case of this: if your locale name for character types contains the
776 string `8859-N', XEmacs automatically selects the corresponding
777 language environment.
779 To display information about the effects of a certain language
780 environment LANG-ENV, use the command `C-h L LANG-ENV <RET>'
781 (`describe-language-environment'). This tells you which languages this
782 language environment is useful for, and lists the character sets,
783 coding systems, and input methods that go with it. It also shows some
784 sample text to illustrate scripts used in this language environment.
785 By default, this command describes the chosen language environment.
788 File: xemacs.info, Node: Input Methods, Next: Select Input Method, Prev: Language Environments, Up: Mule
793 An "input method" is a kind of character conversion designed
794 specifically for interactive input. In XEmacs, typically each language
795 has its own input method; sometimes several languages which use the same
796 characters can share one input method. A few languages support several
799 The simplest kind of input method works by mapping ASCII letters into
800 another alphabet. This is how the Greek and Russian input methods work.
802 A more powerful technique is composition: converting sequences of
803 characters into one letter. Many European input methods use composition
804 to produce a single non-ASCII letter from a sequence that consists of a
805 letter followed by accent characters. For example, some methods convert
806 the sequence `'a' into a single accented letter.
808 The input methods for syllabic scripts typically use mapping followed
809 by composition. The input methods for Thai and Korean work this way.
810 First, letters are mapped into symbols for particular sounds or tone
811 marks; then, sequences of these which make up a whole syllable are
812 mapped into one syllable sign.
814 Chinese and Japanese require more complex methods. In Chinese input
815 methods, first you enter the phonetic spelling of a Chinese word (in
816 input method `chinese-py', among others), or a sequence of portions of
817 the character (input methods `chinese-4corner' and `chinese-sw', and
818 others). Since one phonetic spelling typically corresponds to many
819 different Chinese characters, you must select one of the alternatives
820 using special XEmacs commands. Keys such as `C-f', `C-b', `C-n',
821 `C-p', and digits have special definitions in this situation, used for
822 selecting among the alternatives. <TAB> displays a buffer showing all
825 In Japanese input methods, first you input a whole word using
826 phonetic spelling; then, after the word is in the buffer, XEmacs
827 converts it into one or more characters using a large dictionary. One
828 phonetic spelling corresponds to many differently written Japanese
829 words, so you must select one of them; use `C-n' and `C-p' to cycle
830 through the alternatives.
832 Sometimes it is useful to cut off input method processing so that the
833 characters you have just entered will not combine with subsequent
834 characters. For example, in input method `latin-1-postfix', the
835 sequence `e '' combines to form an `e' with an accent. What if you
836 want to enter them as separate characters?
838 One way is to type the accent twice; that is a special feature for
839 entering the separate letter and accent. For example, `e ' '' gives
840 you the two characters `e''. Another way is to type another letter
841 after the `e'--something that won't combine with that--and immediately
842 delete it. For example, you could type `e e <DEL> '' to get separate
845 Another method, more general but not quite as easy to type, is to use
846 `C-\ C-\' between two characters to stop them from combining. This is
847 the command `C-\' (`toggle-input-method') used twice. *Note Select
850 `C-\ C-\' is especially useful inside an incremental search, because
851 stops waiting for more characters to combine, and starts searching for
852 what you have already entered.
854 The variables `input-method-highlight-flag' and
855 `input-method-verbose-flag' control how input methods explain what is
856 happening. If `input-method-highlight-flag' is non-`nil', the partial
857 sequence is highlighted in the buffer. If `input-method-verbose-flag'
858 is non-`nil', the list of possible characters to type next is displayed
859 in the echo area (but not when you are in the minibuffer).
862 File: xemacs.info, Node: Select Input Method, Next: Coding Systems, Prev: Input Methods, Up: Mule
864 Selecting an Input Method
865 =========================
868 Enable or disable use of the selected input method.
870 `C-x <RET> C-\ METHOD <RET>'
871 Select a new input method for the current buffer.
874 `C-h C-\ METHOD <RET>'
875 Describe the input method METHOD (`describe-input-method'). By
876 default, it describes the current input method (if any).
878 `M-x list-input-methods'
879 Display a list of all the supported input methods.
881 To choose an input method for the current buffer, use `C-x <RET>
882 C-\' (`select-input-method'). This command reads the input method name
883 with the minibuffer; the name normally starts with the language
884 environment that it is meant to be used with. The variable
885 `current-input-method' records which input method is selected.
887 Input methods use various sequences of ASCII characters to stand for
888 non-ASCII characters. Sometimes it is useful to turn off the input
889 method temporarily. To do this, type `C-\' (`toggle-input-method').
890 To reenable the input method, type `C-\' again.
892 If you type `C-\' and you have not yet selected an input method, it
893 prompts for you to specify one. This has the same effect as using `C-x
894 <RET> C-\' to specify an input method.
896 Selecting a language environment specifies a default input method for
897 use in various buffers. When you have a default input method, you can
898 select it in the current buffer by typing `C-\'. The variable
899 `default-input-method' specifies the default input method (`nil' means
902 Some input methods for alphabetic scripts work by (in effect)
903 remapping the keyboard to emulate various keyboard layouts commonly used
904 for those scripts. How to do this remapping properly depends on your
905 actual keyboard layout. To specify which layout your keyboard has, use
906 the command `M-x quail-set-keyboard-layout'.
908 To display a list of all the supported input methods, type `M-x
909 list-input-methods'. The list gives information about each input
910 method, including the string that stands for it in the mode line.
913 File: xemacs.info, Node: Coding Systems, Next: Recognize Coding, Prev: Select Input Method, Up: Mule
918 Users of various languages have established many more-or-less
919 standard coding systems for representing them. XEmacs does not use
920 these coding systems internally; instead, it converts from various
921 coding systems to its own system when reading data, and converts the
922 internal coding system to other coding systems when writing data.
923 Conversion is possible in reading or writing files, in sending or
924 receiving from the terminal, and in exchanging data with subprocesses.
926 XEmacs assigns a name to each coding system. Most coding systems are
927 used for one language, and the name of the coding system starts with the
928 language name. Some coding systems are used for several languages;
929 their names usually start with `iso'. There are also special coding
930 systems `binary' and `no-conversion' which do not convert printing
933 In addition to converting various representations of non-ASCII
934 characters, a coding system can perform end-of-line conversion. XEmacs
935 handles three different conventions for how to separate lines in a file:
936 newline, carriage-return linefeed, and just carriage-return.
939 Describe coding system CODING.
942 Describe the coding systems currently in use.
944 `M-x list-coding-systems'
945 Display a list of all the supported coding systems.
947 The command `C-h C' (`describe-coding-system') displays information
948 about particular coding systems. You can specify a coding system name
949 as argument; alternatively, with an empty argument, it describes the
950 coding systems currently selected for various purposes, both in the
951 current buffer and as the defaults, and the priority list for
952 recognizing coding systems (*note Recognize Coding::.).
954 To display a list of all the supported coding systems, type `M-x
955 list-coding-systems'. The list gives information about each coding
956 system, including the letter that stands for it in the mode line (*note
959 Each of the coding systems that appear in this list--except for
960 `binary', which means no conversion of any kind--specifies how and
961 whether to convert printing characters, but leaves the choice of
962 end-of-line conversion to be decided based on the contents of each file.
963 For example, if the file appears to use carriage-return linefeed between
964 lines, that end-of-line conversion will be used.
966 Each of the listed coding systems has three variants which specify
967 exactly what to do for end-of-line conversion:
970 Don't do any end-of-line conversion; assume the file uses newline
971 to separate lines. (This is the convention normally used on Unix
975 Assume the file uses carriage-return linefeed to separate lines,
976 and do the appropriate conversion. (This is the convention
977 normally used on Microsoft systems.)
980 Assume the file uses carriage-return to separate lines, and do the
981 appropriate conversion. (This is the convention normally used on
982 the Macintosh system.)
984 These variant coding systems are omitted from the
985 `list-coding-systems' display for brevity, since they are entirely
986 predictable. For example, the coding system `iso-8859-1' has variants
987 `iso-8859-1-unix', `iso-8859-1-dos' and `iso-8859-1-mac'.
989 In contrast, the coding system `binary' specifies no character code
990 conversion at all--none for non-Latin-1 byte values and none for end of
991 line. This is useful for reading or writing binary files, tar files,
992 and other files that must be examined verbatim.
994 The easiest way to edit a file with no conversion of any kind is with
995 the `M-x find-file-literally' command. This uses `binary', and also
996 suppresses other XEmacs features that might convert the file contents
997 before you see them. *Note Visiting::.
999 The coding system `no-conversion' means that the file contains
1000 non-Latin-1 characters stored with the internal XEmacs encoding. It
1001 handles end-of-line conversion based on the data encountered, and has
1002 the usual three variants to specify the kind of end-of-line conversion.
1005 File: xemacs.info, Node: Recognize Coding, Next: Specify Coding, Prev: Coding Systems, Up: Mule
1007 Recognizing Coding Systems
1008 ==========================
1010 Most of the time, XEmacs can recognize which coding system to use for
1011 any given file-once you have specified your preferences.
1013 Some coding systems can be recognized or distinguished by which byte
1014 sequences appear in the data. However, there are coding systems that
1015 cannot be distinguished, not even potentially. For example, there is no
1016 way to distinguish between Latin-1 and Latin-2; they use the same byte
1017 values with different meanings.
1019 XEmacs handles this situation by means of a priority list of coding
1020 systems. Whenever XEmacs reads a file, if you do not specify the coding
1021 system to use, XEmacs checks the data against each coding system,
1022 starting with the first in priority and working down the list, until it
1023 finds a coding system that fits the data. Then it converts the file
1024 contents assuming that they are represented in this coding system.
1026 The priority list of coding systems depends on the selected language
1027 environment (*note Language Environments::.). For example, if you use
1028 French, you probably want XEmacs to prefer Latin-1 to Latin-2; if you
1029 use Czech, you probably want Latin-2 to be preferred. This is one of
1030 the reasons to specify a language environment.
1032 However, you can alter the priority list in detail with the command
1033 `M-x prefer-coding-system'. This command reads the name of a coding
1034 system from the minibuffer, and adds it to the front of the priority
1035 list, so that it is preferred to all others. If you use this command
1036 several times, each use adds one element to the front of the priority
1039 Sometimes a file name indicates which coding system to use for the
1040 file. The variable `file-coding-system-alist' specifies this
1041 correspondence. There is a special function
1042 `modify-coding-system-alist' for adding elements to this list. For
1043 example, to read and write all `.txt' using the coding system
1044 `china-iso-8bit', you can execute this Lisp expression:
1046 (modify-coding-system-alist 'file "\\.txt\\'" 'china-iso-8bit)
1048 The first argument should be `file', the second argument should be a
1049 regular expression that determines which files this applies to, and the
1050 third argument says which coding system to use for these files.
1052 You can specify the coding system for a particular file using the
1053 `-*-...-*-' construct at the beginning of a file, or a local variables
1054 list at the end (*note File Variables::.). You do this by defining a
1055 value for the "variable" named `coding'. XEmacs does not really have a
1056 variable `coding'; instead of setting a variable, it uses the specified
1057 coding system for the file. For example, `-*-mode: C; coding:
1058 iso-8859-1;-*-' specifies use of the iso-8859-1 coding system, as well
1061 Once XEmacs has chosen a coding system for a buffer, it stores that
1062 coding system in `buffer-file-coding-system' and uses that coding
1063 system, by default, for operations that write from this buffer into a
1064 file. This includes the commands `save-buffer' and `write-region'. If
1065 you want to write files from this buffer using a different coding
1066 system, you can specify a different coding system for the buffer using
1067 `set-buffer-file-coding-system' (*note Specify Coding::.).