# HG changeset patch # User Paul Eggert # Date 940667176 0 # Node ID 068f7ad41d4043f8fb0ae0ce84854fedb0ac529a # Parent ca31ffbed3185e339b3a3bad760d71645bc36212 Describe new functions and variables for locales. diff -r ca31ffbed318 -r 068f7ad41d40 etc/NEWS --- a/etc/NEWS Fri Oct 22 22:51:33 1999 +0000 +++ b/etc/NEWS Sat Oct 23 08:26:16 1999 +0000 @@ -377,6 +377,10 @@ derived from sh and rc. The indentation style is customizeable, and sh-script can attempt to "learn" the current buffer's style. +** Emacs now attempts to determine the initial language environment +and preferred and locale coding systems systematically from the +LC_ALL, LC_CTYPE, and LANG environment variables during startup. + ** New language environments `Latin-8' and `Latin-9'. These correspond respectively to the ISO character sets 8859-14 (Celtic) and 8859-15 (updated Latin-1, with the Euro sign). There is @@ -483,6 +487,24 @@ When you add a new item, please add it without either +++ or --- so I will know I still need to look at it -- rms. +** New functions and variables for locales. + +The new variable `locale-coding-system' specifies how to encode and +decode strings passed to low-level message functions like strerror and +time functions like strftime. The new variables `messages-locale' and +`time-locale' give the system locales to be used during the next +invocations of these two types of functions; the new variables +`previous-messages-locale' and `previous-time-locale' give the locales +most recently used. + +The new function `set-locale-environment' sets the language +environment, preferred coding system, and locale coding system from +the system locale as specified by the LC_ALL, LC_CTYPE, and LANG +environment variables. It is normally invoked during startup. It +uses the new variables `locale-language-names', +`locale-charset-language-names', and `locale-preferred-coding-systems' +to make its decisions. + ** syntax tables now understand nested comments. To declare a comment syntax as allowing nesting, just add an `n' modifier to either of the characters of the comment end and the comment diff -r ca31ffbed318 -r 068f7ad41d40 man/cmdargs.texi --- a/man/cmdargs.texi Fri Oct 22 22:51:33 1999 +0000 +++ b/man/cmdargs.texi Sat Oct 23 08:26:16 1999 +0000 @@ -338,14 +338,19 @@ @item INFOPATH A colon-separated list of directories holding info files. Setting this variable overrides the setting in @file{paths.el} when Emacs was built. -@item LANG -@itemx LC_ALL +@item LC_ALL @itemx LC_CTYPE -The user's preferred locale. A locale name which contains -@samp{8859-@var{n}}, @samp{8859_@var{n}} or @samp{8859@var{n}}, where -@var{n} is between 1 and 4, automatically specifies the -@samp{Latin-@var{n}} language environment when Emacs starts up. If -@var{n} is 9, that specifies @samp{Latin-5}. +@itemx LANG +@findex set-locale-environment +@vindex locale-language-names +@vindex locale-charset-language-names +@vindex locale-preferred-coding-systems +The user's locale, matched by @code{set-locale-environment} against +entries in @code{locale-language-names}, +@code{locale-charset-language-names}, and +@code{locale-preferred-coding-systems} to select a default language +environment and coding system. The first of these environment variables +with a nonempty value specifies the locale. @item LOGNAME The user's login name. See also @code{USER}. @item MAIL diff -r ca31ffbed318 -r 068f7ad41d40 man/mule.texi --- a/man/mule.texi Fri Oct 22 22:51:33 1999 +0000 +++ b/man/mule.texi Sat Oct 23 08:26:16 1999 +0000 @@ -9,23 +9,24 @@ @cindex encoding of characters @cindex Chinese +@cindex Cyrillic @cindex Devanagari @cindex Hindi @cindex Marathi -@cindex Ethiopian +@cindex Ethiopic @cindex Greek +@cindex Hebrew @cindex IPA @cindex Japanese @cindex Korean @cindex Lao -@cindex Russian @cindex Thai @cindex Tibetan @cindex Vietnamese Emacs supports a wide variety of international character sets, including European variants of the Latin alphabet, as well as Chinese, -Devanagari (Hindi and Marathi), Ethiopian, Greek, IPA, Japanese, Korean, -Lao, Russian, Thai, Tibetan, and Vietnamese scripts. These features +Cyrillic, Devanagari (Hindi and Marathi), Ethiopic, Greek, Hebrew, IPA, +Japanese, Korean, Lao, Thai, Tibetan, and Vietnamese scripts. These features have been merged from the modified version of Emacs known as MULE (for ``MULti-lingual Enhancement to GNU Emacs'') @@ -147,23 +148,54 @@ Each language environment also specifies a default input method. @findex set-language-environment - The way to select a language environment is with the command @kbd{M-x +@vindex current-language-environment + To select a language environment, customize the option +@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: @quotation -Chinese-BIG5, Chinese-CNS, Chinese-GB, Cyrillic-Alternativnyj, -Cyrillic-ISO, Cyrillic-KOI8, Devanagari, English, Ethiopic, Greek, -Hebrew, Japanese, Korean, Lao, Latin-1, Latin-2, Latin-3, Latin-4, -Latin-5, Thai, Tibetan, and Vietnamese. +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, Latin-9, Romanian, Slovak, Slovenian, Thai, +Tibetan, Turkish, and Vietnamese. @end quotation +@findex set-locale-environment +@vindex locale-language-names +@vindex locale-charset-language-names Some operating systems let you specify the language you are using by -setting locale environment variables. Emacs handles one common special -case of this: if your locale name for character types contains the -string @samp{8859-@var{n}}, Emacs automatically selects the -corresponding language environment. +setting the locale environment variables @env{LC_ALL}, @env{LC_CTYPE}, +and @env{LANG}; the first of these which is nonempty specifies your +locale. Emacs handles this during startup by invoking the +@code{set-locale-environment} function, which matches your locale +against entries in the value of the variable +@code{locale-language-names} and selects the corresponding language +environment if a match is found. But if your locale also matches an +entry in the variable @code{locale-charset-language-names}, this entry +is preferred if its character set disagrees. For example, suppose the +locale @samp{en_GB.ISO8859-15} matches @code{"Latin-1"} in +@code{locale-language-names} and @code{"Latin-9"} in +@code{locale-charset-language-names}; since these two language +environments' character sets disagree, Emacs uses @code{"Latin-9"}. + +@findex set-locale-environment +@vindex locale-preferred-coding-systems + The @code{set-locale-environment} function normally uses the preferred +coding system established by the language environment to decode system +messages. But if your locale matches an entry in the variable +@code{locale-preferred-coding-systems}, Emacs uses the corresponding +coding system instead. For example, if the locale @samp{ja_JP.PCK} +matches @code{japanese-shift-jis} in +@code{locale-preferred-coding-systems}, Emacs uses that encoding even +though it might normally use @code{japanese-iso-8bit}. + + The environment chosen from the locale when Emacs starts is +overidden by any explicit use of the command +@code{set-language-environment} or customization of +@code{current-language-environment} in your init file. @kindex C-h L @findex describe-language-environment @@ -750,6 +782,15 @@ 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 + 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. This +coding system should be compatible with the underlying system's coding +system, which is normally specified by the first environment variable in +the list @env{LC_ALL}, @env{LC_CTYPE}, @env{LANG} whose value is +nonempty. + @node Fontsets @section Fontsets @cindex fontsets