annotate lisp/mule/mule-init.el @ 110:fe104dbd9147 r20-1b7

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