annotate lisp/mule/mule-cmds.el @ 203:850242ba4a81 r20-3b28

Import from CVS: tag r20-3b28
author cvs
date Mon, 13 Aug 2007 10:02:21 +0200
parents acd284d43ca1
children e45d5e7c476e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
187
b405438285a2 Import from CVS: tag r20-3b20
cvs
parents: 165
diff changeset
1 ;;; mule-cmds.el --- Commands for multilingual environment
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
4 ;; Licensed to the Free Software Foundation.
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
5 ;; Copyright (C) 1997 MORIOKA Tomohiko
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
6
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
7 ;; Keywords: mule, multilingual
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
8
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
9 ;; This file is part of XEmacs.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
10
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
11 ;; XEmacs is free software; you can redistribute it and/or modify it
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
12 ;; under the terms of the GNU General Public License as published by
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
14 ;; any later version.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
15
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
16 ;; XEmacs is distributed in the hope that it will be useful, but
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
19 ;; General Public License for more details.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
20
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
22 ;; along with XEmacs; see the file COPYING. If not, write to the Free
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
24 ;; 02111-1307, USA.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
25
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
26 ;;; Code:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
27
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
28 ;;; MULE related key bindings and menus.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
29
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
30 (defvar mule-keymap (make-sparse-keymap "MULE")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
31 "Keymap for MULE (Multilingual environment) specific commands.")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
32 (fset 'mule-prefix mule-keymap)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
33
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
34 ;; Keep "C-x C-m ..." for mule specific commands.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
35 (define-key ctl-x-map "\C-m" 'mule-prefix)
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
36
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
37 (define-key mule-keymap "f" 'set-buffer-file-coding-system)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
38 (define-key mule-keymap "F" 'set-default-buffer-file-coding-system) ; XEmacs
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
39 (define-key mule-keymap "t" 'set-terminal-coding-system)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
40 (define-key mule-keymap "k" 'set-keyboard-coding-system)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
41 (define-key mule-keymap "p" 'set-current-process-coding-system)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
42 (define-key mule-keymap "P" 'set-default-process-coding-system) ; XEmacs
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
43 (define-key mule-keymap "\C-\\" 'select-input-method)
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
44 (define-key mule-keymap "c" 'list-coding-system-briefly) ; XEmacs
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
45 (define-key mule-keymap "C" 'list-coding-system) ; XEmacs
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
46 (define-key mule-keymap "r" 'toggle-display-direction) ; XEmacs
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
47 (define-key mule-keymap "l" 'set-language-environment)
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
48
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
49 (define-key help-map "\C-L" 'describe-language-support)
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
50 (define-key help-map "L" 'describe-language-environment)
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
51 (define-key help-map "\C-\\" 'describe-input-method)
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
52 (define-key help-map "I" 'describe-input-method)
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
53 (define-key help-map "C" 'describe-current-coding-system)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
54 (define-key help-map "h" 'view-hello-file)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
55
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
56 ;; Menu for XEmacs were moved to x11/x-menubar.el.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
57
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
58
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
59 ;; This should be a single character key binding because users use it
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
60 ;; very frequently while editing multilingual text. Now we can use
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
61 ;; only two such keys: "\C-\\" and "\C-^", but the latter is not
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
62 ;; convenient because it requires shifting on most keyboards. An
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
63 ;; alternative is "\C-\]" which is now bound to `abort-recursive-edit'
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
64 ;; but it won't be used that frequently.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
65 (define-key global-map "\C-\\" 'toggle-input-method)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
66
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
67 (defun view-hello-file ()
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
68 "Display the HELLO file which list up many languages and characters."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
69 (interactive)
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
70 ;; We have to decode the file in any environment.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
71 (let ((coding-system-for-read 'iso-2022-7))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
72 (find-file-read-only (expand-file-name "HELLO" data-directory))))
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
73
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
74
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
75 ;;; Language support staffs.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
76
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
77 (defvar primary-language "English"
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
78 "Name of a user's primary language.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
79 Emacs provide various language supports based on this variable.")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
80
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
81 (defvar language-info-alist nil
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
82 "Alist of language names vs the corresponding information of various kind.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
83 Each element looks like:
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
84 (LANGUAGE-NAME . ((KEY . INFO) ...))
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
85 where LANGUAGE-NAME is a string,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
86 KEY is a symbol denoting the kind of information,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
87 INFO is any Lisp object which contains the actual information related
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
88 to KEY.")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
89
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
90 (defun get-language-info (language-name key)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
91 "Return the information for LANGUAGE-NAME of the kind KEY.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
92 KEY is a symbol denoting the kind of required information."
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
93 (if (symbolp language-name)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
94 (setq language-name (symbol-name language-name)))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
95 (let ((lang-slot (assoc-ignore-case language-name language-info-alist)))
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
96 (if lang-slot
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
97 (cdr (assq key (cdr lang-slot))))))
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
98
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
99 (defun set-language-info (language-name key info)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
100 "Set for LANGUAGE-NAME the information INFO under KEY.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
101 KEY is a symbol denoting the kind of information.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
102 INFO is any Lisp object which contains the actual information.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
103
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
104 Currently, the following KEYs are used by Emacs:
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
105
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
106 charset: list of symbols whose values are charsets specific to the language.
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
107
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
108 coding-system: list of coding systems specific to the langauge.
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
109
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
110 tutorial: a tutorial file name written in the language.
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
111
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
112 sample-text: one line short text containing characters of the language.
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
113
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
114 documentation: t or a string describing how Emacs supports the language.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
115 If a string is specified, it is shown before any other information
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
116 of the language by the command `describe-language-environment'.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
117
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
118 setup-function: a function to call for setting up environment
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
119 convenient for a user of the language.
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
120
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
121 If KEY is documentation or setup-function, you can also specify
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
122 a cons cell as INFO, in which case, the car part should be
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
123 a normal value as INFO for KEY (as described above),
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
124 and the cdr part should be a symbol whose value is a menu keymap
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
125 in which an entry for the language is defined. But, only the car part
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
126 is actually set as the information.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
127
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
128 We will define more KEYs in the future. To avoid conflict,
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
129 if you want to use your own KEY values, make them start with `user-'."
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
130 (if (symbolp language-name)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
131 (setq language-name (symbol-name language-name)))
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
132 (let (lang-slot key-slot)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
133 (setq lang-slot (assoc language-name language-info-alist))
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
134 (if (null lang-slot) ; If no slot for the language, add it.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
135 (setq lang-slot (list language-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
136 language-info-alist (cons lang-slot language-info-alist)))
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
137 (setq key-slot (assq key lang-slot))
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
138 (if (null key-slot) ; If no slot for the key, add it.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
139 (progn
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
140 (setq key-slot (list key))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
141 (setcdr lang-slot (cons key-slot (cdr lang-slot)))))
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
142 ;; Setup menu.
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
143 (cond ((eq key 'documentation)
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
144 ;; (define-key-after mule-describe-language-support-map
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
145 ;; (vector (intern language-name))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
146 ;; (cons language-name info)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
147 ;; t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
148 (eval-after-load "x-menubar"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
149 `(add-menu-button '("Mule" "Describe Language Support")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
150 (vector ,language-name ',info t)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
151 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
152 ((eq key 'setup-function)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
153 ;; (define-key-after mule-set-language-environment-map
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
154 ;; (vector (intern language-name))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
155 ;; (cons language-name info)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
156 ;; t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
157 (eval-after-load "x-menubar"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
158 `(add-menu-button '("Mule" "Set Language Environment")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
159 (vector ,language-name ',info t)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
160 ))
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
161 ))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
162
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
163 (defun set-language-info-alist (language-name alist)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
164 "Set for LANGUAGE-NAME the information in ALIST.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
165 ALIST is an alist of KEY and INFO. See the documentation of
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
166 `set-langauge-info' for the meanings of KEY and INFO."
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
167 (if (symbolp language-name)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
168 (setq language-name (symbol-name language-name)))
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
169 (while alist
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
170 (set-language-info language-name (car (car alist)) (cdr (car alist)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
171 (setq alist (cdr alist))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
172
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
173 (defun read-language-name (key prompt &optional default)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
174 "Read language name which has information for KEY, prompting with PROMPT.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
175 DEFAULT is the default choice of language.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
176 This returns a language name as a string."
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
177 (let* ((completion-ignore-case t)
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
178 (name (completing-read prompt
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
179 language-info-alist
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
180 (function (lambda (elm) (assq key elm)))
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
181 t nil nil default)))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
182 (if (and (> (length name) 0)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
183 (get-language-info name key))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
184 name)))
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
185
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
186 ;;; Multilingual input methods.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
187
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
188 (defconst leim-list-file-name "leim-list.el"
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
189 "Name of LEIM list file.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
190 This file contains a list of libraries of Emacs input methods (LEIM)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
191 in the format of Lisp expression for registering each input method.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
192 Emacs loads this file at startup time.")
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
193
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
194 (defvar leim-list-header (format "\
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
195 ;;; %s -- list of LEIM (Library of Emacs Input Method)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
196 ;;
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
197 ;; This file contains a list of LEIM (Library of Emacs Input Method)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
198 ;; in the same directory as this file. Loading this file registeres
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
199 ;; the whole input methods in Emacs.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
200 ;;
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
201 ;; Each entry has the form:
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
202 ;; (register-input-method
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
203 ;; INPUT-METHOD LANGUAGE-NAME ACTIVATE-FUNC
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
204 ;; TITLE DESCRIPTION
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
205 ;; ARG ...)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
206 ;; See the function `register-input-method' for the meanings of arguments.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
207 ;;
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
208 ;; If this directory is included in load-path, Emacs automatically
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
209 ;; loads this file at startup time.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
210
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
211 "
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
212 leim-list-file-name)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
213 "Header to be inserted in LEIM list file.")
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
214
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
215 (defvar leim-list-entry-regexp "^(register-input-method"
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
216 "Regexp matching head of each entry in LEIM list file.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
217 See also the variable `leim-list-header'")
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
218
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
219 (defvar update-leim-list-functions
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
220 '(quail-update-leim-list-file)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
221 "List of functions to call to update LEIM list file.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
222 Each function is called with one arg, LEIM directory name.")
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
223
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
224 (defun update-leim-list-file (&rest dirs)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
225 "Update LEIM list file in directories DIRS."
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
226 (let ((functions update-leim-list-functions))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
227 (while functions
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
228 (apply (car functions) dirs)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
229 (setq functions (cdr functions)))))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
230
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
231 (defvar current-input-method nil
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
232 "The current input method for multilingual text.
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
233 If nil, that means no input method is activated now.")
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
234 (make-variable-buffer-local 'current-input-method)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
235 (put 'current-input-method 'permanent-local t)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
236
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
237 (defvar current-input-method-title nil
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
238 "Title string of the current input method shown in mode line.")
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
239 (make-variable-buffer-local 'current-input-method-title)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
240 (put 'current-input-method-title 'permanent-local t)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
241
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
242 (defcustom default-input-method nil
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
243 "*Default input method for multilingual text.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
244 This is the input method activated automatically by the command
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
245 `toggle-input-method' (\\[toggle-input-method])."
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
246 :group 'mule)
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
247
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
248 (defvar input-method-history nil
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
249 "History list for some commands that read input methods.")
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
250 (make-variable-buffer-local 'input-method-history)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
251 (put 'input-method-history 'permanent-local t)
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
252
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
253 (defvar inactivate-current-input-method-function nil
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
254 "Function to call for inactivating the current input method.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
255 Every input method should set this to an appropriate value when activated.
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
256 This function is called with no argument.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
257
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
258 This function should never change the value of `current-input-method'.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
259 It is set to nil by the function `inactivate-input-method'.")
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
260 (make-variable-buffer-local 'inactivate-current-input-method-function)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
261 (put 'inactivate-current-input-method-function 'permanent-local t)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
262
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
263 (defvar describe-current-input-method-function nil
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
264 "Function to call for describing the current input method.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
265 This function is called with no argument.")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
266 (make-variable-buffer-local 'describe-current-input-method-function)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
267 (put 'describe-current-input-method-function 'permanent-local t)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
268
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
269 (defvar input-method-alist nil
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
270 "Alist of input method names vs the corresponding information to use it.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
271 Each element has the form:
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
272 (INPUT-METHOD LANGUAGE-NAME ACTIVATE-FUNC TITLE DESCRIPTION ...)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
273 See the function `register-input-method' for the meanings of each elements.")
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
274
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
275 (defun register-input-method (input-method language-name &rest args)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
276 "Register INPUT-METHOD as an input method for LANGUAGE-NAME.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
277 INPUT-METHOD and LANGUAGE-NAME are symbols or strings.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
278 The remaining arguments are:
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
279 ACTIVATE-FUNC, TITLE, DESCRIPTION, and ARG ...
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
280 where,
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
281 ACTIVATE-FUNC is a function to call for activating this method.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
282 TITLE is a string shown in mode-line while this method is active,
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
283 DESCRIPTION is a string describing about this method,
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
284 Arguments to ACTIVATE-FUNC are INPUT-METHOD and ARGs."
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
285 (if (symbolp language-name)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
286 (setq language-name (symbol-name language-name)))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
287 (if (symbolp input-method)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
288 (setq input-method (symbol-name input-method)))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
289 (let ((info (cons language-name args))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
290 (slot (assoc input-method input-method-alist)))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
291 (if slot
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
292 (setcdr slot info)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
293 (setq slot (cons input-method info))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
294 (setq input-method-alist (cons slot input-method-alist)))))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
295
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
296 (defun read-input-method-name (prompt &optional default inhibit-null)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
297 "Read a name of input method from a minibuffer prompting with PROMPT.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
298 If DEFAULT is non-nil, use that as the default,
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
299 and substitute it into PROMPT at the first `%s'.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
300 If INHIBIT-NULL is non-nil, null input signals an error.
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
301
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
302 The return value is a string."
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
303 (if default
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
304 (setq prompt (format prompt default)))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
305 (let* ((completion-ignore-case t)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
306 ;; This binding is necessary because input-method-history is
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
307 ;; buffer local.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
308 (input-method (completing-read prompt input-method-alist
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
309 nil t nil 'input-method-history)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
310 ;;default)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
311 ))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
312 (if (> (length input-method) 0)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
313 input-method
203
850242ba4a81 Import from CVS: tag r20-3b28
cvs
parents: 197
diff changeset
314 ;; If we have a default, use it, otherwise check inhibit-null
850242ba4a81 Import from CVS: tag r20-3b28
cvs
parents: 197
diff changeset
315 (if default
850242ba4a81 Import from CVS: tag r20-3b28
cvs
parents: 197
diff changeset
316 default
850242ba4a81 Import from CVS: tag r20-3b28
cvs
parents: 197
diff changeset
317 (if inhibit-null
850242ba4a81 Import from CVS: tag r20-3b28
cvs
parents: 197
diff changeset
318 (error "No valid input method is specified"))))))
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
319
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
320 (defun activate-input-method (input-method)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
321 "Turn INPUT-METHOD on.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
322 If some input method is already on, turn it off at first."
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
323 (if (symbolp input-method)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
324 (setq input-method (symbol-name input-method)))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
325 (if (and current-input-method
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
326 (not (string= current-input-method input-method)))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
327 (inactivate-input-method))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
328 (unless current-input-method
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
329 (let ((slot (assoc input-method input-method-alist)))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
330 (if (null slot)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
331 (error "Can't activate input method `%s'" input-method))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
332 (apply (nth 2 slot) input-method (nthcdr 5 slot))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
333 (setq current-input-method input-method)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
334 (setq current-input-method-title (nth 3 slot))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
335 (run-hooks 'input-method-activate-hook))))
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
336
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
337 (defun inactivate-input-method ()
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
338 "Turn off the current input method."
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
339 (when current-input-method
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
340 (if input-method-history
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
341 (unless (string= current-input-method (car input-method-history))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
342 (setq input-method-history
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
343 (cons current-input-method
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
344 (delete current-input-method input-method-history))))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
345 (setq input-method-history (list current-input-method)))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
346 (unwind-protect
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
347 (funcall inactivate-current-input-method-function)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
348 (unwind-protect
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
349 (run-hooks 'input-method-inactivate-hook)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
350 (setq current-input-method nil
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
351 current-input-method-title nil)))))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
352
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
353 (defun select-input-method (input-method)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
354 "Select and turn on INPUT-METHOD.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
355 This sets the default input method to what you specify,
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
356 and turn it on for the current buffer."
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
357 (interactive
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
358 (let* ((default (or (car input-method-history) default-input-method)))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
359 (list (read-input-method-name
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
360 (if default "Select input method (default %s): " "Select input method: ")
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
361 default t))))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
362 (activate-input-method input-method)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
363 (setq default-input-method input-method))
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
364
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
365 (defun toggle-input-method (&optional arg)
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
366 "Turn on or off a multilingual text input method for the current buffer.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
367
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
368 With arg, read an input method from minibuffer and turn it on.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
369
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
370 Without arg, if some input method is currently activated, turn it off,
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
371 else turn on an input method selected last time
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
372 or the default input method (see `default-input-method').
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
373
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
374 When there's no input method to turn on, turn on what read from minibuffer."
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
375 (interactive "P")
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
376 (if (eq arg 1)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
377 (setq arg nil))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
378 (let* ((default (or (car input-method-history) default-input-method)))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
379 (if (and current-input-method (not arg))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
380 (inactivate-input-method)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
381 (activate-input-method
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
382 (if (or arg (not default))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
383 (read-input-method-name
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
384 (if default "Input method (default %s): " "Input method: " )
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
385 default t)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
386 default))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
387 (or default-input-method
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
388 (setq default-input-method current-input-method)))))
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
389
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
390 (defun describe-input-method (input-method)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
391 "Describe input method INPUT-METHOD."
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
392 (interactive
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
393 (list (read-input-method-name
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
394 "Describe input method (default, current choice): ")))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
395 (if (and input-method (symbolp input-method))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
396 (setq input-method (symbol-name input-method)))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
397 (if (null input-method)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
398 (describe-current-input-method)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
399 (with-output-to-temp-buffer "*Help*"
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
400 (let ((elt (assoc input-method input-method-alist)))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
401 (princ (format "Input method: %s (`%s' in mode line) for %s\n %s\n"
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
402 input-method (nth 3 elt) (nth 1 elt) (nth 4 elt)))))))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
403
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
404 (defun describe-current-input-method ()
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
405 "Describe the input method currently in use."
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
406 (if current-input-method
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
407 (if (and (symbolp describe-current-input-method-function)
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
408 (fboundp describe-current-input-method-function))
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
409 (funcall describe-current-input-method-function)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
410 (message "No way to describe the current input method `%s'"
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
411 (cdr current-input-method))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
412 (ding))
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
413 (error "No input method is activated now")))
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
414
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
415 (defun read-multilingual-string (prompt &optional initial-input
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
416 input-method)
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
417 "Read a multilingual string from minibuffer, prompting with string PROMPT.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
418 The input method selected last time is activated in minibuffer.
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
419 If optional second arg INITIAL-INPUT is non-nil, insert it in the minibuffer
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
420 initially.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
421 Optional 3rd argument INPUT-METHOD specifies the input method
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
422 to be activated instead of the one selected last time. It is a symbol
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
423 or a string."
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
424 (setq input-method
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
425 (or input-method
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
426 default-input-method
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
427 (read-input-method-name "Input method: " nil t)))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
428 (if (and input-method (symbolp input-method))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
429 (setq input-method (symbol-name input-method)))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
430 (let ((current-input-method input-method))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
431 (read-string prompt initial-input nil nil t)))
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
432
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
433 ;; Variables to control behavior of input methods. All input methods
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
434 ;; should react to these variables.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
435
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
436 (defcustom input-method-verbose-flag t
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
437 "*If this flag is non-nil, input methods give extra guidance.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
438
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
439 The extra guidance is done by showing list of available keys in echo
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
440 area.
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
441
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
442 For complex input methods such as `chinese-py' and `japanese',
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
443 when you use the input method in the minibuffer, the guidance is
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
444 shown at the bottom short window (split from the existing window).
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
445 For simple input methods, guidance is not shown
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
446 when you are in the minibuffer."
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
447 :type 'boolean
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
448 :group 'mule)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
449
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
450 (defcustom input-method-highlight-flag t
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
451 "*If this flag is non-nil, input methods highlight partially-entered text.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
452 For instance, while you are in the middle of a Quail input method sequence,
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
453 the text inserted so far is temporarily underlined.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
454 The underlining goes away when you finish or abort the input method sequence."
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
455 :type 'boolean
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
456 :group 'mule)
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
457
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
458 (defvar input-method-activate-hook nil
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
459 "Normal hook run just after an input method is activated.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
460
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
461 The variable `current-input-method' keeps the input method name
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
462 just activated.")
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
463
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
464 (defvar input-method-inactivate-hook nil
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
465 "Normal hook run just after an input method is inactivated.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
466
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
467 The variable `current-input-method' still keeps the input method name
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
468 just inacitvated.")
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
469
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
470 (defvar input-method-after-insert-chunk-hook nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
471 "Normal hook run just after an input method insert some chunk of text.")
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
472
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
473 (defvar input-method-exit-on-invalid-key nil
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
474 "This flag controls the behaviour of an input method on invalid key input.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
475 Usually, when a user types a key which doesn't start any character
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
476 handled by the input method, the key is handled by turning off the
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
477 input method temporalily. After the key is handled, the input method is
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
478 back on.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
479 But, if this flag is non-nil, the input method is never back on.")
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 187
diff changeset
480
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
481
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
482 ;;; Language specific setup functions.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
483 ;; (defun set-language-environment (language-name)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
484 ;; "Setup a user's environment for LANGUAGE-NAME.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
485 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
486 ;; To setup, a fucntion returned by:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
487 ;; (get-language-info LANGUAGE-NAME 'setup-function)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
488 ;; is called."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
489 ;; (interactive (list (read-language-name 'setup-function "Language: ")))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
490 ;; (let (func)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
491 ;; (if (or (null language-name)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
492 ;; (null (setq func
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
493 ;; (get-language-info language-name 'setup-function))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
494 ;; (error "No way to setup environment for the specified language"))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
495 ;; (funcall func)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
496
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
497 ;; Print all arguments with `princ', then print "\n".
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
498 (defsubst princ-list (&rest args)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
499 (while args (princ (car args)) (setq args (cdr args)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
500 (princ "\n"))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
501
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
502 (defun describe-language-support (language-name)
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
503 "Describe how Emacs supports LANGUAGE-NAME.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
504
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
505 For that, a function returned by:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
506 (get-language-info LANGUAGE-NAME 'describe-function)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
507 is called."
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
508 (interactive (list (read-language-name 'documentation "Language: ")))
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
509 (let (func)
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
510 (if (or (null language-name)
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
511 (null (setq func
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
512 (get-language-info language-name 'describe-function))))
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
513 (error "No documentation for the specified language"))
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
514 (funcall func)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
515
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
516 ;; Print LANGUAGE-NAME specific information such as input methods,
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
517 ;; charsets, and coding systems. This function is intended to be
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
518 ;; called from various describe-LANGUAGE-support functions defined in
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
519 ;; lisp/language/LANGUAGE.el.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
520 (defun describe-language-support-internal (language-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
521 (with-output-to-temp-buffer "*Help*"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
522 (let ((doc (get-language-info language-name 'documentation)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
523 (if (stringp doc)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
524 (princ-list doc)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
525 (princ "-----------------------------------------------------------\n")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
526 (princ-list "List of items specific to "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
527 language-name
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
528 " support")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
529 (princ "-----------------------------------------------------------\n")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
530 (let ((str (get-language-info language-name 'sample-text)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
531 (if (stringp str)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
532 (progn
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
533 (princ "<sample text>\n")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
534 (princ-list " " str))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
535 (princ "<input methods>\n")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
536 (let ((l (get-language-info language-name 'input-method)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
537 (while l
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
538 (princ-list " " (car (car l)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
539 (setq l (cdr l))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
540 (princ "<character sets>\n")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
541 (let ((l (get-language-info language-name 'charset)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
542 (if (null l)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
543 (princ-list " nothing specific to " language-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
544 (while l
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
545 (princ-list " " (car l) ": "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
546 (charset-description (car l)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
547 (setq l (cdr l)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
548 (princ "<coding systems>\n")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
549 (let ((l (get-language-info language-name 'coding-system)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
550 (if (null l)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
551 (princ-list " nothing specific to " language-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
552 (while l
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
553 (princ-list " " (car l) ":\n\t"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
554 (coding-system-docstring (car l)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 155
diff changeset
555 (setq l (cdr l)))))))
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
556
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
557 ;;; Charset property
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
558
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
559 ;; (defsubst get-charset-property (charset propname)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
560 ;; "Return the value of CHARSET's PROPNAME property.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
561 ;; This is the last value stored with
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
562 ;; `(put-charset-property CHARSET PROPNAME VALUE)'."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
563 ;; (plist-get (charset-plist charset) propname))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
564
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
565 ;; (defsubst put-charset-property (charset propname value)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
566 ;; "Store CHARSETS's PROPNAME property with value VALUE.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
567 ;; It can be retrieved with `(get-charset-property CHARSET PROPNAME)'."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
568 ;; (set-charset-plist charset
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
569 ;; (plist-put (charset-plist charset) propname value)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
570
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
571 ;;; Character code property
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
572 ;; (put 'char-code-property-table 'char-table-extra-slots 0)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
573
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
574 ;; (defvar char-code-property-table
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
575 ;; (make-char-table 'char-code-property-table)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
576 ;; "Char-table containing a property list of each character code.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
577 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
578 ;; See also the documentation of `get-char-code-property' and
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
579 ;; `put-char-code-property'")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
580
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
581 ;; (defun get-char-code-property (char propname)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
582 ;; "Return the value of CHAR's PROPNAME property in `char-code-property-table'."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
583 ;; (let ((plist (aref char-code-property-table char)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
584 ;; (if (listp plist)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
585 ;; (car (cdr (memq propname plist))))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
586
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
587 ;; (defun put-char-code-property (char propname value)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
588 ;; "Store CHAR's PROPNAME property with VALUE in `char-code-property-table'.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
589 ;; It can be retrieved with `(get-char-code-property CHAR PROPNAME)'."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
590 ;; (let ((plist (aref char-code-property-table char)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
591 ;; (if plist
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
592 ;; (let ((slot (memq propname plist)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
593 ;; (if slot
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
594 ;; (setcar (cdr slot) value)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
595 ;; (nconc plist (list propname value))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
596 ;; (aset char-code-property-table char (list propname value)))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
597
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
598 ;;; mule-cmds.el ends here