From: Gerd Moellmann Date: Wed, 21 Mar 2001 10:19:37 +0000 (+0000) Subject: (set-locale-environment): Set X-Git-Tag: emacs-pretest-21.0.101~228 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7008ccaca15bf9a6558b9ffa87cf145d3d18a183;p=emacs.git (set-locale-environment): Set system-messages-locale and system-time-locale, but only if the caller specifies a non-nil locale name. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 80b85ef1ad8..b3aaae58374 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,11 +1,17 @@ +2001-03-21 Paul Eggert + + * international/mule-cmds.el (set-locale-environment): Set + system-messages-locale and system-time-locale, but only if the + caller specifies a non-nil locale name. + 2001-03-20 John Wiegley * calendar/calendar.el (nongregorian-diary-listing-hook): Added :options to cover the possible values. - (nongregorian-diary-marking-hook): ditto + (nongregorian-diary-marking-hook): Ditto * cal-bahai.el, cal-menu.el, calendar.el, diary-lib.el, - holidays.el: Added support for the Baha'i calendar system. + * holidays.el: Added support for the Baha'i calendar system. * pcvs-util.el (cvs-bury-buffer): Bodiless `if' statements cause problems for the interpreter. diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index 8f011b49008..8df321af123 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -2,7 +2,7 @@ ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. ;; Licensed to the Free Software Foundation. -;; Copyright (C) 2000 Free Software Foundation, Inc. +;; Copyright (C) 2000, 2001 Free Software Foundation, Inc. ;; Keywords: mule, multilingual @@ -1898,57 +1898,67 @@ See also `locale-charset-language-names', `locale-language-names', (setq files (cdr files))) (car files))) - (unless locale-name - ;; Use the first of these three environment variables - ;; that has a nonempty value. - (let ((vars '("LC_ALL" "LC_CTYPE" "LANG"))) - (while (and vars (not (setq locale-name (getenv (car vars))))) - (setq vars (cdr vars))))) - - (when locale-name - - ;; Translate "swedish" into "sv_SE.ISO8859-1", and so on, - ;; using the translation file that many systems have. - (when locale-translation-file-name - (with-temp-buffer - (insert-file-contents locale-translation-file-name) - (when (re-search-forward - (concat "^" (regexp-quote locale-name) ":?[ \t]+") nil t) - (setq locale-name (buffer-substring (point) (line-end-position)))))) - - (setq locale-name (downcase locale-name)) - - (let ((language-name - (locale-name-match locale-name locale-language-names)) - (charset-language-name - (locale-name-match locale-name locale-charset-language-names)) - (coding-system - (locale-name-match locale-name locale-preferred-coding-systems))) - - (if (and charset-language-name - (not - (equal (get-language-info language-name 'charset) - (get-language-info charset-language-name 'charset)))) - (setq language-name charset-language-name)) - - (when language-name - - ;; Set up for this character set. This is now the right way - ;; to do it for both unibyte and multibyte modes. - (set-language-environment language-name) - - ;; If default-enable-multibyte-characters is nil, - ;; we are using single-byte characters, - ;; so the display table and terminal coding system are irrelevant. - (when default-enable-multibyte-characters - (set-display-table-and-terminal-coding-system language-name)) - - (setq locale-coding-system - (car (get-language-info language-name 'coding-priority)))) - - (when coding-system - (prefer-coding-system coding-system) - (setq locale-coding-system coding-system))))) + (let ((locale locale-name)) + + (unless locale + ;; Use the first of these three environment variables + ;; that has a nonempty value. + (let ((vars '("LC_ALL" "LC_CTYPE" "LANG"))) + (while (and vars (not (setq locale (getenv (car vars))))) + (setq vars (cdr vars))))) + + (when locale + + ;; Translate "swedish" into "sv_SE.ISO8859-1", and so on, + ;; using the translation file that many systems have. + (when locale-translation-file-name + (with-temp-buffer + (insert-file-contents locale-translation-file-name) + (when (re-search-forward + (concat "^" (regexp-quote locale) ":?[ \t]+") nil t) + (setq locale (buffer-substring (point) (line-end-position)))))) + + ;; Leave the system locales alone if the caller did not specify + ;; an explicit locale name, as their defaults are set from + ;; LC_MESSAGES and LC_TIME, not LC_CTYPE, and the user might not + ;; want to set them to the same value as LC_CTYPE. + (when locale-name + (setq system-messages-locale locale) + (setq system-time-locale locale)) + + (setq locale (downcase locale)) + + (let ((language-name + (locale-name-match locale locale-language-names)) + (charset-language-name + (locale-name-match locale locale-charset-language-names)) + (coding-system + (locale-name-match locale locale-preferred-coding-systems))) + + (if (and charset-language-name + (not + (equal (get-language-info language-name 'charset) + (get-language-info charset-language-name 'charset)))) + (setq language-name charset-language-name)) + + (when language-name + + ;; Set up for this character set. This is now the right way + ;; to do it for both unibyte and multibyte modes. + (set-language-environment language-name) + + ;; If default-enable-multibyte-characters is nil, + ;; we are using single-byte characters, + ;; so the display table and terminal coding system are irrelevant. + (when default-enable-multibyte-characters + (set-display-table-and-terminal-coding-system language-name)) + + (setq locale-coding-system + (car (get-language-info language-name 'coding-priority)))) + + (when coding-system + (prefer-coding-system coding-system) + (setq locale-coding-system coding-system)))))) ;;; Charset property