]> code.delx.au - gnu-emacs/blobdiff - lisp/international/mule-cmds.el
Merged from emacs@sv.gnu.org
[gnu-emacs] / lisp / international / mule-cmds.el
index 336ec40325d3031fd49b484832199cc571fb2863..8e63729b7a5c17beaf87f0d03798b8a494398ba9 100644 (file)
@@ -278,7 +278,7 @@ wrong, use this command again to toggle back to the right mode."
                       buffer-file-coding-system)))
      (list (read-coding-system
            (if default
-               (format "Coding system for following command (default, %s): " default)
+               (format "Coding system for following command (default %s): " default)
              "Coding system for following command: ")
            default))))
   (let* ((keyseq (read-key-sequence
@@ -616,7 +616,7 @@ or nil if all characters are encodable."
   (interactive
    (list (let ((default (or buffer-file-coding-system 'us-ascii)))
           (read-coding-system
-           (format "Coding-system (default, %s): " default)
+           (format "Coding-system (default %s): " default)
            default))))
   (let ((pos (unencodable-char-position (point) (point-max) coding-system)))
     (if pos
@@ -1126,6 +1126,13 @@ For a list of useful values for KEY and their meanings,
 see `language-info-alist'."
   (if (symbolp lang-env)
       (setq lang-env (symbol-name lang-env)))
+  (set-language-info-internal lang-env key info)
+  (if (equal lang-env current-language-environment)
+      (set-language-environment lang-env)))
+
+(defun set-language-info-internal (lang-env key info)
+  "Internal use only.
+Arguments are the same as `set-language-info'."
   (let (lang-slot key-slot)
     (setq lang-slot (assoc lang-env language-info-alist))
     (if (null lang-slot)               ; If no slot for the language, add it.
@@ -1196,9 +1203,11 @@ in the European submenu in each of those two menus."
     (define-key-after setup-map (vector (intern lang-env))
       (cons lang-env 'setup-specified-language-environment) t)
 
-    (while alist
-      (set-language-info lang-env (car (car alist)) (cdr (car alist)))
-      (setq alist (cdr alist)))))
+    (dolist (elt alist)
+      (set-language-info-internal lang-env (car elt) (cdr elt)))
+    
+    (if (equal lang-env current-language-environment)
+       (set-language-environment lang-env))))
 
 (defun read-language-name (key prompt &optional default)
   "Read a language environment name which has information for KEY.
@@ -1490,7 +1499,7 @@ which marks the variable `default-input-method' as set for Custom buffers."
   "Describe input method INPUT-METHOD."
   (interactive
    (list (read-input-method-name
-         "Describe input method (default, current choice): ")))
+         "Describe input method (default current choice): ")))
   (if (and input-method (symbolp input-method))
       (setq input-method (symbol-name input-method)))
   (help-setup-xref (list #'describe-input-method
@@ -1789,7 +1798,9 @@ The default status is as follows:
 (defun set-display-table-and-terminal-coding-system (language-name &optional coding-system display)
   "Set up the display table and terminal coding system for LANGUAGE-NAME."
   (let ((coding (get-language-info language-name 'unibyte-display)))
-    (if coding
+    (if (and coding
+            (or (not coding-system)
+                (coding-system-equal coding coding-system)))
        (standard-display-european-internal)
       ;; The following 2 lines undo the 8-bit display that we set up
       ;; in standard-display-european-internal, which see.  This is in
@@ -1810,7 +1821,7 @@ which is the name of a language environment.  For example, \"Latin-1\"
 specifies the character set for the major languages of Western Europe."
   (interactive (list (read-language-name
                      nil
-                     "Set language environment (default, English): ")))
+                     "Set language environment (default English): ")))
   (if language-name
       (if (symbolp language-name)
          (setq language-name (symbol-name language-name)))
@@ -1867,16 +1878,18 @@ specifies the character set for the major languages of Western Europe."
            (load syntax nil t))
        ;; No information for syntax and case.  Reset to the defaults.
        (let ((syntax-table (standard-syntax-table))
-             (case-table (standard-case-table))
+             (standard-table (standard-case-table))
+             (case-table (make-char-table 'case-table))
              (ch (if (eq window-system 'pc) 128 160)))
          (while (< ch 256)
            (modify-syntax-entry ch " " syntax-table)
-           (aset case-table ch ch)
            (setq ch (1+ ch)))
+         (dotimes (i 128)
+           (aset case-table i (aref standard-table i)))
          (set-char-table-extra-slot case-table 0 nil)
          (set-char-table-extra-slot case-table 1 nil)
-         (set-char-table-extra-slot case-table 2 nil))
-       (set-standard-case-table (standard-case-table))
+         (set-char-table-extra-slot case-table 2 nil)
+         (set-standard-case-table case-table))
        (let ((list (buffer-list)))
          (while list
            (with-current-buffer (car list)
@@ -1901,7 +1914,6 @@ specifies the character set for the major languages of Western Europe."
     (if (functionp func)
        (funcall func)))
   (if (and utf-translate-cjk-mode
-          utf-translate-cjk-lang-env
           (not (eq utf-translate-cjk-lang-env language-name))
           (catch 'tag
             (dolist (charset (get-language-info language-name 'charset))
@@ -1987,7 +1999,7 @@ of `buffer-file-coding-system' set by this function."
   (interactive
    (list (read-language-name
          'documentation
-         "Describe language environment (default, current choice): ")))
+         "Describe language environment (default current choice): ")))
   (if (null language-name)
       (setq language-name current-language-environment))
   (if (or (null language-name)
@@ -2015,7 +2027,7 @@ of `buffer-file-coding-system' set by this function."
              (l (copy-sequence input-method-alist)))
          (insert "Input methods")
          (when input-method
-           (insert " (default, " input-method ")")
+           (insert " (default " input-method ")")
            (setq input-method (assoc input-method input-method-alist))
            (setq l (cons input-method (delete input-method l))))
          (insert ":\n")
@@ -2128,7 +2140,7 @@ of `buffer-file-coding-system' set by this function."
     ;; That's actually what the GNU locales define, modulo things like
     ;; en_IN -- fx.
     ("en_IN" "English" utf-8) ; glibc uses utf-8 for English in India
-    ("en" . "Latin-1") ; English
+    ("en" "English" iso-8859-1) ; English
     ("eo" . "Latin-3") ; Esperanto
     ("es" "Spanish" iso-8859-1)
     ("et" . "Latin-1") ; Estonian
@@ -2428,7 +2440,8 @@ See also `locale-charset-language-names', `locale-language-names',
   ;; to a system without X.
   (setq locale-translation-file-name
        (let ((files
-              '("/usr/lib/X11/locale/locale.alias" ; e.g. X11R6.4
+              '("/usr/share/X11/locale/locale.alias" ; e.g. X11R7
+                "/usr/lib/X11/locale/locale.alias" ; e.g. X11R6.4
                 "/usr/X11R6/lib/X11/locale/locale.alias" ; XFree86, e.g. RedHat 4.2
                 "/usr/openwin/lib/locale/locale.alias" ; e.g. Solaris 2.6
                 ;;
@@ -2448,7 +2461,7 @@ See also `locale-charset-language-names', `locale-language-names',
       (let ((vars '("LC_ALL" "LC_CTYPE" "LANG")))
        (while (and vars
                    (= 0 (length locale))) ; nil or empty string
-         (setq locale (server-getenv (pop vars))))))
+         (setq locale (getenv (pop vars) display)))))
 
     (unless locale
       ;; The two tests are kept separate so the byte-compiler sees
@@ -2561,7 +2574,7 @@ See also `locale-charset-language-names', `locale-language-names',
       ;; Mac OS X's Terminal.app by default uses utf-8 regardless of
       ;; the locale.
       (when (and (null window-system)
-                (equal (server-getenv "TERM_PROGRAM") "Apple_Terminal"))
+                (equal (getenv "TERM_PROGRAM" display) "Apple_Terminal"))
        (set-terminal-coding-system 'utf-8)
        (set-keyboard-coding-system 'utf-8)))
 
@@ -2579,7 +2592,7 @@ See also `locale-charset-language-names', `locale-language-names',
              (setq ps-paper-type 'a4)))
          (let ((vars '("LC_ALL" "LC_PAPER" "LANG")))
            (while (and vars (= 0 (length locale)))
-             (setq locale (server-getenv (pop vars)))))
+             (setq locale (getenv (pop vars) display))))
          (when locale
            ;; As of glibc 2.2.5, these are the only US Letter locales,
            ;; and the rest are A4.
@@ -2658,8 +2671,8 @@ It can be retrieved with `(get-char-code-property CHAR PROPNAME)'."
    (if (and coding-system (eq (coding-system-type coding-system) 2))
        ;; Try to get a pretty description for ISO 2022 escape sequences.
        (function (lambda (x) (or (cdr (assq x iso-2022-control-alist))
-                                (format "0x%02X" x))))
-     (function (lambda (x) (format "0x%02X" x))))
+                                (format "#x%02X" x))))
+     (function (lambda (x) (format "#x%02X" x))))
    str " "))
 
 (defun encode-coding-char (char coding-system)