Mercurial > hg > xemacs-beta
comparison lisp/mule/mule-cmds.el @ 5118:e0db3c197671 ben-lisp-object
merge up to latest default branch, doesn't compile yet
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Sat, 26 Dec 2009 21:18:49 -0600 |
parents | 02b7c7189041 |
children | b3ea9c582280 |
comparison
equal
deleted
inserted
replaced
5117:3742ea8250b5 | 5118:e0db3c197671 |
---|---|
70 "Display the HELLO file which list up many languages and characters." | 70 "Display the HELLO file which list up many languages and characters." |
71 (interactive) | 71 (interactive) |
72 ;; We have to decode the file in any environment. | 72 ;; We have to decode the file in any environment. |
73 (let ((coding-system-for-read 'iso-2022-7bit)) | 73 (let ((coding-system-for-read 'iso-2022-7bit)) |
74 (find-file-read-only (expand-file-name "HELLO" data-directory)))) | 74 (find-file-read-only (expand-file-name "HELLO" data-directory)))) |
75 | |
76 (defvar system-type-file-name-coding | |
77 '((darwin . utf-8)) | |
78 "A map from values of `system-type' to invariant file name coding systems. | |
79 Used if a give system type does not vary in the coding system it uses for | |
80 file names; otherwise, `language-info-alist' is consulted for this | |
81 information. This affects the `file-name' coding system alias, but not the | |
82 `file-name-coding-system' variable, which in practice is mostly ignored. ") | |
75 | 83 |
76 | 84 |
77 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 85 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
78 ;;; Language Support Functions ;;; | 86 ;;; Language Support Functions ;;; |
79 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 87 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
215 LANG if there's no SUBLANG. The return value will be | 223 LANG if there's no SUBLANG. The return value will be |
216 the canonicalized locale, in proper CLIB form.) | 224 the canonicalized locale, in proper CLIB form.) |
217 | 225 |
218 If there is no value for this property, the MS Windows | 226 If there is no value for this property, the MS Windows |
219 locale is assumed to have the same name as the | 227 locale is assumed to have the same name as the |
220 language environment." | 228 language environment. |
229 | |
230 invalid-sequence-coding-system | |
231 VALUE is a fixed-width 8-bit coding system used to | |
232 display Unicode error sequences (using a face to make | |
233 it clear that the data is invalid). In Western Europe | |
234 and the Americas this is normally windows-1252; in | |
235 Russia and the former Soviet Union koi8-ru or | |
236 windows-1251 makes more sense." | |
221 (if (symbolp lang-env) | 237 (if (symbolp lang-env) |
222 (setq lang-env (symbol-name lang-env))) | 238 (setq lang-env (symbol-name lang-env))) |
223 (let (lang-slot prop-slot) | 239 (let (lang-slot prop-slot) |
224 (setq lang-slot (assoc lang-env language-info-alist)) | 240 (setq lang-slot (assoc lang-env language-info-alist)) |
225 (if (null lang-slot) ; If no slot for the language, add it. | 241 (if (null lang-slot) ; If no slot for the language, add it. |
240 (setq lang-env (symbol-name lang-env))) | 256 (setq lang-env (symbol-name lang-env))) |
241 ;; FSF has 30 lines of unbelievably ugly code to set up the menus | 257 ;; FSF has 30 lines of unbelievably ugly code to set up the menus |
242 ;; appropriately. We just use a filter. | 258 ;; appropriately. We just use a filter. |
243 (while alist | 259 (while alist |
244 (set-language-info lang-env (car (car alist)) (cdr (car alist))) | 260 (set-language-info lang-env (car (car alist)) (cdr (car alist))) |
245 (setq alist (cdr alist)))) | 261 (setq alist (cdr alist))) |
262 lang-env) | |
246 | 263 |
247 (defun read-language-name (key prompt &optional default) | 264 (defun read-language-name (key prompt &optional default) |
248 "Read a language environment name which has information for KEY. | 265 "Read a language environment name which has information for KEY. |
249 If KEY is nil, read any language environment. | 266 If KEY is nil, read any language environment. |
250 Prompt with PROMPT. DEFAULT is the default choice of language environment. | 267 Prompt with PROMPT. DEFAULT is the default choice of language environment. |
668 language-name)) | 685 language-name)) |
669 (if current-language-environment | 686 (if current-language-environment |
670 (let ((func (get-language-info current-language-environment | 687 (let ((func (get-language-info current-language-environment |
671 'exit-function))) | 688 'exit-function))) |
672 (run-hooks 'exit-language-environment-hook) | 689 (run-hooks 'exit-language-environment-hook) |
673 (if (fboundp func) (funcall func)))) | 690 (if (functionp func) (funcall func)))) |
674 (setq current-language-environment language-name) | 691 (setq current-language-environment language-name) |
675 (let ((default-eol-type (coding-system-eol-type | 692 (let ((default-eol-type (coding-system-eol-type |
676 default-buffer-file-coding-system))) | 693 default-buffer-file-coding-system))) |
677 (reset-coding-categories-to-default) | 694 (reset-coding-categories-to-default) |
678 (set-locale-for-language-environment language-name) | 695 (set-locale-for-language-environment language-name) |
746 (let ((required-features (get-language-info language-name 'features))) | 763 (let ((required-features (get-language-info language-name 'features))) |
747 (while required-features | 764 (while required-features |
748 (require (car required-features)) | 765 (require (car required-features)) |
749 (setq required-features (cdr required-features)))) | 766 (setq required-features (cdr required-features)))) |
750 (let ((func (get-language-info language-name 'setup-function))) | 767 (let ((func (get-language-info language-name 'setup-function))) |
751 (if (fboundp func) | 768 (if (functionp func) |
752 (funcall func))) | 769 (funcall func))) |
770 | |
771 (let ((invalid-sequence-coding-system | |
772 (get-language-info language-name 'invalid-sequence-coding-system)) | |
773 (disp-table (specifier-instance current-display-table)) | |
774 glyph string unicode-error-lookup first-char) | |
775 (when (consp invalid-sequence-coding-system) | |
776 (setq invalid-sequence-coding-system | |
777 (car invalid-sequence-coding-system))) | |
778 (map-char-table | |
779 #'(lambda (key entry) | |
780 (setq string (decode-coding-string (string entry) | |
781 invalid-sequence-coding-system)) | |
782 (when (= 1 (length string)) | |
783 ;; Treat Unicode error sequence chars as the octets | |
784 ;; corresponding to those on disk: | |
785 (setq unicode-error-lookup | |
786 (get-char-table (aref string 0) | |
787 unicode-error-default-translation-table)) | |
788 (when unicode-error-lookup | |
789 (setq string (format "%c" unicode-error-lookup))) | |
790 ;; Treat control characters specially: | |
791 (setq first-char (aref string 0)) | |
792 (when (or (and (>= #x00 first-char) (<= first-char #x1f)) | |
793 (and (>= #x80 first-char) (<= first-char #x9f))) | |
794 (setq string (format "^%c" (+ ?@ (aref string 0)))))) | |
795 (setq glyph (make-glyph (vector 'string :data string))) | |
796 (set-glyph-face glyph 'unicode-invalid-sequence-warning-face) | |
797 (put-char-table key glyph disp-table) | |
798 nil) | |
799 unicode-error-default-translation-table)) | |
753 | 800 |
754 ;; Fit the charsets preferences in unicode conversions for the | 801 ;; Fit the charsets preferences in unicode conversions for the |
755 ;; language environment. | 802 ;; language environment. |
756 (set-language-unicode-precedence-list | 803 (set-language-unicode-precedence-list |
757 (get-language-info language-name 'charset)) | 804 (get-language-info language-name 'charset)) |
890 | 937 |
891 | 938 |
892 ;; Pretty description of encoded string | 939 ;; Pretty description of encoded string |
893 | 940 |
894 ;; Alist of ISO 2022 control code vs the corresponding mnemonic string. | 941 ;; Alist of ISO 2022 control code vs the corresponding mnemonic string. |
895 ;; (defvar iso-2022-control-alist | 942 (defvar iso-2022-control-alist |
896 ;; '((?\x1b . "ESC") | 943 '((?\x1b . "ESC") |
897 ;; (?\x0e . "SO") | 944 (?\x0e . "SO") |
898 ;; (?\x0f . "SI") | 945 (?\x0f . "SI") |
899 ;; (?\x8e . "SS2") | 946 (?\x8e . "SS2") |
900 ;; (?\x8f . "SS3") | 947 (?\x8f . "SS3") |
901 ;; (?\x9b . "CSI"))) | 948 (?\x9b . "CSI"))) |
902 | 949 |
903 ;; (defun encoded-string-description (str coding-system) | 950 (defun encoded-string-description (str coding-system) |
904 ;; "Return a pretty description of STR that is encoded by CODING-SYSTEM." | 951 "Return a pretty description of STR that is encoded by CODING-SYSTEM." |
905 ;; (setq str (string-as-unibyte str)) | 952 ;; XEmacs; no transformation to unibyte. |
906 ;; (let ((char (aref str 0)) | 953 (mapconcat |
907 ;; desc) | 954 (if (and coding-system (eq (coding-system-type coding-system) 'iso2022)) |
908 ;; (when (< char 128) | 955 ;; Try to get a pretty description for ISO 2022 escape sequences. |
909 ;; (setq desc (or (cdr (assq char iso-2022-control-alist)) | 956 (function (lambda (x) (or (cdr (assq x iso-2022-control-alist)) |
910 ;; (char-to-string char))) | 957 (format "#x%02X" x)))) |
911 ;; (let ((i 1) | 958 (function (lambda (x) (format "#x%02X" x)))) |
912 ;; (len (length str))) | 959 str " ")) |
913 ;; (while (< i len) | 960 |
914 ;; (setq char (aref str i)) | 961 ;; XEmacs; |
915 ;; (if (>= char 128) | 962 ;; (defun encode-coding-char (char coding-system) in coding.el. |
916 ;; (setq desc nil i len) | |
917 ;; (setq desc (concat desc " " | |
918 ;; (or (cdr (assq char iso-2022-control-alist)) | |
919 ;; (char-to-string char))) | |
920 ;; i (1+ i)))))) | |
921 ;; (or desc | |
922 ;; (mapconcat (function (lambda (x) (format "0x%02x" x))) str " ")))) | |
923 | |
924 ;; (defun encode-coding-char (char coding-system) | |
925 ;; "Encode CHAR by CODING-SYSTEM and return the resulting string. | |
926 ;; If CODING-SYSTEM can't safely encode CHAR, return nil." | |
927 ;; (if (cmpcharp char) | |
928 ;; (setq char (car (decompose-composite-char char 'list)))) | |
929 ;; (let ((str1 (char-to-string char)) | |
930 ;; (str2 (make-string 2 char)) | |
931 ;; (safe-charsets (and coding-system | |
932 ;; (coding-system-get coding-system 'safe-charsets))) | |
933 ;; enc1 enc2 i1 i2) | |
934 ;; (when (or (eq safe-charsets t) | |
935 ;; (memq (char-charset char) safe-charsets)) | |
936 ;; ;; We must find the encoded string of CHAR. But, just encoding | |
937 ;; ;; CHAR will put extra control sequences (usually to designate | |
938 ;; ;; ASCII charset) at the tail if type of CODING is ISO 2022. | |
939 ;; ;; To exclude such tailing bytes, we at first encode one-char | |
940 ;; ;; string and two-char string, then check how many bytes at the | |
941 ;; ;; tail of both encoded strings are the same. | |
942 ;; | |
943 ;; (setq enc1 (string-as-unibyte (encode-coding-string str1 coding-system)) | |
944 ;; i1 (length enc1) | |
945 ;; enc2 (string-as-unibyte (encode-coding-string str2 coding-system)) | |
946 ;; i2 (length enc2)) | |
947 ;; (while (and (> i1 0) (= (aref enc1 (1- i1)) (aref enc2 (1- i2)))) | |
948 ;; (setq i1 (1- i1) i2 (1- i2))) | |
949 ;; | |
950 ;; ;; Now (substring enc1 i1) and (substring enc2 i2) are the same, | |
951 ;; ;; and they are the extra control sequences at the tail to | |
952 ;; ;; exclude. | |
953 ;; (substring enc2 0 i2)))) | |
954 | 963 |
955 | 964 |
956 ;; #### The following section is utter junk from mule-misc.el. | 965 ;; #### The following section is utter junk from mule-misc.el. |
957 ;; I've deleted everything that's not referenced in mule-packages and | 966 ;; I've deleted everything that's not referenced in mule-packages and |
958 ;; not in FSF 20.6; there's no point in keeping old namespace-polluting | 967 ;; not in FSF 20.6; there's no point in keeping old namespace-polluting |
1010 ;; Init code. | 1019 ;; Init code. |
1011 | 1020 |
1012 ;; auto-language-alist deleted. We have a more sophisticated system, | 1021 ;; auto-language-alist deleted. We have a more sophisticated system, |
1013 ;; with the locales stored in the language data. | 1022 ;; with the locales stored in the language data. |
1014 | 1023 |
1015 (defconst langenv-to-locale-hash (make-hash-table :test 'equal)) | 1024 ;; Initialised in mule/general-late.el, which is compiled after all the |
1025 ;; language support--and, thus, minority Chinese coding systems and so | |
1026 ;; on--has been loaded. | |
1027 (defvar posix-charset-to-coding-system-hash nil | |
1028 "A map from the POSIX locale charset versions of the defined coding | |
1029 systems' names, with all alpha-numeric characters removed, to the actual | |
1030 coding system names. Used at startup when working out which coding system | |
1031 should be the default for the locale. ") | |
1032 | |
1033 (defun parse-posix-locale-string (locale-string) | |
1034 "Return values \(LANGUAGE REGION CHARSET MODIFIERS\) given LOCALE-STRING. | |
1035 | |
1036 LOCALE-STRING should be a POSIX locale. If it cannot be parsed as such, this | |
1037 function returns nil. " | |
1038 (let (language region charset modifiers locinfo) | |
1039 (setq locale-string (downcase locale-string)) | |
1040 (cond ((string-match | |
1041 #r"^\([a-z0-9]\{2,2\}\)\(_[a-z0-9]\{2,2\}\)?\(\.[^@]*\)?\(@.*\)?$" | |
1042 locale-string) | |
1043 (setq language (match-string 1 locale-string) | |
1044 region (match-string 2 locale-string) | |
1045 charset (match-string 3 locale-string) | |
1046 modifiers (match-string 4 locale-string) | |
1047 region (and region (replace-in-string region "^_" "")) | |
1048 charset (and charset (replace-in-string charset #r"^\." "")) | |
1049 modifiers (and modifiers | |
1050 (replace-in-string modifiers "^@" ""))) | |
1051 (when (and modifiers (equal modifiers "euro") (null charset)) | |
1052 ;; Not ideal for Latvian, say, but I don't have any locales | |
1053 ;; where the @euro modifier doesn't mean ISO-8859-15 in the 956 | |
1054 ;; I have. | |
1055 (setq charset "iso-8859-15")) | |
1056 (when (and modifiers (equal modifiers "cyrillic") (null charset)) | |
1057 ;; Feedback wanted! | |
1058 (setq charset "windows-1251")) | |
1059 (values language region charset modifiers)) | |
1060 ((and (string-match "^[a-z0-9]+$" locale-string) | |
1061 (assoc-ignore-case locale-string language-info-alist)) | |
1062 (setq language (get-language-info locale-string 'locale) | |
1063 language (if (listp language) (car language) language)) | |
1064 (values language region charset modifiers)) | |
1065 ((string-match #r"^\([a-z0-9]+\)\.\([a-z0-9]+\)$" locale-string) | |
1066 (when (assoc-ignore-case | |
1067 (setq locinfo (match-string 1 locale-string)) | |
1068 language-info-alist) | |
1069 (setq language (get-language-info locinfo 'locale) | |
1070 language (if (listp language) (car language) language))) | |
1071 (setq charset (match-string 2 locale-string)) | |
1072 (values language region charset modifiers))))) | |
1073 | |
1074 (defun create-variant-language-environment (langenv coding-system) | |
1075 "Create a variant of LANGENV with CODING-SYSTEM as its coding systems. | |
1076 | |
1077 The coding systems in question are those described in the | |
1078 `set-language-info' docstring with the property names of | |
1079 `native-coding-system' and `coding-system'. The name of the new language | |
1080 environment is the name of the old language environment, followed by | |
1081 CODING-SYSTEM in parentheses. Returns the name of the new language | |
1082 environment. | |
1083 | |
1084 This function also modifies the `coding-priority' of a language | |
1085 environment. " | |
1086 (check-coding-system coding-system) | |
1087 (if (symbolp langenv) (setq langenv (symbol-name langenv))) | |
1088 (unless (setq langenv | |
1089 (assoc-ignore-case langenv language-info-alist)) | |
1090 (error 'wrong-type-argument "Not a known language environment")) | |
1091 (set-language-info-alist | |
1092 (if (string-match " ([^)]+)$" (car langenv)) | |
1093 (replace-match (format " (%s)" | |
1094 (upcase (symbol-name | |
1095 (coding-system-name coding-system)))) | |
1096 nil nil (car langenv)) | |
1097 (format "%s (%s)" (car langenv) | |
1098 (upcase (symbol-name (coding-system-name coding-system))))) | |
1099 (destructive-plist-to-alist | |
1100 (plist-put | |
1101 (plist-put | |
1102 (plist-put | |
1103 (plist-put (alist-to-plist (cdr langenv)) 'native-coding-system | |
1104 coding-system) | |
1105 'coding-system (cons coding-system | |
1106 (cdr (assoc 'coding-system (cdr langenv))))) | |
1107 'coding-priority (cons coding-system | |
1108 (cdr (assq 'coding-priority (cdr langenv))))) | |
1109 ;; The tutorial coding system is important; otherwise the tutorial file | |
1110 ;; gets loaded in the variant coding system. | |
1111 'tutorial-coding-system | |
1112 (or (car-safe (cdr-safe (assoc 'tutorial-coding-system (cdr langenv)))) | |
1113 (car-safe (cdr-safe (assoc 'coding-system (cdr langenv))))))))) | |
1016 | 1114 |
1017 (defun get-language-environment-from-locale (locale) | 1115 (defun get-language-environment-from-locale (locale) |
1018 "Convert LOCALE into a language environment. | 1116 "Convert LOCALE into a language environment. |
1019 LOCALE is a C library locale string, as returned by `current-locale'. | 1117 LOCALE is a C library locale string, as returned by `current-locale'. |
1020 Uses the `locale' property of the language environment." | 1118 Uses the `locale' property of the language environment." |
1021 (or (gethash locale langenv-to-locale-hash) | 1119 (block langenv |
1022 (let ((retval | 1120 (multiple-value-bind (language ignored-arg charset ignored-arg) |
1023 (block langenv | 1121 (parse-posix-locale-string locale) |
1024 (dolist (langcons language-info-alist) | 1122 (let ((case-fold-search t) |
1025 (let* ((lang (car langcons)) | 1123 (desired-coding-system |
1026 (locs (get-language-info lang 'locale)) | 1124 (and charset (gethash (replace-in-string charset "[^a-z0-9]" "") |
1027 (case-fold-search t)) | 1125 posix-charset-to-coding-system-hash))) |
1028 (dolist (loc (if (listp locs) locs (list locs))) | 1126 lang locs given-coding-system) |
1029 (if (cond ((functionp loc) | 1127 (dolist (langcons language-info-alist) |
1030 (funcall loc locale)) | 1128 (setq lang (car langcons) |
1031 ((stringp loc) | 1129 locs (get-language-info lang 'locale)) |
1032 (string-match | 1130 (dolist (loc (if (listp locs) locs (list locs))) |
1033 (concat "^" loc "\\([^A-Za-z0-9]\\|$\\)") | 1131 (cond ((functionp loc) |
1034 locale))) | 1132 (if (funcall loc locale) |
1035 (return-from langenv lang)))))))) | 1133 (return-from langenv lang))) |
1036 (puthash locale retval langenv-to-locale-hash) | 1134 ((stringp loc) |
1037 retval))) | 1135 (when (or (equal loc language) |
1136 (string-match | |
1137 (format "^%s\\([^A-Za-z0-9]\\|$\\)" loc) | |
1138 locale)) | |
1139 (if (or (null desired-coding-system) | |
1140 (and desired-coding-system | |
1141 (or (eq desired-coding-system | |
1142 (setq given-coding-system | |
1143 (get-language-info | |
1144 lang | |
1145 'native-coding-system))) | |
1146 (and (listp given-coding-system) | |
1147 (memq desired-coding-system | |
1148 given-coding-system))))) | |
1149 (return-from langenv lang) | |
1150 (return-from langenv | |
1151 (create-variant-language-environment | |
1152 lang desired-coding-system)))))))))))) | |
1038 | 1153 |
1039 (defun mswindows-get-language-environment-from-locale (ms-locale) | 1154 (defun mswindows-get-language-environment-from-locale (ms-locale) |
1040 "Convert MS-LOCALE (an MS Windows locale) into a language environment. | 1155 "Convert MS-LOCALE (an MS Windows locale) into a language environment. |
1041 MS-LOCALE is in the format recognized by `set-mswindows-current-locale' -- | 1156 MS-LOCALE is in the format recognized by `set-mswindows-current-locale' -- |
1042 i.e. a language string or a cons (LANG . SUBLANG). Note: This is NOT the | 1157 i.e. a language string or a cons (LANG . SUBLANG). Note: This is NOT the |
1248 )) | 1363 )) |
1249 | 1364 |
1250 ;; set the default buffer coding system from the first element of the | 1365 ;; set the default buffer coding system from the first element of the |
1251 ;; list in the `coding-priority' property, under Unix. Under Windows, it | 1366 ;; list in the `coding-priority' property, under Unix. Under Windows, it |
1252 ;; should stay at `mswindows-multibyte', which will reference the current | 1367 ;; should stay at `mswindows-multibyte', which will reference the current |
1253 ;; code page. (#### Does it really make sense the set the Unix default | 1368 ;; code page. ([Does it really make sense to set the Unix default |
1254 ;; that way? NOTE also that it's not the same as the native coding | 1369 ;; that way? NOTE also that it's not the same as the native coding |
1255 ;; system for the locale, which is correct -- the form we choose for text | 1370 ;; system for the locale, which is correct -- the form we choose for text |
1256 ;; files should not necessarily have any relevant to whether we're in a | 1371 ;; files should not necessarily have any relevance to whether we're in a |
1257 ;; Shift-JIS, EUC-JP, JIS, or other Japanese locale.) | 1372 ;; Shift-JIS, EUC-JP, JIS, or other Japanese locale.]) |
1373 ;; | |
1374 ;; On Unix--with the exception of Mac OS X--there is no way to | |
1375 ;; know for certain what coding system to use for file names, and | |
1376 ;; the environment is the best guess. If a particular user's | |
1377 ;; preferences differ from this, then that particular user needs | |
1378 ;; to edit ~/.xemacs/init.el. Aidan Kehoe, Sun Nov 26 18:11:31 CET | |
1379 ;; 2006. OS X uses an almost-normal-form version of UTF-8. | |
1380 | |
1258 (unless (memq system-type '(windows-nt cygwin32)) | 1381 (unless (memq system-type '(windows-nt cygwin32)) |
1259 (set-default-buffer-file-coding-system | 1382 (set-default-buffer-file-coding-system |
1260 (maybe-change-coding-system-with-eol default-coding eol-type)))) | 1383 (maybe-change-coding-system-with-eol default-coding eol-type)))) |
1261 ;; (setq default-sendmail-coding-system default-coding) | 1384 ;; (setq default-sendmail-coding-system default-coding) |
1262 | 1385 |
1268 (define-coding-system-alias 'native | 1391 (define-coding-system-alias 'native |
1269 (maybe-change-coding-system-with-eol native eol-type)) | 1392 (maybe-change-coding-system-with-eol native eol-type)) |
1270 (error | 1393 (error |
1271 (warn "Invalid native-coding-system %s in language environment %s" | 1394 (warn "Invalid native-coding-system %s in language environment %s" |
1272 native language-name))) | 1395 native language-name))) |
1273 (define-coding-system-alias 'file-name 'native) | 1396 ;; These variables have magic handlers to make setting them equivalent |
1397 ;; to setting the file-name, terminal and keyboard coding system | |
1398 ;; aliases. See coding.el. | |
1399 (setq file-name-coding-system | |
1400 (or | |
1401 (let ((fncs (assq system-type system-type-file-name-coding))) | |
1402 (and fncs (cdr fncs))) | |
1403 native) | |
1404 ;; Set the default keyboard and terminal coding systems to the | |
1405 ;; native coding system of the language environment. | |
1406 keyboard-coding-system native | |
1407 terminal-coding-system native) | |
1408 | |
1409 ;; And do the same for any TTYs. | |
1410 (dolist (con (console-list)) | |
1411 (when (eq 'tty (device-type (car (console-device-list con)))) | |
1412 ;; Calling set-input-mode at the same time would be a sane thing | |
1413 ;; to do here. I would prefer to default to accepting eight bit | |
1414 ;; input and not using the top bit for Meta. | |
1415 (set-console-tty-coding-system con native))) | |
1416 | |
1274 ;; process output should not have EOL conversion. under MS Windows | 1417 ;; process output should not have EOL conversion. under MS Windows |
1275 ;; and Cygwin, this screws things up (`cmd' is fine with just LF and | 1418 ;; and Cygwin, this screws things up (`cmd' is fine with just LF and |
1276 ;; `bash' chokes on CR-LF). | 1419 ;; `bash' chokes on CR-LF). |
1277 (setq default-process-coding-system | 1420 (setq default-process-coding-system |
1278 (cons (car default-process-coding-system) native))))) | 1421 (cons (car default-process-coding-system) native))))) |
1325 ;; user-default locale even if the langenv doesn't correspond; | 1468 ;; user-default locale even if the langenv doesn't correspond; |
1326 ;; we might not be able to find a langenv for the user-default | 1469 ;; we might not be able to find a langenv for the user-default |
1327 ;; locale but we should still use the right code page, etc. | 1470 ;; locale but we should still use the right code page, etc. |
1328 (declare-fboundp (mswindows-set-current-locale userdef))) | 1471 (declare-fboundp (mswindows-set-current-locale userdef))) |
1329 ;; Unix: | 1472 ;; Unix: |
1330 (let ((locstring (set-current-locale ""))) | 1473 (let (locstring) |
1331 ;; assume C lib locale and LANG env var are set correctly. use | 1474 ;; Init the POSIX locale from the environment--this calls the C |
1332 ;; them to find the langenv. | 1475 ;; library's setlocale(3). |
1333 (setq langenv | 1476 (set-current-locale "") |
1334 (and locstring (get-language-environment-from-locale | 1477 ;; Can't let locstring be the result of (set-current-locale "") |
1335 locstring))))) | 1478 ;; because that can return a more detailed string than we know how |
1479 ;; to handle. | |
1480 (setq locstring (current-locale) | |
1481 ;; assume C lib locale and LANG env var are set correctly. | |
1482 ;; use them to find the langenv. | |
1483 langenv | |
1484 (and locstring (get-language-environment-from-locale | |
1485 locstring))))) | |
1336 ;; All systems: | 1486 ;; All systems: |
1337 (unless langenv (setq langenv "English")) | 1487 (unless langenv (setq langenv "English")) |
1338 (setq current-language-environment langenv) | 1488 (setq current-language-environment langenv) |
1339 ;; Setup various coding systems and categories. | 1489 ;; Setup various coding systems and categories. |
1340 (let ((default-eol-type (coding-system-eol-type | 1490 (let ((default-eol-type (coding-system-eol-type |
1370 (when current-language-environment | 1520 (when current-language-environment |
1371 ;; rman seems to be incompatible with encoded text | 1521 ;; rman seems to be incompatible with encoded text |
1372 (setq Manual-use-rosetta-man nil)) | 1522 (setq Manual-use-rosetta-man nil)) |
1373 | 1523 |
1374 ;; Register available input methods by loading LEIM list file. | 1524 ;; Register available input methods by loading LEIM list file. |
1375 (load "leim-list.el" 'noerror 'nomessage 'nosuffix) | 1525 (load leim-list-file-name 'noerror 'nomessage 'nosuffix)) |
1376 ) | |
1377 | 1526 |
1378 ;; Code deleted: init-mule-tm (Enable the tm package by default) | 1527 ;; Code deleted: init-mule-tm (Enable the tm package by default) |
1379 | 1528 |
1380 ;;; mule-cmds.el ends here | 1529 ;;; mule-cmds.el ends here |