annotate lisp/international/mule-cmds.el @ 18602:9b34ca7eb8ef

Fix previous change.
author Per Abrahamsen <abraham@dina.kvl.dk>
date Fri, 04 Jul 1997 13:25:17 +0000
parents 8b4a66c66dd6
children c8cbbd038612
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
1 ;;; mule-cmds.el --- Commands for mulitilingual environment
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
18377
8b4a66c66dd6 Change copyright notice.
Richard M. Stallman <rms@gnu.org>
parents: 18351
diff changeset
4 ;; Licensed to the Free Software Foundation.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
5
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
6 ;; Keywords: mule, multilingual
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
7
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
9
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
13 ;; any later version.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
14
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
19
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
17071
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
70194012fb3a Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 17052
diff changeset
23 ;; Boston, MA 02111-1307, USA.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
24
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
25 ;;; Code:
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
26
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
27 ;;; MULE related key bindings and menus.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
28
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
29 (defvar mule-keymap nil
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
30 "Keymap for MULE (Multilingual environment) specific commands.")
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
31 (define-prefix-command 'mule-keymap)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
32
17294
d7ae63db9e6e Prefix for Mule related commands is changed.
Kenichi Handa <handa@m17n.org>
parents: 17090
diff changeset
33 ;; Keep "C-x C-m ..." for mule specific commands.
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
34 (define-key ctl-x-map "\C-m" 'mule-keymap)
17090
8085a8690c87 (mule-keymap): Re-arranged.
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
35
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
36 (define-key mule-keymap "m" 'toggle-enable-multibyte-characters)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
37 (define-key mule-keymap "f" 'set-buffer-file-coding-system)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
38 (define-key mule-keymap "t" 'set-terminal-coding-system)
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
39 (define-key mule-keymap "k" 'set-keyboard-coding-system)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
40 (define-key mule-keymap "p" 'set-buffer-process-coding-system)
17526
6501aac82580 (mule-keymap): Add C-x RET C-\ for select-input-method.
Richard M. Stallman <rms@gnu.org>
parents: 17294
diff changeset
41 (define-key mule-keymap "\C-\\" 'select-input-method)
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
42 (define-key mule-keymap "c" 'universal-coding-system-argument)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
43
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
44 (define-key help-map "\C-L" 'describe-language-environment)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
45 (define-key help-map "\C-\\" 'describe-input-method)
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
46 (define-key help-map "C" 'describe-coding-system)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
47 (define-key help-map "h" 'view-hello-file)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
48
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
49 (defvar mule-menu-keymap nil
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
50 "Keymap for MULE (Multilingual environment) menu specific commands.")
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
51 (define-prefix-command 'mule-menu-keymap)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
52
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
53 (define-key global-map [menu-bar mule] (cons "Mule" mule-menu-keymap))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
54
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
55 (setq menu-bar-final-items (cons 'mule menu-bar-final-items))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
56
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
57 (defvar describe-language-environment-map nil)
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
58 (define-prefix-command 'describe-language-environment-map)
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
59
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
60 (defvar setup-language-environment-map nil)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
61 (define-prefix-command 'setup-language-environment-map)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
62
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
63 (defvar set-coding-system-map nil)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
64 (define-prefix-command 'set-coding-system-map)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
65
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
66 (define-key-after mule-menu-keymap [toggle-mule]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
67 '("Toggle MULE facility" . toggle-enable-multibyte-characters)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
68 t)
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
69 (define-key-after mule-menu-keymap [describe-language-environment]
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
70 '("Describe language environment" . describe-language-environment-map)
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
71 t)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
72 (define-key-after mule-menu-keymap [set-language-environment]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
73 '("Set language environment" . setup-language-environment-map)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
74 t)
18351
8cc30b266976 Define mouse-set-font in mule-menu-keymap agian.
Kenichi Handa <handa@m17n.org>
parents: 18301
diff changeset
75 (define-key-after mule-menu-keymap [mouse-set-font]
8cc30b266976 Define mouse-set-font in mule-menu-keymap agian.
Kenichi Handa <handa@m17n.org>
parents: 18301
diff changeset
76 '("Set font/fontset" . mouse-set-font)
8cc30b266976 Define mouse-set-font in mule-menu-keymap agian.
Kenichi Handa <handa@m17n.org>
parents: 18301
diff changeset
77 t)
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
78 (define-key-after mule-menu-keymap [separator-mule]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
79 '("--")
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
80 t)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
81 (define-key-after mule-menu-keymap [toggle-input-method]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
82 '("Toggle input method" . toggle-input-method)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
83 t)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
84 (define-key-after mule-menu-keymap [select-input-method]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
85 '("Select input method" . select-input-method)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
86 t)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
87 (define-key-after mule-menu-keymap [describe-input-method]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
88 '("Describe input method" . describe-input-method)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
89 t)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
90 (define-key-after mule-menu-keymap [separator-input-method]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
91 '("--")
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
92 t)
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
93 (define-key-after mule-menu-keymap [describe-coding-system]
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
94 '("Describe coding systems" . describe-coding-system)
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
95 t)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
96 (define-key-after mule-menu-keymap [set-various-coding-system]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
97 '("Set coding systems" . set-coding-system-map)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
98 t)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
99 (define-key-after mule-menu-keymap [separator-coding-system]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
100 '("--")
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
101 t)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
102 (define-key-after mule-menu-keymap [mule-diag]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
103 '("Show diagnosis for MULE" . mule-diag)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
104 t)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
105 (define-key-after mule-menu-keymap [view-hello-file]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
106 '("Show many languages" . view-hello-file)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
107 t)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
108
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
109 (define-key-after set-coding-system-map [set-buffer-file-coding-system]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
110 '("Buffer file" . set-buffer-file-coding-system)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
111 t)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
112 (define-key-after set-coding-system-map [set-terminal-coding-system]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
113 '("Terminal" . set-terminal-coding-system)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
114 t)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
115 (define-key-after set-coding-system-map [set-keyboard-coding-system]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
116 '("Keyboard" . set-keyboard-coding-system)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
117 t)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
118 (define-key-after set-coding-system-map [set-buffer-process-coding-system]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
119 '("Buffer process" . set-buffer-process-coding-system)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
120 t)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
121
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
122 (define-key setup-language-environment-map
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
123 [Default] '("Default" . setup-specified-language-environment))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
124
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
125 ;; These are meaningless when running under X.
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
126 (put 'set-terminal-coding-system 'menu-enable
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
127 '(null window-system))
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
128 (put 'set-keyboard-coding-system 'menu-enable
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
129 '(null window-system))
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
130 ;; This is meaningless when the current buffer has no process.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
131 (put 'set-buffer-process-coding-system 'menu-enable
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
132 '(get-buffer-process (current-buffer)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
133
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
134 ;; This should be a single character key binding because users use it
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
135 ;; very frequently while editing multilingual text. Now we can use
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
136 ;; only two such keys: "\C-\\" and "\C-^", but the latter is not
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
137 ;; convenient because it requires shifting on most keyboards. An
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
138 ;; alternative is "\C-\]" which is now bound to `abort-recursive-edit'
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
139 ;; but it won't be used that frequently.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
140 (define-key global-map "\C-\\" 'toggle-input-method)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
141
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
142 (defun toggle-enable-multibyte-characters (&optional arg)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
143 "Change whether this buffer enables multibyte characters.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
144 With arg, make them enable iff arg is positive."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
145 (interactive "P")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
146 (setq enable-multibyte-characters
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
147 (if (null arg) (null enable-multibyte-characters)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
148 (> (prefix-numeric-value arg) 0)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
149 (force-mode-line-update))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
150
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
151 (defun view-hello-file ()
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
152 "Display the HELLO file which list up many languages and characters."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
153 (interactive)
17294
d7ae63db9e6e Prefix for Mule related commands is changed.
Kenichi Handa <handa@m17n.org>
parents: 17090
diff changeset
154 ;; We have to decode the file in any environment.
d7ae63db9e6e Prefix for Mule related commands is changed.
Kenichi Handa <handa@m17n.org>
parents: 17090
diff changeset
155 (let ((default-enable-multibyte-characters t)
18217
13a240aa1960 (view-hello-file): Adjusted for the changes of
Kenichi Handa <handa@m17n.org>
parents: 18176
diff changeset
156 (coding-system-for-read 'iso-2022-7bit))
17294
d7ae63db9e6e Prefix for Mule related commands is changed.
Kenichi Handa <handa@m17n.org>
parents: 17090
diff changeset
157 (find-file-read-only (expand-file-name "HELLO" data-directory))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
158
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
159 (defun universal-coding-system-argument ()
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
160 "Execute an I/O command using the specified coding system."
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
161 (interactive)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
162 (let* ((coding-system (read-coding-system "Coding system: "))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
163 (keyseq (read-key-sequence
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
164 (format "With coding system %s:" coding-system)))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
165 (cmd (key-binding keyseq)))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
166 (let ((coding-system-for-read coding-system)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
167 (coding-system-for-write coding-system))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
168 (message "")
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
169 (call-interactively cmd))))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
170
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
171
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
172 ;;; Language support staffs.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
173
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
174 (defvar primary-language "English"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
175 "Name of a user's primary language.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
176 Emacs provide various language supports based on this variable.")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
177
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
178 (defvar language-info-alist nil
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
179 "Alist of language names vs the corresponding information of various kind.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
180 Each element looks like:
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
181 (LANGUAGE-NAME . ((KEY . INFO) ...))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
182 where LANGUAGE-NAME is a string,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
183 KEY is a symbol denoting the kind of information,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
184 INFO is any Lisp object which contains the actual information related
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
185 to KEY.")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
186
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
187 (defun get-language-info (language-name key)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
188 "Return the information for LANGUAGE-NAME of the kind KEY.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
189 LANGUAGE-NAME is a string.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
190 KEY is a symbol denoting the kind of required information."
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
191 (let ((lang-slot (assoc-ignore-case language-name language-info-alist)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
192 (if lang-slot
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
193 (cdr (assq key (cdr lang-slot))))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
194
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
195 (defun set-language-info (language-name key info)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
196 "Set for LANGUAGE-NAME the information INFO under KEY.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
197 LANGUAGE-NAME is a string
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
198 KEY is a symbol denoting the kind of information.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
199 INFO is any Lisp object which contains the actual information.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
200
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
201 Currently, the following KEYs are used by Emacs:
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
202
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
203 charset: list of symbols whose values are charsets specific to the language.
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
204
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
205 coding-system: list of coding systems specific to the langauge.
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
206
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
207 tutorial: a tutorial file name written in the language.
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
208
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
209 sample-text: one line short text containing characters of the language.
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
210
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
211 documentation: t or a string describing how Emacs supports the language.
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
212 If a string is specified, it is shown before any other information
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
213 of the language by the command `describe-language-environment'.
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
214
17758
8c67c2e2cc29 (build-describe-language-support-function,
Kenichi Handa <handa@m17n.org>
parents: 17526
diff changeset
215 setup-function: a function to call for setting up environment
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
216 convenient for a user of the language.
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
217
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
218 If KEY is documentation or setup-function, you can also specify
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
219 a cons cell as INFO, in which case, the car part should be
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
220 a normal value as INFO for KEY (as described above),
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
221 and the cdr part should be a symbol whose value is a menu keymap
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
222 in which an entry for the language is defined. But, only the car part
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
223 is actually set as the information.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
224
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
225 We will define more KEYs in the future. To avoid conflict,
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
226 if you want to use your own KEY values, make them start with `user-'."
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
227 (let (lang-slot key-slot)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
228 (setq lang-slot (assoc language-name language-info-alist))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
229 (if (null lang-slot) ; If no slot for the language, add it.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
230 (setq lang-slot (list language-name)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
231 language-info-alist (cons lang-slot language-info-alist)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
232 (setq key-slot (assq key lang-slot))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
233 (if (null key-slot) ; If no slot for the key, add it.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
234 (progn
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
235 (setq key-slot (list key))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
236 (setcdr lang-slot (cons key-slot (cdr lang-slot)))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
237 ;; Setup menu.
17840
2517414676ed (set-language-info): Change the special treatment
Kenichi Handa <handa@m17n.org>
parents: 17758
diff changeset
238 (cond ((eq key 'documentation)
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
239 (define-key-after
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
240 (if (consp info)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
241 (prog1 (symbol-value (cdr info))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
242 (setq info (car info)))
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
243 describe-language-environment-map)
17090
8085a8690c87 (mule-keymap): Re-arranged.
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
244 (vector (intern language-name))
17840
2517414676ed (set-language-info): Change the special treatment
Kenichi Handa <handa@m17n.org>
parents: 17758
diff changeset
245 (cons language-name 'describe-specified-language-support)
17758
8c67c2e2cc29 (build-describe-language-support-function,
Kenichi Handa <handa@m17n.org>
parents: 17526
diff changeset
246 t))
17090
8085a8690c87 (mule-keymap): Re-arranged.
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
247 ((eq key 'setup-function)
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
248 (define-key-after
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
249 (if (consp info)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
250 (prog1 (symbol-value (cdr info))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
251 (setq info (car info)))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
252 setup-language-environment-map)
17090
8085a8690c87 (mule-keymap): Re-arranged.
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
253 (vector (intern language-name))
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
254 (cons language-name 'setup-specified-language-environment)
17758
8c67c2e2cc29 (build-describe-language-support-function,
Kenichi Handa <handa@m17n.org>
parents: 17526
diff changeset
255 t)))
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
256
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
257 (setcdr key-slot info)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
258 ))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
259
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
260 (defun set-language-info-alist (language-name alist)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
261 "Set for LANGUAGE-NAME the information in ALIST.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
262 ALIST is an alist of KEY and INFO. See the documentation of
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
263 `set-langauge-info' for the meanings of KEY and INFO."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
264 (while alist
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
265 (set-language-info language-name (car (car alist)) (cdr (car alist)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
266 (setq alist (cdr alist))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
267
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
268 (defun read-language-name (key prompt &optional initial-input)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
269 "Read language name which has information for KEY, prompting with PROMPT."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
270 (let* ((completion-ignore-case t)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
271 (name (completing-read prompt
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
272 language-info-alist
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
273 (function (lambda (elm) (assq key elm)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
274 t
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
275 initial-input)))
17758
8c67c2e2cc29 (build-describe-language-support-function,
Kenichi Handa <handa@m17n.org>
parents: 17526
diff changeset
276 (if (and (> (length name) 0)
8c67c2e2cc29 (build-describe-language-support-function,
Kenichi Handa <handa@m17n.org>
parents: 17526
diff changeset
277 (get-language-info name key))
8c67c2e2cc29 (build-describe-language-support-function,
Kenichi Handa <handa@m17n.org>
parents: 17526
diff changeset
278 name)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
279
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
280 ;;; Multilingual input methods.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
281
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
282 (defconst leim-list-file-name "leim-list.el"
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
283 "Name of LEIM list file.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
284 This file contains a list of libraries of Emacs input methods (LEIM)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
285 in the format of Lisp expression for registering each input method.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
286 Emacs loads this file at startup time.")
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
287
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
288 (defvar leim-list-header (format "\
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
289 ;;; %s -- list of LEIM (Library of Emacs Input Method)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
290 ;;
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
291 ;; This file contains a list of LEIM (Library of Emacs Input Method)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
292 ;; in the same directory as this file. Loading this file registeres
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
293 ;; the whole input methods in Emacs.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
294 ;;
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
295 ;; Each entry is has the form:
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
296 ;; (register-input-method
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
297 ;; INPUT-METHOD LANGUAGE-NAME ACTIVATE-FUNC
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
298 ;; TITLE DESCRIPTION
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
299 ;; ARG ...)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
300 ;; See the function `register-input-method' for the meanings of arguments.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
301 ;;
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
302 ;; If this directory is included in load-path, Emacs automatically
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
303 ;; loads this file at startup time.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
304
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
305 "
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
306 leim-list-file-name)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
307 "Header to be inserted in LEIM list file.")
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
308
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
309 (defvar leim-list-entry-regexp "(register-input-method"
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
310 "Regexp matching head of each entry in LEIM list file.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
311 See also the variable `leim-list-header'")
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
312
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
313 (defvar update-leim-list-functions
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
314 '(quail-update-leim-list-file)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
315 "List of functions to call to update LEIM list file.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
316 Each function is called with one arg, LEIM directory name.")
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
317
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
318 (defun update-leim-list-file (dir)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
319 "Update LEIM list file in directory DIR."
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
320 (let ((functions update-leim-list-functions))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
321 (while functions
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
322 (funcall (car functions) (expand-file-name dir))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
323 (setq functions (cdr functions)))))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
324
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
325 (defun update-all-leim-list-files ()
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
326 "Update all the LEIM list files."
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
327 (interactive)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
328 (let ((l load-path))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
329 (while l
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
330 (if (string-match "leim" (car l))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
331 (update-leim-list-file (car l)))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
332 (setq l (cdr l)))))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
333
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
334 (defvar current-input-method nil
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
335 "The current input method for multilingual text.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
336 If nil, it means no input method is activated now.")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
337 (make-variable-buffer-local 'current-input-method)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
338 (put 'current-input-method 'permanent-local t)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
339
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
340 (defvar current-input-method-title nil
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
341 "Title string of the current input method shown in mode line.")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
342 (make-variable-buffer-local 'current-input-method-title)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
343 (put 'current-input-method-title 'permanent-local t)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
344
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
345 (defvar default-input-method nil
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
346 "Default input method for multilingual text.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
347 The default input method is the one activated automatically by the command
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
348 `toggle-input-method' (\\[toggle-input-method]).")
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
349 (make-variable-buffer-local 'default-input-method)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
350 (put 'default-input-method 'permanent-local t)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
351
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
352 (defvar previous-input-method nil
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
353 "Input method selected previously in the current buffer.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
354 This is the one selected before the current input method is selected.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
355 See also the documentation of `default-input-method'.")
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
356 (make-variable-buffer-local 'previous-input-method)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
357 (put 'previous-input-method 'permanent-local t)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
358
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
359 (defvar inactivate-current-input-method-function nil
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
360 "Function to call for inactivating the current input method.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
361 Every input method should set this to an appropriate value when activated.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
362 This function is called with no argument.")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
363 (make-variable-buffer-local 'inactivate-current-input-method-function)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
364 (put 'inactivate-current-input-method-function 'permanent-local t)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
365
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
366 (defvar describe-current-input-method-function nil
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
367 "Function to call for describing the current input method.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
368 This function is called with no argument.")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
369 (make-variable-buffer-local 'describe-current-input-method-function)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
370 (put 'describe-current-input-method-function 'permanent-local t)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
371
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
372 (defvar input-method-alist nil
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
373 "Alist of input method names vs the corresponding information to use it.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
374 Each element has the form:
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
375 (INPUT-METHOD LANGUAGE-NAME ACTIVATE-FUNC TITLE DESCRIPTION ...)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
376 See the function `register-input-method' for the meanings of each elements.")
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
377
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
378 (defun register-input-method (input-method language-name &rest args)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
379 "Register INPUT-METHOD as an input method for LANGUAGE-NAME.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
380 INPUT-METHOD and LANGUAGE-NAME are strings.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
381 The remaining arguments are:
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
382 ACTIVATE-FUNC, TITLE, DESCRIPTION, and ARG ...
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
383 where,
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
384 ACTIVATE-FUNC is a function to call for activating this method.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
385 TITLE is a string shown in mode-line while this method is active,
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
386 DESCRIPTION is a string describing about this method,
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
387 Arguments to ACTIVATE-FUNC are INPUT-METHOD and ARGs."
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
388 (let ((info (cons language-name args))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
389 (slot (assoc input-method input-method-alist)))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
390 (if slot
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
391 (setcdr slot info)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
392 (setq slot (cons input-method info))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
393 (setq input-method-alist (cons slot input-method-alist)))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
394
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
395 (defun read-input-method-name (prompt &optional initial-input inhibit-null)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
396 "Read a name of input method from a minibuffer prompting with PROMPT.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
397 If INITIAL-INPUT is non-nil, insert it in the minibuffer initially.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
398 If it is (STRING . POSITION), the initial input
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
399 is STRING, but point is placed POSITION characters into the string.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
400 If INHIBIT-NULL is non-nil, null input signals an error."
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
401 (let* ((completion-ignore-case t)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
402 (input-method (completing-read prompt input-method-alist
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
403 nil t initial-input)))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
404 (if (> (length input-method) 0)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
405 input-method
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
406 (if inhibit-null
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
407 (error "The specified input method is not avairable")))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
408
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
409 ;; Actvate INPUT-METHOD.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
410 (defun activate-input-method (input-method)
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
411 (if (and current-input-method
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
412 (not (string= current-input-method input-method)))
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
413 (inactivate-input-method))
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
414 (if current-input-method
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
415 nil ; We have nothing to do.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
416 (let ((slot (assoc input-method input-method-alist)))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
417 (if (null slot)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
418 (error "Invalid input method `%s'" input-method))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
419 (apply (nth 2 slot) input-method (nthcdr 5 slot))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
420 (setq current-input-method input-method)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
421 (setq current-input-method-title (nth 3 slot))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
422 (if (not (string= default-input-method current-input-method))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
423 (setq previous-input-method default-input-method
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
424 default-input-method current-input-method)))))
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
425
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
426 ;; Inactivate the current input method.
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
427 (defun inactivate-input-method ()
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
428 (if current-input-method
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
429 (unwind-protect
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
430 (funcall inactivate-current-input-method-function)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
431 (setq current-input-method nil))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
432
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
433 (defun select-input-method (input-method)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
434 "Select and activate INPUT-METHOD.
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
435 Both the default and local values of default-input-method are
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
436 set to the selected input method.
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
437 See also the function `register-input-method'."
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
438 (interactive
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
439 (let* ((default (or previous-input-method default-input-method))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
440 (initial (if default (cons default 0))))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
441 (list (read-input-method-name "Input method: " initial t))))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
442 (activate-input-method input-method)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
443 (setq-default default-input-method default-input-method))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
444
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
445 (defun toggle-input-method (&optional arg)
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
446 "Turn on or off a multilingual text input method for the current buffer.
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
447 With arg, read an input method from minibuffer and turn it on.
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
448 Without arg, if some input method is currently activated, turn it off,
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
449 else turn on default-input-method (which see).
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
450 In the latter case, if default-input-method is nil, select an input method
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
451 interactively."
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
452 (interactive "P")
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
453 (let* ((default (or previous-input-method default-input-method))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
454 (initial (if default (cons default 0))))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
455 (if arg
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
456 (activate-input-method
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
457 (read-input-method-name "Input method: " initial t))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
458 (if current-input-method
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
459 (inactivate-input-method)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
460 (if default-input-method
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
461 (activate-input-method default-input-method)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
462 (activate-input-method
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
463 (read-input-method-name "Input method: " initial t)))))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
464
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
465 (defun describe-input-method (input-method)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
466 "Describe the current input method."
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
467 (interactive
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
468 (list (read-input-method-name
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
469 "Describe input method (default, current choice): ")))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
470 (if (null input-method)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
471 (describe-current-input-method)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
472 (with-output-to-temp-buffer "*Help*"
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
473 (let ((elt (assoc input-method input-method-alist)))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
474 (princ (format "Input method: %s (`%s' in mode line) for %s\n %s\n"
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
475 input-method (nth 3 elt) (nth 1 elt) (nth 4 elt)))))))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
476
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
477 (defun describe-current-input-method ()
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
478 "Describe the input method currently turned on."
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
479 (if current-input-method
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
480 (if (and (symbolp describe-current-input-method-function)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
481 (fboundp describe-current-input-method-function))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
482 (funcall describe-current-input-method-function)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
483 (message "No way to describe the current input method `%s'"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
484 (cdr current-input-method))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
485 (ding))
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
486 (error "No input method is activated now")))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
487
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
488 (defun read-multilingual-string (prompt &optional initial-input
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
489 input-method)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
490 "Read a multilingual string from minibuffer, prompting with string PROMPT.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
491 The input method selected last time is activated in minibuffer.
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
492 If optional second arg INITIAL-INPUT is non-nil, insert it in the minibuffer
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
493 initially.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
494 Optional 3rd argument INPUT-METHOD specifies the input method
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
495 to be activated instead of the one selected last time."
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
496 (let ((default-input-method
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
497 (or input-method
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
498 default-input-method
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
499 (read-input-method-name "Input method: " nil t))))
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
500 (let ((minibuffer-setup-hook '(toggle-input-method)))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
501 (read-string prompt initial-input))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
502
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
503 ;; Variables to control behavior of input methods. All input methods
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
504 ;; should react to these variables.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
505
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
506 (defvar input-method-tersely-flag nil
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
507 "*If this flag is non-nil, input method works rather tersely.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
508
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
509 For instance, Quail input method does not show guidance buffer while
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
510 inputting at minibuffer if this flag is t.")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
511
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
512 (defvar input-method-activate-hook nil
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
513 "Normal hook run just after an input method is activated.")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
514
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
515 (defvar input-method-inactivate-hook nil
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
516 "Normal hook run just after an input method is inactivated.")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
517
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
518 (defvar input-method-after-insert-chunk-hook nil
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
519 "Normal hook run just after an input method insert some chunk of text.")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
520
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
521
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
522 (defun setup-specified-language-environment ()
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
523 "Setup multi-lingual environment convenient for the specified language."
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
524 (interactive)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
525 (let (language-name func)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
526 (if (and (symbolp last-command-event)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
527 (or (not (eq last-command-event 'Default))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
528 (setq last-command-event 'English))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
529 (setq language-name (symbol-name last-command-event))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
530 (setq func (get-language-info language-name 'setup-function)))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
531 (progn
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
532 (funcall func)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
533 (force-mode-line-update t))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
534 (error "Bogus calling sequence"))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
535
18066
eecd891e2b63 (set-language-environment): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents: 17991
diff changeset
536 ;;;###autoload
eecd891e2b63 (set-language-environment): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents: 17991
diff changeset
537 (defun set-language-environment (language-name)
18068
317f57f07b14 Doc fix for previous change.
Richard M. Stallman <rms@gnu.org>
parents: 18066
diff changeset
538 "Set up multi-lingual environment for using LANGUAGE-NAME.
317f57f07b14 Doc fix for previous change.
Richard M. Stallman <rms@gnu.org>
parents: 18066
diff changeset
539 This sets the coding system priority and the default input method
317f57f07b14 Doc fix for previous change.
Richard M. Stallman <rms@gnu.org>
parents: 18066
diff changeset
540 and sometimes other things."
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
541 (interactive (list (read-language-name 'setup-function "Language: ")))
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
542 (if (or (null language-name)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
543 (null (get-language-info language-name 'setup-function)))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
544 (error "No way to setup environment for the specified language"))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
545 (let ((last-command-event (intern language-name)))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
546 (setup-specified-language-environment)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
547
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
548 ;; Print all arguments with `princ', then print "\n".
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
549 (defsubst princ-list (&rest args)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
550 (while args (princ (car args)) (setq args (cdr args)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
551 (princ "\n"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
552
17840
2517414676ed (set-language-info): Change the special treatment
Kenichi Handa <handa@m17n.org>
parents: 17758
diff changeset
553 ;; Print a language specific information such as input methods,
17758
8c67c2e2cc29 (build-describe-language-support-function,
Kenichi Handa <handa@m17n.org>
parents: 17526
diff changeset
554 ;; charsets, and coding systems. This function is intended to be
17840
2517414676ed (set-language-info): Change the special treatment
Kenichi Handa <handa@m17n.org>
parents: 17758
diff changeset
555 ;; called from the menu:
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
556 ;; [menu-bar mule describe-language-environment LANGUAGE]
17840
2517414676ed (set-language-info): Change the special treatment
Kenichi Handa <handa@m17n.org>
parents: 17758
diff changeset
557 ;; and should not run it by `M-x describe-current-input-method-function'.
2517414676ed (set-language-info): Change the special treatment
Kenichi Handa <handa@m17n.org>
parents: 17758
diff changeset
558 (defun describe-specified-language-support ()
2517414676ed (set-language-info): Change the special treatment
Kenichi Handa <handa@m17n.org>
parents: 17758
diff changeset
559 "Describe how Emacs supports the specified langugage."
2517414676ed (set-language-info): Change the special treatment
Kenichi Handa <handa@m17n.org>
parents: 17758
diff changeset
560 (interactive)
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
561 (let (language-name)
17840
2517414676ed (set-language-info): Change the special treatment
Kenichi Handa <handa@m17n.org>
parents: 17758
diff changeset
562 (if (not (and (symbolp last-command-event)
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
563 (setq language-name (symbol-name last-command-event))))
17840
2517414676ed (set-language-info): Change the special treatment
Kenichi Handa <handa@m17n.org>
parents: 17758
diff changeset
564 (error "Bogus calling sequence"))
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
565 (describe-language-environment language-name)))
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
566
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
567 (defun describe-language-environment (language-name)
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
568 "Describe how Emacs supports language environment LANGUAGE-NAME."
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
569 (interactive (list (read-language-name 'documentation "Language: ")))
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
570 (if (or (null language-name)
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
571 (null (get-language-info language-name 'documentation)))
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
572 (error "No documentation for the specified language"))
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
573 (let ((doc (get-language-info language-name 'documentation)))
17840
2517414676ed (set-language-info): Change the special treatment
Kenichi Handa <handa@m17n.org>
parents: 17758
diff changeset
574 (with-output-to-temp-buffer "*Help*"
17758
8c67c2e2cc29 (build-describe-language-support-function,
Kenichi Handa <handa@m17n.org>
parents: 17526
diff changeset
575 (if (stringp doc)
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
576 (progn
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
577 (princ-list doc)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
578 (terpri)))
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
579 (let ((str (get-language-info language-name 'sample-text)))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
580 (if (stringp str)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
581 (progn
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
582 (princ "Sample text:\n")
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
583 (princ-list " " str)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
584 (terpri))))
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
585 (princ "Input methods:\n")
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
586 (let ((l input-method-alist))
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
587 (while l
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
588 (if (string= language-name (nth 1 (car l)))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
589 (princ-list " " (car (car l))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
590 (format " (`%s' in mode line)" (nth 3 (car l)))))
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
591 (setq l (cdr l))))
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
592 (terpri)
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
593 (princ "Character sets:\n")
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
594 (let ((l (get-language-info language-name 'charset)))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
595 (if (null l)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
596 (princ-list " nothing specific to " language-name)
17840
2517414676ed (set-language-info): Change the special treatment
Kenichi Handa <handa@m17n.org>
parents: 17758
diff changeset
597 (while l
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
598 (princ-list " " (car l) ": "
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
599 (charset-description (car l)))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
600 (setq l (cdr l)))))
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
601 (terpri)
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
602 (princ "Coding systems:\n")
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
603 (let ((l (get-language-info language-name 'coding-system)))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
604 (if (null l)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
605 (princ-list " nothing specific to " language-name)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
606 (while l
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
607 (princ (format " %s (`%c' in mode line):\n\t%s\n"
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
608 (car l)
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
609 (coding-system-mnemonic (car l))
18176
fc07ea29cd81 Define mouse-set-font in mule-menu-keymap.
Kenichi Handa <handa@m17n.org>
parents: 18152
diff changeset
610 (coding-system-doc-string (car l))))
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
611 (setq l (cdr l))))))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
612
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
613 ;;; Charset property
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
614
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
615 (defsubst get-charset-property (charset propname)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
616 "Return the value of CHARSET's PROPNAME property.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
617 This is the last value stored with
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
618 `(put-charset-property CHARSET PROPNAME VALUE)'."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
619 (plist-get (charset-plist charset) propname))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
620
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
621 (defsubst put-charset-property (charset propname value)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
622 "Store CHARSETS's PROPNAME property with value VALUE.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
623 It can be retrieved with `(get-charset-property CHARSET PROPNAME)'."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
624 (set-charset-plist charset
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
625 (plist-put (charset-plist charset) propname value)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
626
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
627 ;;; Character code property
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
628 (put 'char-code-property-table 'char-table-extra-slots 0)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
629
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
630 (defvar char-code-property-table
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
631 (make-char-table 'char-code-property-table)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
632 "Char-table containing a property list of each character code.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
633
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
634 See also the documentation of `get-char-code-property' and
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
635 `put-char-code-property'")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
636
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
637 (defun get-char-code-property (char propname)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
638 "Return the value of CHAR's PROPNAME property in `char-code-property-table'."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
639 (let ((plist (aref char-code-property-table char)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
640 (if (listp plist)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
641 (car (cdr (memq propname plist))))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
642
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
643 (defun put-char-code-property (char propname value)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
644 "Store CHAR's PROPNAME property with VALUE in `char-code-property-table'.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
645 It can be retrieved with `(get-char-code-property CHAR PROPNAME)'."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
646 (let ((plist (aref char-code-property-table char)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
647 (if plist
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
648 (let ((slot (memq propname plist)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
649 (if slot
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
650 (setcar (cdr slot) value)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
651 (nconc plist (list propname value))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
652 (aset char-code-property-table char (list propname value)))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
653
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
654 ;;; mule-cmds.el ends here