annotate lisp/international/robin.el @ 96368:3b1e90875bee

American English spelling fix.
author Glenn Morris <rgm@gnu.org>
date Fri, 27 Jun 2008 02:31:03 +0000
parents a7e2e7044952
children a9dc0e7c3f2b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
90124
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
1 ;;; robin.el --- yet another input method (smaller than quail)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
2
91435
3053d89875bb Update copyright years and GPL version.
Glenn Morris <rgm@gnu.org>
parents: 90279
diff changeset
3 ;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
90124
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
4 ;; National Institute of Advanced Industrial Science and Technology (AIST)
90279
ede12d80b3a5 Copyright fixed.
Kenichi Handa <handa@m17n.org>
parents: 90220
diff changeset
5 ;; Registration Number: H15PRO110
90124
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
6
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
7 ;; Author: TAKAHASHI Naoto <ntakahas@m17n.org>
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
8 ;; Keywords: mule, multilingual, input method
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
9
91435
3053d89875bb Update copyright years and GPL version.
Glenn Morris <rgm@gnu.org>
parents: 90279
diff changeset
10 ;; This file is part of GNU Emacs.
3053d89875bb Update copyright years and GPL version.
Glenn Morris <rgm@gnu.org>
parents: 90279
diff changeset
11
94664
889bc336b89b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 91435
diff changeset
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
889bc336b89b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 91435
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
889bc336b89b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 91435
diff changeset
14 ;; the Free Software Foundation, either version 3 of the License, or
889bc336b89b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 91435
diff changeset
15 ;; (at your option) any later version.
90124
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
16
94664
889bc336b89b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 91435
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
889bc336b89b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 91435
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
889bc336b89b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 91435
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
889bc336b89b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 91435
diff changeset
20 ;; GNU General Public License for more details.
90124
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
21
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
94664
889bc336b89b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 91435
diff changeset
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
90124
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
24
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
25 ;;; Comentary:
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
26
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
27 ;; Functionalities
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
28 ;; ---------------
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
29
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
30 ;; Robin is a new input method for GNU Emacs. It has three
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
31 ;; functionalities:
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
32
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
33 ;; 1. It serves as a simple input method. When the user types an ASCII
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
34 ;; key sequence, robin converts it into a string. This functionality
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
35 ;; is most likely used to input non-ASCII characters.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
36
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
37 ;; 2. It converts existing buffer substring into another string.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
38 ;; This functionality is similar to the 1. above, but the input is
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
39 ;; buffer substring rather than key strokes.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
40
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
41 ;; 3. It offers reverse conversion. Each character produced by a
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
42 ;; robin rule can hold the original ASCII sequence as a
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
43 ;; char-code-property.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
44
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
45
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
46 ;; How to define conversion rules
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
47 ;; ------------------------------
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
48
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
49 ;; Each conversion rule belongs to a robin package. A robin package is
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
50 ;; identified by a string called package name. Use robin-define-package
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
51 ;; to define a robin package.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
52
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
53 ;; (robin-define-package NAME DOCTSTRING
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
54 ;; (INPUT1 OUPUT1)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
55 ;; (INPUT2 OUPUT2)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
56 ;; ...)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
57
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
58 ;; NAME is a string identifying the robin package. It often starts with a
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
59 ;; language name and followed by a method name. For example,
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
60 ;; french-postfix, greek-prefix, etc.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
61
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
62 ;; DOCSTRING is a documentation string for the robin method.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
63
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
64 ;; Each INPUTn is a string. It represents a transliteration of the
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
65 ;; corresponding OUTPUTn.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
66
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
67 ;; Each OUTPUTn is a string or a character that is to be inserted as the
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
68 ;; result of conversion.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
69
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
70 ;; Neither INPUT* nor OUTPUT* are evaluated. Do not use a variable or a
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
71 ;; function in those parts. Instead, use a string or character literal
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
72 ;; directly.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
73
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
74 ;; If multiple rules have the same input pattern but different output
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
75 ;; patterns, only the latest definition is effective.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
76
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
77
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
78 ;; Example
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
79 ;; -------
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
80
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
81 ;; (robin-define-package "german-example"
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
82 ;; "An example for German
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
83
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
84 ;; AE -> Ä OE -> Ö UE -> Ü
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
85 ;; ae -> ä oe -> ö ue -> ü ss -> ß
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
86
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
87 ;; Repeat E or S to input itself.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
88
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
89 ;; AEE -> AE OEE -> OE UEE -> UE
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
90 ;; aee -> ae oee -> oe uee -> ue sss -> ss"
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
91
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
92 ;; ("AE" ?Ä)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
93 ;; ("OE" ?Ö)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
94 ;; ("UE" ?Ü)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
95 ;; ("ae" ?ä)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
96 ;; ("oe" ?ö)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
97 ;; ("ue" ?ü)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
98 ;; ("ss" ?ß)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
99
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
100 ;; ("AEE" "AE")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
101 ;; ("OEE" "OE")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
102 ;; ("UEE" "UE")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
103 ;; ("aee" "ae")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
104 ;; ("oee" "oe")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
105 ;; ("uee" "ue")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
106 ;; ("sss" "ss")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
107 ;; )
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
108
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
109
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
110 ;; Using robin as an input method
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
111 ;; ------------------------------
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
112
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
113 ;; To use a defined robin package as an input method, register it with
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
114 ;; the register-input-method function. For example,
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
115
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
116 ;; (register-input-method
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
117 ;; "german-example"
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
118 ;; "german"
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
119 ;; 'robin-use-package
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
120 ;; "de"
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
121 ;; "An example for German")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
122
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
123 ;; The first argument is the robin package name.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
124
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
125 ;; The second argument is the language environment for which this robin
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
126 ;; package is used.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
127
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
128 ;; Use the symbol `robin-use-package' as the third argument.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
129
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
130 ;; The fourth argument is the prompt that appears in modeline when this
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
131 ;; input method is active.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
132
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
133 ;; The fifth argument is a documentation string; it may or may not be
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
134 ;; identical to the one that you specified in robin-define-package.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
135
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
136 ;; You can activate the robin input method by typing
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
137
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
138 ;; C-u C-\ german-example RET
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
139
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
140 ;; Just like a quail package, only C-\ suffices for subsequent
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
141 ;; invocation.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
142
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
143
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
144 ;; Using robin as a buffer translator
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
145 ;; ----------------------------------
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
146
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
147 ;; To transliterate buffer substring, use the following functions.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
148
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
149 ;; (robin-convert-buffer &optional name)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
150
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
151 ;; Convert the content of current buffer using a robin package.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
152
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
153 ;; NAME, if given, is a string specifying a robin package. If NAME is
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
154 ;; not given or nil, the value of `robin-current-package-name' is used.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
155
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
156 ;; (robin-convert-region begin end &optional name)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
157
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
158 ;; Convert the region using a robin package.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
159
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
160 ;; NAME, if given, is a string specifying a robin package. If NAME is
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
161 ;; not given or nil, the value of `robin-current-package-name' is used.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
162
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
163
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
164 ;; Reverse conversion
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
165 ;; ------------------
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
166
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
167 ;; If the output pattern defined in a robin rule is a character, robin
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
168 ;; gives to the character a char-code-property whose key is the symbol
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
169 ;; representation of the robin package name and whose value is the input
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
170 ;; pattern of that character. For example, with the "german-example"
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
171 ;; definition above,
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
172
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
173 ;; (get-char-code-property ?Ä 'german-example) => "AE"
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
174
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
175 ;; etc.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
176
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
177 ;; If you do not want to assign a char-code-property to a character, use
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
178 ;; a string of length one as the output pattern, e.g.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
179
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
180 ;; (robin-define-package "german-example2"
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
181 ;; "Another example for German."
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
182
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
183 ;; ("AE" "Ä")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
184 ;; ("OE" "Ö")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
185 ;; ...)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
186
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
187 ;; Then
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
188
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
189 ;; (get-char-code-property ?Ä 'german-example2) => nil
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
190
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
191 ;; etc.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
192
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
193 ;; If multiple input patterns in a robin package generate the same
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
194 ;; character, the lastly used input pattern is given as the value of the
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
195 ;; char-code-property.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
196
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
197 ;; There are two functions for reverse conversion.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
198
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
199 ;; (robin-invert-buffer &optional name)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
200
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
201 ;; Apply reverse conversion to the content of current buffer. NAME, if
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
202 ;; given, is a string specifying a robin package. If NAME is not given
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
203 ;; or nil, the value of `robin-current-package-name' is used.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
204
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
205 ;; (robin-invert-region begin end &optional name)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
206
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
207 ;; Apply reverse conversion to the region. NAME, if given, is a string
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
208 ;; specifying a robin package. If NAME is not given or nil, the value of
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
209 ;; `robin-current-package-name' is used.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
210
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
211
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
212 ;; Modifying an existing rule
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
213 ;; --------------------------
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
214
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
215 ;; Use the robin-modify-package function to modify a rule already defined
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
216 ;; in a Robin package.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
217
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
218 ;; (robin-modify-package name input output)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
219
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
220 ;; Change a rule in an already defined Robin package.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
221 ;; NAME is the string specifying a robin package.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
222 ;; INPUT is a string that specifies the input pattern.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
223 ;; OUTPUT is either a character or a string to be generated.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
224
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
225
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
226 ;; The name of the game
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
227 ;; --------------------
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
228
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
229 ;; As stated in Murphy's law, it took longer than expected to develop the
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
230 ;; very first version of Japanese input subsystem in NEmacs (Nihongo
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
231 ;; Emacs). So the subsystem was named "TAMAGO", which is an acronym of
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
232 ;; "TAkusan Matasete GOmennasai" (Sorry to have kept you waiting so
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
233 ;; long). "Tamago" as a Japanese word means "egg", so the word "egg" was
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
234 ;; also used for related filenames and function names.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
235
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
236 ;; Since it was designed to input CJK characters, Egg was rather big as a
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
237 ;; subsystem. So later in Mule (Multilingual Enhancement to GNU Emacs),
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
238 ;; we designed and implemented a smaller input subsystem. We had to give
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
239 ;; it a name. "So, what's smaller than an egg?" "A quail egg, of
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
240 ;; course." Therefore it was named "quail".
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
241
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
242 ;; As time went by, quail became more and more complicated. That
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
243 ;; tendency was inevitable as long as we support CJK input. However, if
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
244 ;; we can limit ourselves to non-CJK characters, a much simpler
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
245 ;; transliteration mechanism suffices. So I wrote "robin", whose name
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
246 ;; was chosen because a robin is smaller than a quail. I could name it
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
247 ;; "hummingbird" or "nightingale", but those spellings seemed too long.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
248
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
249
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
250 ;;; Code:
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
251
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
252 (defvar robin-package-alist nil
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
253 "List of robin packages.
94742
a7e2e7044952 (robin-package-alist): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 94664
diff changeset
254 A robin package is of the form (NAME DOCSTRING &rest RULES).
90124
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
255 NAME is a string specifying a particular robin package.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
256 DOCSTRING is a documentation string for the robin package.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
257
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
258 RULE is of the form (KEY OUTPUT &rest rules).
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
259 KEY is a string.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
260 OUTPUT is a character or a string.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
261 For example, if you evaluate the following,
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
262
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
263 (robin-define-package \"test\" \"Uppercase input characters\"
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
264 (\"a\" \"A\")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
265 (\"ab\" \"AB\")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
266 (\"ac\" \"AC\")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
267 (\"acd\" \"ACD\")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
268 (\"ace\" \"ACE\")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
269 (\"b\" \"B\"))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
270
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
271 this robin package will be the following.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
272
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
273 (\"test\" \"Uppercase input characters\"
94742
a7e2e7044952 (robin-package-alist): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 94664
diff changeset
274 (?a \"A\"
90124
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
275 (?b \"AB\")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
276 (?c \"AC\"
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
277 (?d \"ACD\")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
278 (?e \"ACE\")))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
279 (?b \"B\"))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
280 ")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
281
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
282 ;;;###autoload
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
283 (defmacro robin-define-package (name docstring &rest rules)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
284 "Define a robin package.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
285
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
286 NAME is the string of this robin package.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
287 DOCSTRING is the documentation string of this robin package.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
288 Each RULE is of the form (INPUT OUTPUT) where INPUT is a string and
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
289 OUTPUT is either a character or a string. RULES are not evaluated.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
290
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
291 If there already exists a robin package whose name is NAME, the new
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
292 one replaces the old one."
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
293
90206
4857b75944d3 (robin-define-package): Delete redundant
Kenichi Handa <handa@m17n.org>
parents: 90204
diff changeset
294 (let ((iname (intern name))
90124
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
295 (new (list name "")) ; "" as a fake output
90220
26b71cf7f16d (robin-define-package): Be sure to call put-char-code-property.
Kenichi Handa <handa@m17n.org>
parents: 90206
diff changeset
296 input output pairs)
90124
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
297 (dolist (r rules)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
298 (setq input (car r)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
299 output (cadr r))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
300 (robin-add-rule name new input output)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
301 (cond
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
302 ((not (stringp input))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
303 (error "Bad input sequence %S" r))
90220
26b71cf7f16d (robin-define-package): Be sure to call put-char-code-property.
Kenichi Handa <handa@m17n.org>
parents: 90206
diff changeset
304 ((characterp output)
26b71cf7f16d (robin-define-package): Be sure to call put-char-code-property.
Kenichi Handa <handa@m17n.org>
parents: 90206
diff changeset
305 (setq pairs
26b71cf7f16d (robin-define-package): Be sure to call put-char-code-property.
Kenichi Handa <handa@m17n.org>
parents: 90206
diff changeset
306 (cons (cons input output)
26b71cf7f16d (robin-define-package): Be sure to call put-char-code-property.
Kenichi Handa <handa@m17n.org>
parents: 90206
diff changeset
307 pairs)))
90124
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
308 ((not (stringp output))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
309 (error "Bad output pattern %S" r))))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
310 (setcar (cdr new) docstring) ; replace "" above with real docstring
90204
7eec7b87433c (robin-define-package): Make the expaneded form shorter.
Kenichi Handa <handa@m17n.org>
parents: 90126
diff changeset
311 `(let ((slot (assoc ,name robin-package-alist))
90220
26b71cf7f16d (robin-define-package): Be sure to call put-char-code-property.
Kenichi Handa <handa@m17n.org>
parents: 90206
diff changeset
312 (newdef ',new)
26b71cf7f16d (robin-define-package): Be sure to call put-char-code-property.
Kenichi Handa <handa@m17n.org>
parents: 90206
diff changeset
313 (prop ',iname)
26b71cf7f16d (robin-define-package): Be sure to call put-char-code-property.
Kenichi Handa <handa@m17n.org>
parents: 90206
diff changeset
314 (lst ',pairs))
90204
7eec7b87433c (robin-define-package): Make the expaneded form shorter.
Kenichi Handa <handa@m17n.org>
parents: 90126
diff changeset
315 (if slot
7eec7b87433c (robin-define-package): Make the expaneded form shorter.
Kenichi Handa <handa@m17n.org>
parents: 90126
diff changeset
316 (setcdr slot (cdr newdef))
7eec7b87433c (robin-define-package): Make the expaneded form shorter.
Kenichi Handa <handa@m17n.org>
parents: 90126
diff changeset
317 (setq robin-package-alist
90220
26b71cf7f16d (robin-define-package): Be sure to call put-char-code-property.
Kenichi Handa <handa@m17n.org>
parents: 90206
diff changeset
318 (cons newdef robin-package-alist)))
26b71cf7f16d (robin-define-package): Be sure to call put-char-code-property.
Kenichi Handa <handa@m17n.org>
parents: 90206
diff changeset
319 (dolist (l lst)
26b71cf7f16d (robin-define-package): Be sure to call put-char-code-property.
Kenichi Handa <handa@m17n.org>
parents: 90206
diff changeset
320 (put-char-code-property (cdr l) prop (car l))))))
90124
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
321
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
322 ;;;###autoload
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
323 (defun robin-modify-package (name input output)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
324 "Change a rule in an already defined robin package.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
325
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
326 NAME is the string specifying a robin package.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
327 INPUT is a string that specifies the input pattern.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
328 OUTPUT is either a character or a string to be generated."
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
329
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
330 (let ((tree (assoc name robin-package-alist))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
331 docstring)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
332 (if (not tree)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
333 (error "No such robin package")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
334 (setq docstring (cadr tree))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
335 (setcar (cdr tree) "")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
336 (robin-add-rule name tree input output)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
337 (setcar (cdr tree) docstring)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
338 (if (characterp output)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
339 (put-char-code-property output (intern name) input))))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
340 output)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
341
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
342 (defun robin-add-rule (name tree input output)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
343 "Add translation rule (INPUT OUTPUT) to TREE whose name is NAME.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
344 Internal use only."
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
345
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
346 (let* ((head (aref input 0))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
347 (branch (assoc head tree))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
348 (sofar (cadr tree)))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
349
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
350 (if (= (length input) 1)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
351 (if branch
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
352
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
353 ;; A definition already exists for this input.
90206
4857b75944d3 (robin-define-package): Delete redundant
Kenichi Handa <handa@m17n.org>
parents: 90204
diff changeset
354 ;; We do not cancel old char-code-property of OUTPUT
4857b75944d3 (robin-define-package): Delete redundant
Kenichi Handa <handa@m17n.org>
parents: 90204
diff changeset
355 ;; so that n-to-1 reverse conversion is possible.
4857b75944d3 (robin-define-package): Delete redundant
Kenichi Handa <handa@m17n.org>
parents: 90204
diff changeset
356 (setcar (cdr branch) output)
90124
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
357
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
358 ;; New definition for this input.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
359 (setcdr (last tree) (list (list head output))))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
360
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
361 (unless branch
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
362 (if (characterp sofar)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
363 (setq sofar (char-to-string sofar)))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
364 (setq branch
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
365 (list head
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
366 (concat sofar
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
367 (char-to-string head))))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
368 (setcdr (last tree) (list branch)))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
369
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
370 (robin-add-rule name branch (substring input 1) output))))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
371
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
372 ;;; Interactive use
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
373
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
374 (defvar robin-mode nil
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
375 "If non-nil, `robin-input-method' is active.")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
376 (make-variable-buffer-local 'robin-mode)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
377
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
378 (defvar robin-current-package-name nil
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
379 "String representing the name of the current robin package.
94742
a7e2e7044952 (robin-package-alist): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 94664
diff changeset
380 A nil value means no package is selected.")
90124
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
381 (make-variable-buffer-local 'robin-current-package-name)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
382
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
383 ;;;###autoload
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
384 (defun robin-use-package (name)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
385 "Start using robin package NAME, which is a string."
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
386
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
387 (let ((package (assoc name robin-package-alist)))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
388 (unless package
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
389 (error "No such robin package"))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
390 (setq robin-current-package-name name)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
391 (robin-activate)))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
392
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
393 (defun robin-inactivate ()
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
394 "Inactivate robin input method."
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
395
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
396 (interactive)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
397 (robin-activate -1))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
398
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
399 (defun robin-activate (&optional arg)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
400 "Activate robin input method.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
401
94742
a7e2e7044952 (robin-package-alist): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 94664
diff changeset
402 With ARG, activate robin input method if and only if ARG is positive.
90124
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
403
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
404 While this input method is active, the variable
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
405 `input-method-function' is bound to the function `robin-input-method'."
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
406 (if (and arg
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
407 (< (prefix-numeric-value arg) 0))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
408
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
409 ;; inactivate robin input method.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
410 (unwind-protect
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
411 (progn
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
412 (setq robin-mode nil)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
413 (setq describe-current-input-method-function nil)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
414 (run-hooks 'robin-inactivate-hook))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
415 (kill-local-variable 'input-method-function))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
416
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
417 ;; activate robin input method.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
418 (setq robin-mode t
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
419 describe-current-input-method-function 'robin-help
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
420 inactivate-current-input-method-function 'robin-inactivate)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
421 (if (eq (selected-window) (minibuffer-window))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
422 (add-hook 'minibuffer-exit-hook 'robin-exit-from-minibuffer))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
423 (run-hooks 'input-method-activate-hook
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
424 'robin-activate-hook)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
425 (set (make-local-variable 'input-method-function)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
426 'robin-input-method)))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
427
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
428 (defun robin-exit-from-minibuffer ()
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
429 (inactivate-input-method)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
430 (if (<= (minibuffer-depth) 1)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
431 (remove-hook 'minibuffer-exit-hook 'robin-exit-from-minibuffer)))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
432
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
433 (defun robin-input-method (key)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
434 "Interpret typed key sequence and insert into buffer."
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
435
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
436 (if (or buffer-read-only
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
437 overriding-terminal-local-map
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
438 overriding-local-map)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
439 (list key)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
440
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
441 (let ((echo-keystrokes 0)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
442 (input-method-function nil)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
443 (start (point))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
444 (tree (cddr (assoc robin-current-package-name robin-package-alist)))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
445 branch
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
446 output)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
447
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
448 (while (setq branch (assq key tree))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
449 (delete-region start (point))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
450 (insert (setq output (cadr branch)))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
451 (setq tree (cddr branch))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
452 (if tree
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
453 (setq key (read-event))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
454 (setq key nil)))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
455
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
456 (if (null output)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
457 ;; body of the `while' above was not executed
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
458 (list key)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
459 (delete-region start (point))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
460 (if key
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
461 (setq unread-command-events (list key)))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
462 (if (stringp output)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
463 (string-to-list output)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
464 (list output))))))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
465
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
466 (defun robin-help ()
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
467 "Display the docstring of the current robin package."
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
468
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
469 (interactive)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
470 (let ((buf (get-buffer-create "*Robin Help*"))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
471 (doc (cadr (assoc robin-current-package-name robin-package-alist))))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
472 (set-buffer buf)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
473 (erase-buffer)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
474 (insert doc)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
475 (goto-char (point-min))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
476 (display-buffer buf)))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
477
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
478 ;;; Batch mode
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
479
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
480 (defun robin-convert-buffer (&optional name)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
481 "Convert the content of current buffer using a robin package.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
482 NAME, if given, is a string specifying a robin package. If NAME
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
483 is not given or nil, the value of `robin-current-package-name' is
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
484 used."
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
485
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
486 (interactive "*")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
487 (robin-convert-region (point-min) (point-max) name))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
488
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
489 (defun robin-convert-region (begin end &optional name)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
490 "Convert the region using a robin package.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
491 NAME, if given, is a string specifying a robin package. If NAME
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
492 is not given or nil, the value of `robin-current-package-name' is
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
493 used."
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
494
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
495 (interactive "*r")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
496 (or name
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
497 (setq name robin-current-package-name)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
498 (error "No robin package specified"))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
499
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
500 (let ((tree (assoc name robin-package-alist)))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
501 (unless tree
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
502 (error "No such robin package"))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
503
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
504 (save-excursion
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
505 (save-restriction
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
506 (narrow-to-region begin end)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
507 (goto-char (point-min))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
508 (while (not (eobp))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
509 (robin-convert-region-internal tree))))))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
510
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
511 (defun robin-convert-region-internal (tree)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
512 "Apply a robin rule defined in TREE to the current point.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
513 Use the longest match method to select a rule."
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
514
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
515 (let ((begin (point))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
516 end branch)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
517 (while (setq branch (assq (following-char) tree))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
518 (setq tree branch)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
519 (forward-char 1))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
520
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
521 (setq end (point))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
522 (if (= begin end)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
523 ;; no matching rule found; leave it as it is
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
524 (forward-char 1)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
525 ;; replace the string
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
526 (goto-char begin)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
527 (insert (cadr tree))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
528 (delete-char (- end begin)))))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
529
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
530 ;; for backward compatibility
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
531
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
532 (fset 'robin-transliterate-region 'robin-convert-region)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
533 (fset 'robin-transliterate-buffer 'robin-convert-buffer)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
534
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
535 ;;; Reverse conversion
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
536
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
537 (defun robin-invert-buffer (&optional name)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
538 "Apply reverse conversion to the content of current buffer.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
539 NAME, if given, is a string specifying a robin package. If NAME
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
540 is not given or nil, the value of `robin-current-package-name' is
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
541 used."
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
542
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
543 (interactive "*")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
544 (robin-invert-region (point-min) (point-max) name))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
545
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
546 (defun robin-invert-region (begin end &optional name)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
547 "Apply reverse conversion to the region.
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
548 NAME, if given, is a string specifying a robin package. If NAME
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
549 is not given or nil, the value of `robin-current-package-name' is
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
550 used."
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
551
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
552 (interactive "*r")
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
553 (or name
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
554 (setq name robin-current-package-name)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
555 (error "No robin package specified"))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
556
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
557 (setq name (intern name))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
558 (let (str)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
559 (save-restriction
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
560 (narrow-to-region begin end)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
561 (goto-char (point-min))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
562 (while (not (eobp))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
563 (if (not (setq str (get-char-code-property (following-char) name)))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
564 (forward-char 1)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
565 (insert str)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
566 (delete-char 1))))))
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
567
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
568 (provide 'robin)
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
569
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
570 ;;; Local Variables:
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
571 ;;; coding: utf-8-emacs
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
572 ;;; End:
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
573
90126
8ee106ee2dc8 Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents: 90124
diff changeset
574 ;; arch-tag: ba995140-7436-4a57-b875-747fc340f605
90124
440c632022e0 New file.
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
575 ;;; robin.el ends here