lrt.el 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. ;;; lrt.el --- Quail package for inputting Lao characters by LRT method -*-coding: iso-2022-7bit;-*-
  2. ;; Copyright (C) 1998, 2001-2012 Free Software Foundation, Inc.
  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
  7. ;; Keywords: multilingual, input method, Lao, LRT.
  8. ;; This file is part of GNU Emacs.
  9. ;; GNU Emacs is free software: you can redistribute it and/or modify
  10. ;; it under the terms of the GNU General Public License as published by
  11. ;; the Free Software Foundation, either version 3 of the License, or
  12. ;; (at your option) any later version.
  13. ;; GNU Emacs is distributed in the hope that it will be useful,
  14. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. ;; GNU General Public License for more details.
  17. ;; You should have received a copy of the GNU General Public License
  18. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  19. ;;; Commentary:
  20. ;;; Code:
  21. (require 'quail)
  22. (require 'lao-util)
  23. ;; LRT (Lao Roman Transcription) input method accepts the following
  24. ;; key sequence:
  25. ;; consonant [+ semi-vowel-sign-lo ] + vowel [+ maa-sakod ] [+ tone-mark ]
  26. (defun quail-lao-update-translation (control-flag)
  27. (if (integerp control-flag)
  28. ;; Non-composable character typed.
  29. (setq quail-current-str
  30. (buffer-substring (overlay-start quail-overlay)
  31. (overlay-end quail-overlay))
  32. unread-command-events
  33. (string-to-list
  34. (substring quail-current-key control-flag)))
  35. (let ((lao-str (lao-transcribe-roman-to-lao-string quail-current-key)))
  36. (if (> (aref lao-str 0) 255)
  37. (setq quail-current-str lao-str)
  38. (or quail-current-str
  39. (setq quail-current-str quail-current-key)))))
  40. control-flag)
  41. (quail-define-package
  42. "lao-lrt" "Lao" "(1E(BR" t
  43. "Lao input method using LRT (Lao Roman Transcription).
  44. `\\' (backslash) + number-key => (1p(B,(1q(B,(1r(B,... LAO DIGIT ZERO, ONE, TWO, ...
  45. `\\' (backslash) + `\\' => (1f(B LAO KO LA (REPETITION)
  46. `\\' (backslash) + `$' => (1O(B LAO ELLIPSIS
  47. "
  48. nil 'forget-last-selection 'deterministic 'kbd-translate 'show-layout
  49. nil nil nil 'quail-lao-update-translation nil t)
  50. ;; LRT (Lao Roman Transcription) input method accepts the following
  51. ;; key sequence:
  52. ;; consonant [ semi-vowel-sign-lo ] vowel [ maa-sakod ] [ tone-mark ]
  53. (quail-install-map
  54. (quail-map-from-table
  55. '((base-state (lao-transcription-consonant-alist . sv-state)
  56. lao-transcription-vowel-alist
  57. lao-transcription-tone-alist)
  58. (sv-state (lao-transcription-semi-vowel-alist . v-state)
  59. (lao-transcription-vowel-alist . mt-state))
  60. (v-state (lao-transcription-vowel-alist . mt-state))
  61. (mt-state (lao-transcription-maa-sakod-alist . t-state)
  62. lao-transcription-tone-alist)
  63. (t-state lao-transcription-tone-alist))))
  64. ;;; lrt.el ends here