Mercurial > emacs
annotate lisp/international/mule-cmds.el @ 23021:2a8dbf5b77a8
(select-safe-coding-system): If default-coding-system is no-conversion,
return that; it is always safe.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 14 Aug 1998 09:02:48 +0000 |
parents | b5c383369b40 |
children | 5e2bc240edfc |
rev | line source |
---|---|
17052 | 1 ;;; mule-cmds.el --- Commands for mulitilingual environment |
2 | |
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 | 5 |
6 ;; Keywords: mule, multilingual | |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
17071 | 21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
17052 | 24 |
25 ;;; Code: | |
26 | |
27 ;;; MULE related key bindings and menus. | |
28 | |
19725 | 29 (defvar mule-keymap (make-sparse-keymap) |
17052 | 30 "Keymap for MULE (Multilingual environment) specific commands.") |
31 | |
17294
d7ae63db9e6e
Prefix for Mule related commands is changed.
Kenichi Handa <handa@m17n.org>
parents:
17090
diff
changeset
|
32 ;; Keep "C-x C-m ..." for mule specific commands. |
19725 | 33 (define-key ctl-x-map "\C-m" mule-keymap) |
17090
8085a8690c87
(mule-keymap): Re-arranged.
Kenichi Handa <handa@m17n.org>
parents:
17071
diff
changeset
|
34 |
17052 | 35 (define-key mule-keymap "f" 'set-buffer-file-coding-system) |
36 (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
|
37 (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
|
38 (define-key mule-keymap "p" 'set-buffer-process-coding-system) |
20295
27ae44142cfd
(set-input-method): Renamed from select-input-method.
Karl Heuer <kwzh@gnu.org>
parents:
20231
diff
changeset
|
39 (define-key mule-keymap "\C-\\" 'set-input-method) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
40 (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
|
41 (define-key mule-keymap "l" 'set-language-environment) |
17052 | 42 |
18152
e184e7061c9a
(describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents:
18068
diff
changeset
|
43 (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
|
44 (define-key help-map "L" 'describe-language-environment) |
17052 | 45 (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
|
46 (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
|
47 (define-key help-map "C" 'describe-coding-system) |
17052 | 48 (define-key help-map "h" 'view-hello-file) |
49 | |
19725 | 50 (defvar mule-menu-keymap (make-sparse-keymap "Mule") |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
51 "Keymap for MULE (Multilingual environment) menu specific commands.") |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
52 |
21579
b26c7c2891b4
(global-map [menu-bar mule]):
Richard M. Stallman <rms@gnu.org>
parents:
21471
diff
changeset
|
53 (define-key global-map [menu-bar mule] |
b26c7c2891b4
(global-map [menu-bar mule]):
Richard M. Stallman <rms@gnu.org>
parents:
21471
diff
changeset
|
54 `(menu-item "Mule" ,mule-menu-keymap |
b26c7c2891b4
(global-map [menu-bar mule]):
Richard M. Stallman <rms@gnu.org>
parents:
21471
diff
changeset
|
55 :visible default-enable-multibyte-characters)) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
56 |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
57 (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
|
58 |
18152
e184e7061c9a
(describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents:
18068
diff
changeset
|
59 (defvar describe-language-environment-map nil) |
e184e7061c9a
(describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents:
18068
diff
changeset
|
60 (define-prefix-command 'describe-language-environment-map) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
61 |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
62 (defvar setup-language-environment-map nil) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
63 (define-prefix-command 'setup-language-environment-map) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
64 |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
65 (defvar set-coding-system-map nil) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
66 (define-prefix-command 'set-coding-system-map) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
67 |
18152
e184e7061c9a
(describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents:
18068
diff
changeset
|
68 (define-key-after mule-menu-keymap [describe-language-environment] |
19036
6ed970c33b7d
(mule-menu-keymap): Fix menu item names.
Richard M. Stallman <rms@gnu.org>
parents:
18982
diff
changeset
|
69 '("Describe Language Environment" . describe-language-environment-map) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
70 t) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
71 (define-key-after mule-menu-keymap [set-language-environment] |
19036
6ed970c33b7d
(mule-menu-keymap): Fix menu item names.
Richard M. Stallman <rms@gnu.org>
parents:
18982
diff
changeset
|
72 '("Set Language Environment" . setup-language-environment-map) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
73 t) |
18351
8cc30b266976
Define mouse-set-font in mule-menu-keymap agian.
Kenichi Handa <handa@m17n.org>
parents:
18301
diff
changeset
|
74 (define-key-after mule-menu-keymap [mouse-set-font] |
19036
6ed970c33b7d
(mule-menu-keymap): Fix menu item names.
Richard M. Stallman <rms@gnu.org>
parents:
18982
diff
changeset
|
75 '("Set Font/Fontset" . mouse-set-font) |
18351
8cc30b266976
Define mouse-set-font in mule-menu-keymap agian.
Kenichi Handa <handa@m17n.org>
parents:
18301
diff
changeset
|
76 t) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
77 (define-key-after mule-menu-keymap [separator-mule] |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
78 '("--") |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
79 t) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
80 (define-key-after mule-menu-keymap [toggle-input-method] |
19036
6ed970c33b7d
(mule-menu-keymap): Fix menu item names.
Richard M. Stallman <rms@gnu.org>
parents:
18982
diff
changeset
|
81 '("Toggle Input Method" . toggle-input-method) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
82 t) |
20295
27ae44142cfd
(set-input-method): Renamed from select-input-method.
Karl Heuer <kwzh@gnu.org>
parents:
20231
diff
changeset
|
83 (define-key-after mule-menu-keymap [set-input-method] |
27ae44142cfd
(set-input-method): Renamed from select-input-method.
Karl Heuer <kwzh@gnu.org>
parents:
20231
diff
changeset
|
84 '("Select Input Method" . set-input-method) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
85 t) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
86 (define-key-after mule-menu-keymap [describe-input-method] |
19036
6ed970c33b7d
(mule-menu-keymap): Fix menu item names.
Richard M. Stallman <rms@gnu.org>
parents:
18982
diff
changeset
|
87 '("Describe Input Method" . describe-input-method) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
88 t) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
89 (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
|
90 '("--") |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
91 t) |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
92 (define-key-after mule-menu-keymap [describe-coding-system] |
19036
6ed970c33b7d
(mule-menu-keymap): Fix menu item names.
Richard M. Stallman <rms@gnu.org>
parents:
18982
diff
changeset
|
93 '("Describe Coding Systems" . describe-coding-system) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
94 t) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
95 (define-key-after mule-menu-keymap [set-various-coding-system] |
19036
6ed970c33b7d
(mule-menu-keymap): Fix menu item names.
Richard M. Stallman <rms@gnu.org>
parents:
18982
diff
changeset
|
96 '("Set Coding System" . set-coding-system-map) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
97 t) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
98 (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
|
99 '("--") |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
100 t) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
101 (define-key-after mule-menu-keymap [mule-diag] |
19036
6ed970c33b7d
(mule-menu-keymap): Fix menu item names.
Richard M. Stallman <rms@gnu.org>
parents:
18982
diff
changeset
|
102 '("Show All of MULE Status" . mule-diag) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
103 t) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
104 (define-key-after mule-menu-keymap [view-hello-file] |
19036
6ed970c33b7d
(mule-menu-keymap): Fix menu item names.
Richard M. Stallman <rms@gnu.org>
parents:
18982
diff
changeset
|
105 '("Show Script Examples" . view-hello-file) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
106 t) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
107 |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
108 (define-key-after set-coding-system-map [set-buffer-file-coding-system] |
19036
6ed970c33b7d
(mule-menu-keymap): Fix menu item names.
Richard M. Stallman <rms@gnu.org>
parents:
18982
diff
changeset
|
109 '("Buffer File" . set-buffer-file-coding-system) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
110 t) |
19673
da7f50da6773
(set-coding-system-map):
Richard M. Stallman <rms@gnu.org>
parents:
19654
diff
changeset
|
111 (define-key-after set-coding-system-map [universal-coding-system-argument] |
da7f50da6773
(set-coding-system-map):
Richard M. Stallman <rms@gnu.org>
parents:
19654
diff
changeset
|
112 '("Next Command" . universal-coding-system-argument) |
da7f50da6773
(set-coding-system-map):
Richard M. Stallman <rms@gnu.org>
parents:
19654
diff
changeset
|
113 t) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
114 (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
|
115 '("Terminal" . set-terminal-coding-system) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
116 t) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
117 (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
|
118 '("Keyboard" . set-keyboard-coding-system) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
119 t) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
120 (define-key-after set-coding-system-map [set-buffer-process-coding-system] |
19036
6ed970c33b7d
(mule-menu-keymap): Fix menu item names.
Richard M. Stallman <rms@gnu.org>
parents:
18982
diff
changeset
|
121 '("Buffer Process" . set-buffer-process-coding-system) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
122 t) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
123 |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
124 (define-key setup-language-environment-map |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
125 [Default] '("Default" . setup-specified-language-environment)) |
17052 | 126 |
127 ;; These are meaningless when running under X. | |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
128 (put 'set-terminal-coding-system 'menu-enable |
19614
a0db11a32775
(set-terminal-coding-system):
Richard M. Stallman <rms@gnu.org>
parents:
19555
diff
changeset
|
129 '(not (eq window-system 'x))) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
130 (put 'set-keyboard-coding-system 'menu-enable |
19614
a0db11a32775
(set-terminal-coding-system):
Richard M. Stallman <rms@gnu.org>
parents:
19555
diff
changeset
|
131 '(not (eq window-system 'x))) |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
132 ;; 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
|
133 (put 'set-buffer-process-coding-system 'menu-enable |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
134 '(get-buffer-process (current-buffer))) |
17052 | 135 |
136 ;; This should be a single character key binding because users use it | |
137 ;; very frequently while editing multilingual text. Now we can use | |
138 ;; only two such keys: "\C-\\" and "\C-^", but the latter is not | |
139 ;; convenient because it requires shifting on most keyboards. An | |
140 ;; alternative is "\C-\]" which is now bound to `abort-recursive-edit' | |
141 ;; but it won't be used that frequently. | |
142 (define-key global-map "\C-\\" 'toggle-input-method) | |
143 | |
18807
75b2e402c45d
(global-map): Turn off the S-SPC binding.
Richard M. Stallman <rms@gnu.org>
parents:
18801
diff
changeset
|
144 ;;; 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
|
145 ;;; meaning to type SPC. -- rms. |
75b2e402c45d
(global-map): Turn off the S-SPC binding.
Richard M. Stallman <rms@gnu.org>
parents:
18801
diff
changeset
|
146 ;;; ;; 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
|
147 ;;; (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
|
148 |
17052 | 149 (defun toggle-enable-multibyte-characters (&optional arg) |
20483
141c2d41d39c
(toggle-enable-multibyte-characters): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
20467
diff
changeset
|
150 "Change whether this buffer uses multibyte characters. |
141c2d41d39c
(toggle-enable-multibyte-characters): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
20467
diff
changeset
|
151 With arg, use multibyte characters if the arg is positive. |
141c2d41d39c
(toggle-enable-multibyte-characters): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
20467
diff
changeset
|
152 |
141c2d41d39c
(toggle-enable-multibyte-characters): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
20467
diff
changeset
|
153 Note that this command does not convert the byte contents of |
141c2d41d39c
(toggle-enable-multibyte-characters): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
20467
diff
changeset
|
154 the buffer; it only changes the way those bytes are interpreted. |
141c2d41d39c
(toggle-enable-multibyte-characters): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
20467
diff
changeset
|
155 In general, therefore, this command *changes* the sequence of |
141c2d41d39c
(toggle-enable-multibyte-characters): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
20467
diff
changeset
|
156 characters that the current buffer contains. |
141c2d41d39c
(toggle-enable-multibyte-characters): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
20467
diff
changeset
|
157 |
141c2d41d39c
(toggle-enable-multibyte-characters): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
20467
diff
changeset
|
158 We suggest you avoid using use this command unless you know what you |
141c2d41d39c
(toggle-enable-multibyte-characters): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
20467
diff
changeset
|
159 are doing. If you use it by mistake, and the buffer is now displayed |
141c2d41d39c
(toggle-enable-multibyte-characters): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
20467
diff
changeset
|
160 wrong, use this command again to toggle back to the right mode." |
17052 | 161 (interactive "P") |
20830
237a0f70c61d
(toggle-enable-multibyte-characters): Use set-buffer-multibyte.
Richard M. Stallman <rms@gnu.org>
parents:
20733
diff
changeset
|
162 (let ((new-flag |
237a0f70c61d
(toggle-enable-multibyte-characters): Use set-buffer-multibyte.
Richard M. Stallman <rms@gnu.org>
parents:
20733
diff
changeset
|
163 (if (null arg) (null enable-multibyte-characters) |
237a0f70c61d
(toggle-enable-multibyte-characters): Use set-buffer-multibyte.
Richard M. Stallman <rms@gnu.org>
parents:
20733
diff
changeset
|
164 (> (prefix-numeric-value arg) 0)))) |
237a0f70c61d
(toggle-enable-multibyte-characters): Use set-buffer-multibyte.
Richard M. Stallman <rms@gnu.org>
parents:
20733
diff
changeset
|
165 (set-buffer-multibyte new-flag)) |
17052 | 166 (force-mode-line-update)) |
167 | |
168 (defun view-hello-file () | |
169 "Display the HELLO file which list up many languages and characters." | |
170 (interactive) | |
17294
d7ae63db9e6e
Prefix for Mule related commands is changed.
Kenichi Handa <handa@m17n.org>
parents:
17090
diff
changeset
|
171 ;; 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
|
172 (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
|
173 (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
|
174 (find-file-read-only (expand-file-name "HELLO" data-directory)))) |
17052 | 175 |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
176 (defun universal-coding-system-argument () |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
177 "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
|
178 (interactive) |
21882
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
179 (let* ((default (and buffer-file-coding-system |
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
180 (not (eq (coding-system-type buffer-file-coding-system) |
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
181 t)) |
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
182 buffer-file-coding-system)) |
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
183 (coding-system (read-coding-system |
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
184 (if default |
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
185 (format "Coding system for following command (default, %s): " default) |
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
186 "Coding system for following command: ") |
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
187 default)) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
188 (keyseq (read-key-sequence |
19798
054497f70932
(universal-coding-system-argument): Improve prompt strings.
Richard M. Stallman <rms@gnu.org>
parents:
19784
diff
changeset
|
189 (format "Command to execute with %s:" coding-system))) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
190 (cmd (key-binding keyseq))) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
191 (let ((coding-system-for-read coding-system) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
192 (coding-system-for-write coding-system)) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
193 (message "") |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
194 (call-interactively cmd)))) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
195 |
19141
9e0468e59b5f
(set-default-coding-systems): New function.
Kenichi Handa <handa@m17n.org>
parents:
19083
diff
changeset
|
196 (defun set-default-coding-systems (coding-system) |
19267
6e152439176f
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
19141
diff
changeset
|
197 "Set default value of various coding systems to CODING-SYSTEM. |
21042
b6530c2add6a
(set-default-coding-systems): Set
Kenichi Handa <handa@m17n.org>
parents:
20941
diff
changeset
|
198 This sets the following coding systems: |
19267
6e152439176f
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
19141
diff
changeset
|
199 o coding system of a newly created buffer |
20165
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
200 o default coding system for subprocess I/O |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
201 This also sets the following values: |
21042
b6530c2add6a
(set-default-coding-systems): Set
Kenichi Handa <handa@m17n.org>
parents:
20941
diff
changeset
|
202 o default value used as file-name-coding-system for converting file names. |
20165
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
203 o default value for the command `set-terminal-coding-system' |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
204 o default value for the command `set-keyboard-coding-system'" |
19141
9e0468e59b5f
(set-default-coding-systems): New function.
Kenichi Handa <handa@m17n.org>
parents:
19083
diff
changeset
|
205 (check-coding-system coding-system) |
9e0468e59b5f
(set-default-coding-systems): New function.
Kenichi Handa <handa@m17n.org>
parents:
19083
diff
changeset
|
206 (setq-default buffer-file-coding-system coding-system) |
22899
5f874a55feb3
(set-default-coding-systems):
Richard M. Stallman <rms@gnu.org>
parents:
22887
diff
changeset
|
207 (if default-enable-multibyte-characters |
5f874a55feb3
(set-default-coding-systems):
Richard M. Stallman <rms@gnu.org>
parents:
22887
diff
changeset
|
208 (setq default-file-name-coding-system coding-system)) |
19141
9e0468e59b5f
(set-default-coding-systems): New function.
Kenichi Handa <handa@m17n.org>
parents:
19083
diff
changeset
|
209 (setq default-terminal-coding-system coding-system) |
9e0468e59b5f
(set-default-coding-systems): New function.
Kenichi Handa <handa@m17n.org>
parents:
19083
diff
changeset
|
210 (setq default-keyboard-coding-system coding-system) |
9e0468e59b5f
(set-default-coding-systems): New function.
Kenichi Handa <handa@m17n.org>
parents:
19083
diff
changeset
|
211 (setq default-process-coding-system (cons coding-system coding-system))) |
9e0468e59b5f
(set-default-coding-systems): New function.
Kenichi Handa <handa@m17n.org>
parents:
19083
diff
changeset
|
212 |
22887
e24b79da83d6
(language-info-alist): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
22854
diff
changeset
|
213 (defalias 'update-iso-coding-systems 'update-coding-systems-internal) |
e24b79da83d6
(language-info-alist): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
22854
diff
changeset
|
214 (make-obsolete 'update-iso-coding-systems 'update-coding-systems-internal) |
e24b79da83d6
(language-info-alist): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
22854
diff
changeset
|
215 |
19267
6e152439176f
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
19141
diff
changeset
|
216 (defun prefer-coding-system (coding-system) |
6e152439176f
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
19141
diff
changeset
|
217 "Add CODING-SYSTEM at the front of the priority list for automatic detection. |
21042
b6530c2add6a
(set-default-coding-systems): Set
Kenichi Handa <handa@m17n.org>
parents:
20941
diff
changeset
|
218 This also sets the following coding systems: |
19267
6e152439176f
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
19141
diff
changeset
|
219 o coding system of a newly created buffer |
20165
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
220 o default coding system for subprocess I/O |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
221 This also sets the following values: |
21042
b6530c2add6a
(set-default-coding-systems): Set
Kenichi Handa <handa@m17n.org>
parents:
20941
diff
changeset
|
222 o default value used as file-name-coding-system for converting file names. |
20165
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
223 o default value for the command `set-terminal-coding-system' |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
224 o default value for the command `set-keyboard-coding-system'" |
19267
6e152439176f
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
19141
diff
changeset
|
225 (interactive "zPrefer coding system: ") |
6e152439176f
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
19141
diff
changeset
|
226 (if (not (and coding-system (coding-system-p coding-system))) |
6e152439176f
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
19141
diff
changeset
|
227 (error "Invalid coding system `%s'" coding-system)) |
6e152439176f
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
19141
diff
changeset
|
228 (let ((coding-category (coding-system-category coding-system)) |
20165
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
229 (base (coding-system-base coding-system))) |
19267
6e152439176f
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
19141
diff
changeset
|
230 (if (not coding-category) |
6e152439176f
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
19141
diff
changeset
|
231 ;; CODING-SYSTEM is no-conversion or undecided. |
6e152439176f
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
19141
diff
changeset
|
232 (error "Can't prefer the coding system `%s'" coding-system)) |
20165
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
233 (set coding-category (or base coding-system)) |
22887
e24b79da83d6
(language-info-alist): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
22854
diff
changeset
|
234 (update-coding-systems-internal) |
19267
6e152439176f
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
19141
diff
changeset
|
235 (if (not (eq coding-category (car coding-category-list))) |
6e152439176f
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
19141
diff
changeset
|
236 ;; We must change the order. |
6e152439176f
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
19141
diff
changeset
|
237 (setq coding-category-list |
6e152439176f
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
19141
diff
changeset
|
238 (cons coding-category |
6e152439176f
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
19141
diff
changeset
|
239 (delq coding-category coding-category-list)))) |
20165
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
240 (if (and base (interactive-p)) |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
241 (message "Highest priority is set to %s (base of %s)" |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
242 base coding-system)) |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
243 (set-default-coding-systems (or base coding-system)))) |
19267
6e152439176f
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
19141
diff
changeset
|
244 |
22153 | 245 (defun find-coding-systems-region-subset-p (list1 list2) |
20733
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
246 "Return non-nil if all elements in LIST1 are included in LIST2. |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
247 Comparison done with EQ." |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
248 (catch 'tag |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
249 (while list1 |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
250 (or (memq (car list1) list2) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
251 (throw 'tag nil)) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
252 (setq list1 (cdr list1))) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
253 t)) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
254 |
21377 | 255 (defun find-coding-systems-region (from to) |
20733
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
256 "Return a list of proper coding systems to encode a text between FROM and TO. |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
257 All coding systems in the list can safely encode any multibyte characters |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
258 in the text. |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
259 |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
260 If the text contains no multibyte charcters, return a list of a single |
21377 | 261 element `undecided'." |
262 (find-coding-systems-for-charsets (find-charset-region from to))) | |
263 | |
264 (defun find-coding-systems-string (string) | |
265 "Return a list of proper coding systems to encode STRING. | |
266 All coding systems in the list can safely encode any multibyte characters | |
267 in STRING. | |
268 | |
269 If STRING contains no multibyte charcters, return a list of a single | |
270 element `undecided'." | |
271 (find-coding-systems-for-charsets (find-charset-string string))) | |
20733
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
272 |
21377 | 273 (defun find-coding-systems-for-charsets (charsets) |
274 "Return a list of proper coding systems to encode characters of CHARSETS. | |
275 CHARSETS is a list of character sets." | |
276 (if (or (null charsets) | |
277 (and (= (length charsets) 1) | |
278 (eq 'ascii (car charsets)))) | |
279 '(undecided) | |
280 (let ((l coding-system-list) | |
21882
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
281 (charset-prefered-codings |
21377 | 282 (mapcar (function |
283 (lambda (x) | |
284 (get-charset-property x 'prefered-coding-system))) | |
285 charsets)) | |
21882
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
286 (priorities (mapcar (function (lambda (x) (symbol-value x))) |
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
287 coding-category-list)) |
21377 | 288 codings coding safe) |
289 (while l | |
290 (setq coding (car l) l (cdr l)) | |
291 (if (and (eq coding (coding-system-base coding)) | |
292 (setq safe (coding-system-get coding 'safe-charsets)) | |
293 (or (eq safe t) | |
22153 | 294 (find-coding-systems-region-subset-p charsets safe))) |
21377 | 295 ;; We put the higher priority to coding systems included |
21882
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
296 ;; in CHARSET-PREFERED-CODINGS, and within them, put the |
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
297 ;; higher priority to coding systems which support smaller |
21377 | 298 ;; number of charsets. |
299 (let ((priority | |
21882
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
300 (+ (if (coding-system-get coding 'mime-charset) 4096 0) |
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
301 (lsh (length (memq coding priorities)) 7) |
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
302 (if (memq coding charset-prefered-codings) 64 0) |
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
303 (if (> (coding-system-type coding) 0) 32 0) |
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
304 (if (consp safe) (- 32 (length safe)) 0)))) |
21377 | 305 (setq codings (cons (cons priority coding) codings))))) |
306 (mapcar 'cdr | |
307 (sort codings (function (lambda (x y) (> (car x) (car y)))))) | |
308 ))) | |
20733
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
309 |
22815
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
310 (defun find-multibyte-characters (from to &optional maxcount excludes) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
311 "Find multibyte characters in the region specified by FROM and TO. |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
312 If FROM is a string, find multibyte characters in the string. |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
313 The return value is an alist of the following format: |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
314 ((CHARSET COUNT CHAR ...) ...) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
315 where |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
316 CHARSET is a character set, |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
317 COUNT is a number of characters, |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
318 CHARs are found characters of the character set. |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
319 Optional 3rd arg MAXCOUNT limits how many CHARs are put in the above list. |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
320 Optioanl 4th arg EXCLUDE is a list of character sets to be ignored." |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
321 (let ((chars nil) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
322 charset char) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
323 (if (stringp from) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
324 (let ((idx 0)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
325 (while (setq idx (string-match "[^\000-\177]" from idx)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
326 (setq char (aref from idx) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
327 charset (char-charset char)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
328 (if (not (memq charset excludes)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
329 (let ((slot (assq charset chars))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
330 (if slot |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
331 (if (not (memq char (nthcdr 2 slot))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
332 (let ((count (nth 1 slot))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
333 (setcar (cdr slot) (1+ count)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
334 (if (or (not maxcount) (< count maxcount)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
335 (nconc slot (list char))))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
336 (setq chars (cons (list charset 1 char) chars))))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
337 (setq idx (1+ idx)))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
338 (save-excursion |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
339 (goto-char from) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
340 (while (re-search-forward "[^\000-\177]" to t) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
341 (setq char (preceding-char) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
342 charset (char-charset char)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
343 (if (not (memq charset excludes)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
344 (let ((slot (assq charset chars))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
345 (if slot |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
346 (if (not (memq char (nthcdr 2 slot))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
347 (let ((count (nth 1 slot))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
348 (setcar (cdr slot) (1+ count)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
349 (if (or (not maxcount) (< count maxcount)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
350 (nconc slot (list char))))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
351 (setq chars (cons (list charset 1 char) chars)))))))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
352 (nreverse chars))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
353 |
22025
369ac7fae774
(last-coding-system-specified): New var.
Richard M. Stallman <rms@gnu.org>
parents:
21983
diff
changeset
|
354 (defvar last-coding-system-specified nil |
369ac7fae774
(last-coding-system-specified): New var.
Richard M. Stallman <rms@gnu.org>
parents:
21983
diff
changeset
|
355 "Most recent coding system explicitly specified by the user when asked. |
369ac7fae774
(last-coding-system-specified): New var.
Richard M. Stallman <rms@gnu.org>
parents:
21983
diff
changeset
|
356 This variable is set whenever Emacs asks the user which coding system |
369ac7fae774
(last-coding-system-specified): New var.
Richard M. Stallman <rms@gnu.org>
parents:
21983
diff
changeset
|
357 to use in order to write a file. If you set it to nil explicitly, |
369ac7fae774
(last-coding-system-specified): New var.
Richard M. Stallman <rms@gnu.org>
parents:
21983
diff
changeset
|
358 then call `write-region', then afterward this variable will be non-nil |
369ac7fae774
(last-coding-system-specified): New var.
Richard M. Stallman <rms@gnu.org>
parents:
21983
diff
changeset
|
359 only if the user was explicitly asked and specified a coding system.") |
369ac7fae774
(last-coding-system-specified): New var.
Richard M. Stallman <rms@gnu.org>
parents:
21983
diff
changeset
|
360 |
20733
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
361 (defun select-safe-coding-system (from to &optional default-coding-system) |
20842
428831a6f4d1
(find-safe-coding-system): Return
Kenichi Handa <handa@m17n.org>
parents:
20830
diff
changeset
|
362 "Ask a user to select a safe coding system from candidates. |
428831a6f4d1
(find-safe-coding-system): Return
Kenichi Handa <handa@m17n.org>
parents:
20830
diff
changeset
|
363 The candidates of coding systems which can safely encode a text |
428831a6f4d1
(find-safe-coding-system): Return
Kenichi Handa <handa@m17n.org>
parents:
20830
diff
changeset
|
364 between FROM and TO are shown in a popup window. |
20733
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
365 |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
366 Optional arg DEFAULT-CODING-SYSTEM specifies a coding system to be |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
367 checked at first. If omitted, buffer-file-coding-system of the |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
368 current buffer is used. |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
369 |
20842
428831a6f4d1
(find-safe-coding-system): Return
Kenichi Handa <handa@m17n.org>
parents:
20830
diff
changeset
|
370 If the text can be encoded safely by DEFAULT-CODING-SYSTEM, it is |
428831a6f4d1
(find-safe-coding-system): Return
Kenichi Handa <handa@m17n.org>
parents:
20830
diff
changeset
|
371 returned without any user interaction. |
20733
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
372 |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
373 Kludgy feature: if FROM is a string, the string is the target text, |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
374 and TO is ignored." |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
375 (or default-coding-system |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
376 (setq default-coding-system buffer-file-coding-system)) |
22815
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
377 (let* ((charsets (if (stringp from) (find-charset-string from) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
378 (find-charset-region from to))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
379 (safe-coding-systems (find-coding-systems-for-charsets charsets))) |
20733
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
380 (if (or (eq (car safe-coding-systems) 'undecided) |
23021
2a8dbf5b77a8
(select-safe-coding-system): If default-coding-system is no-conversion,
Richard M. Stallman <rms@gnu.org>
parents:
22986
diff
changeset
|
381 (eq default-coding-system 'no-conversion) |
20733
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
382 (and default-coding-system |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
383 (memq (coding-system-base default-coding-system) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
384 safe-coding-systems))) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
385 default-coding-system |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
386 |
21882
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
387 ;; At first, change each coding system to the corresponding |
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
388 ;; mime-charset name if it is also a coding system. |
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
389 (let ((l safe-coding-systems) |
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
390 mime-charset) |
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
391 (while l |
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
392 (setq mime-charset (coding-system-get (car l) 'mime-charset)) |
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
393 (if (and mime-charset (coding-system-p mime-charset)) |
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
394 (setcar l mime-charset)) |
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
395 (setq l (cdr l)))) |
4fb3860a1f26
(find-coding-systems-for-charsets):
Kenichi Handa <handa@m17n.org>
parents:
21856
diff
changeset
|
396 |
22815
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
397 (let ((non-safe-chars (find-multibyte-characters |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
398 from to 3 |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
399 (and default-coding-system |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
400 (coding-system-get default-coding-system |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
401 'safe-charsets)))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
402 overlays) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
403 (save-excursion |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
404 ;; Highlight characters that default-coding-system can't encode. |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
405 (when (integerp from) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
406 (goto-char from) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
407 (let ((found nil)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
408 (while (and (not found) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
409 (re-search-forward "[^\000-\177]" to t)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
410 (setq found (assq (char-charset (preceding-char)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
411 non-safe-chars)))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
412 (beginning-of-line) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
413 (set-window-start (selected-window) (point)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
414 (save-excursion |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
415 (while (re-search-forward "[^\000-\177]" to t) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
416 (let* ((char (preceding-char)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
417 (charset (char-charset char))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
418 (when (assq charset non-safe-chars) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
419 (setq overlays (cons (make-overlay (1- (point)) (point)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
420 overlays)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
421 (overlay-put (car overlays) 'face 'highlight)))))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
422 |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
423 ;; At last, ask a user to select a proper coding system. |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
424 (unwind-protect |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
425 (save-window-excursion |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
426 ;; At first, show a helpful message. |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
427 (with-output-to-temp-buffer "*Warning*" |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
428 (save-excursion |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
429 (set-buffer standard-output) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
430 (insert "The target text contains the following non ASCII character(s):\n") |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
431 (let ((len (length non-safe-chars)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
432 (shown 0)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
433 (while (and non-safe-chars (< shown 3)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
434 (when (> (length (car non-safe-chars)) 2) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
435 (setq shown (1+ shown)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
436 (insert (format "%25s: " (car (car non-safe-chars)))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
437 (let ((l (nthcdr 2 (car non-safe-chars)))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
438 (while l |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
439 (insert (car l)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
440 (setq l (cdr l)))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
441 (if (> (nth 1 (car non-safe-chars)) 3) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
442 (insert "...")) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
443 (insert "\n")) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
444 (setq non-safe-chars (cdr non-safe-chars))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
445 (if (< shown len) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
446 (insert (format "%27s\n" "...")))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
447 (insert (format "\ |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
448 These can't be encoded safely by the coding system %s. |
20733
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
449 |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
450 Please select one from the following safe coding systems:\n" |
22815
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
451 default-coding-system)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
452 (let ((pos (point)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
453 (fill-prefix " ")) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
454 (mapcar (function (lambda (x) (princ " ") (princ x))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
455 safe-coding-systems) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
456 (fill-region-as-paragraph pos (point))))) |
20733
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
457 |
22815
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
458 ;; Read a coding system. |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
459 (let* ((safe-names (mapcar (lambda (x) (list (symbol-name x))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
460 safe-coding-systems)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
461 (name (completing-read |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
462 (format "Select coding system (default %s): " |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
463 (car safe-coding-systems)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
464 safe-names nil t nil nil |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
465 (car (car safe-names))))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
466 (setq last-coding-system-specified (intern name)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
467 (if (integerp (coding-system-eol-type default-coding-system)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
468 (setq last-coding-system-specified |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
469 (coding-system-change-eol-conversion |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
470 last-coding-system-specified |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
471 (coding-system-eol-type default-coding-system)))) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
472 last-coding-system-specified)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
473 (kill-buffer "*Warning*") |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
474 (while overlays |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
475 (delete-overlay (car overlays)) |
6af93eeeca10
(find-multibyte-characters): New
Kenichi Handa <handa@m17n.org>
parents:
22778
diff
changeset
|
476 (setq overlays (cdr overlays))))))))) |
20733
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
477 |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
478 (setq select-safe-coding-system-function 'select-safe-coding-system) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
479 |
17052 | 480 |
481 ;;; Language support staffs. | |
482 | |
483 (defvar language-info-alist nil | |
22153 | 484 "Alist of language environment definitions. |
17052 | 485 Each element looks like: |
486 (LANGUAGE-NAME . ((KEY . INFO) ...)) | |
22153 | 487 where LANGUAGE-NAME is a string, the name of the language environment, |
488 KEY is a symbol denoting the kind of information, and | |
489 INFO is the data associated with KEY. | |
490 Meaningful values for KEY include | |
17052 | 491 |
22153 | 492 documentation value is documentation of what this language environment |
493 is meant for, and how to use it. | |
494 charset value is a list of the character sets used by this | |
495 language environment. | |
496 sample-text value is one line of text, | |
497 written using those character sets, | |
498 appropriate for this language environment. | |
499 setup-function value is a function to call to switch to this | |
500 language environment. | |
501 exit-function value is a function to call to leave this | |
502 language environment. | |
503 coding-system value is a list of coding systems that are good | |
504 for saving text written in this language environment. | |
505 This list serves as suggestions to the user; | |
506 in effect, as a kind of documentation. | |
507 coding-priority value is a list of coding systems for this language | |
508 environment, in order of decreasing priority. | |
509 This is used to set up the coding system priority | |
22887
e24b79da83d6
(language-info-alist): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
22854
diff
changeset
|
510 list when you switch to this language environment. |
22986
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
511 nonascii-translation |
22887
e24b79da83d6
(language-info-alist): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
22854
diff
changeset
|
512 value is a translation table to be set to the |
e24b79da83d6
(language-info-alist): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
22854
diff
changeset
|
513 variable `nonascii-translation-table' in this |
e24b79da83d6
(language-info-alist): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
22854
diff
changeset
|
514 language environment. |
e24b79da83d6
(language-info-alist): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
22854
diff
changeset
|
515 charset-origin-alist |
e24b79da83d6
(language-info-alist): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
22854
diff
changeset
|
516 value is an alist to be set to the variable |
22986
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
517 `charset-origin-alist' in this language environment. |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
518 input-method value is a default input method for this language |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
519 environment. |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
520 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
521 The following keys take effect only when multibyte characters are |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
522 globally disabled, i.e. the value of `default-enable-multibyte-characters' |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
523 is nil. |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
524 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
525 unibyte-syntax value is a library name to load to set |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
526 unibyte 8-bit charcater syntaxes for this |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
527 language environment. |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
528 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
529 unibyte-display value is a coding system to encode characters |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
530 for the terminal. Characters in the range |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
531 of 160 to 255 display not as octal escapes, |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
532 but as non-ASCII characters in this language |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
533 environment.") |
22153 | 534 |
535 (defun get-language-info (lang-env key) | |
536 "Return information listed under KEY for language environment LANG-ENV. | |
537 KEY is a symbol denoting the kind of information. | |
538 For a list of useful values for KEY and their meanings, | |
539 see `language-info-alist'." | |
540 (if (symbolp lang-env) | |
541 (setq lang-env (symbol-name lang-env))) | |
542 (let ((lang-slot (assoc-ignore-case lang-env language-info-alist))) | |
17052 | 543 (if lang-slot |
544 (cdr (assq key (cdr lang-slot)))))) | |
545 | |
22200
a0d60a6c87da
(register-input-method): Rename arg ENV to LANG-ENV. Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22153
diff
changeset
|
546 (defun set-language-info (lang-env key info) |
22153 | 547 "Modify part of the definition of language environment LANG-ENV. |
548 Specifically, this stores the information INFO under KEY | |
549 in the definition of this language environment. | |
17052 | 550 KEY is a symbol denoting the kind of information. |
22153 | 551 INFO is the value for that information. |
20733
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
552 |
22153 | 553 For a list of useful values for KEY and their meanings, |
22200
a0d60a6c87da
(register-input-method): Rename arg ENV to LANG-ENV. Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22153
diff
changeset
|
554 see `language-info-alist'." |
22153 | 555 (if (symbolp lang-env) |
556 (setq lang-env (symbol-name lang-env))) | |
17052 | 557 (let (lang-slot key-slot) |
22153 | 558 (setq lang-slot (assoc lang-env language-info-alist)) |
17052 | 559 (if (null lang-slot) ; If no slot for the language, add it. |
22153 | 560 (setq lang-slot (list lang-env) |
17052 | 561 language-info-alist (cons lang-slot language-info-alist))) |
562 (setq key-slot (assq key lang-slot)) | |
563 (if (null key-slot) ; If no slot for the key, add it. | |
564 (progn | |
565 (setq key-slot (list key)) | |
566 (setcdr lang-slot (cons key-slot (cdr lang-slot))))) | |
22200
a0d60a6c87da
(register-input-method): Rename arg ENV to LANG-ENV. Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22153
diff
changeset
|
567 (setcdr key-slot info))) |
17052 | 568 |
22153 | 569 (defun set-language-info-alist (lang-env alist &optional parents) |
570 "Store ALIST as the definition of language environment LANG-ENV. | |
571 ALIST is an alist of KEY and INFO values. See the documentation of | |
20733
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
572 `set-langauge-info' for the meanings of KEY and INFO. |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
573 |
22153 | 574 Optional arg PARENTS is a list of parent menu names; it specifies |
575 where to put this language environment in the | |
576 Describe Language Environment and Set Language Environment menus. | |
577 For example, (\"European\") means to put this language environment | |
578 in the European submenu in each of those two menus." | |
579 (if (symbolp lang-env) | |
580 (setq lang-env (symbol-name lang-env))) | |
20733
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
581 (let ((describe-map describe-language-environment-map) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
582 (setup-map setup-language-environment-map)) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
583 (if parents |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
584 (let ((l parents) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
585 map parent-symbol parent) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
586 (while l |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
587 (if (symbolp (setq parent-symbol (car l))) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
588 (setq parent (symbol-name parent)) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
589 (setq parent parent-symbol parent-symbol (intern parent))) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
590 (setq map (lookup-key describe-map (vector parent-symbol))) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
591 (if (not map) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
592 (progn |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
593 (setq map (intern (format "describe-%s-environment-map" |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
594 (downcase parent)))) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
595 (define-prefix-command map) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
596 (define-key-after describe-map (vector parent-symbol) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
597 (cons parent map) t))) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
598 (setq describe-map (symbol-value map)) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
599 (setq map (lookup-key setup-map (vector parent-symbol))) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
600 (if (not map) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
601 (progn |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
602 (setq map (intern (format "setup-%s-environment-map" |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
603 (downcase parent)))) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
604 (define-prefix-command map) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
605 (define-key-after setup-map (vector parent-symbol) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
606 (cons parent map) t))) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
607 (setq setup-map (symbol-value map)) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
608 (setq l (cdr l))))) |
22200
a0d60a6c87da
(register-input-method): Rename arg ENV to LANG-ENV. Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22153
diff
changeset
|
609 |
a0d60a6c87da
(register-input-method): Rename arg ENV to LANG-ENV. Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22153
diff
changeset
|
610 ;; Set up menu items for this language env. |
a0d60a6c87da
(register-input-method): Rename arg ENV to LANG-ENV. Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22153
diff
changeset
|
611 (let ((doc (assq 'documentation alist)) |
a0d60a6c87da
(register-input-method): Rename arg ENV to LANG-ENV. Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22153
diff
changeset
|
612 (setup-function (assq 'setup-function alist))) |
a0d60a6c87da
(register-input-method): Rename arg ENV to LANG-ENV. Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22153
diff
changeset
|
613 (when doc |
a0d60a6c87da
(register-input-method): Rename arg ENV to LANG-ENV. Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22153
diff
changeset
|
614 (define-key-after describe-map (vector (intern lang-env)) |
a0d60a6c87da
(register-input-method): Rename arg ENV to LANG-ENV. Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22153
diff
changeset
|
615 (cons lang-env 'describe-specified-language-support) t)) |
a0d60a6c87da
(register-input-method): Rename arg ENV to LANG-ENV. Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22153
diff
changeset
|
616 (when setup-function |
a0d60a6c87da
(register-input-method): Rename arg ENV to LANG-ENV. Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22153
diff
changeset
|
617 (define-key-after setup-map (vector (intern lang-env)) |
a0d60a6c87da
(register-input-method): Rename arg ENV to LANG-ENV. Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22153
diff
changeset
|
618 (cons lang-env 'setup-specified-language-environment) t))) |
a0d60a6c87da
(register-input-method): Rename arg ENV to LANG-ENV. Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22153
diff
changeset
|
619 |
20733
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
620 (while alist |
22200
a0d60a6c87da
(register-input-method): Rename arg ENV to LANG-ENV. Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22153
diff
changeset
|
621 (set-language-info lang-env (car (car alist)) (cdr (car alist))) |
20733
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
622 (setq alist (cdr alist))))) |
17052 | 623 |
19734
c4894d8a3310
(read-language-name): Use a default, not an initial input.
Richard M. Stallman <rms@gnu.org>
parents:
19725
diff
changeset
|
624 (defun read-language-name (key prompt &optional default) |
22153 | 625 "Read a language environment name which has information for KEY. |
22986
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
626 If KEY is nil, read any language environment. |
22153 | 627 Prompt with PROMPT. DEFAULT is the default choice of language environment. |
628 This returns a language environment name as a string." | |
17052 | 629 (let* ((completion-ignore-case t) |
630 (name (completing-read prompt | |
631 language-info-alist | |
22986
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
632 (and key |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
633 (function (lambda (elm) (assq key elm)))) |
19734
c4894d8a3310
(read-language-name): Use a default, not an initial input.
Richard M. Stallman <rms@gnu.org>
parents:
19725
diff
changeset
|
634 t nil nil default))) |
17758
8c67c2e2cc29
(build-describe-language-support-function,
Kenichi Handa <handa@m17n.org>
parents:
17526
diff
changeset
|
635 (if (and (> (length name) 0) |
22986
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
636 (or (not key) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
637 (get-language-info name key))) |
17758
8c67c2e2cc29
(build-describe-language-support-function,
Kenichi Handa <handa@m17n.org>
parents:
17526
diff
changeset
|
638 name))) |
17052 | 639 |
640 ;;; Multilingual input methods. | |
641 | |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
642 (defconst leim-list-file-name "leim-list.el" |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
643 "Name of LEIM list file. |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
644 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
|
645 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
|
646 Emacs loads this file at startup time.") |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
647 |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
648 (defvar leim-list-header (format "\ |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
649 ;;; %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
|
650 ;; |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
651 ;; 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
|
652 ;; 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
|
653 ;; the whole input methods in Emacs. |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
654 ;; |
18969 | 655 ;; Each entry has the form: |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
656 ;; (register-input-method |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
657 ;; INPUT-METHOD LANGUAGE-NAME ACTIVATE-FUNC |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
658 ;; TITLE DESCRIPTION |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
659 ;; ARG ...) |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
660 ;; 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
|
661 ;; |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
662 ;; 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
|
663 ;; loads this file at startup time. |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
664 |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
665 " |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
666 leim-list-file-name) |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
667 "Header to be inserted in LEIM list file.") |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
668 |
18982
2297a2cb909d
(leim-list-entry-regexp): Make this match only at beginning of line.
Kenichi Handa <handa@m17n.org>
parents:
18978
diff
changeset
|
669 (defvar leim-list-entry-regexp "^(register-input-method" |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
670 "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
|
671 See also the variable `leim-list-header'") |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
672 |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
673 (defvar update-leim-list-functions |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
674 '(quail-update-leim-list-file) |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
675 "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
|
676 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
|
677 |
19615
4cdef838afb0
(update-leim-list-file): Make it handle multiple directories.
Richard M. Stallman <rms@gnu.org>
parents:
19614
diff
changeset
|
678 (defun update-leim-list-file (&rest dirs) |
4cdef838afb0
(update-leim-list-file): Make it handle multiple directories.
Richard M. Stallman <rms@gnu.org>
parents:
19614
diff
changeset
|
679 "Update LEIM list file in directories DIRS." |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
680 (let ((functions update-leim-list-functions)) |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
681 (while functions |
19615
4cdef838afb0
(update-leim-list-file): Make it handle multiple directories.
Richard M. Stallman <rms@gnu.org>
parents:
19614
diff
changeset
|
682 (apply (car functions) dirs) |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
683 (setq functions (cdr functions))))) |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
684 |
17052 | 685 (defvar current-input-method nil |
686 "The current input method for multilingual text. | |
19083
8fdb29b769ed
Doc fixes; fix error message text.
Richard M. Stallman <rms@gnu.org>
parents:
19036
diff
changeset
|
687 If nil, that means no input method is activated now.") |
17052 | 688 (make-variable-buffer-local 'current-input-method) |
689 (put 'current-input-method 'permanent-local t) | |
690 | |
691 (defvar current-input-method-title nil | |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
692 "Title string of the current input method shown in mode line.") |
17052 | 693 (make-variable-buffer-local 'current-input-method-title) |
694 (put 'current-input-method-title 'permanent-local t) | |
695 | |
18801
f60dbf4f7d7c
(mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents:
18712
diff
changeset
|
696 (defcustom default-input-method nil |
21229
38b621cd9169
(set-language-environment): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21042
diff
changeset
|
697 "*Default input method for multilingual text (a string). |
18801
f60dbf4f7d7c
(mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents:
18712
diff
changeset
|
698 This is the input method activated automatically by the command |
19329
249631cebee0
(default-input-method):
Richard M. Stallman <rms@gnu.org>
parents:
19328
diff
changeset
|
699 `toggle-input-method' (\\[toggle-input-method])." |
21229
38b621cd9169
(set-language-environment): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21042
diff
changeset
|
700 :group 'mule |
38b621cd9169
(set-language-environment): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21042
diff
changeset
|
701 :type 'string) |
18801
f60dbf4f7d7c
(mule-keymap): Bind l to set-language-environment.
Kenichi Handa <handa@m17n.org>
parents:
18712
diff
changeset
|
702 |
19405
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
703 (defvar input-method-history nil |
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
704 "History list for some commands that read input methods.") |
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
705 (make-variable-buffer-local 'input-method-history) |
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
706 (put 'input-method-history 'permanent-local t) |
17052 | 707 |
708 (defvar inactivate-current-input-method-function nil | |
709 "Function to call for inactivating the current input method. | |
710 Every input method should set this to an appropriate value when activated. | |
19555
df2996f7fdc3
(inactivate-current-input-method-function): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
19424
diff
changeset
|
711 This function is called with no argument. |
df2996f7fdc3
(inactivate-current-input-method-function): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
19424
diff
changeset
|
712 |
df2996f7fdc3
(inactivate-current-input-method-function): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
19424
diff
changeset
|
713 This function should never change the value of `current-input-method'. |
df2996f7fdc3
(inactivate-current-input-method-function): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
19424
diff
changeset
|
714 It is set to nil by the function `inactivate-input-method'.") |
17052 | 715 (make-variable-buffer-local 'inactivate-current-input-method-function) |
716 (put 'inactivate-current-input-method-function 'permanent-local t) | |
717 | |
718 (defvar describe-current-input-method-function nil | |
719 "Function to call for describing the current input method. | |
720 This function is called with no argument.") | |
721 (make-variable-buffer-local 'describe-current-input-method-function) | |
722 (put 'describe-current-input-method-function 'permanent-local t) | |
723 | |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
724 (defvar input-method-alist nil |
22153 | 725 "Alist of input method names vs how to use them. |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
726 Each element has the form: |
22153 | 727 (INPUT-METHOD LANGUAGE-ENV ACTIVATE-FUNC TITLE DESCRIPTION ARGS...) |
728 See the function `register-input-method' for the meanings of the elements.") | |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
729 |
22200
a0d60a6c87da
(register-input-method): Rename arg ENV to LANG-ENV. Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22153
diff
changeset
|
730 (defun register-input-method (input-method lang-env &rest args) |
22153 | 731 "Register INPUT-METHOD as an input method for language environment ENV. |
22200
a0d60a6c87da
(register-input-method): Rename arg ENV to LANG-ENV. Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22153
diff
changeset
|
732 INPUT-METHOD and LANG-ENV are symbols or strings. |
22153 | 733 |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
734 The remaining arguments are: |
22153 | 735 ACTIVATE-FUNC, TITLE, DESCRIPTION, and ARGS... |
736 ACTIVATE-FUNC is a function to call to activate this method. | |
737 TITLE is a string to show in the mode line when this method is active. | |
738 DESCRIPTION is a string describing this method and what it is good for. | |
739 The ARGS, if any, are passed as arguments to ACTIVATE-FUNC. | |
740 All told, the arguments to ACTIVATE-FUNC are INPUT-METHOD and the ARGS." | |
22200
a0d60a6c87da
(register-input-method): Rename arg ENV to LANG-ENV. Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22153
diff
changeset
|
741 (if (symbolp lang-env) |
a0d60a6c87da
(register-input-method): Rename arg ENV to LANG-ENV. Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22153
diff
changeset
|
742 (setq lang-env (symbol-name lang-env))) |
19649
b2bf3c43c86a
(get-language-info): Accept a symbol
Kenichi Handa <handa@m17n.org>
parents:
19615
diff
changeset
|
743 (if (symbolp input-method) |
b2bf3c43c86a
(get-language-info): Accept a symbol
Kenichi Handa <handa@m17n.org>
parents:
19615
diff
changeset
|
744 (setq input-method (symbol-name input-method))) |
22200
a0d60a6c87da
(register-input-method): Rename arg ENV to LANG-ENV. Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22153
diff
changeset
|
745 (let ((info (cons lang-env args)) |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
746 (slot (assoc input-method input-method-alist))) |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
747 (if slot |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
748 (setcdr slot info) |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
749 (setq slot (cons input-method info)) |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
750 (setq input-method-alist (cons slot input-method-alist))))) |
17052 | 751 |
19328
a616b45ffa31
(read-input-method-name): Replace INITIAL-INPUT arg with DEFAULT arg.
Richard M. Stallman <rms@gnu.org>
parents:
19267
diff
changeset
|
752 (defun read-input-method-name (prompt &optional default inhibit-null) |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
753 "Read a name of input method from a minibuffer prompting with PROMPT. |
19328
a616b45ffa31
(read-input-method-name): Replace INITIAL-INPUT arg with DEFAULT arg.
Richard M. Stallman <rms@gnu.org>
parents:
19267
diff
changeset
|
754 If DEFAULT is non-nil, use that as the default, |
a616b45ffa31
(read-input-method-name): Replace INITIAL-INPUT arg with DEFAULT arg.
Richard M. Stallman <rms@gnu.org>
parents:
19267
diff
changeset
|
755 and substitute it into PROMPT at the first `%s'. |
19649
b2bf3c43c86a
(get-language-info): Accept a symbol
Kenichi Handa <handa@m17n.org>
parents:
19615
diff
changeset
|
756 If INHIBIT-NULL is non-nil, null input signals an error. |
b2bf3c43c86a
(get-language-info): Accept a symbol
Kenichi Handa <handa@m17n.org>
parents:
19615
diff
changeset
|
757 |
b2bf3c43c86a
(get-language-info): Accept a symbol
Kenichi Handa <handa@m17n.org>
parents:
19615
diff
changeset
|
758 The return value is a string." |
19328
a616b45ffa31
(read-input-method-name): Replace INITIAL-INPUT arg with DEFAULT arg.
Richard M. Stallman <rms@gnu.org>
parents:
19267
diff
changeset
|
759 (if default |
a616b45ffa31
(read-input-method-name): Replace INITIAL-INPUT arg with DEFAULT arg.
Richard M. Stallman <rms@gnu.org>
parents:
19267
diff
changeset
|
760 (setq prompt (format prompt default))) |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
761 (let* ((completion-ignore-case t) |
19405
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
762 ;; This binding is necessary because input-method-history is |
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
763 ;; buffer local. |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
764 (input-method (completing-read prompt input-method-alist |
19748
06cbad2e806a
(read-input-method-name): Specify the input history properly.
Richard M. Stallman <rms@gnu.org>
parents:
19746
diff
changeset
|
765 nil t nil 'input-method-history |
06cbad2e806a
(read-input-method-name): Specify the input history properly.
Richard M. Stallman <rms@gnu.org>
parents:
19746
diff
changeset
|
766 default))) |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
767 (if (> (length input-method) 0) |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
768 input-method |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
769 (if inhibit-null |
18978
0f01c27a9756
(read-input-method-name): Show more appropriate error message.
Kenichi Handa <handa@m17n.org>
parents:
18969
diff
changeset
|
770 (error "No valid input method is specified"))))) |
17052 | 771 |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
772 (defun activate-input-method (input-method) |
22153 | 773 "Switch to input method INPUT-METHOD for the current buffer. |
774 If some other input method is already active, turn it off first. | |
775 If INPUT-METHOD is nil, deactivate any current input method." | |
19649
b2bf3c43c86a
(get-language-info): Accept a symbol
Kenichi Handa <handa@m17n.org>
parents:
19615
diff
changeset
|
776 (if (symbolp input-method) |
b2bf3c43c86a
(get-language-info): Accept a symbol
Kenichi Handa <handa@m17n.org>
parents:
19615
diff
changeset
|
777 (setq input-method (symbol-name input-method))) |
19405
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
778 (if (and current-input-method |
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
779 (not (string= current-input-method input-method))) |
19402 | 780 (inactivate-input-method)) |
22153 | 781 (unless (or current-input-method (null input-method)) |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
782 (let ((slot (assoc input-method input-method-alist))) |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
783 (if (null slot) |
19405
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
784 (error "Can't activate input method `%s'" input-method)) |
20165
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
785 (let ((func (nth 2 slot))) |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
786 (if (functionp func) |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
787 (apply (nth 2 slot) input-method (nthcdr 5 slot)) |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
788 (if (and (consp func) (symbolp (car func)) (symbolp (cdr func))) |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
789 (progn |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
790 (require (cdr func)) |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
791 (apply (car func) input-method (nthcdr 5 slot))) |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
792 (error "Can't activate input method `%s'" input-method)))) |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
793 (setq current-input-method input-method) |
19405
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
794 (setq current-input-method-title (nth 3 slot)) |
22854
dd7dcda2d47b
(activate-input-method): Update mode line.
Kenichi Handa <handa@m17n.org>
parents:
22815
diff
changeset
|
795 (unwind-protect |
dd7dcda2d47b
(activate-input-method): Update mode line.
Kenichi Handa <handa@m17n.org>
parents:
22815
diff
changeset
|
796 (run-hooks 'input-method-activate-hook) |
dd7dcda2d47b
(activate-input-method): Update mode line.
Kenichi Handa <handa@m17n.org>
parents:
22815
diff
changeset
|
797 (force-mode-line-update))))) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
798 |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
799 (defun inactivate-input-method () |
19555
df2996f7fdc3
(inactivate-current-input-method-function): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
19424
diff
changeset
|
800 "Turn off the current input method." |
19405
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
801 (when current-input-method |
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
802 (if input-method-history |
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
803 (unless (string= current-input-method (car input-method-history)) |
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
804 (setq input-method-history |
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
805 (cons current-input-method |
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
806 (delete current-input-method input-method-history)))) |
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
807 (setq input-method-history (list current-input-method))) |
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
808 (unwind-protect |
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
809 (funcall inactivate-current-input-method-function) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
810 (unwind-protect |
19405
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
811 (run-hooks 'input-method-inactivate-hook) |
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
812 (setq current-input-method nil |
22854
dd7dcda2d47b
(activate-input-method): Update mode line.
Kenichi Handa <handa@m17n.org>
parents:
22815
diff
changeset
|
813 current-input-method-title nil) |
dd7dcda2d47b
(activate-input-method): Update mode line.
Kenichi Handa <handa@m17n.org>
parents:
22815
diff
changeset
|
814 (force-mode-line-update))))) |
17052 | 815 |
20295
27ae44142cfd
(set-input-method): Renamed from select-input-method.
Karl Heuer <kwzh@gnu.org>
parents:
20231
diff
changeset
|
816 (defun set-input-method (input-method) |
22153 | 817 "Select and activate input method INPUT-METHOD for the current buffer. |
818 This also sets the default input method to the one you specify." | |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
819 (interactive |
19405
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
820 (let* ((default (or (car input-method-history) default-input-method))) |
19402 | 821 (list (read-input-method-name |
19748
06cbad2e806a
(read-input-method-name): Specify the input history properly.
Richard M. Stallman <rms@gnu.org>
parents:
19746
diff
changeset
|
822 (if default "Select input method (default %s): " "Select input method: ") |
19402 | 823 default t)))) |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
824 (activate-input-method input-method) |
19402 | 825 (setq default-input-method input-method)) |
17052 | 826 |
827 (defun toggle-input-method (&optional arg) | |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
828 "Turn on or off a multilingual text input method for the current buffer. |
19405
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
829 |
21983
487cd71c058d
(toggle-input-method): Use a more
Richard M. Stallman <rms@gnu.org>
parents:
21882
diff
changeset
|
830 With no prefix argument, if some input method is currently activated, |
487cd71c058d
(toggle-input-method): Use a more
Richard M. Stallman <rms@gnu.org>
parents:
21882
diff
changeset
|
831 turn it off. Otherwise, activate an input method--the one most recently used, |
487cd71c058d
(toggle-input-method): Use a more
Richard M. Stallman <rms@gnu.org>
parents:
21882
diff
changeset
|
832 or the one specified in `default-input-method', or one read from the |
487cd71c058d
(toggle-input-method): Use a more
Richard M. Stallman <rms@gnu.org>
parents:
21882
diff
changeset
|
833 minibuffer. |
19405
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
834 |
21983
487cd71c058d
(toggle-input-method): Use a more
Richard M. Stallman <rms@gnu.org>
parents:
21882
diff
changeset
|
835 With a prefix arg, read an input method from minibuffer and turn it on. |
487cd71c058d
(toggle-input-method): Use a more
Richard M. Stallman <rms@gnu.org>
parents:
21882
diff
changeset
|
836 The default is the most recent input method specified |
487cd71c058d
(toggle-input-method): Use a more
Richard M. Stallman <rms@gnu.org>
parents:
21882
diff
changeset
|
837 \(not including the currently active input method, if any). |
19405
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
838 |
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
839 When there's no input method to turn on, turn on what read from minibuffer." |
17052 | 840 (interactive "P") |
21983
487cd71c058d
(toggle-input-method): Use a more
Richard M. Stallman <rms@gnu.org>
parents:
21882
diff
changeset
|
841 (if (and current-input-method (not arg)) |
487cd71c058d
(toggle-input-method): Use a more
Richard M. Stallman <rms@gnu.org>
parents:
21882
diff
changeset
|
842 (inactivate-input-method) |
487cd71c058d
(toggle-input-method): Use a more
Richard M. Stallman <rms@gnu.org>
parents:
21882
diff
changeset
|
843 (let ((default (or (car input-method-history) default-input-method))) |
487cd71c058d
(toggle-input-method): Use a more
Richard M. Stallman <rms@gnu.org>
parents:
21882
diff
changeset
|
844 (if (and arg default (equal current-input-method default) |
487cd71c058d
(toggle-input-method): Use a more
Richard M. Stallman <rms@gnu.org>
parents:
21882
diff
changeset
|
845 (> (length input-method-history) 1)) |
487cd71c058d
(toggle-input-method): Use a more
Richard M. Stallman <rms@gnu.org>
parents:
21882
diff
changeset
|
846 (setq default (nth 1 input-method-history))) |
19405
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
847 (activate-input-method |
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
848 (if (or arg (not default)) |
21983
487cd71c058d
(toggle-input-method): Use a more
Richard M. Stallman <rms@gnu.org>
parents:
21882
diff
changeset
|
849 (progn |
487cd71c058d
(toggle-input-method): Use a more
Richard M. Stallman <rms@gnu.org>
parents:
21882
diff
changeset
|
850 (read-input-method-name |
487cd71c058d
(toggle-input-method): Use a more
Richard M. Stallman <rms@gnu.org>
parents:
21882
diff
changeset
|
851 (if default "Input method (default %s): " "Input method: " ) |
487cd71c058d
(toggle-input-method): Use a more
Richard M. Stallman <rms@gnu.org>
parents:
21882
diff
changeset
|
852 default t)) |
19405
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
853 default)) |
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
854 (or default-input-method |
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
855 (setq default-input-method current-input-method))))) |
17052 | 856 |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
857 (defun describe-input-method (input-method) |
22153 | 858 "Describe input method INPUT-METHOD." |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
859 (interactive |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
860 (list (read-input-method-name |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
861 "Describe input method (default, current choice): "))) |
19653
431753f747ea
(describe-input-method): Fix previous
Kenichi Handa <handa@m17n.org>
parents:
19649
diff
changeset
|
862 (if (and input-method (symbolp input-method)) |
19649
b2bf3c43c86a
(get-language-info): Accept a symbol
Kenichi Handa <handa@m17n.org>
parents:
19615
diff
changeset
|
863 (setq input-method (symbol-name input-method))) |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
864 (if (null input-method) |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
865 (describe-current-input-method) |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
866 (with-output-to-temp-buffer "*Help*" |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
867 (let ((elt (assoc input-method input-method-alist))) |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
868 (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
|
869 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
|
870 |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
871 (defun describe-current-input-method () |
19083
8fdb29b769ed
Doc fixes; fix error message text.
Richard M. Stallman <rms@gnu.org>
parents:
19036
diff
changeset
|
872 "Describe the input method currently in use." |
17052 | 873 (if current-input-method |
874 (if (and (symbolp describe-current-input-method-function) | |
875 (fboundp describe-current-input-method-function)) | |
876 (funcall describe-current-input-method-function) | |
877 (message "No way to describe the current input method `%s'" | |
878 (cdr current-input-method)) | |
879 (ding)) | |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
880 (error "No input method is activated now"))) |
17052 | 881 |
20116
8c1995cc7702
(read-multilingual-string): Use
Kenichi Handa <handa@m17n.org>
parents:
20091
diff
changeset
|
882 (defun read-multilingual-string (prompt &optional initial-input input-method) |
17052 | 883 "Read a multilingual string from minibuffer, prompting with string PROMPT. |
884 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
|
885 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
|
886 initially. |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
887 Optional 3rd argument INPUT-METHOD specifies the input method |
19649
b2bf3c43c86a
(get-language-info): Accept a symbol
Kenichi Handa <handa@m17n.org>
parents:
19615
diff
changeset
|
888 to be activated instead of the one selected last time. It is a symbol |
b2bf3c43c86a
(get-language-info): Accept a symbol
Kenichi Handa <handa@m17n.org>
parents:
19615
diff
changeset
|
889 or a string." |
18712
7366898bee9e
(read-multilingual-string): Adjusted
Kenichi Handa <handa@m17n.org>
parents:
18634
diff
changeset
|
890 (setq input-method |
7366898bee9e
(read-multilingual-string): Adjusted
Kenichi Handa <handa@m17n.org>
parents:
18634
diff
changeset
|
891 (or input-method |
20116
8c1995cc7702
(read-multilingual-string): Use
Kenichi Handa <handa@m17n.org>
parents:
20091
diff
changeset
|
892 current-input-method |
18712
7366898bee9e
(read-multilingual-string): Adjusted
Kenichi Handa <handa@m17n.org>
parents:
18634
diff
changeset
|
893 default-input-method |
7366898bee9e
(read-multilingual-string): Adjusted
Kenichi Handa <handa@m17n.org>
parents:
18634
diff
changeset
|
894 (read-input-method-name "Input method: " nil t))) |
19654
4c0174fcf26c
(read-multilingual-string): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
19653
diff
changeset
|
895 (if (and input-method (symbolp input-method)) |
19649
b2bf3c43c86a
(get-language-info): Accept a symbol
Kenichi Handa <handa@m17n.org>
parents:
19615
diff
changeset
|
896 (setq input-method (symbol-name input-method))) |
22778
42258900078d
(read-multilingual-string): Don't
Kenichi Handa <handa@m17n.org>
parents:
22727
diff
changeset
|
897 (let ((current-input-method input-method)) |
42258900078d
(read-multilingual-string): Don't
Kenichi Handa <handa@m17n.org>
parents:
22727
diff
changeset
|
898 (read-string prompt initial-input nil nil t))) |
17052 | 899 |
900 ;; Variables to control behavior of input methods. All input methods | |
901 ;; should react to these variables. | |
902 | |
20165
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
903 (defcustom input-method-verbose-flag 'default |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
904 "*A flag to control extra guidance given by input methods. |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
905 The value should be nil, t, `complex-only', or `default'. |
17052 | 906 |
19917
834c629f9220
(select-input-method): No error if enable-multibyte-characters is nil.
Richard M. Stallman <rms@gnu.org>
parents:
19848
diff
changeset
|
907 The extra guidance is done by showing list of available keys in echo |
20165
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
908 area. When you use the input method in the minibuffer, the guidance |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
909 is shown at the bottom short window (split from the existing window). |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
910 |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
911 If the value is t, extra guidance is always given, if the value is |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
912 nil, extra guidance is always suppressed. |
19848
68c5c0b3ed0d
(input-method-verbose-flag):
Kenichi Handa <handa@m17n.org>
parents:
19798
diff
changeset
|
913 |
20165
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
914 If the value is `complex-only', only complex input methods such as |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
915 `chinese-py' and `japanese' give extra guidance. |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
916 |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
917 If the value is `default', complex input methods always give extra |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
918 guidance, but simple input methods give it only when you are not in |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
919 the minibuffer. |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
920 |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
921 See also the variable `input-method-highlight-flag'." |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
922 :type '(choice (const t) (const nil) (const complex-only) (const default)) |
19402 | 923 :group 'mule) |
924 | |
925 (defcustom input-method-highlight-flag t | |
926 "*If this flag is non-nil, input methods highlight partially-entered text. | |
927 For instance, while you are in the middle of a Quail input method sequence, | |
928 the text inserted so far is temporarily underlined. | |
20165
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
929 The underlining goes away when you finish or abort the input method sequence. |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
930 See also the variable `input-method-verbose-flag'." |
19402 | 931 :type 'boolean |
932 :group 'mule) | |
17052 | 933 |
934 (defvar input-method-activate-hook nil | |
19555
df2996f7fdc3
(inactivate-current-input-method-function): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
19424
diff
changeset
|
935 "Normal hook run just after an input method is activated. |
df2996f7fdc3
(inactivate-current-input-method-function): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
19424
diff
changeset
|
936 |
df2996f7fdc3
(inactivate-current-input-method-function): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
19424
diff
changeset
|
937 The variable `current-input-method' keeps the input method name |
df2996f7fdc3
(inactivate-current-input-method-function): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
19424
diff
changeset
|
938 just activated.") |
17052 | 939 |
940 (defvar input-method-inactivate-hook nil | |
19555
df2996f7fdc3
(inactivate-current-input-method-function): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
19424
diff
changeset
|
941 "Normal hook run just after an input method is inactivated. |
df2996f7fdc3
(inactivate-current-input-method-function): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
19424
diff
changeset
|
942 |
df2996f7fdc3
(inactivate-current-input-method-function): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
19424
diff
changeset
|
943 The variable `current-input-method' still keeps the input method name |
20467 | 944 just inactivated.") |
17052 | 945 |
946 (defvar input-method-after-insert-chunk-hook nil | |
947 "Normal hook run just after an input method insert some chunk of text.") | |
948 | |
22918
776bc4293c87
(input-method-exit-on-first-char):
Kenichi Handa <handa@m17n.org>
parents:
22899
diff
changeset
|
949 (defvar input-method-exit-on-first-char nil |
776bc4293c87
(input-method-exit-on-first-char):
Kenichi Handa <handa@m17n.org>
parents:
22899
diff
changeset
|
950 "This flag controls a timing when an input method returns. |
776bc4293c87
(input-method-exit-on-first-char):
Kenichi Handa <handa@m17n.org>
parents:
22899
diff
changeset
|
951 Usually, the input method does not return while there's a possibility |
776bc4293c87
(input-method-exit-on-first-char):
Kenichi Handa <handa@m17n.org>
parents:
22899
diff
changeset
|
952 that it may find a different translation if a user types another key. |
22948
e259bed9247e
(input-method-exit-on-first-char)
Richard M. Stallman <rms@gnu.org>
parents:
22918
diff
changeset
|
953 But, it this flag is non-nil, the input method returns as soon as |
e259bed9247e
(input-method-exit-on-first-char)
Richard M. Stallman <rms@gnu.org>
parents:
22918
diff
changeset
|
954 the current key sequence gets long enough to have some valid translation.") |
22918
776bc4293c87
(input-method-exit-on-first-char):
Kenichi Handa <handa@m17n.org>
parents:
22899
diff
changeset
|
955 |
776bc4293c87
(input-method-exit-on-first-char):
Kenichi Handa <handa@m17n.org>
parents:
22899
diff
changeset
|
956 (defvar input-method-use-echo-area nil |
776bc4293c87
(input-method-exit-on-first-char):
Kenichi Handa <handa@m17n.org>
parents:
22899
diff
changeset
|
957 "This flag controls how an input method shows an intermediate key sequence. |
22948
e259bed9247e
(input-method-exit-on-first-char)
Richard M. Stallman <rms@gnu.org>
parents:
22918
diff
changeset
|
958 Usually, the input method inserts the intermediate key sequence, |
e259bed9247e
(input-method-exit-on-first-char)
Richard M. Stallman <rms@gnu.org>
parents:
22918
diff
changeset
|
959 or candidate translations corresponding to the sequence, |
e259bed9247e
(input-method-exit-on-first-char)
Richard M. Stallman <rms@gnu.org>
parents:
22918
diff
changeset
|
960 at point in the current buffer. |
e259bed9247e
(input-method-exit-on-first-char)
Richard M. Stallman <rms@gnu.org>
parents:
22918
diff
changeset
|
961 But, if this flag is non-nil, it displays them in echo area instead.") |
22918
776bc4293c87
(input-method-exit-on-first-char):
Kenichi Handa <handa@m17n.org>
parents:
22899
diff
changeset
|
962 |
19405
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
963 (defvar input-method-exit-on-invalid-key nil |
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
964 "This flag controls the behaviour of an input method on invalid key input. |
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
965 Usually, when a user types a key which doesn't start any character |
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
966 handled by the input method, the key is handled by turning off the |
22948
e259bed9247e
(input-method-exit-on-first-char)
Richard M. Stallman <rms@gnu.org>
parents:
22918
diff
changeset
|
967 input method temporarily. After that key, the input method is renabled. |
19405
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
968 But, if this flag is non-nil, the input method is never back on.") |
7ef4af7505f2
(previous-input-method): This
Kenichi Handa <handa@m17n.org>
parents:
19402
diff
changeset
|
969 |
17052 | 970 |
20165
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
971 (defvar set-language-environment-hook nil |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
972 "Normal hook run after some language environment is set. |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
973 |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
974 When you set some hook function here, that effect usually should not |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
975 be inherited to another language environment. So, you had better set |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
976 another function in `exit-language-environment-hook' (which see) to |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
977 cancel the effect.") |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
978 |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
979 (defvar exit-language-environment-hook nil |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
980 "Normal hook run after exiting from some language environment. |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
981 When this hook is run, the variable `current-language-environment' |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
982 is still bound to the language environment being exited. |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
983 |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
984 This hook is mainly used for cancelling the effect of |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
985 `set-language-environment-hook' (which-see).") |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
986 |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
987 (defun setup-specified-language-environment () |
22200
a0d60a6c87da
(register-input-method): Rename arg ENV to LANG-ENV. Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
22153
diff
changeset
|
988 "Switch to a specified language environment." |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
989 (interactive) |
18634
8b309d07a95e
(set-language-environment): Do the real work here.
Richard M. Stallman <rms@gnu.org>
parents:
18633
diff
changeset
|
990 (let (language-name) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
991 (if (and (symbolp last-command-event) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
992 (or (not (eq last-command-event 'Default)) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
993 (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
|
994 (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
|
995 (set-language-environment language-name) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
996 (error "Bogus calling sequence")))) |
17052 | 997 |
21229
38b621cd9169
(set-language-environment): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21042
diff
changeset
|
998 (defcustom current-language-environment "English" |
38b621cd9169
(set-language-environment): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21042
diff
changeset
|
999 "The last language environment specified with `set-language-environment'." |
38b621cd9169
(set-language-environment): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21042
diff
changeset
|
1000 :set 'set-language-environment |
38b621cd9169
(set-language-environment): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21042
diff
changeset
|
1001 :initialize 'custom-initialize-default |
38b621cd9169
(set-language-environment): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21042
diff
changeset
|
1002 :group 'mule |
38b621cd9169
(set-language-environment): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21042
diff
changeset
|
1003 :type 'string) |
18634
8b309d07a95e
(set-language-environment): Do the real work here.
Richard M. Stallman <rms@gnu.org>
parents:
18633
diff
changeset
|
1004 |
22986
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1005 (defun reset-language-environment () |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1006 "Reset multilingual environment of Emacs to the default status. |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1007 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1008 The default status is as follows: |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1009 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1010 The default value of buffer-file-coding-system is nil. |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1011 The default coding system for process I/O is nil. |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1012 The default value for the command `set-terminal-coding-system' is nil. |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1013 The default value for the command `set-keyboard-coding-system' is nil. |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1014 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1015 The order of priorities of coding categories and the coding system |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1016 bound to each category are as follows |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1017 coding category coding system |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1018 -------------------------------------------------- |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1019 coding-category-iso-8-2 iso-latin-1 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1020 coding-category-iso-8-1 iso-latin-1 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1021 coding-category-iso-7-tight iso-2022-jp |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1022 coding-category-iso-7 iso-2022-7bit |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1023 coding-category-iso-7-else iso-2022-7bit-lock |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1024 coding-category-iso-8-else iso-2022-8bit-ss2 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1025 coding-category-emacs-mule emacs-mule |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1026 coding-category-raw-text raw-text |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1027 coding-category-sjis japanese-shift-jis |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1028 coding-category-big5 chinese-big5 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1029 coding-category-ccl nil |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1030 coding-category-binarry no-conversion |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1031 " |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1032 (interactive) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1033 ;; This function formerly set default-enable-multibyte-characters to t, |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1034 ;; but that is incorrect. It should not alter the unibyte/multibyte choice. |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1035 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1036 (setq coding-category-iso-7-tight 'iso-2022-jp |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1037 coding-category-iso-7 'iso-2022-7bit |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1038 coding-category-iso-8-1 'iso-latin-1 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1039 coding-category-iso-8-2 'iso-latin-1 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1040 coding-category-iso-7-else 'iso-2022-7bit-lock |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1041 coding-category-iso-8-else 'iso-2022-8bit-ss2 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1042 coding-category-emacs-mule 'emacs-mule |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1043 coding-category-raw-text 'raw-text |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1044 coding-category-sjis 'japanese-shift-jis |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1045 coding-category-big5 'chinese-big5 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1046 coding-category-ccl nil |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1047 coding-category-binary 'no-conversion) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1048 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1049 (set-coding-priority |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1050 '(coding-category-iso-8-1 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1051 coding-category-iso-8-2 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1052 coding-category-iso-7-tight |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1053 coding-category-iso-7 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1054 coding-category-iso-7-else |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1055 coding-category-iso-8-else |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1056 coding-category-emacs-mule |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1057 coding-category-raw-text |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1058 coding-category-sjis |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1059 coding-category-big5 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1060 coding-category-ccl |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1061 coding-category-binary)) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1062 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1063 (set-default-coding-systems nil) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1064 ;; Don't alter the terminal and keyboard coding systems here. |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1065 ;; The terminal still supports the same coding system |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1066 ;; that it supported a minute ago. |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1067 ;;; (set-terminal-coding-system-internal nil) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1068 ;;; (set-keyboard-coding-system-internal nil) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1069 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1070 (setq nonascii-translation-table nil |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1071 nonascii-insert-offset 0)) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1072 |
18066
eecd891e2b63
(set-language-environment): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
17991
diff
changeset
|
1073 (defun set-language-environment (language-name) |
18068
317f57f07b14
Doc fix for previous change.
Richard M. Stallman <rms@gnu.org>
parents:
18066
diff
changeset
|
1074 "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
|
1075 This sets the coding system priority and the default input method |
21229
38b621cd9169
(set-language-environment): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21042
diff
changeset
|
1076 and sometimes other things. LANGUAGE-NAME should be a string |
38b621cd9169
(set-language-environment): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21042
diff
changeset
|
1077 which is the name of a language environment. For example, \"Latin-1\" |
38b621cd9169
(set-language-environment): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
21042
diff
changeset
|
1078 specifies the character set for the major languages of Western Europe." |
20165
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
1079 (interactive (list (read-language-name |
22986
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1080 nil |
20165
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
1081 "Set language environment (default, English): "))) |
19649
b2bf3c43c86a
(get-language-info): Accept a symbol
Kenichi Handa <handa@m17n.org>
parents:
19615
diff
changeset
|
1082 (if language-name |
b2bf3c43c86a
(get-language-info): Accept a symbol
Kenichi Handa <handa@m17n.org>
parents:
19615
diff
changeset
|
1083 (if (symbolp language-name) |
b2bf3c43c86a
(get-language-info): Accept a symbol
Kenichi Handa <handa@m17n.org>
parents:
19615
diff
changeset
|
1084 (setq language-name (symbol-name language-name))) |
b2bf3c43c86a
(get-language-info): Accept a symbol
Kenichi Handa <handa@m17n.org>
parents:
19615
diff
changeset
|
1085 (setq language-name "English")) |
22986
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1086 (or (assoc-ignore-case language-name language-info-alist) |
18634
8b309d07a95e
(set-language-environment): Do the real work here.
Richard M. Stallman <rms@gnu.org>
parents:
18633
diff
changeset
|
1087 (error "Language environment not defined: %S" language-name)) |
20165
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
1088 (if current-language-environment |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
1089 (let ((func (get-language-info current-language-environment |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
1090 'exit-function))) |
20231
7f0ea4977b32
(set-language-environment): Run
Kenichi Handa <handa@m17n.org>
parents:
20165
diff
changeset
|
1091 (run-hooks 'exit-language-environment-hook) |
7f0ea4977b32
(set-language-environment): Run
Kenichi Handa <handa@m17n.org>
parents:
20165
diff
changeset
|
1092 (if (fboundp func) (funcall func)))) |
22986
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1093 (reset-language-environment) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1094 |
20165
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
1095 (setq current-language-environment language-name) |
22986
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1096 (set-language-environment-coding-systems language-name) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1097 (let ((input-method (get-language-info language-name 'input-method))) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1098 (when input-method |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1099 (setq default-input-method input-method) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1100 (if input-method-history |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1101 (setq input-method-history |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1102 (cons input-method |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1103 (delete input-method input-method-history)))))) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1104 (let ((nonascii (get-language-info language-name 'nonascii-translation))) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1105 (if (char-table-p nonascii) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1106 (setq nonascii-translation-table nonascii) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1107 (if (charsetp nonascii) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1108 (setq nonascii-insert-offset (- (make-char nonascii) 128))))) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1109 |
22887
e24b79da83d6
(language-info-alist): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
22854
diff
changeset
|
1110 (setq charset-origin-alist |
e24b79da83d6
(language-info-alist): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
22854
diff
changeset
|
1111 (get-language-info language-name 'charset-origin-alist)) |
22986
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1112 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1113 (unless default-enable-multibyte-characters |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1114 ;; Unibyte setups. |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1115 (let ((syntax (get-language-info language-name 'unibyte-syntax))) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1116 (if syntax |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1117 (let ((set-case-syntax-set-multibyte nil)) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1118 (load syntax nil t) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1119 (set-standard-case-table (standard-case-table)) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1120 (let ((list (buffer-list))) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1121 (while list |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1122 (with-current-buffer (car list) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1123 (set-case-table (standard-case-table))) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1124 (setq list (cdr list))))))) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1125 (let ((coding (get-language-info language-name 'unibyte-display))) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1126 (if coding |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1127 (progn |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1128 (standard-display-european-internal) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1129 (set-terminal-coding-system coding)) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1130 (standard-display-default 160 255) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1131 (aset standard-display-table 146 nil) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1132 (set-terminal-coding-system nil)))) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1133 |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1134 (let ((required-features (get-language-info language-name 'features))) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1135 (while required-features |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1136 (require (car required-features)) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1137 (setq required-features (cdr required-features)))) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1138 (let ((func (get-language-info language-name 'setup-function))) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1139 (if (fboundp func) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1140 (funcall func))) |
20165
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
1141 (run-hooks 'set-language-environment-hook) |
18634
8b309d07a95e
(set-language-environment): Do the real work here.
Richard M. Stallman <rms@gnu.org>
parents:
18633
diff
changeset
|
1142 (force-mode-line-update t)) |
17052 | 1143 |
21856
68e39b75b862
(set-language-environment): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
21770
diff
changeset
|
1144 (defun standard-display-european-internal () |
68e39b75b862
(set-language-environment): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
21770
diff
changeset
|
1145 ;; Actually set up direct output of non-ASCII characters. |
68e39b75b862
(set-language-environment): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
21770
diff
changeset
|
1146 (standard-display-8bit 160 255) |
68e39b75b862
(set-language-environment): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
21770
diff
changeset
|
1147 ;; Make non-line-break space display as a plain space. |
68e39b75b862
(set-language-environment): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
21770
diff
changeset
|
1148 ;; Most X fonts do the wrong thing for code 160. |
68e39b75b862
(set-language-environment): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
21770
diff
changeset
|
1149 (aset standard-display-table 160 [32]) |
68e39b75b862
(set-language-environment): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
21770
diff
changeset
|
1150 ;; Most Windows programs send out apostrophe's as \222. Most X fonts |
68e39b75b862
(set-language-environment): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
21770
diff
changeset
|
1151 ;; don't contain a character at that position. Map it to the ASCII |
68e39b75b862
(set-language-environment): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
21770
diff
changeset
|
1152 ;; apostrophe. |
68e39b75b862
(set-language-environment): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
21770
diff
changeset
|
1153 (aset standard-display-table 146 [39])) |
68e39b75b862
(set-language-environment): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
21770
diff
changeset
|
1154 |
20733
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
1155 (defun set-language-environment-coding-systems (language-name) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
1156 "Do various coding system setups for language environment LANGUAGE-NAME." |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
1157 (let* ((priority (get-language-info language-name 'coding-priority)) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
1158 (default-coding (car priority))) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
1159 (if priority |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
1160 (let ((categories (mapcar 'coding-system-category priority))) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
1161 (set-default-coding-systems default-coding) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
1162 (set-coding-priority categories) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
1163 (while priority |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
1164 (set (car categories) (car priority)) |
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
1165 (setq priority (cdr priority) categories (cdr categories))) |
22887
e24b79da83d6
(language-info-alist): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
22854
diff
changeset
|
1166 (update-coding-systems-internal))))) |
20733
079907c59fb2
(set-language-info): Doc-string
Kenichi Handa <handa@m17n.org>
parents:
20485
diff
changeset
|
1167 |
17052 | 1168 ;; Print all arguments with `princ', then print "\n". |
1169 (defsubst princ-list (&rest args) | |
1170 (while args (princ (car args)) (setq args (cdr args))) | |
1171 (princ "\n")) | |
1172 | |
17840
2517414676ed
(set-language-info): Change the special treatment
Kenichi Handa <handa@m17n.org>
parents:
17758
diff
changeset
|
1173 ;; 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
|
1174 ;; 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
|
1175 ;; called from the menu: |
18152
e184e7061c9a
(describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents:
18068
diff
changeset
|
1176 ;; [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
|
1177 ;; 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
|
1178 (defun describe-specified-language-support () |
19083
8fdb29b769ed
Doc fixes; fix error message text.
Richard M. Stallman <rms@gnu.org>
parents:
19036
diff
changeset
|
1179 "Describe how Emacs supports the specified language environment." |
17840
2517414676ed
(set-language-info): Change the special treatment
Kenichi Handa <handa@m17n.org>
parents:
17758
diff
changeset
|
1180 (interactive) |
18152
e184e7061c9a
(describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents:
18068
diff
changeset
|
1181 (let (language-name) |
17840
2517414676ed
(set-language-info): Change the special treatment
Kenichi Handa <handa@m17n.org>
parents:
17758
diff
changeset
|
1182 (if (not (and (symbolp last-command-event) |
18152
e184e7061c9a
(describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents:
18068
diff
changeset
|
1183 (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
|
1184 (error "Bogus calling sequence")) |
18152
e184e7061c9a
(describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents:
18068
diff
changeset
|
1185 (describe-language-environment language-name))) |
e184e7061c9a
(describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents:
18068
diff
changeset
|
1186 |
e184e7061c9a
(describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents:
18068
diff
changeset
|
1187 (defun describe-language-environment (language-name) |
e184e7061c9a
(describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents:
18068
diff
changeset
|
1188 "Describe how Emacs supports language environment LANGUAGE-NAME." |
19653
431753f747ea
(describe-input-method): Fix previous
Kenichi Handa <handa@m17n.org>
parents:
19649
diff
changeset
|
1189 (interactive |
431753f747ea
(describe-input-method): Fix previous
Kenichi Handa <handa@m17n.org>
parents:
19649
diff
changeset
|
1190 (list (read-language-name |
431753f747ea
(describe-input-method): Fix previous
Kenichi Handa <handa@m17n.org>
parents:
19649
diff
changeset
|
1191 'documentation |
20091
aac4c6a58684
(describe-language-environment): Fix prompt.
Karl Heuer <kwzh@gnu.org>
parents:
19917
diff
changeset
|
1192 "Describe language environment (default, current choice): "))) |
18634
8b309d07a95e
(set-language-environment): Do the real work here.
Richard M. Stallman <rms@gnu.org>
parents:
18633
diff
changeset
|
1193 (if (null language-name) |
8b309d07a95e
(set-language-environment): Do the real work here.
Richard M. Stallman <rms@gnu.org>
parents:
18633
diff
changeset
|
1194 (setq language-name current-language-environment)) |
18152
e184e7061c9a
(describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents:
18068
diff
changeset
|
1195 (if (or (null language-name) |
e184e7061c9a
(describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents:
18068
diff
changeset
|
1196 (null (get-language-info language-name 'documentation))) |
e184e7061c9a
(describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents:
18068
diff
changeset
|
1197 (error "No documentation for the specified language")) |
19649
b2bf3c43c86a
(get-language-info): Accept a symbol
Kenichi Handa <handa@m17n.org>
parents:
19615
diff
changeset
|
1198 (if (symbolp language-name) |
b2bf3c43c86a
(get-language-info): Accept a symbol
Kenichi Handa <handa@m17n.org>
parents:
19615
diff
changeset
|
1199 (setq language-name (symbol-name language-name))) |
18152
e184e7061c9a
(describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents:
18068
diff
changeset
|
1200 (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
|
1201 (with-output-to-temp-buffer "*Help*" |
21471
ae34e7d5c51f
(describe-language-environment):
Kenichi Handa <handa@m17n.org>
parents:
21377
diff
changeset
|
1202 (princ-list language-name " language environment" "\n") |
17758
8c67c2e2cc29
(build-describe-language-support-function,
Kenichi Handa <handa@m17n.org>
parents:
17526
diff
changeset
|
1203 (if (stringp doc) |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
1204 (progn |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
1205 (princ-list doc) |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
1206 (terpri))) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
1207 (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
|
1208 (if (stringp str) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
1209 (progn |
18152
e184e7061c9a
(describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents:
18068
diff
changeset
|
1210 (princ "Sample text:\n") |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
1211 (princ-list " " str) |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
1212 (terpri)))) |
22986
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1213 (let ((input-method (get-language-info language-name 'input-method)) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1214 (l input-method-alist)) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1215 (princ "Input methods") |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1216 (when input-method |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1217 (princ (format " (default, %s)" input-method)) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1218 (setq input-method (assoc input-method input-method-alist)) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1219 (setq l (cons input-method (delete input-method l)))) |
b5c383369b40
(language-info-alist): Doc-string modified.
Kenichi Handa <handa@m17n.org>
parents:
22948
diff
changeset
|
1220 (princ ":\n") |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
1221 (while l |
18301
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
1222 (if (string= language-name (nth 1 (car l))) |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
1223 (princ-list " " (car (car l)) |
a4da36c7bb08
Define describe-coding-system instead of
Kenichi Handa <handa@m17n.org>
parents:
18217
diff
changeset
|
1224 (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
|
1225 (setq l (cdr l)))) |
18152
e184e7061c9a
(describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents:
18068
diff
changeset
|
1226 (terpri) |
e184e7061c9a
(describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents:
18068
diff
changeset
|
1227 (princ "Character sets:\n") |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
1228 (let ((l (get-language-info language-name 'charset))) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
1229 (if (null l) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
1230 (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
|
1231 (while l |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
1232 (princ-list " " (car l) ": " |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
1233 (charset-description (car l))) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
1234 (setq l (cdr l))))) |
18152
e184e7061c9a
(describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents:
18068
diff
changeset
|
1235 (terpri) |
e184e7061c9a
(describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents:
18068
diff
changeset
|
1236 (princ "Coding systems:\n") |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
1237 (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
|
1238 (if (null l) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
1239 (princ-list " nothing specific to " language-name) |
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
1240 (while l |
18152
e184e7061c9a
(describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents:
18068
diff
changeset
|
1241 (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
|
1242 (car l) |
e184e7061c9a
(describe-language-environment):
Richard M. Stallman <rms@gnu.org>
parents:
18068
diff
changeset
|
1243 (coding-system-mnemonic (car l)) |
18176
fc07ea29cd81
Define mouse-set-font in mule-menu-keymap.
Kenichi Handa <handa@m17n.org>
parents:
18152
diff
changeset
|
1244 (coding-system-doc-string (car l)))) |
20165
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
1245 (let ((aliases (coding-system-get (car l) 'alias-coding-systems))) |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
1246 (when aliases |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
1247 (princ "\t") |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
1248 (princ (cons 'alias: (cdr aliases))) |
2d0abf12009b
(set-default-coding-systems):
Kenichi Handa <handa@m17n.org>
parents:
20116
diff
changeset
|
1249 (terpri))) |
17991
65407fdc4a33
Delete defining "i" in mule-keymap.
Kenichi Handa <handa@m17n.org>
parents:
17840
diff
changeset
|
1250 (setq l (cdr l)))))))) |
17052 | 1251 |
1252 ;;; Charset property | |
1253 | |
1254 (defsubst get-charset-property (charset propname) | |
1255 "Return the value of CHARSET's PROPNAME property. | |
1256 This is the last value stored with | |
19083
8fdb29b769ed
Doc fixes; fix error message text.
Richard M. Stallman <rms@gnu.org>
parents:
19036
diff
changeset
|
1257 (put-charset-property CHARSET PROPNAME VALUE)." |
17052 | 1258 (plist-get (charset-plist charset) propname)) |
1259 | |
1260 (defsubst put-charset-property (charset propname value) | |
1261 "Store CHARSETS's PROPNAME property with value VALUE. | |
1262 It can be retrieved with `(get-charset-property CHARSET PROPNAME)'." | |
1263 (set-charset-plist charset | |
1264 (plist-put (charset-plist charset) propname value))) | |
1265 | |
1266 ;;; Character code property | |
1267 (put 'char-code-property-table 'char-table-extra-slots 0) | |
1268 | |
1269 (defvar char-code-property-table | |
1270 (make-char-table 'char-code-property-table) | |
1271 "Char-table containing a property list of each character code. | |
1272 | |
1273 See also the documentation of `get-char-code-property' and | |
19083
8fdb29b769ed
Doc fixes; fix error message text.
Richard M. Stallman <rms@gnu.org>
parents:
19036
diff
changeset
|
1274 `put-char-code-property'.") |
17052 | 1275 |
1276 (defun get-char-code-property (char propname) | |
1277 "Return the value of CHAR's PROPNAME property in `char-code-property-table'." | |
1278 (let ((plist (aref char-code-property-table char))) | |
1279 (if (listp plist) | |
1280 (car (cdr (memq propname plist)))))) | |
1281 | |
1282 (defun put-char-code-property (char propname value) | |
1283 "Store CHAR's PROPNAME property with VALUE in `char-code-property-table'. | |
1284 It can be retrieved with `(get-char-code-property CHAR PROPNAME)'." | |
1285 (let ((plist (aref char-code-property-table char))) | |
1286 (if plist | |
1287 (let ((slot (memq propname plist))) | |
1288 (if slot | |
1289 (setcar (cdr slot) value) | |
1290 (nconc plist (list propname value)))) | |
1291 (aset char-code-property-table char (list propname value))))) | |
1292 | |
1293 ;;; mule-cmds.el ends here |