(U+6215): Apply new conventions for glyph granularity.
[chise/xemacs-chise.git.1] / lisp / mule / mule-init.el
1 ;; Mule default configuration file
2
3 ;; This file is part of XEmacs.
4
5 ;; XEmacs is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 2, or (at your option)
8 ;; any later version.
9
10 ;; XEmacs is distributed in the hope that it will be useful, but
11 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 ;; General Public License for more details.
14
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with XEmacs; see the file COPYING.  If not, write to the 
17 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 ;; Boston, MA 02111-1307, USA.
19
20 ;;; 87.6.9   created by K.handa
21 ;;; (Note: following comment obsolete -- mrb)
22
23 ;;; IMPORTANT NOTICE -- DON'T EDIT THIS FILE!!!
24 ;;;  Keep this file unmodified for further patches being applied successfully.
25 ;;;  All language specific basic environments are defined here.
26 ;;;  By default, Japanese is set as the primary environment.
27 ;;;  You can change primary environment in `./lisp/site-init.el by
28 ;;;  `set-primary-environment'.  For instance,
29 ;;;     (set-primary-environment 'chinese)
30 ;;;  makes Chinese the primary environment.
31 ;;;  If you are still not satisfied with the settings, you can
32 ;;;  override them after the above line.  For instance,
33 ;;;     (set-default-buffer-file-coding-system 'big5)
34 ;;;  makes big5 be used for file I/O by default.
35 ;;;  If you are not satisfied with other default settings in this file,
36 ;;;  override any of them also in `./lisp/site-init.el'.  For instance,
37 ;;;     (define-program-coding-system nil ".*mail.*" 'iso-8859-1)
38 ;;;  makes the coding-system 'iso-8859-1 be used in mail.
39
40
41 ;;;; GLOBAL ENVIRONMENT SETUP
42 (require 'cl)
43
44 \f
45 ;; (setq language-environment-list
46 ;;       (sort (language-environment-list) 'string-lessp))
47
48 ;; MULE keymap codes were moved to mule-cmds.el.
49
50 ;; Alternative key definitions
51 ;; Original mapping will be altered by set-keyboard-coding-system.
52 (define-key global-map [(meta \#)] 'ispell-word)        ;originally "$"
53 ;; (define-key global-map [(meta {)] 'insert-parentheses) ;originally "("
54
55 ;; Following line isn't mule-specific --mrb
56 ;;(setq-default modeline-buffer-identification '("XEmacs: %17b"))
57
58 ;; MULE keymap codes were moved to mule-cmds.el.
59
60 ;; (define-key help-map "T" 'help-with-tutorial-for-mule)
61
62 ;; (defvar help-with-tutorial-language-alist
63 ;;  '(("Japanese" . ".jp")
64 ;;    ("Korean"   . ".kr")
65 ;;    ("Thai"     . ".th")))
66
67 ;(defun help-with-tutorial-for-mule (language)
68 ;  "Select the Mule learn-by-doing tutorial."
69 ;  (interactive (list (let ((completion-ignore-case t)
70 ;                          lang)
71 ;                      (completing-read
72 ;                       "Language: "
73 ;                       help-with-tutorial-language-alist))))
74 ;  (setq language (cdr (assoc language help-with-tutorial-language-alist)))
75 ;  (help-with-tutorial (concat "mule/TUTORIAL" (or language ""))))
76
77 (defvar auto-language-alist
78   '(("^ja" . "Japanese")
79     ("^zh_.*.GB.*" . "Chinese-GB")
80     ("^zh_.*.BIG5.*" . "Chinese-BIG5")
81     ("^ko" . "Korean"))
82   "Alist of LANG patterns vs. corresponding language environment.
83 Each element looks like (REGEXP . LANGUAGE-ENVIRONMENT).
84 It the value of the environment variable LANG matches the regexp REGEXP,
85 then `set-language-environment' is called with LANGUAGE-ENVIRONMENT.")
86
87 (defun init-mule ()
88   "Initialize MULE environment at startup.  Don't call this."
89   (let ((lang (or (getenv "LC_ALL") (getenv "LC_MESSAGES") (getenv "LANG"))))
90     (unless (or (null lang) (string-equal "C" lang))
91       (let ((case-fold-search t))
92         (loop for elt in auto-language-alist
93               if (string-match (car elt) lang)
94               return (progn
95                        (setq lang (substring lang 0 (match-end 0)))
96                        (set-language-environment (cdr elt))
97                        )))
98       ;; Load a (localizable) locale-specific init file, if it exists.
99       (load (format "%s%s/locale-start"
100                     (locate-data-directory "start-files")
101                     lang) t t)))
102   
103   (when current-language-environment
104     ;; Translate remaining args on command line using file-name-coding-system
105     (loop for arg in-ref command-line-args-left do
106           (setf arg (decode-coding-string arg file-name-coding-system)))
107     
108     ;; rman seems to be incompatible with encoded text
109     (setq Manual-use-rosetta-man nil)
110
111     ;; Make sure ls -l output is readable by dired and encoded using
112     ;; file-name-coding-system
113     (add-hook
114      'dired-mode-hook
115      (lambda ()
116        (make-local-variable 'process-environment)
117        (setenv "LC_MESSAGES" "C")
118        (setenv "LC_TIME"     "C"))))
119   
120   ;; Register available input methods by loading LEIM list file.
121   (load "leim-list.el" 'noerror 'nomessage 'nosuffix)
122   )
123
124 (add-hook 'before-init-hook 'init-mule)
125
126 ;;;;; Enable the tm package by default
127 ;;(defun init-mule-tm ()
128 ;;  "Load MIME (TM) support for GNUS, VM, MH-E, and RMAIL."
129 ;;  (load "mime-setup"))
130
131 ;;(add-hook 'after-init-hook 'init-mule-tm)
132
133 ;;; mule-init.el ends here