comparison lisp/mule/mule-init.el @ 207:e45d5e7c476e r20-4b2

Import from CVS: tag r20-4b2
author cvs
date Mon, 13 Aug 2007 10:03:52 +0200
parents acd284d43ca1
children 41ff10fd062f
comparison
equal deleted inserted replaced
206:d3e9274cbc4e 207:e45d5e7c476e
40 40
41 ;;;; GLOBAL ENVIRONMENT SETUP 41 ;;;; GLOBAL ENVIRONMENT SETUP
42 (require 'cl) 42 (require 'cl)
43 43
44 44
45 (setq language-environment-list 45 ;; (setq language-environment-list
46 (sort (language-environment-list) 'string-lessp)) 46 ;; (sort (language-environment-list) 'string-lessp))
47 47
48 ;; MULE keymap codes were moved to mule-cmds.el. 48 ;; MULE keymap codes were moved to mule-cmds.el.
49 49
50 ;; Alternative key definitions 50 ;; Alternative key definitions
51 ;; Original mapping will be altered by set-keyboard-coding-system. 51 ;; Original mapping will be altered by set-keyboard-coding-system.
82 help-with-tutorial-language-alist)))) 82 help-with-tutorial-language-alist))))
83 (setq language (cdr (assoc language help-with-tutorial-language-alist))) 83 (setq language (cdr (assoc language help-with-tutorial-language-alist)))
84 (help-with-tutorial (concat "mule/TUTORIAL" (or language "")))) 84 (help-with-tutorial (concat "mule/TUTORIAL" (or language ""))))
85 85
86 (defvar auto-language-alist 86 (defvar auto-language-alist
87 '(("^ja" . japanese) 87 '(("^ja" . "Japanese")
88 ("^zh" . chinese) 88 ("^zh" . "Chinese")
89 ("^ko" . korean)) 89 ("^ko" . "Korean"))
90 "Alist of LANG patterns vs. corresponding language environment. 90 "Alist of LANG patterns vs. corresponding language environment.
91 Each element looks like (REGEXP . LANGUAGE-ENVIRONMENT). 91 Each element looks like (REGEXP . LANGUAGE-ENVIRONMENT).
92 It the value of the environment variable LANG matches the regexp REGEXP, 92 It the value of the environment variable LANG matches the regexp REGEXP,
93 then `set-language-environment' is called with LANGUAGE-ENVIRONMENT.") 93 then `set-language-environment' is called with LANGUAGE-ENVIRONMENT.")
94 94
95 (defun init-mule () 95 (defun init-mule ()
96 "Initialize MULE environment at startup. Don't call this." 96 "Initialize MULE environment at startup. Don't call this."
97 (let ((lang (or (getenv "LC_ALL") (getenv "LC_MESSAGES") (getenv "LANG")))) 97 (let ((lang (or (getenv "LC_ALL") (getenv "LC_MESSAGES") (getenv "LANG"))))
98 (unless (or (null lang) (string-equal "C" lang)) 98 (unless (or (null lang) (string-equal "C" lang))
99 (let ((case-fold-search t)) 99 (let ((case-fold-search t))
100 (loop for elt in auto-language-alist 100 (loop for elt in auto-language-alist
101 if (string-match (car elt) lang) 101 if (string-match (car elt) lang)
102 return (set-language-environment (cdr elt)))) 102 return (progn
103 103 (setq lang (substring lang 0 (match-end 0)))
104 (set-language-environment (cdr elt))
105 )))
104 ;; Load a (localizable) locale-specific init file, if it exists. 106 ;; Load a (localizable) locale-specific init file, if it exists.
105 (load (format "locale/%s/locale-start" lang) t t))) 107 (load (format "locale/%s/locale-start" lang) t t)))
106 108
107 (when (current-language-environment) 109 (when current-language-environment
108 ;; Translate remaining args on command line using file-name-coding-system 110 ;; Translate remaining args on command line using file-name-coding-system
109 (loop for arg in-ref command-line-args-left do 111 (loop for arg in-ref command-line-args-left do
110 (setf arg (decode-coding-string arg file-name-coding-system))) 112 (setf arg (decode-coding-string arg file-name-coding-system)))
111 113
112 ;; rman seems to be incompatible with encoded text 114 ;; rman seems to be incompatible with encoded text
113 (setq Manual-use-rosetta-man nil) 115 (setq Manual-use-rosetta-man nil)
114 116
115 ;; Make sure ls -l output is readable by dired and encoded using 117 ;; Make sure ls -l output is readable by dired and encoded using
116 ;; file-name-coding-system 118 ;; file-name-coding-system
117 (add-hook 119 (add-hook
118 'dired-mode-hook 120 'dired-mode-hook
119 (lambda () 121 (lambda ()
120 (make-local-variable 'process-environment) 122 (make-local-variable 'process-environment)
121 (setenv "LC_MESSAGES" "C") 123 (setenv "LC_MESSAGES" "C")
122 (setenv "LC_TIME" "C")))) 124 (setenv "LC_TIME" "C"))))
123 125
124 ;; Register avairable input methods by loading LEIM list file. 126 ;; Register avairable input methods by loading LEIM list file.
125 (load "leim-list.el" 'noerror 'nomessage 'nosuffix) 127 (load "leim-list.el" 'noerror 'nomessage 'nosuffix)
126 ) 128 )
127 129
128 (add-hook 'before-init-hook 'init-mule) 130 (add-hook 'before-init-hook 'init-mule)