1 ;;; lao.el --- Quail package for inputting Lao characters -*-coding: utf-8;-*-
3 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
4 ;; 2006, 2007, 2008, 2009, 2010, 2011
5 ;; National Institute of Advanced Industrial Science and Technology (AIST)
6 ;; Registration Number H14PRO021
8 ;; Keywords: multilingual, input method, Lao
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
32 (defun quail-lao-update-translation (control-flag)
33 (if (integerp control-flag
)
34 ;; Non-composable character typed.
35 (setq quail-current-str
36 (buffer-substring (overlay-start quail-overlay
)
37 (overlay-end quail-overlay
))
40 (substring quail-current-key control-flag
)))
41 (setq quail-current-str
42 (compose-string (quail-lookup-map-and-concat quail-current-key
))))
150 "Alist of key sequences vs the corresponding Lao string to input.
151 This variable is for the input method \"lao\".
152 If you change the value of this variable while quail/lao is already loaded,
153 you need to re-load it to properly re-initialize related alists.")
155 ;; Temporary variable to initialize lao-consonant-key-alist, etc.
156 (defconst lao-key-alist-vector
157 (let ((tail lao-key-alist
)
158 consonant-key-alist semivowel-key-alist vowel-key-alist
159 voweltone-key-alist tone-key-alist other-key-alist
162 (setq elt
(car tail
) tail
(cdr tail
))
163 (if (stringp (cdr elt
))
164 (setq phonetic-type
(get-char-code-property (aref (cdr elt
) 0)
166 (setq phonetic-type
(get-char-code-property (aref (aref (cdr elt
) 0) 0)
168 (aset (cdr elt
) 0 (compose-string (aref (cdr elt
) 0))))
169 (cond ((eq phonetic-type
'consonant
)
170 (setq consonant-key-alist
(cons elt consonant-key-alist
)))
171 ((memq phonetic-type
'(vowel-upper vowel-lower
))
172 (if (stringp (cdr elt
))
173 (setq vowel-key-alist
(cons elt vowel-key-alist
))
174 (setq voweltone-key-alist
(cons elt voweltone-key-alist
))))
175 ((eq phonetic-type
'tone
)
176 (setq tone-key-alist
(cons elt tone-key-alist
)))
177 ((eq phonetic-type
'semivowel-lower
)
178 (setq semivowel-key-alist
(cons elt semivowel-key-alist
)))
180 (setq other-key-alist
(cons elt other-key-alist
)))))
181 (vector consonant-key-alist semivowel-key-alist vowel-key-alist
182 voweltone-key-alist tone-key-alist other-key-alist
)))
184 (defconst lao-consonant-key-alist
(aref lao-key-alist-vector
0))
185 (defconst lao-semivowel-key-alist
(aref lao-key-alist-vector
1))
186 (defconst lao-vowel-key-alist
(aref lao-key-alist-vector
2))
187 (defconst lao-voweltone-key-alist
(aref lao-key-alist-vector
3))
188 (defconst lao-tone-key-alist
(aref lao-key-alist-vector
4))
189 (defconst lao-other-key-alist
(aref lao-key-alist-vector
5))
192 (makunbound 'lao-key-alist-vector
)
194 (quail-define-package
196 "Lao input method simulating Lao keyboard layout based on Thai TIS620"
197 nil t t t t nil nil nil
'quail-lao-update-translation nil t
)
200 (quail-map-from-table
201 '((base-state (lao-consonant-key-alist . svt-state
)
203 lao-voweltone-key-alist
206 (svt-state (lao-semivowel-key-alist . v-state
)
207 (lao-vowel-key-alist . t-state
)
208 lao-voweltone-key-alist
210 (v-state (lao-vowel-key-alist . t-state
))
211 (t-state lao-tone-key-alist
))))