Add arch taglines
[bpt/emacs.git] / man / mule.texi
index 4ca9602..065c9c7 100644 (file)
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+@c Copyright (C) 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node International, Major Modes, Frames, Top
 @chapter International Character Set Support
@@ -44,8 +44,46 @@ have been merged from the modified version of Emacs known as MULE (for
   Emacs also supports various encodings of these characters used by
 other internationalized software, such as word processors and mailers.
 
+  Emacs allows editing text with international characters by supporting
+all the related activities:
+
+@itemize @bullet
+@item
+You can visit files with non-ASCII characters, save non-ASCII text, and
+pass non-ASCII text between Emacs and programs it invokes (such as
+compilers, spell-checkers, and mailers).  Setting your language
+environment (@pxref{Language Environments}) takes care of setting up the
+coding systems and other options for a specific language or culture.
+Alternatively, you can specify how Emacs should encode or decode text
+for each command; see @ref{Specify Coding}.
+
+@item
+You can display non-ASCII characters encoded by the various scripts.
+This works by using appropriate fonts on X and similar graphics
+displays (@pxref{Defining Fontsets}), and by sending special codes to
+text-only displays (@pxref{Specify Coding}).  If some characters are
+displayed incorrectly, refer to @ref{Undisplayable Characters}, which
+describes possible problems and explains how to solve them.
+
+@item
+You can insert non-ASCII characters or search for them.  To do that,
+you can specify an input method (@pxref{Select Input Method}) suitable
+for your language, or use the default input method set up when you set
+your language environment.  (Emacs input methods are part of the Leim
+package, which must be installed for you to be able to use them.)  If
+your keyboard can produce non-ASCII characters, you can select an
+appropriate keyboard coding system (@pxref{Specify Coding}), and Emacs
+will accept those characters.  Latin-1 characters can also be input by
+using the @kbd{C-x 8} prefix, see @ref{Single-Byte Character Support,
+C-x 8}.  On X Window systems, your locale should be set to an
+appropriate value to make sure Emacs interprets keyboard input
+correctly; see @ref{Language Environments, locales}.
+@end itemize
+
+  The rest of this chapter describes these issues in detail.
+
 @menu
-* International Intro::     Basic concepts of multibyte characters.
+* International Chars::     Basic concepts of multibyte characters.
 * Enabling Multibyte::      Controlling whether to use multibyte characters.
 * Language Environments::   Setting things up for the language you use.
 * Input Methods::           Entering text characters not on your keyboard.
@@ -62,9 +100,10 @@ other internationalized software, such as word processors and mailers.
 * Single-Byte Character Support::
                             You can pick one European character set
                             to use without multibyte characters.
+* Charsets::                How Emacs groups its internal character codes.
 @end menu
 
-@node International Intro
+@node International Chars
 @section Introduction to International Character Sets
 
   The users of international character sets and scripts have established
@@ -96,31 +135,10 @@ language, to make it convenient to type them.
   The prefix key @kbd{C-x @key{RET}} is used for commands that pertain
 to multibyte characters, coding systems, and input methods.
 
-@ignore
-@c This is commented out because it doesn't fit here, or anywhere.
-@c This manual does not discuss "character sets" as they
-@c are used in Mule, and it makes no sense to mention these commands
-@c except as part of a larger discussion of the topic.
-@c But it is not clear that topic is worth mentioning here,
-@c since that is more of an implementation concept
-@c than a user-level concept.  And when we switch to Unicode,
-@c character sets in the current sense may not even exist.
-
-@findex list-charset-chars
-@cindex characters in a certain charset
-  The command @kbd{M-x list-charset-chars} prompts for a name of a
-character set, and displays all the characters in that character set.
-
-@findex describe-character-set
-@cindex character set, description
-  The command @kbd{M-x describe-character-set} prompts for a character
-set name and displays information about that character set, including
-its internal representation within Emacs.
-@end ignore
-
 @node Enabling Multibyte
 @section Enabling Multibyte Characters
 
+@cindex turn multibyte support on or off
   You can enable or disable multibyte character support, either for
 Emacs as a whole, or for a single buffer.  When multibyte characters are
 disabled in a buffer, then each byte in that buffer represents a
@@ -134,6 +152,9 @@ use ISO Latin; the Emacs multibyte character set includes all the
 characters in these character sets, and Emacs can translate
 automatically to and from the ISO codes.
 
+  By default, Emacs starts in multibyte mode, because that allows you to
+use all the supported languages and scripts without limitations.
+
   To edit a particular file in unibyte representation, visit it using
 @code{find-file-literally}.  @xref{Visiting}.  To convert a buffer in
 multibyte representation into a single-byte representation of the same
@@ -152,8 +173,16 @@ conversion, uncompression and auto mode selection as
 the @samp{--unibyte} option (@pxref{Initial Options}), or set the
 environment variable @env{EMACS_UNIBYTE}.  You can also customize
 @code{enable-multibyte-characters} or, equivalently, directly set the
-variable @code{default-enable-multibyte-characters} in your init file to
-have basically the same effect as @samp{--unibyte}.
+variable @code{default-enable-multibyte-characters} to @code{nil} in
+your init file to have basically the same effect as @samp{--unibyte}.
+
+@findex toggle-enable-multibyte-characters
+  To convert a unibyte session to a multibyte session, set
+@code{default-enable-multibyte-characters} to @code{t}.  Buffers which
+were created in the unibyte session before you turn on multibyte support
+will stay unibyte.  You can turn on multibyte support in a specific
+buffer by invoking the command @code{toggle-enable-multibyte-characters}
+in that buffer.
 
 @cindex Lisp files, and multibyte operation
 @cindex multibyte operation, and Lisp files
@@ -169,13 +198,13 @@ characters.
 you used @samp{--unibyte}.  This includes the Emacs initialization
 file, @file{.emacs}, and the initialization files of Emacs packages
 such as Gnus.  However, you can specify unibyte loading for a
-particular Lisp file, by putting @samp{-*-unibyte: t;-*-} in a comment
-on the first line.  Then that file is always loaded as unibyte text,
-even if you did not start Emacs with @samp{--unibyte}.  The motivation
-for these conventions is that it is more reliable to always load any
-particular Lisp file in the same way.  However, you can load a Lisp
-file as unibyte, on any one occasion, by typing @kbd{C-x @key{RET} c
-raw-text @key{RET}} immediately before loading it.
+particular Lisp file, by putting @w{@samp{-*-unibyte: t;-*-}} in a
+comment on the first line.  Then that file is always loaded as unibyte
+text, even if you did not start Emacs with @samp{--unibyte}.  The
+motivation for these conventions is that it is more reliable to always
+load any particular Lisp file in the same way.  However, you can load
+a Lisp file as unibyte, on any one occasion, by typing @kbd{C-x
+@key{RET} c raw-text @key{RET}} immediately before loading it.
 
   The mode line indicates whether multibyte character support is enabled
 in the current buffer.  If it is, there are two or more characters (most
@@ -203,44 +232,57 @@ Each language environment also specifies a default input method.
 
 @findex set-language-environment
 @vindex current-language-environment
-  To select a language environment, customize the option
+  To select a language environment, you can customize the variable
 @code{current-language-environment} or use the command @kbd{M-x
 set-language-environment}.  It makes no difference which buffer is
 current when you use this command, because the effects apply globally to
 the Emacs session.  The supported language environments include:
 
 @cindex Euro sign
+@cindex UTF-8
 @quotation
 Chinese-BIG5, Chinese-CNS, Chinese-GB, Cyrillic-ALT, Cyrillic-ISO,
-Cyrillic-KOI8, Czech, Devanagari, English, Ethiopic, German, Greek,
-Hebrew, IPA, Japanese, Korean, Lao, Latin-1, Latin-2, Latin-3, Latin-4,
-Latin-5, Latin-8 (Celtic), Latin-9 (updated Latin-1, with the Euro
-sign), Polish, Romanian, Slovak, Slovenian, Thai, Tibetan, Turkish, 
-Dutch, Spanish, and Vietnamese.
+Cyrillic-KOI8, Czech, Devanagari, Dutch, English, Ethiopic, German,
+Greek, Hebrew, IPA, Japanese, Korean, Lao, Latin-1, Latin-2, Latin-3,
+Latin-4, Latin-5, Latin-8 (Celtic), Latin-9 (updated Latin-1, with the
+Euro sign), Polish, Romanian, Slovak, Slovenian, Spanish, Thai, Tibetan,
+Turkish, UTF-8 (for a setup which prefers Unicode characters and files
+encoded in UTF-8), and Vietnamese.
 @end quotation
 
 @cindex fonts for various scripts
+@cindex Intlfonts package, installation
   To display the script(s) used by your language environment on a
 graphical display, you need to have a suitable font.  If some of the
 characters appear as empty boxes, you should install the GNU Intlfonts
-package, which includes fonts for all supported scripts.
+package, which includes fonts for all supported scripts.@footnote{If
+you run Emacs on X, you need to inform the X server about the location
+of the newly installed fonts with the following commands:
+
+@example
+ xset fp+ /usr/local/share/emacs/fonts
+ xset fp rehash
+@end example
+}
 @xref{Fontsets}, for more details about setting up your fonts.
 
 @findex set-locale-environment
 @vindex locale-language-names
 @vindex locale-charset-language-names
 @cindex locales
-  Some operating systems let you specify the language you are using by
-setting the locale environment variables @env{LC_ALL}, @env{LC_CTYPE},
-or @env{LANG}.@footnote{If more than one of these is set, the first
-one that is nonempty specifies your locale for this purpose.}  Emacs
-handles this during startup by matching your locale against entries in
-the value of the variables @code{locale-charset-language-names} and
-@code{locale-language-names} and selects the corresponding language
-environment if a match is found.  (The former variable overrides the
-latter.)  It also adjusts the display table and terminal coding
-system, the locale coding system, and the preferred coding system as
-needed for the locale.
+  Some operating systems let you specify the character-set locale you
+are using by setting the locale environment variables @env{LC_ALL},
+@env{LC_CTYPE}, or @env{LANG}.@footnote{If more than one of these is
+set, the first one that is nonempty specifies your locale for this
+purpose.}  During startup, Emacs looks up your character-set locale's
+name in the system locale alias table, matches its canonical name
+against entries in the value of the variables
+@code{locale-charset-language-names} and @code{locale-language-names},
+and selects the corresponding language environment if a match is found.
+(The former variable overrides the latter.)  It also adjusts the display
+table and terminal coding system, the locale coding system, the
+preferred coding system as needed for the locale, and---last but not
+least---the way Emacs decodes non-ASCII characters sent by your keyboard.
 
   If you modify the @env{LC_ALL}, @env{LC_CTYPE}, or @env{LANG}
 environment variables while running Emacs, you may want to invoke the
@@ -279,7 +321,10 @@ environment.
 @code{set-language-environment} runs that hook after setting up the new
 language environment.  The hook functions can test for a specific
 language environment by checking the variable
-@code{current-language-environment}.
+@code{current-language-environment}.  This hook is where you should
+put non-default settings for specific language environment, such as
+coding systems for keyboard input and terminal output, the default
+input method, etc.
 
 @vindex exit-language-environment-hook
   Before it starts to set up the new language environment,
@@ -301,8 +346,10 @@ has its own input method; sometimes several languages which use the same
 characters can share one input method.  A few languages support several
 input methods.
 
-  The simplest kind of input method works by mapping ASCII letters into
-another alphabet.  This is how the Greek and Russian input methods work.
+  The simplest kind of input method works by mapping ASCII letters
+into another alphabet; this allows you to use one other alphabet
+instead of ASCII.  The Greek and Russian input methods
+work this way.
 
   A more powerful technique is composition: converting sequences of
 characters into one letter.  Many European input methods use composition
@@ -320,20 +367,40 @@ mapped into one syllable sign.
 
   Chinese and Japanese require more complex methods.  In Chinese input
 methods, first you enter the phonetic spelling of a Chinese word (in
-input method @code{chinese-py}, among others), or a sequence of portions
-of the character (input methods @code{chinese-4corner} and
-@code{chinese-sw}, and others).  Since one phonetic spelling typically
-corresponds to many different Chinese characters, you must select one of
-the alternatives using special Emacs commands.  Keys such as @kbd{C-f},
-@kbd{C-b}, @kbd{C-n}, @kbd{C-p}, and digits have special definitions in
-this situation, used for selecting among the alternatives.  @key{TAB}
-displays a buffer showing all the possibilities.
-
-   In Japanese input methods, first you input a whole word using
-phonetic spelling; then, after the word is in the buffer, Emacs converts
-it into one or more characters using a large dictionary.  One phonetic
-spelling corresponds to many differently written Japanese words, so you
-must select one of them; use @kbd{C-n} and @kbd{C-p} to cycle through
+input method @code{chinese-py}, among others), or a sequence of
+portions of the character (input methods @code{chinese-4corner} and
+@code{chinese-sw}, and others).  One input sequence typically
+corresponds to many possible Chinese characters.  You select the one
+you mean using keys such as @kbd{C-f}, @kbd{C-b}, @kbd{C-n},
+@kbd{C-p}, and digits, which have special meanings in this situation.
+
+  The possible characters are conceptually arranged in several rows,
+with each row holding up to 10 alternatives.  Normally, Emacs displays
+just one row at a time, in the echo area; @code{(@var{i}/@var{j})}
+appears at the beginning, to indicate that this is the @var{i}th row
+out of a total of @var{j} rows.  Type @kbd{C-n} or @kbd{C-p} to
+display the next row or the previous row.
+
+    Type @kbd{C-f} and @kbd{C-b} to move forward and backward among
+the alternatives in the current row.  As you do this, Emacs highlights
+the current alternative with a special color; type @code{C-@key{SPC}}
+to select the current alternative and use it as input.  The
+alternatives in the row are also numbered; the number appears before
+the alternative.  Typing a digit @var{n} selects the @var{n}th
+alternative of the current row and uses it as input.
+
+  @key{TAB} in these Chinese input methods displays a buffer showing
+all the possible characters at once; then clicking @kbd{Mouse-2} on
+one of them selects that alternative.  The keys @kbd{C-f}, @kbd{C-b},
+@kbd{C-n}, @kbd{C-p}, and digits continue to work as usual, but they
+do the highlighting in the buffer showing the possible characters,
+rather than in the echo area.
+
+  In Japanese input methods, first you input a whole word using
+phonetic spelling; then, after the word is in the buffer, Emacs
+converts it into one or more characters using a large dictionary.  One
+phonetic spelling corresponds to a number of different Japanese words;
+to select one of them, use @kbd{C-n} and @kbd{C-p} to cycle through
 the alternatives.
 
   Sometimes it is useful to cut off input method processing so that the
@@ -342,7 +409,7 @@ characters.  For example, in input method @code{latin-1-postfix}, the
 sequence @kbd{e '} combines to form an @samp{e} with an accent.  What if
 you want to enter them as separate characters?
 
-  One way is to type the accent twice; that is a special feature for
+  One way is to type the accent twice; this is a special feature for
 entering the separate letter and accent.  For example, @kbd{e ' '} gives
 you the two characters @samp{e'}.  Another way is to type another letter
 after the @kbd{e}---something that won't combine with that---and
@@ -356,6 +423,7 @@ is the command @kbd{C-\} (@code{toggle-input-method}) used twice.
 @xref{Select Input Method}.
 @end ifinfo
 
+@cindex incremental search, input method interference
   @kbd{C-\ C-\} is especially useful inside an incremental search,
 because it stops waiting for more characters to combine, and starts
 searching for what you have already entered.
@@ -363,12 +431,13 @@ searching for what you have already entered.
 @vindex input-method-verbose-flag
 @vindex input-method-highlight-flag
   The variables @code{input-method-highlight-flag} and
-@code{input-method-verbose-flag} control how input methods explain what
-is happening.  If @code{input-method-highlight-flag} is non-@code{nil},
-the partial sequence is highlighted in the buffer.  If
-@code{input-method-verbose-flag} is non-@code{nil}, the list of possible
-characters to type next is displayed in the echo area (but not when you
-are in the minibuffer).
+@code{input-method-verbose-flag} control how input methods explain
+what is happening.  If @code{input-method-highlight-flag} is
+non-@code{nil}, the partial sequence is highlighted in the buffer (for
+most input methods---some disable this feature).  If
+@code{input-method-verbose-flag} is non-@code{nil}, the list of
+possible characters to type next is displayed in the echo area (but
+not when you are in the minibuffer).
 
 @cindex Leim package
   Input methods are implemented in the separate Leim package: they are
@@ -405,10 +474,10 @@ Display a list of all the supported input methods.
 @kindex C-x RET C-\
   To choose an input method for the current buffer, use @kbd{C-x
 @key{RET} C-\} (@code{set-input-method}).  This command reads the
-input method name with the minibuffer; the name normally starts with the
+input method name from the minibuffer; the name normally starts with the
 language environment that it is meant to be used with.  The variable
 @code{current-input-method} records which input method is selected.
-  
+
 @findex toggle-input-method
 @kindex C-\
   Input methods use various sequences of ASCII characters to stand for
@@ -421,6 +490,10 @@ method temporarily.  To do this, type @kbd{C-\}
 it prompts for you to specify one.  This has the same effect as using
 @kbd{C-x @key{RET} C-\} to specify an input method.
 
+  When invoked with a numeric argument, as in @kbd{C-u C-\},
+@code{toggle-input-method} always prompts you for an input method,
+suggesting the most recently selected one as the default.
+
 @vindex default-input-method
   Selecting a language environment specifies a default input method for
 use in various buffers.  When you have a default input method, you can
@@ -428,6 +501,26 @@ select it in the current buffer by typing @kbd{C-\}.  The variable
 @code{default-input-method} specifies the default input method
 (@code{nil} means there is none).
 
+  In some language environments, which support several different input
+methods, you might want to use an input method different from the
+default chosen by @code{set-language-environment}.  You can instruct
+Emacs to select a different default input method for a certain
+language environment, if you wish, by using
+@code{set-language-environment-hook} (@pxref{Language Environments,
+set-language-environment-hook}).  For example:
+
+@lisp
+(defun my-chinese-setup ()
+  "Set up my private Chinese environment."
+  (if (equal current-language-environment "Chinese-GB")
+      (setq default-input-method "chinese-tonepy")))
+(add-hook 'set-language-environment-hook 'my-chinese-setup)
+@end lisp
+
+@noindent
+This sets the default input method to be @code{chinese-tonepy}
+whenever you choose a Chinese-GB language environment.
+
 @findex quail-set-keyboard-layout
   Some input methods for alphabetic scripts work by (in effect)
 remapping the keyboard to emulate various keyboard layouts commonly used
@@ -487,10 +580,15 @@ their names usually start with @samp{iso}.  There are also special
 coding systems @code{no-conversion}, @code{raw-text} and
 @code{emacs-mule} which do not convert printing characters at all.
 
+@cindex international files from DOS/Windows systems
   A special class of coding systems, collectively known as
 @dfn{codepages}, is designed to support text encoded by MS-Windows and
 MS-DOS software.  To use any of these systems, you need to create it
-with @kbd{M-x codepage-setup}.  @xref{MS-DOS and MULE}.
+with @kbd{M-x codepage-setup}.  @xref{MS-DOS and MULE}.  After
+creating the coding system for the codepage, you can use it as any
+other coding system.  For example, to visit a file encoded in codepage
+850, type @kbd{C-x @key{RET} c cp850 @key{RET} C-x C-f @var{filename}
+@key{RET}}.
 
   In addition to converting various representations of non-ASCII
 characters, a coding system can perform end-of-line conversion.  Emacs
@@ -512,7 +610,7 @@ Display a list of all the supported coding systems.
 @findex describe-coding-system
   The command @kbd{C-h C} (@code{describe-coding-system}) displays
 information about particular coding systems.  You can specify a coding
-system name as argument; alternatively, with an empty argument, it
+system name as the argument; alternatively, with an empty argument, it
 describes the coding systems currently selected for various purposes,
 both in the current buffer and as the defaults, and the priority list
 for recognizing coding systems (@pxref{Recognize Coding}).
@@ -590,8 +688,11 @@ the usual three variants to specify the kind of end-of-line conversion.
 @node Recognize Coding
 @section Recognizing Coding Systems
 
-  Most of the time, Emacs can recognize which coding system to use for
-any given file---once you have specified your preferences.
+  Emacs tries to recognize which coding system to use for a given text
+as an integral part of reading that text.  (This applies to files
+being read, output from subprocesses, text from X selections, etc.)
+Emacs can select the right coding system automatically most of the
+time---once you have specified your preferences.
 
   Some coding systems can be recognized or distinguished by which byte
 sequences appear in the data.  However, there are coding systems that
@@ -613,17 +714,17 @@ Czech, you probably want Latin-2 to be preferred.  This is one of the
 reasons to specify a language environment.
 
 @findex prefer-coding-system
-  However, you can alter the priority list in detail with the command
-@kbd{M-x prefer-coding-system}.  This command reads the name of a coding
-system from the minibuffer, and adds it to the front of the priority
-list, so that it is preferred to all others.  If you use this command
-several times, each use adds one element to the front of the priority
-list.
+  However, you can alter the coding system priority list in detail
+with the command @kbd{M-x prefer-coding-system}.  This command reads
+the name of a coding system from the minibuffer, and adds it to the
+front of the priority list, so that it is preferred to all others.  If
+you use this command several times, each use adds one element to the
+front of the priority list.
 
   If you use a coding system that specifies the end-of-line conversion
-type, such as @code{iso-8859-1-dos}, what that means is that Emacs
+type, such as @code{iso-8859-1-dos}, what this means is that Emacs
 should attempt to recognize @code{iso-8859-1} with priority, and should
-use DOS end-of-line conversion in case it recognizes @code{iso-8859-1}.
+use DOS end-of-line conversion when it does recognize @code{iso-8859-1}.
 
 @vindex file-coding-system-alist
   Sometimes a file name indicates which coding system to use for the
@@ -649,7 +750,11 @@ the contents of the file: if it sees only carriage-returns, or only
 carriage-return linefeed sequences, then it chooses the end-of-line
 conversion accordingly.  You can inhibit the automatic use of
 end-of-line conversion by setting the variable @code{inhibit-eol-conversion}
-to non-@code{nil}.
+to non-@code{nil}.  If you do that, DOS-style files will be displayed
+with the @samp{^M} characters visible in the buffer; some people
+prefer this to the more subtle @samp{(DOS)} end-of-line type
+indication near the left edge of the mode line (@pxref{Mode Line,
+eol-mnemonic}).
 
 @vindex inhibit-iso-escape-detection
 @cindex escape sequences in files
@@ -669,29 +774,54 @@ the buffer.
   The default value of @code{inhibit-iso-escape-detection} is
 @code{nil}.  We recommend that you not change it permanently, only for
 one specific operation.  That's because many Emacs Lisp source files
-that contain non-ASCII characters are encoded in the coding system
-@code{iso-2022-7bit} in the Emacs distribution, and they won't be
+in the Emacs distribution contain non-ASCII characters encoded in the
+coding system @code{iso-2022-7bit}, and they won't be
 decoded correctly when you visit those files if you suppress the
 escape sequence detection.
 
 @vindex coding
   You can specify the coding system for a particular file using the
-@samp{-*-@dots{}-*-} construct at the beginning of a file, or a local
-variables list at the end (@pxref{File Variables}).  You do this by
-defining a value for the ``variable'' named @code{coding}.  Emacs does
-not really have a variable @code{coding}; instead of setting a variable,
-it uses the specified coding system for the file.  For example,
-@samp{-*-mode: C; coding: latin-1;-*-} specifies use of the Latin-1
-coding system, as well as C mode.  If you specify the coding explicitly
-in the file, that overrides @code{file-coding-system-alist}.
+@w{@samp{-*-@dots{}-*-}} construct at the beginning of a file, or a
+local variables list at the end (@pxref{File Variables}).  You do this
+by defining a value for the ``variable'' named @code{coding}.  Emacs
+does not really have a variable @code{coding}; instead of setting a
+variable, this uses the specified coding system for the file.  For
+example, @samp{-*-mode: C; coding: latin-1;-*-} specifies use of the
+Latin-1 coding system, as well as C mode.  When you specify the coding
+explicitly in the file, that overrides
+@code{file-coding-system-alist}.
 
 @vindex auto-coding-alist
-  The variable @code{auto-coding-alist} is the strongest way to specify
-the coding system for certain patterns of file names; this variable even
-overrides @samp{-*-coding:-*-} tags in the file itself.  Emacs uses this
-feature for tar and archive files, to prevent Emacs from being confused
-by a @samp{-*-coding:-*-} tag in a member of the archive and thinking it
-applies to the archive file as a whole.
+@vindex auto-coding-regexp-alist
+@vindex auto-coding-functions
+  The variables @code{auto-coding-alist},
+@code{auto-coding-regexp-alist} and @code{auto-coding-functions} are
+the strongest way to specify the coding system for certain patterns of
+file names, or for files containing certain patterns; these variables
+even override @samp{-*-coding:-*-} tags in the file itself.  Emacs
+uses @code{auto-coding-alist} for tar and archive files, to prevent it
+from being confused by a @samp{-*-coding:-*-} tag in a member of the
+archive and thinking it applies to the archive file as a whole.
+Likewise, Emacs uses @code{auto-coding-regexp-alist} to ensure that
+RMAIL files, whose names in general don't match any particular
+pattern, are decoded correctly.  One of the builtin
+@code{auto-coding-functions} detects the encoding for XML files.
+
+  If Emacs recognizes the encoding of a file incorrectly, you can
+reread the file using the correct coding system by typing @kbd{C-x
+@key{RET} c @var{coding-system} @key{RET} M-x revert-buffer
+@key{RET}}.  To see what coding system Emacs actually used to decode
+the file, look at the coding system mnemonic letter near the left edge
+of the mode line (@pxref{Mode Line}), or type @kbd{C-h C @key{RET}}.
+
+@findex unify-8859-on-decoding-mode
+  The command @code{unify-8859-on-decoding-mode} enables a mode that
+``unifies'' the Latin alphabets when decoding text.  This works by
+converting all non-ASCII Latin-@var{n} characters to either Latin-1 or
+Unicode characters.  This way it is easier to use various
+Latin-@var{n} alphabets together.  In a future Emacs version we hope
+to move towards full Unicode support and complete unification of
+character sets.
 
 @vindex buffer-file-coding-system
   Once Emacs has chosen a coding system for a buffer, it stores that
@@ -705,14 +835,14 @@ Coding}).
 
   You can insert any possible character into any Emacs buffer, but
 most coding systems can only handle some of the possible characters.
-This means that you can insert characters that cannot be encoded with
-the coding system that will be used to save the buffer.  For example,
-you could start with an ASCII file and insert a few Latin-1 characters
-into it, or or you could edit a text file in Polish encoded in
-@code{iso-8859-2} and add to it translations of several Polish words
-into Russian.  When you save the buffer, Emacs cannot use the current
-value of @code{buffer-file-coding-system}, because the characters you
-added cannot be encoded by that coding system.
+This means that it is possible for you to insert characters that
+cannot be encoded with the coding system that will be used to save the
+buffer.  For example, you could start with an ASCII file and insert a
+few Latin-1 characters into it, or you could edit a text file in
+Polish encoded in @code{iso-8859-2} and add some Russian words to it.
+When you save the buffer, Emacs cannot use the current value of
+@code{buffer-file-coding-system}, because the characters you added
+cannot be encoded by that coding system.
 
   When that happens, Emacs tries the most-preferred coding system (set
 by @kbd{M-x prefer-coding-system} or @kbd{M-x
@@ -720,17 +850,17 @@ set-language-environment}), and if that coding system can safely
 encode all of the characters in the buffer, Emacs uses it, and stores
 its value in @code{buffer-file-coding-system}.  Otherwise, Emacs
 displays a list of coding systems suitable for encoding the buffer's
-contents, and asks to choose one of those coding systems.
+contents, and asks you to choose one of those coding systems.
 
   If you insert the unsuitable characters in a mail message, Emacs
 behaves a bit differently.  It additionally checks whether the
 most-preferred coding system is recommended for use in MIME messages;
-if it isn't, Emacs tells you that the most-preferred coding system is
+if not, Emacs tells you that the most-preferred coding system is
 not recommended and prompts you for another coding system.  This is so
 you won't inadvertently send a message encoded in a way that your
 recipient's mail software will have difficulty decoding.  (If you do
-want to use the most-preferred coding system, you can type its name to
-Emacs prompt anyway.)
+want to use the most-preferred coding system, you can still type its
+name in response to the question.)
 
 @vindex sendmail-coding-system
   When you send a message with Mail mode (@pxref{Sending Mail}), Emacs has
@@ -745,7 +875,7 @@ Emacs encodes outgoing mail using the Latin-1 coding system.
 
 @vindex rmail-decode-mime-charset
   When you get new mail in Rmail, each message is translated
-automatically from the coding system it is written in---as if it were a
+automatically from the coding system it is written inas if it were a
 separate file.  This uses the priority list of coding systems that you
 have specified.  If a MIME message specifies a character set, Rmail
 obeys that specification, unless @code{rmail-decode-mime-charset} is
@@ -766,8 +896,8 @@ system, you can use these commands to specify one:
 
 @table @kbd
 @item C-x @key{RET} f @var{coding} @key{RET}
-Use coding system @var{coding} for the visited file
-in the current buffer.
+Use coding system @var{coding} for saving or revisiting the visited
+file in the current buffer.
 
 @item C-x @key{RET} c @var{coding} @key{RET}
 Specify coding system @var{coding} for the immediately following
@@ -794,12 +924,14 @@ selection---the next one---to or from the window system.
 
 @kindex C-x RET f
 @findex set-buffer-file-coding-system
-  The command @kbd{C-x @key{RET} f} (@code{set-buffer-file-coding-system})
-specifies the file coding system for the current buffer---in other
-words, which coding system to use when saving or rereading the visited
-file.  You specify which coding system using the minibuffer.  Since this
-command applies to a file you have already visited, it affects only the
-way the file is saved.
+  The command @kbd{C-x @key{RET} f}
+(@code{set-buffer-file-coding-system}) sets the file coding system for
+the current buffer---in other words, it says which coding system to
+use when saving or reverting the visited file.  You specify which
+coding system using the minibuffer.  If you specify a coding system
+that cannot handle all of the characters in the buffer, Emacs warns
+you about the troublesome characters when you actually save the
+buffer.
 
 @kindex C-x RET c
 @findex universal-coding-system-argument
@@ -812,17 +944,19 @@ command}.
 
   So if the immediately following command is @kbd{C-x C-f}, for example,
 it reads the file using that coding system (and records the coding
-system for when the file is saved).  Or if the immediately following
+system for when you later save the file).  Or if the immediately following
 command is @kbd{C-x C-w}, it writes the file using that coding system.
-Other file commands affected by a specified coding system include
-@kbd{C-x C-i} and @kbd{C-x C-v}, as well as the other-window variants of
-@kbd{C-x C-f}.
+When you specify the coding system for saving in this way, instead
+of with @kbd{C-x @key{RET} f}, there is no warning if the buffer
+contains characters that the coding system cannot handle.
 
-  @kbd{C-x @key{RET} c} also affects commands that start subprocesses,
-including @kbd{M-x shell} (@pxref{Shell}).
+  Other file commands affected by a specified coding system include
+@kbd{C-x C-i} and @kbd{C-x C-v}, as well as the other-window variants
+of @kbd{C-x C-f}.  @kbd{C-x @key{RET} c} also affects commands that
+start subprocesses, including @kbd{M-x shell} (@pxref{Shell}).
 
-  However, if the immediately following command does not use the coding
-system, then @kbd{C-x @key{RET} c} ultimately has no effect.
+  If the immediately following command does not use the coding system,
+then @kbd{C-x @key{RET} c} ultimately has no effect.
 
   An easy way to visit a file with no conversion is with the @kbd{M-x
 find-file-literally} command.  @xref{Visiting}.
@@ -862,7 +996,19 @@ translation of keyboard input is useful for terminals with keys that
 send non-ASCII graphic characters---for example, some terminals designed
 for ISO Latin-1 or subsets of it.
 
-  By default, keyboard input is not translated at all.
+  By default, keyboard input is translated based on your system locale
+setting.  If your terminal does not really support the encoding
+implied by your locale (for example, if you find it inserts a
+non-ASCII character if you type @kbd{M-i}), you will need to set
+@code{keyboard-coding-system} to @code{nil} to turn off encoding.
+You can do this by putting
+
+@lisp
+(set-keyboard-coding-system nil)
+@end lisp
+
+@noindent
+in your @file{~/.emacs} file.
 
   There is a similarity between using a coding system translation for
 keyboard input, and using an input method: both define sequences of
@@ -897,6 +1043,7 @@ corresponding buffer.
 current language environment.
 
 @vindex file-name-coding-system
+@cindex file names with non-ASCII characters
   The variable @code{file-name-coding-system} specifies a coding system
 to use for encoding file names.  If you set the variable to a coding
 system name (as a Lisp symbol or a string), Emacs encodes file names
@@ -920,20 +1067,23 @@ name, or it may get an error.  If such a problem happens, use @kbd{C-x
 C-w} to specify a new file name for that buffer.
 
 @vindex locale-coding-system
+@cindex decoding non-ASCII keyboard input on X
   The variable @code{locale-coding-system} specifies a coding system
 to use when encoding and decoding system strings such as system error
-messages and @code{format-time-string} formats and time stamps.  You
-should choose a coding system that is compatible with the underlying
-system's text representation, which is normally specified by one of
-the environment variables @env{LC_ALL}, @env{LC_CTYPE}, and
-@env{LANG}.  (The first one whose value is nonempty is the one that
-determines the text representation.)
+messages and @code{format-time-string} formats and time stamps.  That
+coding system is also used for decoding non-ASCII keyboard input on X
+Window systems.  You should choose a coding system that is compatible
+with the underlying system's text representation, which is normally
+specified by one of the environment variables @env{LC_ALL},
+@env{LC_CTYPE}, and @env{LANG}.  (The first one, in the order
+specified above, whose value is nonempty is the one that determines
+the text representation.)
 
 @node Fontsets
 @section Fontsets
 @cindex fontsets
 
-  A font for X typically defines shapes for one alphabet or script.
+  A font for X typically defines shapes for a single alphabet or script.
 Therefore, displaying the entire range of scripts that Emacs supports
 requires a collection of many fonts.  In Emacs, such a collection is
 called a @dfn{fontset}.  A fontset is defined by a list of fonts, each
@@ -953,7 +1103,7 @@ additional font support.}
 and the @dfn{startup fontset}.  The standard fontset is most likely to
 have fonts for a wide variety of non-ASCII characters; however, this is
 not the default for Emacs to use.  (By default, Emacs tries to find a
-font which has bold and italic variants.)  You can specify use of the
+font that has bold and italic variants.)  You can specify use of the
 standard fontset with the @samp{-fn} option, or with the @samp{Font} X
 resource (@pxref{Font X}).  For example,
 
@@ -967,14 +1117,6 @@ specifies a font that does not exist on your system, then it cannot
 display that character properly.  It will display that character as an
 empty box instead.
 
-@vindex highlight-wrong-size-font
-  The fontset height and width are determined by the ASCII characters
-(that is, by the font used for ASCII characters in that fontset).  If
-another font in the fontset has a different height, or a different
-width, then characters assigned to that font are clipped to the
-fontset's size.  If @code{highlight-wrong-size-font} is non-@code{nil},
-a box is displayed around these wrong-size characters as well.
-
 @node Defining Fontsets
 @section Defining fontsets
 
@@ -1021,7 +1163,7 @@ window frame:
   With the X resource @samp{Emacs.Font}, you can specify a fontset name
 just like an actual font name.  But be careful not to specify a fontset
 name in a wildcard resource like @samp{Emacs*Font}---that wildcard
-specification applies to various other purposes, such as menus, and
+specification matches various other resources, such as for menus, and
 menus cannot handle fontsets.
 
   You can specify additional fontsets using X resources named
@@ -1056,7 +1198,8 @@ that describe the character set.  For the ASCII character font,
 collapses them into a single wildcard.  This is to prevent use of
 auto-scaled fonts.  Fonts made by scaling larger fonts are not usable
 for editing, and scaling a smaller font is not useful because it is
-better to use the smaller font in its own size, which Emacs does.
+better to use the smaller font in its own size, which is what Emacs
+does.
 
   Thus if @var{fontpattern} is this,
 
@@ -1104,9 +1247,9 @@ call this function explicitly to create a fontset.
 @node Undisplayable Characters
 @section Undisplayable Characters
 
-  Your terminal may be unable to display some non-@sc{ascii}
-characters.  Most non-windowing terminals can only use a single
-character set (use the variable @code{default-terminal-coding-system}
+  There may be a some non-ASCII characters that your terminal cannot
+display.  Most non-windowing terminals support just a single character
+set (use the variable @code{default-terminal-coding-system}
 (@pxref{Specify Coding}) to tell Emacs which one); characters which
 can't be encoded in that coding system are displayed as @samp{?} by
 default.
@@ -1116,14 +1259,15 @@ you may not have fonts installed for all of them; characters that have
 no font appear as a hollow box.
 
   If you use Latin-1 characters but your terminal can't display
-Latin-1, you can arrange to display mnemonic @sc{ascii} sequences
+Latin-1, you can arrange to display mnemonic ASCII sequences
 instead, e.g.@: @samp{"o} for o-umlaut.  Load the library
 @file{iso-ascii} to do this.
 
+@vindex latin1-display
   If your terminal can display Latin-1, you can display characters
 from other European character sets using a mixture of equivalent
-Latin-1 characters and @sc{ascii} mnemonics.  Use the Custom option
-@code{latin1-display} to enable this.  The mnemonic @sc{ascii}
+Latin-1 characters and ASCII mnemonics.  Use the Custom option
+@code{latin1-display} to enable this.  The mnemonic ASCII
 sequences mostly correspond to those of the prefix input methods.
 
 @node Single-Byte Character Support
@@ -1134,13 +1278,13 @@ sequences mostly correspond to those of the prefix input methods.
 @cindex ISO Latin character sets
 @cindex Unibyte operation
   The ISO 8859 Latin-@var{n} character sets define character codes in
-the range 160 to 255 to handle the accented letters and punctuation
-needed by various European languages (and some non-European ones).
-If you disable multibyte
-characters, Emacs can still handle @emph{one} of these character codes
-at a time.  To specify @emph{which} of these codes to use, invoke
-@kbd{M-x set-language-environment} and specify a suitable language
-environment such as @samp{Latin-@var{n}}.
+the range 0240 to 0377 octal (160 to 255 decimal) to handle the
+accented letters and punctuation needed by various European languages
+(and some non-European ones).  If you disable multibyte characters,
+Emacs can still handle @emph{one} of these character codes at a time.
+To specify @emph{which} of these codes to use, invoke @kbd{M-x
+set-language-environment} and specify a suitable language environment
+such as @samp{Latin-@var{n}}.
 
   For more information about unibyte operation, see @ref{Enabling
 Multibyte}.  Note particularly that you probably want to ensure that
@@ -1166,7 +1310,7 @@ them yet.
 
 @findex standard-display-8bit
 @cindex 8-bit display
-  Normally non-ISO-8859 characters (between characters 128 and 159
+  Normally non-ISO-8859 characters (decimal codes between 128 and 159
 inclusive) are displayed as octal escapes.  You can change this for
 non-standard ``extended'' versions of ISO-8859 character sets by using the
 function @code{standard-display-8bit} in the @code{disp-table} library.
@@ -1177,8 +1321,9 @@ characters:
 @itemize @bullet
 @cindex 8-bit input
 @item
-If your keyboard can generate character codes 128 and up, representing
-non-ASCII you can type those character codes directly.
+If your keyboard can generate character codes 128 (decimal) and up,
+representing non-ASCII characters, you can type those character codes
+directly.
 
 On a windowing terminal, you should not need to do anything special to
 use these keys; they should simply work.  On a text-only terminal, you
@@ -1221,9 +1366,45 @@ command names.
 @cindex ISO Accents mode
 @findex iso-accents-mode
 @cindex Latin-1, Latin-2 and Latin-3 input mode
-For Latin-1, Latin-2 and Latin-3, @kbd{M-x iso-accents-mode} installs
-a minor mode which works much like the @code{latin-1-prefix} input
-method does not depend on having the input methods installed.  This
+For Latin-1, Latin-2 and Latin-3, @kbd{M-x iso-accents-mode} enables
+a minor mode that works much like the @code{latin-1-prefix} input
+method, but does not depend on having the input methods installed.  This
 mode is buffer-local.  It can be customized for various languages with
 @kbd{M-x iso-accents-customize}.
 @end itemize
+
+@node Charsets
+@section Charsets
+@cindex charsets
+
+  Emacs groups all supported characters into disjoint @dfn{charsets}.
+Each character code belongs to one and only one charset.  For
+historical reasons, Emacs typically divides an 8-bit character code
+for an extended version of ASCII into two charsets: ASCII, which
+covers the codes 0 through 127, plus another charset which covers the
+``right-hand part'' (the codes 128 and up).  For instance, the
+characters of Latin-1 include the Emacs charset @code{ascii} plus the
+Emacs charset @code{latin-iso8859-1}.
+
+  Emacs characters belonging to different charsets may look the same,
+but they are still different characters.  For example, the letter
+@samp{o} with acute accent in charset @code{latin-iso8859-1}, used for
+Latin-1, is different from the letter @samp{o} with acute accent in
+charset @code{latin-iso8859-2}, used for Latin-2.
+
+@findex list-charset-chars
+@cindex characters in a certain charset
+@findex describe-character-set
+  There are two commands for obtaining information about Emacs
+charsets.  The command @kbd{M-x list-charset-chars} prompts for a name
+of a character set, and displays all the characters in that character
+set.  The command @kbd{M-x describe-character-set} prompts for a
+charset name and displays information about that charset, including
+its internal representation within Emacs.
+
+  To find out which charset a character in the buffer belongs to,
+put point before it and type @kbd{C-u C-x =}.
+
+@ignore
+   arch-tag: 310ba60d-31ef-4ce7-91f1-f282dd57b6b3
+@end ignore