lrt.el 2.94 KB
Newer Older
1
;;; lrt.el --- Quail package for inputting Lao characters by LRT method  -*-coding: utf-8;-*-
Kenichi Handa's avatar
Kenichi Handa committed
2

Paul Eggert's avatar
Paul Eggert committed
3
;; Copyright (C) 1998, 2001-2020 Free Software Foundation, Inc.
4
;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
5
;;   2006, 2007, 2008, 2009, 2010, 2011
Kenichi Handa's avatar
Kenichi Handa committed
6 7
;;   National Institute of Advanced Industrial Science and Technology (AIST)
;;   Registration Number H14PRO021
Kenichi Handa's avatar
Kenichi Handa committed
8 9 10 11 12

;; Keywords: multilingual, input method, Lao, LRT.

;; This file is part of GNU Emacs.

13
;; GNU Emacs is free software: you can redistribute it and/or modify
Kenichi Handa's avatar
Kenichi Handa committed
14
;; it under the terms of the GNU General Public License as published by
15 16
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
Kenichi Handa's avatar
Kenichi Handa committed
17 18 19 20 21 22 23

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
24
;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
Kenichi Handa's avatar
Kenichi Handa committed
25

26 27
;;; Commentary:

Kenichi Handa's avatar
Kenichi Handa committed
28 29 30 31 32 33 34 35 36
;;; Code:

(require 'quail)
(require 'lao-util)

;; LRT (Lao Roman Transcription) input method accepts the following
;; key sequence:
;;	consonant [+ semi-vowel-sign-lo ] + vowel [+ maa-sakod ] [+ tone-mark ]

37
(defun quail-lrt-update-translation (control-flag)
38 39 40 41 42 43
  (if (integerp control-flag)
      ;; Non-composable character typed.
      (setq quail-current-str
	    (buffer-substring (overlay-start quail-overlay)
			      (overlay-end quail-overlay))
	    unread-command-events
44 45 46
	    (append
	     (substring quail-current-key control-flag)
             unread-command-events))
47 48 49 50 51 52
    (let ((lao-str (lao-transcribe-roman-to-lao-string quail-current-key)))
      (if (> (aref lao-str 0) 255)
	  (setq quail-current-str lao-str)
	(or quail-current-str
	    (setq quail-current-str quail-current-key)))))
  control-flag)
Kenichi Handa's avatar
Kenichi Handa committed
53 54 55


(quail-define-package
56
 "lao-lrt" "Lao" "ລR" t
57
 "Lao input method using LRT (Lao Roman Transcription).
58 59 60
`\\' (backslash) + number-key	=> ໐,໑,໒,...	LAO DIGIT ZERO, ONE, TWO, ...
`\\' (backslash) + `\\'		=> ໆ		LAO KO LA (REPETITION)
`\\' (backslash) + `$'		=> ຯ		LAO ELLIPSIS
61
"
62
 nil 'forget-last-selection 'deterministic 'kbd-translate 'show-layout
63
  nil nil nil 'quail-lrt-update-translation nil t)
64

65 66 67 68 69 70 71 72 73
;; LRT (Lao Roman Transcription) input method accepts the following
;; key sequence:
;;	consonant [ semi-vowel-sign-lo ] vowel [ maa-sakod ] [ tone-mark ]

(quail-install-map
 (quail-map-from-table
  '((base-state (lao-transcription-consonant-alist . sv-state)
		lao-transcription-vowel-alist
		lao-transcription-tone-alist)
74
    (sv-state (lao-transcription-semi-vowel-alist . v-state)
75 76
	      (lao-transcription-vowel-alist . mt-state))
    (v-state (lao-transcription-vowel-alist . mt-state))
77
    (mt-state (lao-transcription-maa-sakod-alist . t-state)
78 79
	      lao-transcription-tone-alist)
    (t-state lao-transcription-tone-alist))))
80

81
;;; lrt.el ends here