comparison lisp/mule/mule-init.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents
children 6a378aca36af
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
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-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
45 (setq language-environment-list
46 (sort (language-environment-list) 'string-lessp))
47
48 (defvar mule-keymap (make-sparse-keymap) "Keymap for Mule specific commands.")
49 (fset 'mule-prefix mule-keymap)
50
51 (define-key ctl-x-map "\C-k" 'mule-prefix)
52
53 ;; Alternative key definitions
54 ;; Original mapping will be altered by set-keyboard-coding-system.
55 (define-key global-map [(meta \#)] 'ispell-word) ;originally "$"
56 ;; (define-key global-map [(meta {)] 'insert-parentheses) ;originally "("
57
58 ;; Following line isn't mule-specific --mrb
59 ;;(setq-default modeline-buffer-identification '("XEmacs: %17b"))
60
61 (defconst modeline-multibyte-status '("%C")
62 "Modeline control for showing multibyte extension status.")
63
64 ;; override the default value defined in loaddefs.el.
65 (setq-default modeline-format
66 (cons (purecopy "")
67 (cons 'modeline-multibyte-status
68 (cdr modeline-format))))
69
70 (define-key mule-keymap "f" 'set-file-coding-system)
71 (define-key mule-keymap "i" 'set-keyboard-coding-system)
72 (define-key mule-keymap "d" 'set-terminal-coding-system)
73 (define-key mule-keymap "p" 'set-current-process-coding-system)
74 (define-key mule-keymap "F" 'set-default-file-coding-system)
75 (define-key mule-keymap "P" 'set-default-process-coding-system)
76 (define-key mule-keymap "c" 'list-coding-system-briefly)
77 (define-key mule-keymap "C" 'list-coding-system)
78 (define-key mule-keymap "r" 'toggle-display-direction)
79
80 (define-key help-map "T" 'help-with-tutorial-for-mule)
81
82 (defvar help-with-tutorial-language-alist
83 '(("Japanese" . ".jp")
84 ("Korean" . ".kr")
85 ("Thai" . ".th")))
86
87 (defun help-with-tutorial-for-mule (language)
88 "Select the Mule learn-by-doing tutorial."
89 (interactive (list (let ((completion-ignore-case t)
90 lang)
91 (completing-read
92 "Language: "
93 help-with-tutorial-language-alist))))
94 (setq language (cdr (assoc language help-with-tutorial-language-alist)))
95 (help-with-tutorial (concat "mule/TUTORIAL" (or language ""))))
96
97 (defvar auto-language-alist
98 '(("^ja" . japanese)
99 ("^zh" . chinese)
100 ("^ko" . korean))
101 "Alist of LANG patterns vs. corresponding language environment.
102 Each element looks like (REGEXP . LANGUAGE-ENVIRONMENT).
103 It the value of the environment variable LANG matches the regexp REGEXP,
104 then `set-language-environment' is called with LANGUAGE-ENVIRONMENT.")
105
106 (defun init-mule ()
107 "Initialize MULE environment at startup. Don't call this."
108 (let ((lang (or (getenv "LC_ALL") (getenv "LC_MESSAGES") (getenv "LANG"))))
109 (unless (or (null lang) (string-equal "C" lang))
110 (let ((case-fold-search t))
111 (loop for elt in auto-language-alist
112 if (string-match (car elt) lang)
113 return (set-language-environment (cdr elt))))
114
115 ;; Load a (localizable) locale-specific init file, if it exists.
116 (load (format "locale/%s/locale-start" lang) t t)))
117
118 (when (current-language-environment)
119 ;; Translate remaining args on command line using pathname-coding-system
120 (loop for arg in-ref command-line-args-left do
121 (setf arg (decode-coding-string arg pathname-coding-system)))
122
123 ;; Make sure ls -l output is readable by dired and encoded using
124 ;; pathname-coding-system
125 (add-hook
126 'dired-mode-hook
127 (lambda ()
128 (make-local-variable 'process-output-coding-system)
129 (make-local-variable 'process-input-coding-system)
130 (setq process-output-coding-system pathname-coding-system)
131 (setq process-input-coding-system pathname-coding-system)
132 (make-local-variable 'process-environment)
133 (setenv "LC_MESSAGES" "C")
134 (setenv "LC_TIME" "C"))))
135 )
136
137 (add-hook 'before-init-hook 'init-mule)
138
139 ;;;;; Enable the tm package by default
140 ;;(defun init-mule-tm ()
141 ;; "Load MIME (TM) support for GNUS, VM, MH-E, and RMAIL."
142 ;; (load "mime-setup"))
143
144 ;;(add-hook 'after-init-hook 'init-mule-tm)
145
146 ;;; mule-init.el ends here