annotate lisp/international/mule-cmds.el @ 18208:5b68d05ff026 gnumach-release-1-1-2 gnumach-release-1-1-3 hurd-release-0-2 libc-970610 libc-970611 libc-970612 libc-970613 libc-970614 libc-970615 libc-970616 libc-970617 libc-970618 libc-970619 libc-970620 libc-970621 libc-970622

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