annotate lisp/international/mule-cmds.el @ 18914:f9d2d84a004c

Initial revision
author Richard M. Stallman <rms@gnu.org>
date Wed, 23 Jul 1997 02:34:54 +0000
parents 75b2e402c45d
children 817d02b8b126
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)
18801
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
43 (define-key mule-keymap "l" 'set-language-environment)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
44
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
45 (define-key help-map "\C-L" 'describe-language-environment)
18633
c8cbbd038612 (help-map): Bind I to describe-input-method.
Richard M. Stallman <rms@gnu.org>
parents: 18377
diff changeset
46 (define-key help-map "L" 'describe-language-environment)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
47 (define-key help-map "\C-\\" 'describe-input-method)
18633
c8cbbd038612 (help-map): Bind I to describe-input-method.
Richard M. Stallman <rms@gnu.org>
parents: 18377
diff changeset
48 (define-key help-map "I" 'describe-input-method)
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
49 (define-key help-map "C" 'describe-coding-system)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
50 (define-key help-map "h" 'view-hello-file)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
51
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
52 (defvar mule-menu-keymap nil
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
53 "Keymap for MULE (Multilingual environment) menu specific commands.")
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
54 (define-prefix-command 'mule-menu-keymap)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
55
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
56 (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
57
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
58 (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
59
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
60 (defvar describe-language-environment-map nil)
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
61 (define-prefix-command 'describe-language-environment-map)
17991
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 setup-language-environment-map nil)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
64 (define-prefix-command 'setup-language-environment-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 (defvar set-coding-system-map nil)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
67 (define-prefix-command 'set-coding-system-map)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
68
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
69 (define-key-after mule-menu-keymap [toggle-mule]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
70 '("Toggle MULE facility" . toggle-enable-multibyte-characters)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
71 t)
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
72 (define-key-after mule-menu-keymap [describe-language-environment]
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
73 '("Describe language environment" . describe-language-environment-map)
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
74 t)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
75 (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
76 '("Set language environment" . setup-language-environment-map)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
77 t)
18351
8cc30b266976 Define mouse-set-font in mule-menu-keymap agian.
Kenichi Handa <handa@m17n.org>
parents: 18301
diff changeset
78 (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
79 '("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
80 t)
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
81 (define-key-after mule-menu-keymap [separator-mule]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
82 '("--")
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 [toggle-input-method]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
85 '("Toggle input method" . toggle-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 [select-input-method]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
88 '("Select input method" . select-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 [describe-input-method]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
91 '("Describe input method" . describe-input-method)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
92 t)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
93 (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
94 '("--")
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
95 t)
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
96 (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
97 '("Describe coding systems" . describe-coding-system)
17991
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 [set-various-coding-system]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
100 '("Set coding systems" . set-coding-system-map)
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 [separator-coding-system]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
103 '("--")
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 [mule-diag]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
106 '("Show diagnosis for MULE" . mule-diag)
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 (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
109 '("Show many languages" . view-hello-file)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
110 t)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
111
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-buffer-file-coding-system]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
113 '("Buffer file" . set-buffer-file-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-terminal-coding-system]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
116 '("Terminal" . set-terminal-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-keyboard-coding-system]
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
119 '("Keyboard" . set-keyboard-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 (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
122 '("Buffer process" . set-buffer-process-coding-system)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
123 t)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
124
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
125 (define-key setup-language-environment-map
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
126 [Default] '("Default" . setup-specified-language-environment))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
127
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
128 ;; These are meaningless when running under X.
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
129 (put 'set-terminal-coding-system 'menu-enable
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
130 '(null window-system))
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
131 (put 'set-keyboard-coding-system 'menu-enable
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
132 '(null window-system))
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
133 ;; 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
134 (put 'set-buffer-process-coding-system 'menu-enable
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
135 '(get-buffer-process (current-buffer)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
136
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
137 ;; This should be a single character key binding because users use it
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
138 ;; very frequently while editing multilingual text. Now we can use
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
139 ;; only two such keys: "\C-\\" and "\C-^", but the latter is not
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
140 ;; convenient because it requires shifting on most keyboards. An
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
141 ;; alternative is "\C-\]" which is now bound to `abort-recursive-edit'
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
142 ;; but it won't be used that frequently.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
143 (define-key global-map "\C-\\" 'toggle-input-method)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
144
18807
75b2e402c45d (global-map): Turn off the S-SPC binding.
Richard M. Stallman <rms@gnu.org>
parents: 18801
diff changeset
145 ;;; This is no good because people often type Shift-SPC
75b2e402c45d (global-map): Turn off the S-SPC binding.
Richard M. Stallman <rms@gnu.org>
parents: 18801
diff changeset
146 ;;; meaning to type SPC. -- rms.
75b2e402c45d (global-map): Turn off the S-SPC binding.
Richard M. Stallman <rms@gnu.org>
parents: 18801
diff changeset
147 ;;; ;; Here's an alternative key binding for X users (Shift-SPACE).
75b2e402c45d (global-map): Turn off the S-SPC binding.
Richard M. Stallman <rms@gnu.org>
parents: 18801
diff changeset
148 ;;; (define-key global-map [?\S- ] 'toggle-input-method)
18801
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
149
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
150 (defun toggle-enable-multibyte-characters (&optional arg)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
151 "Change whether this buffer enables multibyte characters.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
152 With arg, make them enable iff arg is positive."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
153 (interactive "P")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
154 (setq enable-multibyte-characters
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
155 (if (null arg) (null enable-multibyte-characters)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
156 (> (prefix-numeric-value arg) 0)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
157 (force-mode-line-update))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
158
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
159 (defun view-hello-file ()
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
160 "Display the HELLO file which list up many languages and characters."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
161 (interactive)
17294
d7ae63db9e6e Prefix for Mule related commands is changed.
Kenichi Handa <handa@m17n.org>
parents: 17090
diff changeset
162 ;; 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
163 (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
164 (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
165 (find-file-read-only (expand-file-name "HELLO" data-directory))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
166
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
167 (defun universal-coding-system-argument ()
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
168 "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
169 (interactive)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
170 (let* ((coding-system (read-coding-system "Coding system: "))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
171 (keyseq (read-key-sequence
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
172 (format "With coding system %s:" coding-system)))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
173 (cmd (key-binding keyseq)))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
174 (let ((coding-system-for-read coding-system)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
175 (coding-system-for-write coding-system))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
176 (message "")
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
177 (call-interactively cmd))))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
178
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
179
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
180 ;;; Language support staffs.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
181
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
182 (defvar primary-language "English"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
183 "Name of a user's primary language.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
184 Emacs provide various language supports based on this variable.")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
185
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
186 (defvar language-info-alist nil
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
187 "Alist of language names vs the corresponding information of various kind.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
188 Each element looks like:
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
189 (LANGUAGE-NAME . ((KEY . INFO) ...))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
190 where LANGUAGE-NAME is a string,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
191 KEY is a symbol denoting the kind of information,
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
192 INFO is any Lisp object which contains the actual information related
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
193 to KEY.")
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 get-language-info (language-name key)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
196 "Return the information for LANGUAGE-NAME of the kind 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 required information."
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
199 (let ((lang-slot (assoc-ignore-case language-name language-info-alist)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
200 (if lang-slot
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
201 (cdr (assq key (cdr lang-slot))))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
202
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
203 (defun set-language-info (language-name key info)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
204 "Set for LANGUAGE-NAME the information INFO under KEY.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
205 LANGUAGE-NAME is a string
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
206 KEY is a symbol denoting the kind of information.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
207 INFO is any Lisp object which contains the actual information.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
208
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
209 Currently, the following KEYs are used by Emacs:
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
210
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
211 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
212
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
213 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
214
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
215 tutorial: a tutorial file name written in the language.
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
216
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
217 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
218
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
219 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
220 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
221 of the language by the command `describe-language-environment'.
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
222
17758
8c67c2e2cc29 (build-describe-language-support-function,
Kenichi Handa <handa@m17n.org>
parents: 17526
diff changeset
223 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
224 convenient for a user of the language.
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
225
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
226 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
227 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
228 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
229 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
230 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
231 is actually set as the information.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
232
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
233 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
234 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
235 (let (lang-slot key-slot)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
236 (setq lang-slot (assoc language-name language-info-alist))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
237 (if (null lang-slot) ; If no slot for the language, add it.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
238 (setq lang-slot (list language-name)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
239 language-info-alist (cons lang-slot language-info-alist)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
240 (setq key-slot (assq key lang-slot))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
241 (if (null key-slot) ; If no slot for the key, add it.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
242 (progn
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
243 (setq key-slot (list key))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
244 (setcdr lang-slot (cons key-slot (cdr lang-slot)))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
245 ;; Setup menu.
17840
2517414676ed (set-language-info): Change the special treatment
Kenichi Handa <handa@m17n.org>
parents: 17758
diff changeset
246 (cond ((eq key 'documentation)
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
247 (define-key-after
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
248 (if (consp info)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
249 (prog1 (symbol-value (cdr info))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
250 (setq info (car info)))
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
251 describe-language-environment-map)
17090
8085a8690c87 (mule-keymap): Re-arranged.
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
252 (vector (intern language-name))
17840
2517414676ed (set-language-info): Change the special treatment
Kenichi Handa <handa@m17n.org>
parents: 17758
diff changeset
253 (cons language-name 'describe-specified-language-support)
17758
8c67c2e2cc29 (build-describe-language-support-function,
Kenichi Handa <handa@m17n.org>
parents: 17526
diff changeset
254 t))
17090
8085a8690c87 (mule-keymap): Re-arranged.
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
255 ((eq key 'setup-function)
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
256 (define-key-after
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
257 (if (consp info)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
258 (prog1 (symbol-value (cdr info))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
259 (setq info (car info)))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
260 setup-language-environment-map)
17090
8085a8690c87 (mule-keymap): Re-arranged.
Kenichi Handa <handa@m17n.org>
parents: 17071
diff changeset
261 (vector (intern language-name))
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
262 (cons language-name 'setup-specified-language-environment)
17758
8c67c2e2cc29 (build-describe-language-support-function,
Kenichi Handa <handa@m17n.org>
parents: 17526
diff changeset
263 t)))
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
264
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
265 (setcdr key-slot info)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
266 ))
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 set-language-info-alist (language-name alist)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
269 "Set for LANGUAGE-NAME the information in ALIST.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
270 ALIST is an alist of KEY and INFO. See the documentation of
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
271 `set-langauge-info' for the meanings of KEY and INFO."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
272 (while alist
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
273 (set-language-info language-name (car (car alist)) (cdr (car alist)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
274 (setq alist (cdr alist))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
275
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
276 (defun read-language-name (key prompt &optional initial-input)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
277 "Read language name which has information for KEY, prompting with PROMPT."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
278 (let* ((completion-ignore-case t)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
279 (name (completing-read prompt
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
280 language-info-alist
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
281 (function (lambda (elm) (assq key elm)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
282 t
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
283 initial-input)))
17758
8c67c2e2cc29 (build-describe-language-support-function,
Kenichi Handa <handa@m17n.org>
parents: 17526
diff changeset
284 (if (and (> (length name) 0)
8c67c2e2cc29 (build-describe-language-support-function,
Kenichi Handa <handa@m17n.org>
parents: 17526
diff changeset
285 (get-language-info name key))
8c67c2e2cc29 (build-describe-language-support-function,
Kenichi Handa <handa@m17n.org>
parents: 17526
diff changeset
286 name)))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
287
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
288 ;;; Multilingual input methods.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
289
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
290 (defconst leim-list-file-name "leim-list.el"
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
291 "Name of LEIM list file.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
292 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
293 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
294 Emacs loads this file at startup time.")
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
295
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
296 (defvar leim-list-header (format "\
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
297 ;;; %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
298 ;;
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
299 ;; 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
300 ;; 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
301 ;; the whole input methods in Emacs.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
302 ;;
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
303 ;; Each entry is has the form:
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
304 ;; (register-input-method
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
305 ;; INPUT-METHOD LANGUAGE-NAME ACTIVATE-FUNC
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
306 ;; TITLE DESCRIPTION
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
307 ;; ARG ...)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
308 ;; 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
309 ;;
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
310 ;; 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
311 ;; loads this file at startup time.
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 "
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
314 leim-list-file-name)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
315 "Header to be inserted in LEIM list file.")
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
316
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
317 (defvar leim-list-entry-regexp "(register-input-method"
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
318 "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
319 See also the variable `leim-list-header'")
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
320
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
321 (defvar update-leim-list-functions
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
322 '(quail-update-leim-list-file)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
323 "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
324 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
325
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
326 (defun update-leim-list-file (dir)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
327 "Update LEIM list file in directory DIR."
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
328 (let ((functions update-leim-list-functions))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
329 (while functions
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
330 (funcall (car functions) (expand-file-name dir))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
331 (setq functions (cdr functions)))))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
332
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
333 (defun update-all-leim-list-files ()
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
334 "Update all the LEIM list files."
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
335 (interactive)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
336 (let ((l load-path))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
337 (while l
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
338 (if (string-match "leim" (car l))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
339 (update-leim-list-file (car l)))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
340 (setq l (cdr l)))))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
341
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
342 (defvar current-input-method nil
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
343 "The current input method for multilingual text.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
344 If nil, it means no input method is activated now.")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
345 (make-variable-buffer-local 'current-input-method)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
346 (put 'current-input-method 'permanent-local t)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
347
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
348 (defvar current-input-method-title nil
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
349 "Title string of the current input method shown in mode line.")
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
350 (make-variable-buffer-local 'current-input-method-title)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
351 (put 'current-input-method-title 'permanent-local t)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
352
18801
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
353 (defcustom default-input-method nil
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
354 "*Default input method for multilingual text.
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
355 This is the input method activated automatically by the command
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
356 `toggle-input-method' (\\[toggle-input-method]).
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
357 Automatically local in all buffers."
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
358 :group 'mule)
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
359
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
360 (make-variable-buffer-local 'default-input-method)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
361 (put 'default-input-method 'permanent-local t)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
362
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
363 (defvar previous-input-method nil
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
364 "Input method selected previously in the current buffer.
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
365 This is the one selected before the current input method is selected.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
366 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
367 (make-variable-buffer-local 'previous-input-method)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
368 (put 'previous-input-method 'permanent-local t)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
369
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
370 (defvar inactivate-current-input-method-function nil
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
371 "Function to call for inactivating the current input method.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
372 Every input method should set this to an appropriate value when activated.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
373 This function is called with no argument.")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
374 (make-variable-buffer-local 'inactivate-current-input-method-function)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
375 (put 'inactivate-current-input-method-function 'permanent-local t)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
376
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
377 (defvar describe-current-input-method-function nil
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
378 "Function to call for describing the current input method.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
379 This function is called with no argument.")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
380 (make-variable-buffer-local 'describe-current-input-method-function)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
381 (put 'describe-current-input-method-function 'permanent-local t)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
382
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
383 (defvar input-method-alist nil
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
384 "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
385 Each element has the form:
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
386 (INPUT-METHOD LANGUAGE-NAME ACTIVATE-FUNC TITLE DESCRIPTION ...)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
387 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
388
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
389 (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
390 "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
391 INPUT-METHOD and LANGUAGE-NAME are strings.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
392 The remaining arguments are:
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
393 ACTIVATE-FUNC, TITLE, DESCRIPTION, and ARG ...
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
394 where,
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
395 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
396 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
397 DESCRIPTION is a string describing about this method,
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
398 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
399 (let ((info (cons language-name args))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
400 (slot (assoc input-method input-method-alist)))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
401 (if slot
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
402 (setcdr slot info)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
403 (setq slot (cons input-method info))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
404 (setq input-method-alist (cons slot input-method-alist)))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
405
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
406 (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
407 "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
408 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
409 If it is (STRING . POSITION), the initial input
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
410 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
411 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
412 (let* ((completion-ignore-case t)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
413 (input-method (completing-read prompt input-method-alist
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
414 nil t initial-input)))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
415 (if (> (length input-method) 0)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
416 input-method
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
417 (if inhibit-null
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
418 (error "The specified input method is not avairable")))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
419
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
420 ;; Actvate INPUT-METHOD.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
421 (defun activate-input-method (input-method)
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
422 (if (and current-input-method
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
423 (not (string= current-input-method input-method)))
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
424 (inactivate-input-method))
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
425 (if current-input-method
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
426 nil ; We have nothing to do.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
427 (let ((slot (assoc input-method input-method-alist)))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
428 (if (null slot)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
429 (error "Invalid input method `%s'" input-method))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
430 (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
431 (setq current-input-method input-method)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
432 (setq current-input-method-title (nth 3 slot))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
433 (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
434 (setq previous-input-method default-input-method
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
435 default-input-method current-input-method)))))
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
436
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
437 ;; Inactivate the current input method.
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
438 (defun inactivate-input-method ()
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
439 (if current-input-method
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
440 (unwind-protect
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
441 (funcall inactivate-current-input-method-function)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
442 (setq current-input-method nil))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
443
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
444 (defun select-input-method (input-method)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
445 "Select and activate INPUT-METHOD.
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
446 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
447 set to the selected input method.
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
448 See also the function `register-input-method'."
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
449 (interactive
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
450 (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
451 (initial (if default (cons default 0))))
18801
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
452 (if (not enable-multibyte-characters)
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
453 (error "Can't activate any input method while enable-multibyte-characters is nil"))
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
454 (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
455 (activate-input-method input-method)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
456 (setq-default default-input-method default-input-method))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
457
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
458 (defun toggle-input-method (&optional arg)
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
459 "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
460 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
461 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
462 else turn on default-input-method (which see).
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
463 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
464 interactively."
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
465 (interactive "P")
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
466 (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
467 (initial (if default (cons default 0))))
18801
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
468 (if (and current-input-method (not arg))
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
469 (inactivate-input-method)
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
470 (if (not enable-multibyte-characters)
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
471 (error "Can't activate any input method while enable-multibyte-characters is nil"))
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
472 (activate-input-method
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
473 (if (or arg (not default-input-method))
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
474 (read-input-method-name "Input method: " initial t)
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
475 default-input-method)))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
476
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
477 (defun describe-input-method (input-method)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
478 "Describe the current input method."
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
479 (interactive
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
480 (list (read-input-method-name
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
481 "Describe input method (default, current choice): ")))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
482 (if (null input-method)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
483 (describe-current-input-method)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
484 (with-output-to-temp-buffer "*Help*"
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
485 (let ((elt (assoc input-method input-method-alist)))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
486 (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
487 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
488
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
489 (defun describe-current-input-method ()
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
490 "Describe the input method currently turned on."
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
491 (if current-input-method
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
492 (if (and (symbolp describe-current-input-method-function)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
493 (fboundp describe-current-input-method-function))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
494 (funcall describe-current-input-method-function)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
495 (message "No way to describe the current input method `%s'"
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
496 (cdr current-input-method))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
497 (ding))
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
498 (error "No input method is activated now")))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
499
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
500 (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
501 input-method)
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
502 "Read a multilingual string from minibuffer, prompting with string PROMPT.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
503 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
504 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
505 initially.
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
506 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
507 to be activated instead of the one selected last time."
18712
7366898bee9e (read-multilingual-string): Adjusted
Kenichi Handa <handa@m17n.org>
parents: 18634
diff changeset
508 (setq input-method
7366898bee9e (read-multilingual-string): Adjusted
Kenichi Handa <handa@m17n.org>
parents: 18634
diff changeset
509 (or input-method
7366898bee9e (read-multilingual-string): Adjusted
Kenichi Handa <handa@m17n.org>
parents: 18634
diff changeset
510 default-input-method
7366898bee9e (read-multilingual-string): Adjusted
Kenichi Handa <handa@m17n.org>
parents: 18634
diff changeset
511 (read-input-method-name "Input method: " nil t)))
7366898bee9e (read-multilingual-string): Adjusted
Kenichi Handa <handa@m17n.org>
parents: 18634
diff changeset
512 (save-excursion
7366898bee9e (read-multilingual-string): Adjusted
Kenichi Handa <handa@m17n.org>
parents: 18634
diff changeset
513 (set-buffer (window-buffer (minibuffer-window)))
7366898bee9e (read-multilingual-string): Adjusted
Kenichi Handa <handa@m17n.org>
parents: 18634
diff changeset
514 (let ((default-input-method input-method)
7366898bee9e (read-multilingual-string): Adjusted
Kenichi Handa <handa@m17n.org>
parents: 18634
diff changeset
515 (minibuffer-setup-hook '(toggle-input-method)))
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
516 (read-string prompt initial-input))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
517
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
518 ;; Variables to control behavior of input methods. All input methods
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
519 ;; should react to these variables.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
520
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
521 (defvar input-method-tersely-flag nil
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
522 "*If this flag is non-nil, input method works rather tersely.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
523
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
524 For instance, Quail input method does not show guidance buffer while
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
525 inputting at minibuffer if this flag is t.")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
526
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
527 (defvar input-method-activate-hook nil
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
528 "Normal hook run just after an input method is activated.")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
529
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
530 (defvar input-method-inactivate-hook nil
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
531 "Normal hook run just after an input method is inactivated.")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
532
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
533 (defvar input-method-after-insert-chunk-hook nil
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
534 "Normal hook run just after an input method insert some chunk of text.")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
535
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
536
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
537 (defun setup-specified-language-environment ()
18634
8b309d07a95e (set-language-environment): Do the real work here.
Richard M. Stallman <rms@gnu.org>
parents: 18633
diff changeset
538 "Set up multi-lingual environment convenient for the specified language."
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
539 (interactive)
18634
8b309d07a95e (set-language-environment): Do the real work here.
Richard M. Stallman <rms@gnu.org>
parents: 18633
diff changeset
540 (let (language-name)
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
541 (if (and (symbolp last-command-event)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
542 (or (not (eq last-command-event 'Default))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
543 (setq last-command-event 'English))
18634
8b309d07a95e (set-language-environment): Do the real work here.
Richard M. Stallman <rms@gnu.org>
parents: 18633
diff changeset
544 (setq language-name (symbol-name last-command-event)))
8b309d07a95e (set-language-environment): Do the real work here.
Richard M. Stallman <rms@gnu.org>
parents: 18633
diff changeset
545 (set-language-environment language-name)
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
546 (error "Bogus calling sequence"))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
547
18634
8b309d07a95e (set-language-environment): Do the real work here.
Richard M. Stallman <rms@gnu.org>
parents: 18633
diff changeset
548 (defvar current-language-environment "English"
8b309d07a95e (set-language-environment): Do the real work here.
Richard M. Stallman <rms@gnu.org>
parents: 18633
diff changeset
549 "The last language environment specified with `set-language-environment'.")
8b309d07a95e (set-language-environment): Do the real work here.
Richard M. Stallman <rms@gnu.org>
parents: 18633
diff changeset
550
18066
eecd891e2b63 (set-language-environment): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents: 17991
diff changeset
551 (defun set-language-environment (language-name)
18068
317f57f07b14 Doc fix for previous change.
Richard M. Stallman <rms@gnu.org>
parents: 18066
diff changeset
552 "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
553 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
554 and sometimes other things."
18801
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
555 (interactive (list (read-language-name 'setup-function
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
556 "Language (null for default): ")))
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
557 (or language-name
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
558 (setq language-name "English"))
f60dbf4f7d7c (mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents: 18712
diff changeset
559 (if (null (get-language-info language-name 'setup-function))
18634
8b309d07a95e (set-language-environment): Do the real work here.
Richard M. Stallman <rms@gnu.org>
parents: 18633
diff changeset
560 (error "Language environment not defined: %S" language-name))
8b309d07a95e (set-language-environment): Do the real work here.
Richard M. Stallman <rms@gnu.org>
parents: 18633
diff changeset
561 (funcall (get-language-info language-name 'setup-function))
8b309d07a95e (set-language-environment): Do the real work here.
Richard M. Stallman <rms@gnu.org>
parents: 18633
diff changeset
562 (setq current-language-environment language-name)
8b309d07a95e (set-language-environment): Do the real work here.
Richard M. Stallman <rms@gnu.org>
parents: 18633
diff changeset
563 (force-mode-line-update t))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
564
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
565 ;; Print all arguments with `princ', then print "\n".
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
566 (defsubst princ-list (&rest args)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
567 (while args (princ (car args)) (setq args (cdr args)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
568 (princ "\n"))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
569
17840
2517414676ed (set-language-info): Change the special treatment
Kenichi Handa <handa@m17n.org>
parents: 17758
diff changeset
570 ;; 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
571 ;; 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
572 ;; called from the menu:
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
573 ;; [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
574 ;; 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
575 (defun describe-specified-language-support ()
2517414676ed (set-language-info): Change the special treatment
Kenichi Handa <handa@m17n.org>
parents: 17758
diff changeset
576 "Describe how Emacs supports the specified langugage."
2517414676ed (set-language-info): Change the special treatment
Kenichi Handa <handa@m17n.org>
parents: 17758
diff changeset
577 (interactive)
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
578 (let (language-name)
17840
2517414676ed (set-language-info): Change the special treatment
Kenichi Handa <handa@m17n.org>
parents: 17758
diff changeset
579 (if (not (and (symbolp last-command-event)
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
580 (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
581 (error "Bogus calling sequence"))
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
582 (describe-language-environment language-name)))
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
583
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
584 (defun describe-language-environment (language-name)
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
585 "Describe how Emacs supports language environment LANGUAGE-NAME."
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
586 (interactive (list (read-language-name 'documentation "Language: ")))
18634
8b309d07a95e (set-language-environment): Do the real work here.
Richard M. Stallman <rms@gnu.org>
parents: 18633
diff changeset
587 (if (null language-name)
8b309d07a95e (set-language-environment): Do the real work here.
Richard M. Stallman <rms@gnu.org>
parents: 18633
diff changeset
588 (setq language-name current-language-environment))
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
589 (if (or (null language-name)
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
590 (null (get-language-info language-name 'documentation)))
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
591 (error "No documentation for the specified language"))
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
592 (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
593 (with-output-to-temp-buffer "*Help*"
17758
8c67c2e2cc29 (build-describe-language-support-function,
Kenichi Handa <handa@m17n.org>
parents: 17526
diff changeset
594 (if (stringp doc)
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
595 (progn
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
596 (princ-list doc)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
597 (terpri)))
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
598 (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
599 (if (stringp str)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
600 (progn
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
601 (princ "Sample text:\n")
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
602 (princ-list " " str)
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
603 (terpri))))
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
604 (princ "Input methods:\n")
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
605 (let ((l input-method-alist))
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
606 (while l
18301
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
607 (if (string= language-name (nth 1 (car l)))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
608 (princ-list " " (car (car l))
a4da36c7bb08 Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents: 18217
diff changeset
609 (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
610 (setq l (cdr l))))
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
611 (terpri)
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
612 (princ "Character sets:\n")
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
613 (let ((l (get-language-info language-name 'charset)))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
614 (if (null l)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
615 (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
616 (while l
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
617 (princ-list " " (car l) ": "
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
618 (charset-description (car l)))
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
619 (setq l (cdr l)))))
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
620 (terpri)
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
621 (princ "Coding systems:\n")
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
622 (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
623 (if (null l)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
624 (princ-list " nothing specific to " language-name)
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
625 (while l
18152
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
626 (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
627 (car l)
e184e7061c9a (describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents: 18068
diff changeset
628 (coding-system-mnemonic (car l))
18176
fc07ea29cd81 Define mouse-set-font in mule-menu-keymap.
Kenichi Handa <handa@m17n.org>
parents: 18152
diff changeset
629 (coding-system-doc-string (car l))))
17991
65407fdc4a33 Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents: 17840
diff changeset
630 (setq l (cdr l))))))))
17052
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
631
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
632 ;;; Charset property
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
633
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
634 (defsubst get-charset-property (charset propname)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
635 "Return the value of CHARSET's PROPNAME property.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
636 This is the last value stored with
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
637 `(put-charset-property CHARSET PROPNAME VALUE)'."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
638 (plist-get (charset-plist charset) propname))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
639
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
640 (defsubst put-charset-property (charset propname value)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
641 "Store CHARSETS's PROPNAME property with value VALUE.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
642 It can be retrieved with `(get-charset-property CHARSET PROPNAME)'."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
643 (set-charset-plist charset
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
644 (plist-put (charset-plist charset) propname value)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
645
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
646 ;;; Character code property
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
647 (put 'char-code-property-table 'char-table-extra-slots 0)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
648
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
649 (defvar char-code-property-table
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
650 (make-char-table 'char-code-property-table)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
651 "Char-table containing a property list of each character code.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
652
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
653 See also the documentation of `get-char-code-property' and
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
654 `put-char-code-property'")
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
655
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
656 (defun get-char-code-property (char propname)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
657 "Return the value of CHAR's PROPNAME property in `char-code-property-table'."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
658 (let ((plist (aref char-code-property-table char)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
659 (if (listp plist)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
660 (car (cdr (memq propname plist))))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
661
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
662 (defun put-char-code-property (char propname value)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
663 "Store CHAR's PROPNAME property with VALUE in `char-code-property-table'.
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
664 It can be retrieved with `(get-char-code-property CHAR PROPNAME)'."
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
665 (let ((plist (aref char-code-property-table char)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
666 (if plist
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
667 (let ((slot (memq propname plist)))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
668 (if slot
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
669 (setcar (cdr slot) value)
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
670 (nconc plist (list propname value))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
671 (aset char-code-property-table char (list propname value)))))
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
672
d0d7b244b1d0 Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
673 ;;; mule-cmds.el ends here