]> code.delx.au - gnu-emacs/blobdiff - man/mule.texi
(clipboard_sequence_fn): New variable.
[gnu-emacs] / man / mule.texi
index cd811722add7d5f62201320d96a276c6e5a3a665..ccba75e93278deaa3eb813d18b6f632dbab7f4c6 100644 (file)
@@ -75,7 +75,9 @@ 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}.
+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.
@@ -98,6 +100,7 @@ C-x 8}.
 * 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 Chars
@@ -132,28 +135,6 @@ 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
 
@@ -251,20 +232,22 @@ 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, 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, and Vietnamese.
+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
@@ -297,12 +280,13 @@ 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.
+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
-@code{set-locale-environment} function afterwards to re-adjust the
+@code{set-locale-environment} function afterwards to readjust the
 language environment from the new locale.
 
 @vindex locale-preferred-coding-systems
@@ -363,9 +347,9 @@ 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 allows you to type characters that your
-keyboard doesn't support directly.  This is how the Greek and Russian
-input methods work.
+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
@@ -385,8 +369,8 @@ mapped into one syllable sign.
 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).  One phonetic spelling typically
-corresponds to many different Chinese characters.  You select the one
+@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.
 
@@ -408,9 +392,9 @@ 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 also.  When this
-buffer is visible, @kbd{C-n} and @kbd{C-p} move the current
-alternative to a different row.
+@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
@@ -493,7 +477,7 @@ Display a list of all the supported input methods.
 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
@@ -730,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 this means is that Emacs
 should attempt to recognize @code{iso-8859-1} with priority, and should
-use DOS end-of-line conversion if 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
@@ -801,25 +785,27 @@ escape sequence detection.
 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
+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.  If you specify the coding
+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
 @vindex auto-coding-regexp-alist
-  The variables @code{auto-coding-alist} and
-@code{auto-coding-regexp-alist} 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
+@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.
+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
@@ -828,6 +814,15 @@ reread the file using the correct coding system by typing @kbd{C-x
 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
 coding system in @code{buffer-file-coding-system} and uses that coding
@@ -844,11 +839,10 @@ 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 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.
+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
@@ -861,7 +855,7 @@ 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
@@ -902,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
@@ -930,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
@@ -948,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}.
@@ -998,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
@@ -1057,14 +1067,17 @@ 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, in the order specified above, 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
@@ -1104,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
 
@@ -1242,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.
@@ -1254,15 +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
@@ -1367,3 +1372,35 @@ 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 =}.